diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/PrismaticImage.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/PrismaticImage.java index df32b83bc..8e88862a2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/PrismaticImage.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/PrismaticImage.java @@ -144,12 +144,20 @@ public class PrismaticImage extends NPC { @Override public int damageRoll() { - return Random.NormalIntRange( 1 + hero.lvl/8, 4 + hero.lvl/2 ); + if (hero != null) { + return Random.NormalIntRange( 1 + hero.lvl/8, 4 + hero.lvl/2 ); + } else { + return Random.NormalIntRange( 1, 4 ); + } } @Override public int attackSkill( Char target ) { - return hero.attackSkill(target); + if (hero != null) { + return hero.attackSkill(target); + } else { + return 0; + } } @Override @@ -177,7 +185,7 @@ public class PrismaticImage extends NPC { @Override public int defenseProc(Char enemy, int damage) { damage = super.defenseProc(enemy, damage); - if (hero.belongings.armor != null){ + if (hero != null && hero.belongings.armor != null){ return hero.belongings.armor.proc( enemy, this, damage ); } else { return damage; @@ -188,7 +196,7 @@ public class PrismaticImage extends NPC { public void damage(int dmg, Object src) { //TODO improve this when I have proper damage source logic - if (hero.belongings.armor != null && hero.belongings.armor.hasGlyph(AntiMagic.class, this) + if (hero != null && hero.belongings.armor != null && hero.belongings.armor.hasGlyph(AntiMagic.class, this) && AntiMagic.RESISTS.contains(src.getClass())){ dmg -= AntiMagic.drRoll(hero.belongings.armor.buffedLvl()); } @@ -198,7 +206,7 @@ public class PrismaticImage extends NPC { @Override public float speed() { - if (hero.belongings.armor != null){ + if (hero != null && hero.belongings.armor != null){ return hero.belongings.armor.speedFactor(this, super.speed()); } return super.speed();