v0.2.3d: piranha now move right away when a door is closed on them.

This commit is contained in:
Evan Debenham 2015-01-15 01:42:15 -05:00
parent 7b699cca6d
commit 1407ccf3bf

View File

@ -57,6 +57,21 @@ public class Piranha extends Mob {
die( null );
return true;
} else {
//this causes pirahna to move away when a door is closed on them.
Dungeon.level.updateFieldOfView( this );
if (state == this.HUNTING && !(enemy.isAlive() && Level.fieldOfView[enemy.pos] && enemy.invisible <= 0)){
state = this.WANDERING;
int oldPos = pos;
int i = 0;
do {
i++;
target = Dungeon.level.randomDestination();
if (i == 100) return true;
} while (!getCloser(target));
moveSprite( oldPos, pos );
return true;
}
return super.act();
}
}