v2.0.1: added various safety checks for rare crashes
This commit is contained in:
@@ -1992,6 +1992,12 @@ public class Hero extends Char {
|
||||
|
||||
@Override
|
||||
public void onAttackComplete() {
|
||||
|
||||
if (enemy == null){
|
||||
curAction = null;
|
||||
super.onAttackComplete();
|
||||
return;
|
||||
}
|
||||
|
||||
AttackIndicator.target(enemy);
|
||||
boolean wasEnemy = enemy.alignment == Alignment.ENEMY
|
||||
|
||||
@@ -698,7 +698,7 @@ public abstract class Mob extends Char {
|
||||
|
||||
public boolean surprisedBy( Char enemy, boolean attacking ){
|
||||
return enemy == Dungeon.hero
|
||||
&& (enemy.invisible > 0 || !enemySeen || (fieldOfView != null && !fieldOfView[enemy.pos]))
|
||||
&& (enemy.invisible > 0 || !enemySeen || (fieldOfView != null && fieldOfView.length == Dungeon.level.length() && !fieldOfView[enemy.pos]))
|
||||
&& (!attacking || enemy.canSurpriseAttack());
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,10 @@ public class Item implements Bundlable {
|
||||
}
|
||||
|
||||
public void execute( Hero hero ) {
|
||||
execute( hero, defaultAction() );
|
||||
String action = defaultAction();
|
||||
if (action != null) {
|
||||
execute(hero, defaultAction());
|
||||
}
|
||||
}
|
||||
|
||||
protected void onThrow( int cell ) {
|
||||
|
||||
Reference in New Issue
Block a user