From f857349a5716c319dba95ce3e9a85de610ed02a2 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 7 Apr 2024 16:23:07 -0400 Subject: [PATCH] v2.4.0: improved when the player taps on an enemy that charmed them --- core/src/main/assets/messages/actors/actors.properties | 1 + .../shatteredpixeldungeon/actors/hero/Hero.java | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index 024803bb4..59307fd23 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -141,6 +141,7 @@ actors.buffs.championenemy$growing.desc=Growing champions gain a steadily increa actors.buffs.charm.name=charmed actors.buffs.charm.heromsg=You are charmed! +actors.buffs.charm.cant_attack=You are charmed by that enemy and can't attack them. actors.buffs.charm.desc=A charm is manipulative magic that can make enemies temporarily adore each other.\n\nCharacters affected by charm are unable to directly attack the enemy they are charmed by. Attacking other targets is still possible however. The shock of pain will lessen the duration of charm.\n\nTurns of charm remaining: %s. actors.buffs.chill.name=chilled diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index b6ebd3121..859a52a47 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -43,6 +43,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Berserk; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bless; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Charm; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Combo; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Drowsy; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Foresight; @@ -1305,7 +1306,13 @@ public class Hero extends Char { enemy = action.target; - if (enemy.isAlive() && canAttack( enemy ) && !isCharmedBy( enemy ) && enemy.invisible == 0) { + if (isCharmedBy( enemy )){ + GLog.w( Messages.get(Charm.class, "cant_attack")); + ready(); + return false; + } + + if (enemy.isAlive() && canAttack( enemy ) && enemy.invisible == 0) { if (heroClass != HeroClass.DUELIST && hasTalent(Talent.AGGRESSIVE_BARRIER)