v1.0.3: fixed extremely rare cases of the hero resurrecting onto plants

This commit is contained in:
Evan Debenham 2021-08-30 18:59:45 -04:00
parent 30c00f95b6
commit a6e349ab7e

View File

@ -453,7 +453,6 @@ public class InterlevelScene extends PixelScene {
Dungeon.hero.pos = level.randomRespawnCell(Dungeon.hero); Dungeon.hero.pos = level.randomRespawnCell(Dungeon.hero);
level.drop(new LostBackpack(), level.randomRespawnCell(null)); level.drop(new LostBackpack(), level.randomRespawnCell(null));
} else { } else {
Dungeon.hero.resurrect();
level = Dungeon.level; level = Dungeon.level;
BArray.setFalse(level.heroFOV); BArray.setFalse(level.heroFOV);
BArray.setFalse(level.visited); BArray.setFalse(level.visited);
@ -464,6 +463,8 @@ public class InterlevelScene extends PixelScene {
Dungeon.hero.pos = level.randomRespawnCell(Dungeon.hero); Dungeon.hero.pos = level.randomRespawnCell(Dungeon.hero);
tries++; tries++;
} while (level.trueDistance(invPos, Dungeon.hero.pos) <= 30 - (tries/10)); } while (level.trueDistance(invPos, Dungeon.hero.pos) <= 30 - (tries/10));
level.plants.remove(Dungeon.hero.pos); //so the hero does not spawn on a plant
Dungeon.hero.resurrect();
level.drop(new LostBackpack(), invPos); level.drop(new LostBackpack(), invPos);
} }