Browse Source

Template passed to method

combat-2
MagicBot 8 months ago
parent
commit
023fd547fd
  1. 7
      src/engine/mobileAI/utilities/CombatUtilities.java

7
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) { public static void combatCycle(Mob agent, AbstractWorldObject target, boolean mainHand, ItemBase wb) {
ItemTemplate template = ItemTemplate.templates.get(wb.getUUID());
if (!agent.isAlive() || !target.isAlive()) if (!agent.isAlive() || !target.isAlive())
return; return;
@ -221,7 +223,7 @@ public class CombatUtilities {
if (agent.isSiege()) if (agent.isSiege())
dt = SourceType.SIEGE; dt = SourceType.SIEGE;
if (wb != null) { if (wb != null) {
anim = CombatManager.getSwingAnimation(wb, null, mainHand); anim = CombatManager.getSwingAnimation(template, null, mainHand);
dt = wb.getDamageType(); dt = wb.getDamageType();
} else if (!mainHand) } else if (!mainHand)
return; return;
@ -250,7 +252,8 @@ public class CombatUtilities {
if (res != null && (res.immuneToAll() || res.immuneToAttacks() || res.immuneTo(dt))) if (res != null && (res.immuneToAll() || res.immuneToAttacks() || res.immuneTo(dt)))
return; return;
int passiveAnim = CombatManager.getSwingAnimation(wb, null, mainHand); int passiveAnim = CombatManager.getSwingAnimation(template, null, mainHand);
if (canSwing(agent)) { if (canSwing(agent)) {
if (triggerDefense(agent, target)) { if (triggerDefense(agent, target)) {
swingIsMiss(agent, target, passiveAnim); swingIsMiss(agent, target, passiveAnim);

Loading…
Cancel
Save