Browse Source

inLined single line methods for code clarity.

master
MagicBot 1 year ago
parent
commit
2d0116a9d9
  1. 3
      src/engine/InterestManagement/InterestManager.java
  2. 7
      src/engine/devcmd/cmds/InfoCmd.java
  3. 2
      src/engine/gameManager/CombatManager.java
  4. 2
      src/engine/gameManager/NPCManager.java
  5. 2
      src/engine/gameManager/PowersManager.java
  6. 6
      src/engine/mobileAI/MobAI.java
  7. 2
      src/engine/mobileAI/utilities/CombatUtilities.java
  8. 49
      src/engine/objects/AbstractIntelligenceAgent.java
  9. 12
      src/engine/objects/Mob.java
  10. 2
      src/engine/objects/PlayerCharacter.java
  11. 2
      src/engine/powers/poweractions/CharmPowerAction.java
  12. 4
      src/engine/powers/poweractions/CreateMobPowerAction.java
  13. 2
      src/engine/powers/poweractions/FearPowerAction.java

3
src/engine/InterestManagement/InterestManager.java

@ -8,6 +8,7 @@ @@ -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 { @@ -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));

7
src/engine/devcmd/cmds/InfoCmd.java

@ -9,6 +9,7 @@ @@ -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 { @@ -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 { @@ -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 { @@ -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();

2
src/engine/gameManager/CombatManager.java

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

2
src/engine/gameManager/NPCManager.java

@ -168,7 +168,7 @@ public enum NPCManager { @@ -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) {

2
src/engine/gameManager/PowersManager.java

@ -1203,7 +1203,7 @@ public enum PowersManager { @@ -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;

6
src/engine/mobileAI/MobAI.java

@ -143,7 +143,7 @@ public class MobAI { @@ -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 { @@ -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))

2
src/engine/mobileAI/utilities/CombatUtilities.java

@ -322,7 +322,7 @@ public class CombatUtilities { @@ -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);

49
src/engine/objects/AbstractIntelligenceAgent.java

@ -29,8 +29,8 @@ import java.util.ArrayList; @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -199,6 +181,5 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
}
}
}

12
src/engine/objects/Mob.java

@ -1226,7 +1226,7 @@ public class Mob extends AbstractIntelligenceAgent { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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

2
src/engine/objects/PlayerCharacter.java

@ -4713,7 +4713,7 @@ public class PlayerCharacter extends AbstractCharacter { @@ -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())

2
src/engine/powers/poweractions/CharmPowerAction.java

@ -48,7 +48,7 @@ public class CharmPowerAction extends AbstractPowerAction { @@ -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

4
src/engine/powers/poweractions/CreateMobPowerAction.java

@ -97,7 +97,7 @@ public class CreateMobPowerAction extends AbstractPowerAction { @@ -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 { @@ -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);

2
src/engine/powers/poweractions/FearPowerAction.java

@ -47,7 +47,7 @@ public class FearPowerAction extends AbstractPowerAction { @@ -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

Loading…
Cancel
Save