Browse Source

invalid range check for ranged characters attacking a building

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

6
src/engine/gameManager/CombatManager.java

@ -165,8 +165,12 @@ public enum CombatManager { @@ -165,8 +165,12 @@ public enum CombatManager {
break;
case Building:
if(attackRange > 15){
if(attacker.loc.distanceSquared(target.loc) < (attackRange * attackRange))
float rangeSquared = attackRange * attackRange;
//float distanceSquared = attacker.loc.distanceSquared(target.loc);
if(distanceSquared < rangeSquared) {
inRange = true;
break;
}
}else {
float locX = target.loc.x - target.getBounds().getHalfExtents().x;
float locZ = target.loc.z - target.getBounds().getHalfExtents().y;

Loading…
Cancel
Save