v2.5.0: added a safety check to bee AI

This commit is contained in:
Evan Debenham
2024-09-05 11:29:02 -04:00
parent 85d619ceff
commit 75da7a40e1

View File

@@ -187,12 +187,17 @@ public class Bee extends Mob {
@Override
protected boolean getCloser(int target) {
if (alignment == Alignment.ALLY && enemy == null && buffs(AllyBuff.class).isEmpty()){
if (alignment == Alignment.ALLY && enemy == null && buffs(AllyBuff.class).isEmpty()) {
target = Dungeon.hero.pos;
} else if (enemy != null && Actor.findById(potHolder) == enemy) {
target = enemy.pos;
} else if (potPos != -1 && (state == WANDERING || Dungeon.level.distance(target, potPos) > 3))
this.target = target = potPos;
} else if (potPos != -1 && (state == WANDERING || Dungeon.level.distance(target, potPos) > 3)) {
if (!Dungeon.level.insideMap(potPos)){
potPos = -1;
} else {
this.target = target = potPos;
}
}
return super.getCloser( target );
}