From 4446177e8460a02ed33be2ddcb3b9f19bd0d1964 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 31 Dec 2024 12:54:49 -0500 Subject: [PATCH] v3.0.0: turned off autotarget in cases where it's almost always wrong --- .../shatteredpixeldungeon/actors/hero/spells/BlessSpell.java | 5 +++++ .../actors/hero/spells/ClericSpell.java | 4 ++++ .../actors/hero/spells/TargetedClericSpell.java | 5 +++++ .../shatteredpixeldungeon/items/artifacts/HolyTome.java | 3 +-- .../shatteredpixeldungeon/items/wands/WandOfWarding.java | 1 + .../items/weapon/missiles/darts/HealingDart.java | 1 + .../shatteredpixeldungeon/windows/WndClericSpells.java | 5 ++--- 7 files changed, 19 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/BlessSpell.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/BlessSpell.java index a5be430e8..72400a4ab 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/BlessSpell.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/BlessSpell.java @@ -48,6 +48,11 @@ public class BlessSpell extends TargetedClericSpell { return HeroIcon.BLESS; } + @Override + public boolean usesTargeting() { + return false; //targeting behaviour is often wrong + } + @Override protected void onTargetSelected(HolyTome tome, Hero hero, Integer target) { if (target == null){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/ClericSpell.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/ClericSpell.java index ad6c6098f..2f8edf325 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/ClericSpell.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/ClericSpell.java @@ -59,6 +59,10 @@ public abstract class ClericSpell { return Messages.get(this, "desc") + "\n\n" + Messages.get(this, "charge_cost", (int)chargeUse(Dungeon.hero)); } + public boolean usesTargeting(){ + return false; + } + public int icon(){ return HeroIcon.NONE; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/TargetedClericSpell.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/TargetedClericSpell.java index 2186462a2..7f8ebcef9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/TargetedClericSpell.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/TargetedClericSpell.java @@ -44,6 +44,11 @@ public abstract class TargetedClericSpell extends ClericSpell { }); } + @Override + public boolean usesTargeting() { + return true; + } + protected String targetingPrompt(){ return Messages.get(this, "prompt"); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HolyTome.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HolyTome.java index 5f51936d0..dc04e3bf5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HolyTome.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HolyTome.java @@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.ClericSpell; -import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.TargetedClericSpell; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy; @@ -343,7 +342,7 @@ public class HolyTome extends Artifact { } else { quickSpell.onCast(HolyTome.this, Dungeon.hero); - if (quickSpell instanceof TargetedClericSpell && Dungeon.quickslot.contains(HolyTome.this)){ + if (quickSpell.usesTargeting() && Dungeon.quickslot.contains(HolyTome.this)){ QuickSlotButton.useTargeting(Dungeon.quickslot.getSlot(HolyTome.this)); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java index 1255e8779..6bf9f8f85 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java @@ -57,6 +57,7 @@ public class WandOfWarding extends Wand { { image = ItemSpriteSheet.WAND_WARDING; + usesTargeting = false; //player usually targets wards or spaces, not enemies } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/HealingDart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/HealingDart.java index 8517c7ebb..b3aeabf84 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/HealingDart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/HealingDart.java @@ -31,6 +31,7 @@ public class HealingDart extends TippedDart { { image = ItemSpriteSheet.HEALING_DART; + usesTargeting = false; //you never want to throw this at an enemy } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndClericSpells.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndClericSpells.java index a20d4855c..b37e28398 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndClericSpells.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndClericSpells.java @@ -27,7 +27,6 @@ import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.ClericSpell; -import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.TargetedClericSpell; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HolyTome; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -180,7 +179,7 @@ public class WndClericSpells extends Window { spell.onCast(tome, Dungeon.hero); //TODO, probably need targeting logic here - if (spell instanceof TargetedClericSpell && Dungeon.quickslot.contains(tome)){ + if (spell.usesTargeting() && Dungeon.quickslot.contains(tome)){ QuickSlotButton.useTargeting(Dungeon.quickslot.getSlot(tome)); } } @@ -217,7 +216,7 @@ public class WndClericSpells extends Window { spell.onCast(tome, Dungeon.hero); //TODO, probably need targeting logic here - if (spell instanceof TargetedClericSpell && Dungeon.quickslot.contains(tome)){ + if (spell.usesTargeting() && Dungeon.quickslot.contains(tome)){ QuickSlotButton.useTargeting(Dungeon.quickslot.getSlot(tome)); } }