From 47ddb75f4457760c9b51f5f241f9b1f2164e94bd Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 19 Nov 2025 12:12:40 -0500 Subject: [PATCH] v3.3.0: tele grab is now instant if the collected items are also instant --- .../items/spells/TargetedSpell.java | 6 ++++- .../items/spells/TelekineticGrab.java | 27 ++++++++++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TargetedSpell.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TargetedSpell.java index 97e4f4a41..7af3c8bec 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TargetedSpell.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TargetedSpell.java @@ -56,6 +56,10 @@ public abstract class TargetedSpell extends Spell { callback); Sample.INSTANCE.play( Assets.Sounds.ZAP ); } + + protected float timeToCast(){ + return Actor.TICK; + } private static CellSelector.Listener targeter = new CellSelector.Listener(){ @@ -92,7 +96,7 @@ public abstract class TargetedSpell extends Spell { curSpell.detach( curUser.belongings.backpack ); Invisibility.dispel(); curSpell.updateQuickslot(); - curUser.spendAndNext( 1f ); + curUser.spendAndNext( curSpell.timeToCast() ); Catalog.countUse(curSpell.getClass()); if (Random.Float() < curSpell.talentChance){ Talent.onScrollUsed(curUser, curUser.pos, curSpell.talentFactor, curSpell.getClass()); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TelekineticGrab.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TelekineticGrab.java index 3e6a8e98a..2048d60ee 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TelekineticGrab.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TelekineticGrab.java @@ -57,6 +57,11 @@ public class TelekineticGrab extends TargetedSpell { Sample.INSTANCE.play( Assets.Sounds.ZAP ); } + @Override + protected float timeToCast() { + return 0; + } + @Override protected void affectTarget(Ballistica bolt, Hero hero) { Char ch = Actor.findChar(bolt.collisionPos); @@ -69,29 +74,37 @@ public class TelekineticGrab extends TargetedSpell { } } + float totalpickupTime = 0; + if (ch != null && ch.buff(PinCushion.class) != null){ while (ch.buff(PinCushion.class) != null) { Item item = ch.buff(PinCushion.class).grabOne(); if (item.doPickUp(hero, ch.pos)) { - hero.spend(-item.pickupDelay()); //casting the spell already takes a turn + totalpickupTime += item.pickupDelay(); GLog.i( Messages.capitalize(Messages.get(hero, "you_now_have", item.name())) ); } else { GLog.w(Messages.get(this, "cant_grab")); Dungeon.level.drop(item, ch.pos).sprite.drop(); - return; + break; } } + //casting the spell takes at most 1 turn + if (totalpickupTime > 1){ + hero.spend(-(totalpickupTime-1)); + } + } else if (Dungeon.level.heaps.get(bolt.collisionPos) != null){ Heap h = Dungeon.level.heaps.get(bolt.collisionPos); if (h.type != Heap.Type.HEAP){ GLog.w(Messages.get(this, "cant_grab")); + hero.spend(Actor.TICK); h.sprite.drop(); return; } @@ -100,18 +113,24 @@ public class TelekineticGrab extends TargetedSpell { Item item = h.peek(); if (item.doPickUp(hero, h.pos)) { h.pickUp(); - hero.spend(-item.pickupDelay()); //casting the spell already takes a turn + totalpickupTime += item.pickupDelay(); GLog.i( Messages.capitalize(Messages.get(hero, "you_now_have", item.name())) ); } else { GLog.w(Messages.get(this, "cant_grab")); h.sprite.drop(); - return; + break; } } + //casting the spell takes at most 1 turn + if (totalpickupTime > 1){ + hero.spend(-(totalpickupTime-1)); + } + } else { GLog.w(Messages.get(this, "no_target")); + hero.spend(Actor.TICK); } }