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 @@
package engine.InterestManagement; package engine.InterestManagement;
import engine.Enum;
import engine.Enum.DispatchChannel; import engine.Enum.DispatchChannel;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.gameManager.GroupManager; import engine.gameManager.GroupManager;
@ -474,7 +475,7 @@ public enum InterestManager implements Runnable {
awonpc.playerAgroMap.put(player.getObjectUUID(), false); awonpc.playerAgroMap.put(player.getObjectUUID(), false);
if (awonpc.isMob()) if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
//MobAI.setAwake(awonpc, false); //MobAI.setAwake(awonpc, false);
((Mob) awonpc).setCombatTarget(null); ((Mob) awonpc).setCombatTarget(null);
// IVarController.setVariable(awonpc, "IntelligenceDisableDelay", (double) (System.currentTimeMillis() + 5000)); // IVarController.setVariable(awonpc, "IntelligenceDisableDelay", (double) (System.currentTimeMillis() + 5000));

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

@ -9,6 +9,7 @@
package engine.devcmd.cmds; package engine.devcmd.cmds;
import engine.Enum;
import engine.Enum.BuildingGroup; import engine.Enum.BuildingGroup;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.Enum.TargetColor; import engine.Enum.TargetColor;
@ -435,7 +436,7 @@ public class InfoCmd extends AbstractDevCmd {
if (targetMob.isPet()) { if (targetMob.isPet()) {
output += "isPet: true"; output += "isPet: true";
output += newline; output += newline;
if (targetMob.isSummonedPet()) if ((targetMob.agentType.equals(Enum.AIAgentType.PET)))
output += "isSummonedPet: true"; output += "isSummonedPet: true";
else else
output += "isSummonedPet: false"; output += "isSummonedPet: false";
@ -443,7 +444,7 @@ public class InfoCmd extends AbstractDevCmd {
if (owner != null) if (owner != null)
output += " owner: " + owner.getObjectUUID(); output += " owner: " + owner.getObjectUUID();
output += newline; output += newline;
output += "assist: " + targetMob.assist() + " resting: " + targetMob.isSit(); output += "assist: " + targetMob.assist + " resting: " + targetMob.isSit();
output += newline; output += newline;
} }
if (targetMob.getMobBase() != null) { if (targetMob.getMobBase() != null) {
@ -453,7 +454,7 @@ public class InfoCmd extends AbstractDevCmd {
output += newline; output += newline;
} }
if (targetMob.isMob()) { if ((targetMob.agentType.equals(Enum.AIAgentType.MOBILE))) {
output += "SpawnRadius: " + targetMob.getSpawnRadius(); output += "SpawnRadius: " + targetMob.getSpawnRadius();
output += newline; output += newline;
output += "Spawn Timer: " + targetMob.getSpawnTimeAsString(); output += "Spawn Timer: " + targetMob.getSpawnTimeAsString();

2
src/engine/gameManager/CombatManager.java

@ -1307,7 +1307,7 @@ public enum CombatManager {
Mob pet = ((PlayerCharacter) tarAc).getPet(); Mob pet = ((PlayerCharacter) tarAc).getPet();
if (pet != null && pet.assist() && pet.getCombatTarget() == null) if (pet != null && pet.assist && pet.getCombatTarget() == null)
pet.setCombatTarget(ac); pet.setCombatTarget(ac);
} }

2
src/engine/gameManager/NPCManager.java

@ -168,7 +168,7 @@ public enum NPCManager {
for (Mob necroPet : player.necroPets) for (Mob necroPet : player.necroPets)
if (necroPet.isPet()) if (necroPet.isPet())
necroPet.setMob(); necroPet.agentType = Enum.AIAgentType.MOBILE;
} }
public static void spawnNecroPet(PlayerCharacter playerCharacter, Mob mob) { public static void spawnNecroPet(PlayerCharacter playerCharacter, Mob mob) {

2
src/engine/gameManager/PowersManager.java

@ -1203,7 +1203,7 @@ public enum PowersManager {
} else if (target.getObjectType().equals(GameObjectType.Mob)) { } else if (target.getObjectType().equals(GameObjectType.Mob)) {
Mob mob = (Mob) target; Mob mob = (Mob) target;
if (pb.targetMob() && !mob.isMob() && !mob.isSiege()) if (pb.targetMob() && !(mob.agentType.equals(AIAgentType.MOBILE)) && !mob.isSiege())
return false; return false;
else if (pb.targetPet() && !mob.isPet() && !mob.isSiege()) else if (pb.targetPet() && !mob.isPet() && !mob.isSiege())
return false; return false;

6
src/engine/mobileAI/MobAI.java

@ -143,7 +143,7 @@ public class MobAI {
} }
if (target.getPet() != null) 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); target.getPet().setCombatTarget(mob);
} catch (Exception e) { } catch (Exception e) {
@ -1003,14 +1003,14 @@ public class MobAI {
//dont scan self. //dont scan self.
if (mob.equals(awoMob) || mob.isGuard() == true) if (mob.equals(awoMob) || (mob.agentType.equals(Enum.AIAgentType.GUARD)) == true)
continue; continue;
Mob aggroMob = (Mob) awoMob; Mob aggroMob = (Mob) awoMob;
//don't attack other guards //don't attack other guards
if (aggroMob.isGuard()) if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARD)))
continue; continue;
if(aggroMob.BehaviourType.equals(Enum.MobBehaviourType.Pet1)) if(aggroMob.BehaviourType.equals(Enum.MobBehaviourType.Pet1))

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

@ -322,7 +322,7 @@ public class CombatUtilities {
float damage = 0; float damage = 0;
DamageType dt = getDamageType(agent); 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); damage = calculatePetDamage(agent);
} else if (agent.isPlayerGuard() == true) { } else if (agent.isPlayerGuard() == true) {
//damage = calculateGuardDamage(agent); //damage = calculateGuardDamage(agent);

49
src/engine/objects/AbstractIntelligenceAgent.java

@ -29,8 +29,8 @@ import java.util.ArrayList;
public abstract class AbstractIntelligenceAgent extends AbstractCharacter { public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
protected Vector3fImmutable lastBindLoc; protected Vector3fImmutable lastBindLoc;
private boolean assist = false; public boolean assist = false;
private Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE; public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE;
public AbstractIntelligenceAgent(ResultSet rs) throws SQLException { public AbstractIntelligenceAgent(ResultSet rs) throws SQLException {
@ -79,10 +79,6 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
return null; return null;
} }
public void setMob() {
this.agentType = Enum.AIAgentType.MOBILE;
}
public void setPet(PlayerCharacter owner, boolean summoned) { public void setPet(PlayerCharacter owner, boolean summoned) {
if (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() { public boolean isPet() {
return (this.agentType.equals(Enum.AIAgentType.PET) || return (this.agentType.equals(Enum.AIAgentType.PET) ||
this.agentType.equals(Enum.AIAgentType.CHARMED)); 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() { public void toggleAssist() {
this.assist = !this.assist; this.assist = !this.assist;
} }
@ -154,9 +130,12 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
} }
public float getAggroRange() { public float getAggroRange() {
float ret = MobAIThread.AI_BASE_AGGRO_RANGE; float ret = MobAIThread.AI_BASE_AGGRO_RANGE;
if (this.bonuses != null) if (this.bonuses != null)
ret *= (1 + this.bonuses.getFloatPercentAll(ModType.ScanRange, SourceType.None)); ret *= (1 + this.bonuses.getFloatPercentAll(ModType.ScanRange, SourceType.None));
return ret; return ret;
} }
@ -164,28 +143,31 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
if (this.isPet()) { if (this.isPet()) {
if (this.isSummonedPet()) { //delete summoned pet if ((this.agentType.equals(Enum.AIAgentType.PET))) { //delete summoned pet
WorldGrid.RemoveWorldObject(this); WorldGrid.RemoveWorldObject(this);
if (this.getObjectType() == GameObjectType.Mob) {
//((Mob)this).state = STATE.Disabled; if (this.getObjectType() == GameObjectType.Mob)
if (((Mob) this).getParentZone() != null) if (((Mob) this).getParentZone() != null)
((Mob) this).getParentZone().zoneMobSet.remove(this); ((Mob) this).getParentZone().zoneMobSet.remove(this);
}
} else { //revert charmed pet } else { //revert charmed pet
this.setMob(); this.agentType = Enum.AIAgentType.MOBILE;
this.setCombatTarget(null); this.setCombatTarget(null);
} }
//clear owner //clear owner
PlayerCharacter owner = this.getOwner(); PlayerCharacter owner = this.getOwner();
//close pet window //close pet window
if (owner != null) { if (owner != null) {
Mob pet = owner.getPet(); 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); DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
if (pet != null && pet.getObjectUUID() == this.getObjectUUID()) if (pet != null && pet.getObjectUUID() == this.getObjectUUID())
@ -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 {
Group g = GroupManager.getGroup((PlayerCharacter) attacker); Group g = GroupManager.getGroup((PlayerCharacter) attacker);
// Give XP, now handled inside the Experience Object // 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); Experience.doExperience((PlayerCharacter) attacker, this, g);
} else if (attacker.getObjectType().equals(GameObjectType.Mob)) { } else if (attacker.getObjectType().equals(GameObjectType.Mob)) {
Mob mobAttacker = (Mob) attacker; Mob mobAttacker = (Mob) attacker;
@ -1236,7 +1236,7 @@ public class Mob extends AbstractIntelligenceAgent {
PlayerCharacter owner = mobAttacker.getOwner(); PlayerCharacter owner = mobAttacker.getOwner();
if (owner != null) 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); Group g = GroupManager.getGroup(owner);
// Give XP, now handled inside the Experience Object // 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 // Combine mobbase and mob aggro arrays into one bitvector
//skip for pets //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) if (this.getMobBase().notEnemy.size() > 0)
this.notEnemy.addAll(this.getMobBase().notEnemy); this.notEnemy.addAll(this.getMobBase().notEnemy);
@ -1985,7 +1985,7 @@ public class Mob extends AbstractIntelligenceAgent {
} }
//assign 5 random patrol points for regular mobs //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<>(); this.patrolPoints = new ArrayList<>();
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
@ -2229,7 +2229,7 @@ public class Mob extends AbstractIntelligenceAgent {
if (this.isPet()) { if (this.isPet()) {
if (this.isSummonedPet()) { //delete summoned pet if ((this.agentType.equals(AIAgentType.PET))) { //delete summoned pet
WorldGrid.RemoveWorldObject(this); WorldGrid.RemoveWorldObject(this);
DbManager.removeFromCache(this); DbManager.removeFromCache(this);
@ -2239,7 +2239,7 @@ public class Mob extends AbstractIntelligenceAgent {
this.getParentZone().zoneMobSet.remove(this); this.getParentZone().zoneMobSet.remove(this);
} else { //revert charmed pet } else { //revert charmed pet
this.setMob(); this.agentType = AIAgentType.MOBILE;
this.setCombatTarget(null); this.setCombatTarget(null);
} }
//clear owner //clear owner

2
src/engine/objects/PlayerCharacter.java

@ -4713,7 +4713,7 @@ public class PlayerCharacter extends AbstractCharacter {
DbManager.removeFromCache(currentPet); DbManager.removeFromCache(currentPet);
} else if (currentPet.isSiege()) { } else if (currentPet.isSiege()) {
currentPet.setMob(); currentPet.agentType = AIAgentType.MOBILE;
currentPet.setOwner(null); currentPet.setOwner(null);
currentPet.setCombatTarget(null); currentPet.setCombatTarget(null);
if (currentPet.isAlive()) if (currentPet.isAlive())

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

@ -48,7 +48,7 @@ public class CharmPowerAction extends AbstractPowerAction {
//verify is mob, not pet or guard //verify is mob, not pet or guard
Mob mob = (Mob) awo; Mob mob = (Mob) awo;
if (!mob.isMob()) if (!(mob.agentType.equals(Enum.AIAgentType.MOBILE)))
return; return;
//make sure mob isn't too high level //make sure mob isn't too high level

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

@ -97,7 +97,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
//currentPet.disableIntelligence(); //currentPet.disableIntelligence();
} else if (currentPet != null && currentPet.isSiege()) { } else if (currentPet != null && currentPet.isSiege()) {
currentPet.setMob(); currentPet.agentType = Enum.AIAgentType.MOBILE;
currentPet.setOwner(null); currentPet.setOwner(null);
currentPet.setCombatTarget(null); currentPet.setCombatTarget(null);
@ -124,7 +124,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
//currentPet.disableIntelligence(); //currentPet.disableIntelligence();
} else { } else {
if (currentPet.isSiege()) { if (currentPet.isSiege()) {
currentPet.setMob(); currentPet.agentType = Enum.AIAgentType.MOBILE;
currentPet.setOwner(null); currentPet.setOwner(null);
currentPet.setCombatTarget(null); currentPet.setCombatTarget(null);

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

@ -47,7 +47,7 @@ public class FearPowerAction extends AbstractPowerAction {
//verify is mob, not pet or guard //verify is mob, not pet or guard
Mob mob = (Mob) awo; Mob mob = (Mob) awo;
if (!mob.isMob()) if (!(mob.agentType.equals(Enum.AIAgentType.MOBILE)))
return; return;
//make sure mob isn't too high level //make sure mob isn't too high level

Loading…
Cancel
Save