Skip to content

Commit

Permalink
Few changes
Browse files Browse the repository at this point in the history
Remove it.charges so you can edit the amount of charges per rune
Edited updateDirection and danceStep
#22
  • Loading branch information
joseluis2g committed Jan 30, 2019
1 parent eaadea6 commit 816cce5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/behaviourdatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,10 +820,11 @@ void BehaviourDatabase::checkAction(const NpcBehaviourAction* action, Player* pl
}
} while (amount);
} else {

/*
if (it.charges && (data < static_cast<int32_t>(it.charges))) {
data = it.charges;
}
*/

for (int32_t i = 0; i < std::max<int32_t>(1, amount); i++) {
Item* item = Item::CreateItem(itemId, data);
Expand Down
32 changes: 22 additions & 10 deletions src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1159,8 +1159,8 @@ bool Monster::getNextStep(Direction& direction, uint32_t& flags)
if ((!followCreature || !hasFollowPath) && (!isSummon() || !isMasterInRange)) {
if (OTSYS_TIME() >= nextDanceStepRound) {
updateLookDirection();
nextDanceStepRound = OTSYS_TIME() + 200 + getStepDuration();

nextDanceStepRound = OTSYS_TIME() + getStepDuration();
//choose a random direction
result = getRandomStep(getPosition(), direction);
}
Expand Down Expand Up @@ -2004,34 +2004,46 @@ void Monster::updateLookDirection()
} else {
Direction dir = getDirection();
if (offsetx < 0 && offsety < 0) {
if (offsetx == -1 && offsety == -1) {
if (dir == DIRECTION_NORTH) {
newDir = DIRECTION_WEST;
}
}
if (dir == DIRECTION_SOUTH) {
newDir = DIRECTION_WEST;
} else if (dir == DIRECTION_NORTH) {
newDir = DIRECTION_WEST;
} else if (dir == DIRECTION_EAST) {
newDir = DIRECTION_NORTH;
}
} else if (offsetx < 0 && offsety > 0) {
if (offsetx == -1 && offsety == 1) {
if (dir == DIRECTION_SOUTH) {
newDir = DIRECTION_WEST;
}
}
if (dir == DIRECTION_NORTH) {
newDir = DIRECTION_WEST;
} else if (dir == DIRECTION_SOUTH) {
newDir = DIRECTION_WEST;
} else if (dir == DIRECTION_EAST) {
newDir = DIRECTION_SOUTH;
}
} else if (offsetx > 0 && offsety < 0) {
if (offsetx == 1 && offsety == -1) {
if (dir == DIRECTION_NORTH) {
newDir = DIRECTION_EAST;
}
}
if (dir == DIRECTION_SOUTH) {
newDir = DIRECTION_EAST;
} else if (dir == DIRECTION_NORTH) {
newDir = DIRECTION_EAST;
} else if (dir == DIRECTION_WEST) {
newDir = DIRECTION_NORTH;
}
} else {
if (offsetx == 1 && offsety == 1) {
if (dir == DIRECTION_SOUTH) {
newDir = DIRECTION_EAST;
}
}
if (dir == DIRECTION_NORTH) {
newDir = DIRECTION_EAST;
} else if (dir == DIRECTION_SOUTH) {
newDir = DIRECTION_EAST;
} else if (dir == DIRECTION_WEST) {
newDir = DIRECTION_SOUTH;
}
Expand Down

0 comments on commit 816cce5

Please sign in to comment.