From 21a9320b17a0290a46689ebfb2d5900d54767198 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 6 Mar 2023 13:57:22 -0500 Subject: [PATCH] v2.0.0: fixed freezes with DM-300 abilities if its target just died --- .../shatteredpixeldungeon/actors/mobs/DM300.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java index 4daa113a4..7dafeb760 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java @@ -176,7 +176,7 @@ public class DM300 extends Mob { //determine if DM can reach its enemy boolean canReach; - if (enemy == null){ + if (enemy == null || !enemy.isAlive()){ if (Dungeon.level.adjacent(pos, Dungeon.hero.pos)){ canReach = true; } else { @@ -196,10 +196,12 @@ public class DM300 extends Mob { } } else { - if (enemy == null && Dungeon.hero.invisible <= 0) enemy = Dungeon.hero; + if ((enemy == null || !enemy.isAlive()) && Dungeon.hero.invisible <= 0) { + enemy = Dungeon.hero; + } //more aggressive ability usage when DM can't reach its target - if (enemy != null && !canReach){ + if (enemy != null && enemy.isAlive() && !canReach){ //try to fire gas at an enemy we can't reach if (turnsSinceLastAbility >= MIN_COOLDOWN){ @@ -236,7 +238,7 @@ public class DM300 extends Mob { } - } else if (enemy != null && fieldOfView[enemy.pos]) { + } else if (enemy != null && enemy.isAlive() && fieldOfView[enemy.pos]) { if (turnsSinceLastAbility > abilityCooldown) { if (lastAbility == NONE) {