Browse Source

invalid range check for ranged characters attacking a building

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

6
src/engine/gameManager/CombatManager.java

@ -12,6 +12,7 @@ import engine.job.JobContainer; @@ -12,6 +12,7 @@ import engine.job.JobContainer;
import engine.job.JobScheduler;
import engine.jobs.AttackJob;
import engine.jobs.DeferredPowerJob;
import engine.math.Vector3f;
import engine.mbEnums;
import engine.net.client.ClientConnection;
import engine.net.client.msg.TargetedActionMsg;
@ -163,6 +164,10 @@ public enum CombatManager { @@ -163,6 +164,10 @@ public enum CombatManager {
inRange = true;
break;
case Building:
if(attackRange > 15){
if(attacker.loc.distanceSquared(target.loc) < (attackRange * attackRange))
inRange = true;
}else {
float locX = target.loc.x - target.getBounds().getHalfExtents().x;
float locZ = target.loc.z - target.getBounds().getHalfExtents().y;
float sizeX = (target.getBounds().getHalfExtents().x + attackRange) * 2;
@ -172,6 +177,7 @@ public enum CombatManager { @@ -172,6 +177,7 @@ public enum CombatManager {
inRange = true;
break;
}
}
//get delay for the auto attack job
long delay = 5000;

Loading…
Cancel
Save