v2.5.0: fixed ripper demons refusing to leap into enemies over pits
This commit is contained in:
+11
@@ -157,12 +157,23 @@ public class RipperDemon extends Mob {
|
|||||||
//ensure there is somewhere to land after leaping
|
//ensure there is somewhere to land after leaping
|
||||||
if (leapVictim != null){
|
if (leapVictim != null){
|
||||||
int bouncepos = -1;
|
int bouncepos = -1;
|
||||||
|
//attempt to bounce in free passable space
|
||||||
for (int i : PathFinder.NEIGHBOURS8){
|
for (int i : PathFinder.NEIGHBOURS8){
|
||||||
if ((bouncepos == -1 || Dungeon.level.trueDistance(pos, leapPos+i) < Dungeon.level.trueDistance(pos, bouncepos))
|
if ((bouncepos == -1 || Dungeon.level.trueDistance(pos, leapPos+i) < Dungeon.level.trueDistance(pos, bouncepos))
|
||||||
&& Actor.findChar(leapPos+i) == null && Dungeon.level.passable[leapPos+i]){
|
&& Actor.findChar(leapPos+i) == null && Dungeon.level.passable[leapPos+i]){
|
||||||
bouncepos = 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) {
|
if (bouncepos == -1) {
|
||||||
leapPos = -1;
|
leapPos = -1;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user