From da51be1beff6603f63edce5f019a950b1e133c29 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 25 Jun 2023 13:36:24 -0500 Subject: [PATCH] Mob Casting bypasses mele range check --- src/engine/ai/MobileFSM.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index eed4a390..f618fa91 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -36,17 +36,17 @@ public class MobileFSM { mob.setCombatTarget(null); return; } + if(target.getObjectType() == Enum.GameObjectType.PlayerCharacter && canCast(mob)){ + if(MobCast(mob)){ + return; + } + } if (!CombatUtilities.inRangeToAttack(mob, target)) return; switch (target.getObjectType()) { case PlayerCharacter: PlayerCharacter targetPlayer = (PlayerCharacter) target; - if (canCast(mob)) { - if (!MobCast(mob)) - AttackPlayer(mob, targetPlayer); - } else { - AttackPlayer(mob, targetPlayer); - } + AttackPlayer(mob, targetPlayer); break; case Building: Building targetBuilding = (Building) target;