|
|
|
@ -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,14 +164,19 @@ public enum CombatManager {
@@ -163,14 +164,19 @@ public enum CombatManager {
|
|
|
|
|
inRange = true; |
|
|
|
|
break; |
|
|
|
|
case Building: |
|
|
|
|
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; |
|
|
|
|
float sizeZ = (target.getBounds().getHalfExtents().y + attackRange) * 2; |
|
|
|
|
Rectangle2D.Float rect = new Rectangle2D.Float(locX, locZ, sizeX, sizeZ); |
|
|
|
|
if (rect.contains(new Point2D.Float(attacker.loc.x, attacker.loc.z))) |
|
|
|
|
inRange = true; |
|
|
|
|
break; |
|
|
|
|
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; |
|
|
|
|
float sizeZ = (target.getBounds().getHalfExtents().y + attackRange) * 2; |
|
|
|
|
Rectangle2D.Float rect = new Rectangle2D.Float(locX, locZ, sizeX, sizeZ); |
|
|
|
|
if (rect.contains(new Point2D.Float(attacker.loc.x, attacker.loc.z))) |
|
|
|
|
inRange = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//get delay for the auto attack job
|
|
|
|
|