From 12e73d59c75693c1f1c5a34c71f1eefebecd68c3 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 31 May 2024 18:26:36 -0500 Subject: [PATCH] apply weapon powers before early exit for defense of passives --- src/engine/gameManager/CombatManager.java | 32 ++++++++++++----------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 31536847..66d511fa 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -264,6 +264,22 @@ public enum CombatManager { atr = attacker.atrHandTwo; } + //apply weapon powers before early exit for miss or passives + DeferredPowerJob dpj = null; + + if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) { + + dpj = ((PlayerCharacter) attacker).getWeaponPower(); + + if (dpj != null) { + dpj.attack(target, attackRange); + + if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) + ((PlayerCharacter) attacker).setWeaponPower(dpj); + } + } + + int def = 0; if (AbstractCharacter.IsAbstractCharacter(target)) @@ -446,20 +462,6 @@ public enum CombatManager { } } - DeferredPowerJob dpj = null; - - if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) { - - dpj = ((PlayerCharacter) attacker).getWeaponPower(); - - if (dpj != null) { - dpj.attack(target, attackRange); - - if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) - ((PlayerCharacter) attacker).setWeaponPower(dpj); - } - } - //set auto attack job setAutoAttackJob(attacker, slot, delay); @@ -537,7 +539,7 @@ public enum CombatManager { } //Item has no equipment slots and should not try to return an animation, return default instead - if(wb.item_eq_slots_or == null || wb.item_eq_slots_or.size() == 0){ + if(wb.item_eq_slots_or == null || wb.item_eq_slots_or.isEmpty()){ return 75; }