Browse Source

Modification to minion retaliate.

combat-2
MagicBot 1 year ago
parent
commit
ff36d8f3db
  1. 20
      src/engine/gameManager/CombatManager.java
  2. 2
      src/engine/objects/AbstractCharacter.java

20
src/engine/gameManager/CombatManager.java

@ -1314,23 +1314,21 @@ public enum CombatManager { @@ -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);
}
}

2
src/engine/objects/AbstractCharacter.java

@ -1107,6 +1107,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { @@ -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 { @@ -1127,7 +1128,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.combatTarget = value;
}
public final ConcurrentHashMap<String, JobContainer> getTimers() {

Loading…
Cancel
Save