From 1bbbc396bd1ba268830038a8826c61e1b36f19a3 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 22 May 2024 20:49:33 -0500 Subject: [PATCH] handle destory or derank for buildings --- src/engine/gameManager/CombatManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 5297fe43..524c8970 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -165,7 +165,7 @@ public enum CombatManager { break; case Building: if(attackRange > 15){ - float rangeSquared = attackRange * attackRange; + float rangeSquared = (attackRange + target.getBounds().getHalfExtents().x) * (attackRange + target.getBounds().getHalfExtents().x); //float distanceSquared = attacker.loc.distanceSquared(target.loc); if(distanceSquared < rangeSquared) { inRange = true; @@ -420,7 +420,7 @@ public enum CombatManager { if (AbstractCharacter.IsAbstractCharacter(target)) ((AbstractCharacter) target).modifyHealth(-damage, attacker, true); else - ((Building) target).setCurrentHitPoints(target.getCurrentHitpoints() - damage); + ((Building) target).modifyHealth(-damage, attacker); int attackAnim = getSwingAnimation(null, null, slot.equals(mbEnums.EquipSlotType.RHELD)); if (attacker.charItemManager.getEquipped().get(slot) != null) {