v0.9.0b: added safety checks to beacon of returning

This commit is contained in:
Evan Debenham 2020-10-12 19:50:17 -04:00
parent 1a3eade255
commit a08b3a94a8
2 changed files with 4 additions and 1 deletions

View File

@ -355,7 +355,7 @@ public class Dungeon {
if (pos == -2){
pos = level.exit;
} else if (pos < 0 || pos >= level.length()){
} else if (pos < 0 || pos >= level.length() || (!level.passable[pos] && !level.avoid[pos])){
pos = level.entrance;
}

View File

@ -120,6 +120,9 @@ public class BeaconOfReturning extends Spell {
}
if (returnDepth == Dungeon.depth) {
if (!Dungeon.level.passable[returnPos] && !Dungeon.level.avoid[returnPos]){
returnPos = Dungeon.level.entrance;
}
ScrollOfTeleportation.appear( hero, returnPos );
for(Mob m : Dungeon.level.mobs){
if (m.pos == hero.pos){