v2.2.0: sad ghost now avoids heaps and level exit while wandering

This commit is contained in:
Evan Debenham
2023-09-13 16:12:02 -04:00
parent 92b7a03dc7
commit 0c0919f45a

View File

@@ -61,12 +61,25 @@ public class Ghost extends NPC {
flying = true;
WANDERING = new Wandering();
state = WANDERING;
//not actually large of course, but this makes the ghost stick to the exit room
properties.add(Property.LARGE);
}
protected class Wandering extends Mob.Wandering{
@Override
protected int randomDestination() {
int pos = super.randomDestination();
//cannot wander onto heaps or the level exit
if (Dungeon.level.heaps.get(pos) != null || pos == Dungeon.level.exit()){
return -1;
}
return pos;
}
}
@Override
protected boolean act() {
if (Dungeon.hero.buff(AscensionChallenge.class) != null){