From 023fd547fdcfb47aa00b0a7879eac8ce7b777832 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 16 Mar 2024 17:46:49 -0400 Subject: [PATCH] Template passed to method --- src/engine/mobileAI/utilities/CombatUtilities.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/engine/mobileAI/utilities/CombatUtilities.java b/src/engine/mobileAI/utilities/CombatUtilities.java index 0ee24bb7..ad0a5fce 100644 --- a/src/engine/mobileAI/utilities/CombatUtilities.java +++ b/src/engine/mobileAI/utilities/CombatUtilities.java @@ -201,6 +201,8 @@ public class CombatUtilities { public static void combatCycle(Mob agent, AbstractWorldObject target, boolean mainHand, ItemBase wb) { + ItemTemplate template = ItemTemplate.templates.get(wb.getUUID()); + if (!agent.isAlive() || !target.isAlive()) return; @@ -221,7 +223,7 @@ public class CombatUtilities { if (agent.isSiege()) dt = SourceType.SIEGE; if (wb != null) { - anim = CombatManager.getSwingAnimation(wb, null, mainHand); + anim = CombatManager.getSwingAnimation(template, null, mainHand); dt = wb.getDamageType(); } else if (!mainHand) return; @@ -250,7 +252,8 @@ public class CombatUtilities { if (res != null && (res.immuneToAll() || res.immuneToAttacks() || res.immuneTo(dt))) return; - int passiveAnim = CombatManager.getSwingAnimation(wb, null, mainHand); + int passiveAnim = CombatManager.getSwingAnimation(template, null, mainHand); + if (canSwing(agent)) { if (triggerDefense(agent, target)) { swingIsMiss(agent, target, passiveAnim);