diff --git a/src/engine/InterestManagement/InterestManager.java b/src/engine/InterestManagement/InterestManager.java index 0580d421..f36aac87 100644 --- a/src/engine/InterestManagement/InterestManager.java +++ b/src/engine/InterestManagement/InterestManager.java @@ -8,6 +8,7 @@ package engine.InterestManagement; +import engine.Enum; import engine.Enum.DispatchChannel; import engine.Enum.GameObjectType; import engine.gameManager.GroupManager; @@ -474,7 +475,7 @@ public enum InterestManager implements Runnable { awonpc.playerAgroMap.put(player.getObjectUUID(), false); - if (awonpc.isMob()) + if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE))) //MobAI.setAwake(awonpc, false); ((Mob) awonpc).setCombatTarget(null); // IVarController.setVariable(awonpc, "IntelligenceDisableDelay", (double) (System.currentTimeMillis() + 5000)); diff --git a/src/engine/devcmd/cmds/InfoCmd.java b/src/engine/devcmd/cmds/InfoCmd.java index 5f96dd13..5cb88ef9 100644 --- a/src/engine/devcmd/cmds/InfoCmd.java +++ b/src/engine/devcmd/cmds/InfoCmd.java @@ -9,6 +9,7 @@ package engine.devcmd.cmds; +import engine.Enum; import engine.Enum.BuildingGroup; import engine.Enum.GameObjectType; import engine.Enum.TargetColor; @@ -435,7 +436,7 @@ public class InfoCmd extends AbstractDevCmd { if (targetMob.isPet()) { output += "isPet: true"; output += newline; - if (targetMob.isSummonedPet()) + if ((targetMob.agentType.equals(Enum.AIAgentType.PET))) output += "isSummonedPet: true"; else output += "isSummonedPet: false"; @@ -443,7 +444,7 @@ public class InfoCmd extends AbstractDevCmd { if (owner != null) output += " owner: " + owner.getObjectUUID(); output += newline; - output += "assist: " + targetMob.assist() + " resting: " + targetMob.isSit(); + output += "assist: " + targetMob.assist + " resting: " + targetMob.isSit(); output += newline; } if (targetMob.getMobBase() != null) { @@ -453,7 +454,7 @@ public class InfoCmd extends AbstractDevCmd { output += newline; } - if (targetMob.isMob()) { + if ((targetMob.agentType.equals(Enum.AIAgentType.MOBILE))) { output += "SpawnRadius: " + targetMob.getSpawnRadius(); output += newline; output += "Spawn Timer: " + targetMob.getSpawnTimeAsString(); diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 7bccb83b..cd53fde8 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -1307,7 +1307,7 @@ public enum CombatManager { Mob pet = ((PlayerCharacter) tarAc).getPet(); - if (pet != null && pet.assist() && pet.getCombatTarget() == null) + if (pet != null && pet.assist && pet.getCombatTarget() == null) pet.setCombatTarget(ac); } diff --git a/src/engine/gameManager/NPCManager.java b/src/engine/gameManager/NPCManager.java index 0ad83ecb..11deb263 100644 --- a/src/engine/gameManager/NPCManager.java +++ b/src/engine/gameManager/NPCManager.java @@ -168,7 +168,7 @@ public enum NPCManager { for (Mob necroPet : player.necroPets) if (necroPet.isPet()) - necroPet.setMob(); + necroPet.agentType = Enum.AIAgentType.MOBILE; } public static void spawnNecroPet(PlayerCharacter playerCharacter, Mob mob) { diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index 4bc2d34c..580665f8 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -1203,7 +1203,7 @@ public enum PowersManager { } else if (target.getObjectType().equals(GameObjectType.Mob)) { Mob mob = (Mob) target; - if (pb.targetMob() && !mob.isMob() && !mob.isSiege()) + if (pb.targetMob() && !(mob.agentType.equals(AIAgentType.MOBILE)) && !mob.isSiege()) return false; else if (pb.targetPet() && !mob.isPet() && !mob.isSiege()) return false; diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 64df857c..751ffc0e 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -143,7 +143,7 @@ public class MobAI { } if (target.getPet() != null) - if (target.getPet().getCombatTarget() == null && target.getPet().assist() == true) + if (target.getPet().getCombatTarget() == null && target.getPet().assist == true) target.getPet().setCombatTarget(mob); } catch (Exception e) { @@ -1003,14 +1003,14 @@ public class MobAI { //dont scan self. - if (mob.equals(awoMob) || mob.isGuard() == true) + if (mob.equals(awoMob) || (mob.agentType.equals(Enum.AIAgentType.GUARD)) == true) continue; Mob aggroMob = (Mob) awoMob; //don't attack other guards - if (aggroMob.isGuard()) + if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARD))) continue; if(aggroMob.BehaviourType.equals(Enum.MobBehaviourType.Pet1)) diff --git a/src/engine/mobileAI/utilities/CombatUtilities.java b/src/engine/mobileAI/utilities/CombatUtilities.java index 5ad79656..fd52a2e3 100644 --- a/src/engine/mobileAI/utilities/CombatUtilities.java +++ b/src/engine/mobileAI/utilities/CombatUtilities.java @@ -322,7 +322,7 @@ public class CombatUtilities { float damage = 0; DamageType dt = getDamageType(agent); - if (agent.isSummonedPet() == true || agent.isPet() == true || agent.isNecroPet() == true) { + if ((agent.agentType.equals(AIAgentType.PET)) == true || agent.isPet() == true || agent.isNecroPet() == true) { damage = calculatePetDamage(agent); } else if (agent.isPlayerGuard() == true) { //damage = calculateGuardDamage(agent); diff --git a/src/engine/objects/AbstractIntelligenceAgent.java b/src/engine/objects/AbstractIntelligenceAgent.java index e73b8386..3c7c9635 100644 --- a/src/engine/objects/AbstractIntelligenceAgent.java +++ b/src/engine/objects/AbstractIntelligenceAgent.java @@ -29,8 +29,8 @@ import java.util.ArrayList; public abstract class AbstractIntelligenceAgent extends AbstractCharacter { protected Vector3fImmutable lastBindLoc; - private boolean assist = false; - private Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE; + public boolean assist = false; + public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE; public AbstractIntelligenceAgent(ResultSet rs) throws SQLException { @@ -79,10 +79,6 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter { return null; } - public void setMob() { - this.agentType = Enum.AIAgentType.MOBILE; - } - public void setPet(PlayerCharacter owner, boolean summoned) { if (summoned) @@ -96,32 +92,12 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter { } - public boolean isMob() { - return (this.agentType.equals(Enum.AIAgentType.MOBILE)); - } - public boolean isPet() { return (this.agentType.equals(Enum.AIAgentType.PET) || this.agentType.equals(Enum.AIAgentType.CHARMED)); } - public boolean isSummonedPet() { - return (this.agentType.equals(Enum.AIAgentType.PET)); - } - - public boolean isCharmedPet() { - return (this.agentType.equals(Enum.AIAgentType.CHARMED)); - } - - public boolean isGuard() { - return (this.agentType.equals(Enum.AIAgentType.GUARD)); - } - - public boolean assist() { - return this.assist; - } - public void toggleAssist() { this.assist = !this.assist; } @@ -154,9 +130,12 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter { } public float getAggroRange() { + float ret = MobAIThread.AI_BASE_AGGRO_RANGE; + if (this.bonuses != null) ret *= (1 + this.bonuses.getFloatPercentAll(ModType.ScanRange, SourceType.None)); + return ret; } @@ -164,28 +143,31 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter { if (this.isPet()) { - if (this.isSummonedPet()) { //delete summoned pet + if ((this.agentType.equals(Enum.AIAgentType.PET))) { //delete summoned pet WorldGrid.RemoveWorldObject(this); - if (this.getObjectType() == GameObjectType.Mob) { - //((Mob)this).state = STATE.Disabled; + + if (this.getObjectType() == GameObjectType.Mob) if (((Mob) this).getParentZone() != null) ((Mob) this).getParentZone().zoneMobSet.remove(this); - } } else { //revert charmed pet - this.setMob(); + this.agentType = Enum.AIAgentType.MOBILE; this.setCombatTarget(null); } //clear owner + PlayerCharacter owner = this.getOwner(); //close pet window + if (owner != null) { + Mob pet = owner.getPet(); - PetMsg pm = new PetMsg(5, null); - Dispatch dispatch = Dispatch.borrow(owner, pm); + + PetMsg petMsg = new PetMsg(5, null); + Dispatch dispatch = Dispatch.borrow(owner, petMsg); DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); if (pet != null && pet.getObjectUUID() == this.getObjectUUID()) @@ -199,6 +181,5 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter { } } - } diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 7b629df3..f385d7b7 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1226,7 +1226,7 @@ public class Mob extends AbstractIntelligenceAgent { Group g = GroupManager.getGroup((PlayerCharacter) attacker); // Give XP, now handled inside the Experience Object - if (!this.isPet() && !this.isNecroPet() && !this.isSummonedPet() && !this.isPlayerGuard) + if (!this.isPet() && !this.isNecroPet() && !(this.agentType.equals(AIAgentType.PET)) && !this.isPlayerGuard) Experience.doExperience((PlayerCharacter) attacker, this, g); } else if (attacker.getObjectType().equals(GameObjectType.Mob)) { Mob mobAttacker = (Mob) attacker; @@ -1236,7 +1236,7 @@ public class Mob extends AbstractIntelligenceAgent { PlayerCharacter owner = mobAttacker.getOwner(); if (owner != null) - if (!this.isPet() && !this.isNecroPet() && !this.isSummonedPet() && !this.isPlayerGuard) { + if (!this.isPet() && !this.isNecroPet() && !(this.agentType.equals(AIAgentType.PET)) && !this.isPlayerGuard) { Group g = GroupManager.getGroup(owner); // Give XP, now handled inside the Experience Object @@ -1958,7 +1958,7 @@ public class Mob extends AbstractIntelligenceAgent { // Combine mobbase and mob aggro arrays into one bitvector //skip for pets - if (this.isPet() == false && this.isSummonedPet() == false && this.isNecroPet() == false) { + if (this.isPet() == false && (this.agentType.equals(AIAgentType.PET)) == false && this.isNecroPet() == false) { if (this.getMobBase().notEnemy.size() > 0) this.notEnemy.addAll(this.getMobBase().notEnemy); @@ -1985,7 +1985,7 @@ public class Mob extends AbstractIntelligenceAgent { } //assign 5 random patrol points for regular mobs - if (!this.isGuard() && !this.isPlayerGuard() && !this.isPet() && !this.isNecroPet() && !this.isSummonedPet() && !this.isCharmedPet()) { + if (!(this.agentType.equals(AIAgentType.GUARD)) && !this.isPlayerGuard() && !this.isPet() && !this.isNecroPet() && !(this.agentType.equals(AIAgentType.PET)) && !(this.agentType.equals(AIAgentType.CHARMED))) { this.patrolPoints = new ArrayList<>(); for (int i = 0; i < 5; ++i) { @@ -2229,7 +2229,7 @@ public class Mob extends AbstractIntelligenceAgent { if (this.isPet()) { - if (this.isSummonedPet()) { //delete summoned pet + if ((this.agentType.equals(AIAgentType.PET))) { //delete summoned pet WorldGrid.RemoveWorldObject(this); DbManager.removeFromCache(this); @@ -2239,7 +2239,7 @@ public class Mob extends AbstractIntelligenceAgent { this.getParentZone().zoneMobSet.remove(this); } else { //revert charmed pet - this.setMob(); + this.agentType = AIAgentType.MOBILE; this.setCombatTarget(null); } //clear owner diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 49f23de2..91b8d32a 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4713,7 +4713,7 @@ public class PlayerCharacter extends AbstractCharacter { DbManager.removeFromCache(currentPet); } else if (currentPet.isSiege()) { - currentPet.setMob(); + currentPet.agentType = AIAgentType.MOBILE; currentPet.setOwner(null); currentPet.setCombatTarget(null); if (currentPet.isAlive()) diff --git a/src/engine/powers/poweractions/CharmPowerAction.java b/src/engine/powers/poweractions/CharmPowerAction.java index 39afcce7..100f5461 100644 --- a/src/engine/powers/poweractions/CharmPowerAction.java +++ b/src/engine/powers/poweractions/CharmPowerAction.java @@ -48,7 +48,7 @@ public class CharmPowerAction extends AbstractPowerAction { //verify is mob, not pet or guard Mob mob = (Mob) awo; - if (!mob.isMob()) + if (!(mob.agentType.equals(Enum.AIAgentType.MOBILE))) return; //make sure mob isn't too high level diff --git a/src/engine/powers/poweractions/CreateMobPowerAction.java b/src/engine/powers/poweractions/CreateMobPowerAction.java index 5c9ec7fa..90b64055 100644 --- a/src/engine/powers/poweractions/CreateMobPowerAction.java +++ b/src/engine/powers/poweractions/CreateMobPowerAction.java @@ -97,7 +97,7 @@ public class CreateMobPowerAction extends AbstractPowerAction { //currentPet.disableIntelligence(); } else if (currentPet != null && currentPet.isSiege()) { - currentPet.setMob(); + currentPet.agentType = Enum.AIAgentType.MOBILE; currentPet.setOwner(null); currentPet.setCombatTarget(null); @@ -124,7 +124,7 @@ public class CreateMobPowerAction extends AbstractPowerAction { //currentPet.disableIntelligence(); } else { if (currentPet.isSiege()) { - currentPet.setMob(); + currentPet.agentType = Enum.AIAgentType.MOBILE; currentPet.setOwner(null); currentPet.setCombatTarget(null); diff --git a/src/engine/powers/poweractions/FearPowerAction.java b/src/engine/powers/poweractions/FearPowerAction.java index 2ddcb504..c1bae2ed 100644 --- a/src/engine/powers/poweractions/FearPowerAction.java +++ b/src/engine/powers/poweractions/FearPowerAction.java @@ -47,7 +47,7 @@ public class FearPowerAction extends AbstractPowerAction { //verify is mob, not pet or guard Mob mob = (Mob) awo; - if (!mob.isMob()) + if (!(mob.agentType.equals(Enum.AIAgentType.MOBILE))) return; //make sure mob isn't too high level