v2.5.0: fixed ripper demons refusing to leap into enemies over pits

This commit is contained in:
Evan Debenham
2024-09-01 14:38:46 -04:00
parent 0d5d505038
commit 5563ceb3cd
@@ -157,12 +157,23 @@ public class RipperDemon extends Mob {
//ensure there is somewhere to land after leaping
if (leapVictim != null){
int bouncepos = -1;
//attempt to bounce in free passable space
for (int i : PathFinder.NEIGHBOURS8){
if ((bouncepos == -1 || Dungeon.level.trueDistance(pos, leapPos+i) < Dungeon.level.trueDistance(pos, bouncepos))
&& Actor.findChar(leapPos+i) == null && Dungeon.level.passable[leapPos+i]){
bouncepos = leapPos+i;
}
}
//try again, allowing a bounce into any non-solid terrain
if (bouncepos == -1){
for (int i : PathFinder.NEIGHBOURS8){
if ((bouncepos == -1 || Dungeon.level.trueDistance(pos, leapPos+i) < Dungeon.level.trueDistance(pos, bouncepos))
&& Actor.findChar(leapPos+i) == null && !Dungeon.level.solid[leapPos+i]){
bouncepos = leapPos+i;
}
}
}
//if no valid position, cancel the leap
if (bouncepos == -1) {
leapPos = -1;
return true;