|
|
@ -1268,61 +1268,69 @@ public enum CombatManager { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Called when character takes damage.
|
|
|
|
//Called when character takes damage.
|
|
|
|
public static void handleRetaliate(AbstractCharacter tarAc, AbstractCharacter ac) { |
|
|
|
public static void handleRetaliate(AbstractCharacter target, AbstractCharacter attacker) { |
|
|
|
|
|
|
|
|
|
|
|
if (ac == null || tarAc == null) |
|
|
|
if (attacker == null || target == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (ac.equals(tarAc)) |
|
|
|
if (attacker.equals(target)) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (tarAc.isMoving() && tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) |
|
|
|
if (target.isMoving() && target.getObjectType().equals(GameObjectType.PlayerCharacter)) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (!tarAc.isAlive() || !ac.isAlive()) |
|
|
|
if (!target.isAlive() || !attacker.isAlive()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
boolean isCombat = tarAc.isCombat(); |
|
|
|
boolean isCombat = target.isCombat(); |
|
|
|
|
|
|
|
|
|
|
|
//If target in combat and has no target, then attack back
|
|
|
|
//If target in combat and has no target, then attack back
|
|
|
|
|
|
|
|
|
|
|
|
AbstractWorldObject awoCombTar = tarAc.getCombatTarget(); |
|
|
|
AbstractWorldObject awoCombTar = target.getCombatTarget(); |
|
|
|
|
|
|
|
|
|
|
|
if ((tarAc.isCombat() && awoCombTar == null) || (isCombat && awoCombTar != null && (!awoCombTar.isAlive() || tarAc.isCombat() && NotInRange(tarAc, awoCombTar, tarAc.getRange()))) || (tarAc != null && tarAc.getObjectType() == GameObjectType.Mob && ((Mob) tarAc).isSiege())) |
|
|
|
if ((target.isCombat() && awoCombTar == null) || (isCombat && awoCombTar != null && (!awoCombTar.isAlive() || target.isCombat() && NotInRange(target, awoCombTar, target.getRange()))) || (target != null && target.getObjectType() == GameObjectType.Mob && ((Mob) target).isSiege())) |
|
|
|
if (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target
|
|
|
|
if (target.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target
|
|
|
|
|
|
|
|
|
|
|
|
PlayerCharacter pc = (PlayerCharacter) tarAc; |
|
|
|
PlayerCharacter pc = (PlayerCharacter) target; |
|
|
|
tarAc.setCombatTarget(ac); |
|
|
|
target.setCombatTarget(attacker); |
|
|
|
pc.setLastTarget(ac.getObjectType(), ac.getObjectUUID()); |
|
|
|
pc.setLastTarget(attacker.getObjectType(), attacker.getObjectUUID()); |
|
|
|
|
|
|
|
|
|
|
|
if (tarAc.getTimers() != null) |
|
|
|
if (target.getTimers() != null) |
|
|
|
if (!tarAc.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND)) |
|
|
|
if (!target.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND)) |
|
|
|
CombatManager.AttackTarget((PlayerCharacter) tarAc, tarAc.getCombatTarget()); |
|
|
|
CombatManager.AttackTarget((PlayerCharacter) target, target.getCombatTarget()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Handle pet retaliate if assist is on and pet doesn't have a target.
|
|
|
|
//Handle pet retaliate if assist is on and pet doesn't have a target.
|
|
|
|
|
|
|
|
|
|
|
|
if (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) { |
|
|
|
if (target.getObjectType().equals(GameObjectType.PlayerCharacter)) { |
|
|
|
|
|
|
|
|
|
|
|
Mob pet = ((PlayerCharacter) tarAc).getPet(); |
|
|
|
Mob pet = ((PlayerCharacter) target).getPet(); |
|
|
|
|
|
|
|
|
|
|
|
if (pet != null && pet.assist && pet.getCombatTarget() == null) |
|
|
|
if (pet != null && pet.assist && pet.getCombatTarget() == null) |
|
|
|
pet.setCombatTarget(ac); |
|
|
|
pet.setCombatTarget(attacker); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Handle Mob Retaliate.
|
|
|
|
//Handle Mob Retaliate.
|
|
|
|
|
|
|
|
|
|
|
|
if (tarAc.getObjectType() == GameObjectType.Mob) { |
|
|
|
if (target.getObjectType() == GameObjectType.Mob) { |
|
|
|
|
|
|
|
|
|
|
|
Mob retaliater = (Mob) tarAc; |
|
|
|
Mob retaliater = (Mob) target; |
|
|
|
|
|
|
|
|
|
|
|
if (retaliater.getCombatTarget() != null && !retaliater.isSiege()) |
|
|
|
if (retaliater.getCombatTarget() != null && !retaliater.isSiege()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (ac.getObjectType() == GameObjectType.Mob && retaliater.isSiege()) |
|
|
|
if (attacker.getObjectType() == GameObjectType.Mob && retaliater.isSiege()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
retaliater.setCombatTarget(ac); |
|
|
|
//handle minion informing his captain of the attack
|
|
|
|
|
|
|
|
if(attacker.getObjectType().equals(GameObjectType.Mob)){ |
|
|
|
|
|
|
|
Mob mob = (Mob)attacker; |
|
|
|
|
|
|
|
if(mob.agentType.equals(AIAgentType.GUARDMINION) && mob.guardCaptain != null && mob.guardCaptain.isAlive()) |
|
|
|
|
|
|
|
if(mob.guardCaptain.combatTarget == null) |
|
|
|
|
|
|
|
mob.guardCaptain.combatTarget = attacker; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
retaliater.setCombatTarget(attacker); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|