From 50792327a4d882ee470acadd6517e18f46203795 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 10 Sep 2023 12:31:39 -0500 Subject: [PATCH] moveToPoint attack handling --- .../client/handlers/MoveToPointHandler.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/engine/net/client/handlers/MoveToPointHandler.java b/src/engine/net/client/handlers/MoveToPointHandler.java index 3c82d07b..3c017b13 100644 --- a/src/engine/net/client/handlers/MoveToPointHandler.java +++ b/src/engine/net/client/handlers/MoveToPointHandler.java @@ -14,6 +14,8 @@ import engine.gameManager.MovementManager; import engine.net.client.ClientConnection; import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.MoveToPointMsg; +import engine.objects.AbstractWorldObject; +import engine.objects.Building; import engine.objects.PlayerCharacter; public class MoveToPointHandler extends AbstractClientMsgHandler { @@ -30,9 +32,23 @@ public class MoveToPointHandler extends AbstractClientMsgHandler { PlayerCharacter pc = (origin != null) ? (origin.getPlayerCharacter()) : null; if (pc == null) return false; + PlayerCharacter player = origin.getPlayerCharacter(); + if (player == null) + return false; + AbstractWorldObject target = player.combatTarget; + + if (target != null) { + switch (target.getObjectType()) { + case NPC: + return false; + case Building: + Building targetBuilding = (Building) target; + if (!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0) + return false; + } + } MovementManager.movement(msg, pc); return true; } - }