v0.7.4: added some safety checks

This commit is contained in:
Evan Debenham 2019-07-14 15:43:54 -04:00
parent d6cf71e790
commit ed45c37e0a
2 changed files with 4 additions and 3 deletions

View File

@ -91,6 +91,7 @@ public class Piranha extends Mob {
public int defenseSkill( Char enemy ) { public int defenseSkill( Char enemy ) {
enemySeen = state != SLEEPING enemySeen = state != SLEEPING
&& this.enemy != null && this.enemy != null
&& fieldOfView != null
&& fieldOfView[this.enemy.pos] && fieldOfView[this.enemy.pos]
&& this.enemy.invisible == 0; && this.enemy.invisible == 0;
return super.defenseSkill( enemy ); return super.defenseSkill( enemy );

View File

@ -75,8 +75,7 @@ public class WardSprite extends MobSprite {
idle = tierIdles[tier]; idle = tierIdles[tier];
run = idle.clone(); run = idle.clone();
//zap = idle.clone(); attack = idle.clone();
//attack = idle.clone();
die = idle.clone(); die = idle.clone();
//always render first //always render first
@ -100,7 +99,7 @@ public class WardSprite extends MobSprite {
} }
} }
private float baseY; private float baseY = Float.NaN;
@Override @Override
public void place(int cell) { public void place(int cell) {
@ -113,6 +112,7 @@ public class WardSprite extends MobSprite {
super.update(); super.update();
//if tier is greater than 3 //if tier is greater than 3
if (perspectiveRaise >= 6 / 16f){ if (perspectiveRaise >= 6 / 16f){
if (Float.isNaN(baseY)) baseY = y;
y = baseY + (float) Math.sin(Game.timeTotal); y = baseY + (float) Math.sin(Game.timeTotal);
shadowOffset = 0.25f - 0.8f*(float) Math.sin(Game.timeTotal); shadowOffset = 0.25f - 0.8f*(float) Math.sin(Game.timeTotal);
} }