From 590e9fe44f75882eb8351ef62864d7e65542d521 Mon Sep 17 00:00:00 2001 From: randy Date: Wed, 20 Aug 2025 13:23:00 -0600 Subject: [PATCH] Telekinetic grab now grabs all matching items within 10 tiles of the target item If casting without line of sight, the player will now walk closer rather than simply being unable to cast --- .../minigame/mta/TelekineticGrabSpell.java | 50 +++++++++++++++++-- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/Server/src/main/content/minigame/mta/TelekineticGrabSpell.java b/Server/src/main/content/minigame/mta/TelekineticGrabSpell.java index 72728d1e6..9c3174d1f 100644 --- a/Server/src/main/content/minigame/mta/TelekineticGrabSpell.java +++ b/Server/src/main/content/minigame/mta/TelekineticGrabSpell.java @@ -25,6 +25,9 @@ import core.game.global.action.PickupHandler; import core.game.world.GameWorld; import org.rs09.consts.Sounds; +import core.game.world.map.Location; +import core.game.interaction.MovementPulse; + import static core.api.ContentAPIKt.*; /** @@ -106,9 +109,22 @@ public final class TelekineticGrabSpell extends MagicSpell { if (!canCast(entity, ground)) { return false; } + + //Snowscape: pick up all items of the target type within a square centered on the target + int radius = 10; + for (int x = target.getLocation().getX() - radius; x <= target.getLocation().getX() + radius; x++) { + for (int y = target.getLocation().getY() - radius; y <= target.getLocation().getY() + radius; y++) { + GroundItem targetItem = GroundItemManager.get(target.getId(), new Location(x,y), (Player) entity); + if (targetItem != null) { + GameWorld.getPulser().submit(getGrabPulse(entity, targetItem)); + visualize(entity, targetItem); + } + } + } + entity.lock(2); - visualize(entity, target); - GameWorld.getPulser().submit(getGrabPulse(entity, ground)); + //visualize(entity, target); + //GameWorld.getPulser().submit(getGrabPulse(entity, ground)); return true; } @@ -149,11 +165,15 @@ public final class TelekineticGrabSpell extends MagicSpell { } playAudio(player, Sounds.VULNERABILITY_IMPACT_3008); if (!teleZone) { - player.getInventory().add(new Item(g.getId(), g.getAmount(), g.getCharge())); + if (hasSpaceFor(player, g)) { + player.getInventory().add(new Item(g.getId(), g.getAmount(), g.getCharge())); + } else { + return true; + } } else { TelekineticZone zone = TelekineticZone.getZone(player); zone.moveStatue(); - player.lock(getDelay()); + //player.lock(getDelay()); } player.getPacketDispatch().sendPositionedGraphics(END_GRAPHIC, ground.getLocation()); } @@ -178,7 +198,27 @@ public final class TelekineticGrabSpell extends MagicSpell { if (entity instanceof Player) { final Player player = (Player) entity; if (!CombatSwingHandler.isProjectileClipped(player, item, false)) { - sendMessage(player, "I can't reach that."); //TODO authentic message? + //Move to the target, stopping and recasting when within line of sight. + player.getPulseManager().run(new MovementPulse(player, item) { + @Override + public boolean pulse() { + castSpell(player, SpellBook.MODERN, SPELL_ID, item); + return true; + } + + @Override + public boolean update() { + if (CombatSwingHandler.isProjectileClipped(player, item, false)) { + player.getWalkingQueue().reset(); + pulse(); + stop(); + return true; + } + return super.update(); + } + }); + + //sendMessage(player, "I can't reach that."); //TODO authentic message? return false; } if (!hasSpaceFor(player, item)) {