diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index 729a9f8f..f3364e5b 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -118,6 +118,14 @@ public class CommandService implements INetworkDispatch { return false; } + if (target != null && actor.getPosition().getDistance(target.getPosition) > command.getMaxRangeToTarget()) { + return false; + } + + if (!core.simulationService.checkLineOfSight(actor, target)) { + return false; + } + break; case 2: // Self Only if (target == null) { @@ -138,6 +146,10 @@ public class CommandService implements INetworkDispatch { target = actor; } + if (!core.simulationService.checkLineOfSight(actor, target)) { + return false; + } + break; default: break; @@ -159,6 +171,11 @@ public class CommandService implements INetworkDispatch { return false; } + // Without this we could be buffing ally NPCs and such + if (object.getSlottedObject("ghost") == null) { + return; + } + break; case 1: // Enemy Only if (target == null || !(target instanceof TangibleObject)) { @@ -178,10 +195,6 @@ public class CommandService implements INetworkDispatch { break; } - if (target != null && actor.getPosition().getDistance(target.getPosition) > command.getMaxRangeToTarget()) { - return false; - } - if (command.shouldCallOnTarget()) { if (target == null || !(target instanceof CreatureObject)) { return false;