Browse Source

handle destory or derank for buildings

combat-2
FatBoy-DOTC 6 months ago
parent
commit
1bbbc396bd
  1. 4
      src/engine/gameManager/CombatManager.java

4
src/engine/gameManager/CombatManager.java

@ -165,7 +165,7 @@ public enum CombatManager {
break; break;
case Building: case Building:
if(attackRange > 15){ 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); //float distanceSquared = attacker.loc.distanceSquared(target.loc);
if(distanceSquared < rangeSquared) { if(distanceSquared < rangeSquared) {
inRange = true; inRange = true;
@ -420,7 +420,7 @@ public enum CombatManager {
if (AbstractCharacter.IsAbstractCharacter(target)) if (AbstractCharacter.IsAbstractCharacter(target))
((AbstractCharacter) target).modifyHealth(-damage, attacker, true); ((AbstractCharacter) target).modifyHealth(-damage, attacker, true);
else else
((Building) target).setCurrentHitPoints(target.getCurrentHitpoints() - damage); ((Building) target).modifyHealth(-damage, attacker);
int attackAnim = getSwingAnimation(null, null, slot.equals(mbEnums.EquipSlotType.RHELD)); int attackAnim = getSwingAnimation(null, null, slot.equals(mbEnums.EquipSlotType.RHELD));
if (attacker.charItemManager.getEquipped().get(slot) != null) { if (attacker.charItemManager.getEquipped().get(slot) != null) {

Loading…
Cancel
Save