From ed45c37e0a98d243d0c964a178918c9b1ca806b6 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 14 Jul 2019 15:43:54 -0400 Subject: [PATCH] v0.7.4: added some safety checks --- .../shatteredpixeldungeon/actors/mobs/Piranha.java | 1 + .../shatteredpixeldungeon/sprites/WardSprite.java | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java index f31371882..638db2e8c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java @@ -91,6 +91,7 @@ public class Piranha extends Mob { 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 ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/WardSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/WardSprite.java index 97d2e4a5e..df3ec28c1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/WardSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/WardSprite.java @@ -75,8 +75,7 @@ public class WardSprite extends MobSprite { idle = tierIdles[tier]; run = idle.clone(); - //zap = idle.clone(); - //attack = idle.clone(); + attack = idle.clone(); die = idle.clone(); //always render first @@ -100,7 +99,7 @@ public class WardSprite extends MobSprite { } } - private float baseY; + private float baseY = Float.NaN; @Override public void place(int cell) { @@ -113,6 +112,7 @@ public class WardSprite extends MobSprite { super.update(); //if tier is greater than 3 if (perspectiveRaise >= 6 / 16f){ + if (Float.isNaN(baseY)) baseY = y; y = baseY + (float) Math.sin(Game.timeTotal); shadowOffset = 0.25f - 0.8f*(float) Math.sin(Game.timeTotal); }