|
|
|
@ -471,27 +471,24 @@ public enum CombatManager {
@@ -471,27 +471,24 @@ public enum CombatManager {
|
|
|
|
|
//Range check.
|
|
|
|
|
|
|
|
|
|
if(abstractCharacter.isMoving()){ |
|
|
|
|
range += (abstractCharacter.getSpeed() * 0.1f); |
|
|
|
|
range += (abstractCharacter.getSpeed() * 0.1f); // add movement vector offset for moving attacker
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(AbstractWorldObject.IsAbstractCharacter(target)) { |
|
|
|
|
AbstractCharacter tarAc = (AbstractCharacter) target; |
|
|
|
|
if(tarAc != null && tarAc.isMoving()){ |
|
|
|
|
range += (tarAc.getSpeed() * 0.1f); |
|
|
|
|
range += (tarAc.getSpeed() * 0.1f); // add movement vector offset for moving target
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
float attackerHitBox = abstractCharacter.calcHitBox(); |
|
|
|
|
float attackerHitBox = abstractCharacter.calcHitBox(); // add attacker hitbox
|
|
|
|
|
float targetHitBox = 0.0f; |
|
|
|
|
if(AbstractCharacter.IsAbstractCharacter(target)){ |
|
|
|
|
AbstractCharacter targetCharacter = (AbstractCharacter)target; |
|
|
|
|
targetHitBox = targetCharacter.calcHitBox(); |
|
|
|
|
}else if(target.getObjectType().equals(GameObjectType.Building)){ |
|
|
|
|
Building targetBuilding = (Building)target; |
|
|
|
|
targetHitBox = targetBuilding.getBounds().getHalfExtents().x; |
|
|
|
|
targetHitBox = targetCharacter.calcHitBox(); // add target hitbox
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
range += attackerHitBox + targetHitBox; |
|
|
|
|
range += attackerHitBox + targetHitBox + 2.5f; // offset standard range to sync where client tries to stop
|
|
|
|
|
|
|
|
|
|
if (NotInRange(abstractCharacter, target, range)) { |
|
|
|
|
|
|
|
|
|