add half player character height to attack range in lieu of hitbox
This commit is contained in:
@@ -113,13 +113,20 @@ public enum CombatManager {
|
|||||||
float distanceSquared = attacker.loc.distanceSquared(target.loc);
|
float distanceSquared = attacker.loc.distanceSquared(target.loc);
|
||||||
|
|
||||||
boolean inRange = false;
|
boolean inRange = false;
|
||||||
|
if(attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)){
|
||||||
attackRange += attacker.calcHitBox();
|
attackRange += ((PlayerCharacter)attacker).getCharacterHeight() * 0.5f;
|
||||||
|
}else {
|
||||||
|
attackRange += attacker.calcHitBox();
|
||||||
|
}
|
||||||
switch(target.getObjectType()){
|
switch(target.getObjectType()){
|
||||||
case PlayerCharacter:
|
case PlayerCharacter:
|
||||||
|
attackRange += ((PlayerCharacter)target).getCharacterHeight() * 0.5f;
|
||||||
|
if(distanceSquared < attackRange * attackRange)
|
||||||
|
inRange = true;
|
||||||
|
break;
|
||||||
case Mob:
|
case Mob:
|
||||||
attackRange += ((AbstractCharacter)target).calcHitBox();
|
attackRange += ((AbstractCharacter)target).calcHitBox();
|
||||||
if(distanceSquared < attackRange * 2)
|
if(distanceSquared < attackRange * attackRange)
|
||||||
inRange = true;
|
inRange = true;
|
||||||
break;
|
break;
|
||||||
case Building:
|
case Building:
|
||||||
@@ -143,6 +150,20 @@ public enum CombatManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeferredPowerJob dpj = null;
|
||||||
|
|
||||||
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||||
|
|
||||||
|
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
||||||
|
|
||||||
|
if (dpj != null) {
|
||||||
|
dpj.attack(target, attackRange);
|
||||||
|
|
||||||
|
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
||||||
|
((PlayerCharacter) attacker).setWeaponPower(dpj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// take stamina away from attacker
|
// take stamina away from attacker
|
||||||
|
|
||||||
if (weapon != null) {
|
if (weapon != null) {
|
||||||
@@ -336,19 +357,6 @@ public enum CombatManager {
|
|||||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) damage, attackAnim);
|
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) damage, attackAnim);
|
||||||
DispatchMessage.sendToAllInRange(target, cmm);
|
DispatchMessage.sendToAllInRange(target, cmm);
|
||||||
}
|
}
|
||||||
DeferredPowerJob dpj = null;
|
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
|
||||||
|
|
||||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
|
||||||
|
|
||||||
if (dpj != null) {
|
|
||||||
dpj.attack(target, attackRange);
|
|
||||||
|
|
||||||
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
|
||||||
((PlayerCharacter) attacker).setWeaponPower(dpj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//calculate next allowed attack and update the timestamp
|
//calculate next allowed attack and update the timestamp
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user