Skip to content

Commit

Permalink
Fix summon walk behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
ralke23 committed May 15, 2024
1 parent 7b8ba75 commit 337b629
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1237,21 +1237,28 @@ bool Monster::getNextStep(Direction& direction, uint32_t& flags)
result = getRandomStep(getPosition(), direction);
}
} else if ((isSummon() && isMasterInRange) || followCreature || walkingToSpawn) {
randomStepping = false;
result = Creature::getNextStep(direction, flags);
if (result) {
flags |= FLAG_PATHFINDING;
if (!hasFollowPath && getMaster() && !getMaster()->getPlayer()) {
randomStepping = true;
result = getRandomStep(getPosition(), direction);
} else {
if (ignoreFieldDamage) {
ignoreFieldDamage = false;
updateMapCache();
randomStepping = false;
result = Creature::getNextStep(direction, flags);
if (result) {
flags |= FLAG_PATHFINDING;
}
//target dancing
if (attackedCreature && attackedCreature == followCreature) {
if (isFleeing()) {
result = getDanceStep(getPosition(), direction, false, false);
} else if (mType->info.staticAttackChance < static_cast<uint32_t>(uniform_random(1, 100))) {
result = getDanceStep(getPosition(), direction);
else {
if (ignoreFieldDamage) {
ignoreFieldDamage = false;
updateMapCache();
}
// target dancing
if (attackedCreature && attackedCreature == followCreature) {
if (isFleeing()) {
result = getDanceStep(getPosition(), direction, false, false);
}
else if (mType->info.staticAttackChance < static_cast<uint32_t>(uniform_random(1, 100))) {
result = getDanceStep(getPosition(), direction);
}
}
}
}
Expand Down

0 comments on commit 337b629

Please sign in to comment.