From ff36d8f3db3fe375d13b6eef6387ca0e0ccfa5de Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 5 Sep 2023 08:27:34 -0400 Subject: [PATCH] Modification to minion retaliate. --- src/engine/gameManager/CombatManager.java | 20 +++++++++----------- src/engine/objects/AbstractCharacter.java | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 0f90188b..b63d21f6 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -1314,23 +1314,21 @@ public enum CombatManager { if (target.getObjectType() == GameObjectType.Mob) { - Mob retaliater = (Mob) target; + Mob attackedMobile = (Mob) target; - if (retaliater.getCombatTarget() != null && !retaliater.isSiege()) - return; - - if (attacker.getObjectType() == GameObjectType.Mob && retaliater.isSiege()) + if (attackedMobile.getCombatTarget() != null && !attackedMobile.isSiege()) return; //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; + 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.setCombatTarget(attacker); + } - retaliater.setCombatTarget(attacker); + attackedMobile.setCombatTarget(attacker); } } diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index c4feef6f..87ef3fff 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -1107,6 +1107,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { } public final void setCombatTarget(final AbstractWorldObject value) { + if(this.getObjectTypeMask() == 2050) {//MOB? if (value == null) { if (this.isCombat()) { @@ -1127,7 +1128,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject { this.combatTarget = value; - } public final ConcurrentHashMap getTimers() {