v0.8.2c: improved piranha surprise attack logic

This commit is contained in:
Evan Debenham 2020-08-27 11:36:33 -04:00
parent eb65e2b356
commit fc60397281

View File

@ -86,13 +86,15 @@ public class Piranha extends Mob {
}
@Override
public int defenseSkill( Char enemy ) {
enemySeen = state != SLEEPING
&& this.enemy != null
&& fieldOfView != null
&& fieldOfView[this.enemy.pos]
&& this.enemy.invisible == 0;
return super.defenseSkill( enemy );
public boolean surprisedBy(Char enemy) {
if (enemy == Dungeon.hero){
if (fieldOfView == null || fieldOfView.length != Dungeon.level.length()){
fieldOfView = new boolean[Dungeon.level.length()];
Dungeon.level.updateFieldOfView( this, fieldOfView );
}
return state == SLEEPING || !fieldOfView[enemy.pos] || enemy.invisible > 0;
}
return super.surprisedBy(enemy);
}
@Override