From 3f8973743f855e0252628009eb968e541297998e Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 30 Apr 2024 13:10:06 -0400 Subject: [PATCH] v2.4.0: fixed errors when challenge is used on neutral mobs --- .../hero/abilities/duelist/Challenge.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/Challenge.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/Challenge.java index e26faefe8..d90c1083a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/Challenge.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/Challenge.java @@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.NPC; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; @@ -99,7 +100,8 @@ public class Challenge extends ArmorAbility { return; } - if (targetCh.alignment == hero.alignment){ + if (targetCh.alignment != Char.Alignment.ENEMY + && !(targetCh instanceof Mimic && targetCh.alignment == Char.Alignment.NEUTRAL)){ GLog.w(Messages.get(this, "ally_target")); return; } @@ -275,14 +277,6 @@ public class Challenge extends ArmorAbility { } } - for (Char ch : Actor.chars()) { - if (ch.buff(SpectatorFreeze.class) != null) { - ch.buff(SpectatorFreeze.class).detach(); - } - if (ch.buff(DuelParticipant.class) != null && ch != target) { - ch.buff(DuelParticipant.class).detach(); - } - } } else { if (Dungeon.hero.isAlive()) { GameScene.flash(0x80FFFFFF); @@ -292,6 +286,15 @@ public class Challenge extends ArmorAbility { } } } + + for (Char ch : Actor.chars()) { + if (ch.buff(SpectatorFreeze.class) != null) { + ch.buff(SpectatorFreeze.class).detach(); + } + if (ch.buff(DuelParticipant.class) != null && ch != target) { + ch.buff(DuelParticipant.class).detach(); + } + } } @Override