v0.6.1: fixed issues with ghost spawning position between floors

This commit is contained in:
Evan Debenham 2017-07-05 12:24:57 -04:00
parent debd7d6436
commit c8df657e51
2 changed files with 7 additions and 1 deletions

View File

@ -317,7 +317,7 @@ public class Dungeon {
PathFinder.setMapSize(level.width(), level.height());
Dungeon.level = level;
DriedRose.restoreGhostHero( level, pos + PathFinder.NEIGHBOURS8[Random.Int(8)]);
DriedRose.restoreGhostHero( level, pos );
Actor.init();
visible = new boolean[level.length()];

View File

@ -256,6 +256,12 @@ public class DriedRose extends Artifact {
public static void restoreGhostHero( Level level, int pos ){
if (heldGhost != null){
level.mobs.add( heldGhost );
int ghostPos;
do {
ghostPos = pos + PathFinder.NEIGHBOURS8[Random.Int(8)];
} while (!Level.solid[ghostPos] || level.findMob(ghostPos) != null);
heldGhost.pos = pos;
heldGhost = null;
}