From df07c80b1b88b00decc6aeb7591c91b6017c28c7 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 28 Mar 2024 20:25:40 -0500 Subject: [PATCH] combat manager fix --- src/engine/gameManager/CombatManager.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index a98b4df5..c53b0285 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -65,6 +65,9 @@ public enum CombatManager { } else if (mainWeapon == null && offWeapon != null && offWeapon.template.item_skill_required.containsKey("Block") == false) { //swing left hand only processAttack(attacker, target, Enum.EquipSlotType.LHELD); + } else if (mainWeapon != null && offWeapon == null) { + //swing left hand only + processAttack(attacker, target, Enum.EquipSlotType.RHELD); } } @@ -146,7 +149,10 @@ public enum CombatManager { if (target.getObjectType() == Enum.GameObjectType.Building) hitChance = 100; - int passiveAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template, null, true); + int passiveAnim = getSwingAnimation(null, null, slot.equals(Enum.EquipSlotType.RHELD)); + if(attacker.charItemManager.getEquipped().get(slot) != null){ + passiveAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template, null, true); + } if (ThreadLocalRandom.current().nextInt(100) > hitChance) { TargetedActionMsg msg = new TargetedActionMsg(attacker, target, 0f, passiveAnim); @@ -282,7 +288,11 @@ public enum CombatManager { else ((Building) target).setCurrentHitPoints(target.getCurrentHitpoints() - damage); - TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) damage, 0); + int attackAnim = getSwingAnimation(null,null,slot.equals(Enum.EquipSlotType.RHELD)); + if (attacker.charItemManager.getEquipped().get(slot) != null) { + attackAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template,null,slot.equals(Enum.EquipSlotType.RHELD)); + } + TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) damage, attackAnim); DispatchMessage.sendToAllInRange(target, cmm); }