inLined single line methods for code clarity.
This commit is contained in:
@@ -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 {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user