Browse Source

combat manager fix

combat-2
FatBoy-DOTC 8 months ago
parent
commit
df07c80b1b
  1. 14
      src/engine/gameManager/CombatManager.java

14
src/engine/gameManager/CombatManager.java

@ -65,6 +65,9 @@ public enum CombatManager { @@ -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 { @@ -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 { @@ -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);
}

Loading…
Cancel
Save