Browse Source

properly configure hitbox radius

lakebane
FatBoy-DOTC 3 weeks ago
parent
commit
f4361113ed
  1. 13
      src/engine/gameManager/CombatManager.java
  2. 4
      src/engine/objects/AbstractCharacter.java

13
src/engine/gameManager/CombatManager.java

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

4
src/engine/objects/AbstractCharacter.java

@ -1046,7 +1046,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
if (MBServerStatics.COMBAT_TARGET_HITBOX_DEBUG) { if (MBServerStatics.COMBAT_TARGET_HITBOX_DEBUG) {
Logger.info("Hit box radius for " + this.getFirstName() + " is " + (this.statStrCurrent / 200f)); Logger.info("Hit box radius for " + this.getFirstName() + " is " + (this.statStrCurrent / 200f));
} }
return ((PlayerCharacter) this).getStrForClient() / 200f; int strength = ((PlayerCharacter) this).statStrBase;
float radius = strength * 0.1f * 0.5f;
return radius;
//TODO CALCULATE MOB HITBOX BECAUSE FAIL EMU IS FAIL!!!!!!! //TODO CALCULATE MOB HITBOX BECAUSE FAIL EMU IS FAIL!!!!!!!
} else if (this.getObjectType() == GameObjectType.Mob) { } else if (this.getObjectType() == GameObjectType.Mob) {
if (MBServerStatics.COMBAT_TARGET_HITBOX_DEBUG) { if (MBServerStatics.COMBAT_TARGET_HITBOX_DEBUG) {

Loading…
Cancel
Save