v2.3.0: phantom piranhas now die on land if there is no open water

This commit is contained in:
Evan Debenham
2023-11-15 11:48:25 -05:00
parent 98438cf9ae
commit ff2239e67a

View File

@@ -85,10 +85,12 @@ public class PhantomPiranha extends Piranha {
@Override
public void dieOnLand() {
teleportAway();
if (!teleportAway()){
super.dieOnLand();
}
}
private void teleportAway(){
private boolean teleportAway(){
ArrayList<Integer> inFOVCandidates = new ArrayList<>();
ArrayList<Integer> outFOVCandidates = new ArrayList<>();
@@ -105,9 +107,13 @@ public class PhantomPiranha extends Piranha {
if (!outFOVCandidates.isEmpty()){
if (Dungeon.level.heroFOV[pos]) GLog.i(Messages.get(this, "teleport_away"));
ScrollOfTeleportation.appear(this, Random.element(outFOVCandidates));
return true;
} else if (!inFOVCandidates.isEmpty()){
ScrollOfTeleportation.appear(this, Random.element(inFOVCandidates));
return true;
}
return false;
}
}