v0.9.4: fixed pitfall traps not cancelling hero actions if they fell

This commit is contained in:
Evan Debenham 2021-07-28 17:26:38 -04:00
parent 1ae3e4fcbd
commit 72a821e087

View File

@ -78,6 +78,8 @@ public class PitfallTrap extends Trap {
@Override @Override
public boolean act() { public boolean act() {
boolean herofell = false;
if (depth == Dungeon.depth) { if (depth == Dungeon.depth) {
for (int i : PathFinder.NEIGHBOURS9) { for (int i : PathFinder.NEIGHBOURS9) {
@ -109,6 +111,7 @@ public class PitfallTrap extends Trap {
&& !(ch.alignment == Char.Alignment.NEUTRAL && Char.hasProp(ch, Char.Property.IMMOVABLE))) { && !(ch.alignment == Char.Alignment.NEUTRAL && Char.hasProp(ch, Char.Property.IMMOVABLE))) {
if (ch == Dungeon.hero) { if (ch == Dungeon.hero) {
Chasm.heroFall(cell); Chasm.heroFall(cell);
herofell = true;
} else { } else {
Chasm.mobFall((Mob) ch); Chasm.mobFall((Mob) ch);
} }
@ -118,7 +121,7 @@ public class PitfallTrap extends Trap {
} }
detach(); detach();
return true; return !herofell;
} }
private static final String POS = "pos"; private static final String POS = "pos";