Browse Source

utilization and assignment of aiAgentType

feature-workorder
FatBoy-DOTC 1 year ago
parent
commit
c5443f622c
  1. 5
      src/engine/devcmd/cmds/AddMobCmd.java
  2. 3
      src/engine/devcmd/cmds/SplatMobCmd.java
  3. 6
      src/engine/gameManager/BuildingManager.java
  4. 26
      src/engine/mobileAI/MobAI.java
  5. 5
      src/engine/objects/Mob.java

5
src/engine/devcmd/cmds/AddMobCmd.java

@ -9,6 +9,7 @@
package engine.devcmd.cmds; package engine.devcmd.cmds;
import engine.Enum;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ChatManager; import engine.gameManager.ChatManager;
@ -43,7 +44,7 @@ public class AddMobCmd extends AbstractDevCmd {
MobBase mb = (MobBase) mobbaseAGO; MobBase mb = (MobBase) mobbaseAGO;
int loadID = mb.getObjectUUID(); int loadID = mb.getObjectUUID();
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100), Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
null, zone, null, null, "", 1); null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
if (mob != null) { if (mob != null) {
mob.updateDatabase(); mob.updateDatabase();
this.setResult(String.valueOf(mob.getDBID())); this.setResult(String.valueOf(mob.getDBID()));
@ -84,7 +85,7 @@ public class AddMobCmd extends AbstractDevCmd {
Mob mob = Mob.createMob(loadID, pc.getLoc(), Mob mob = Mob.createMob(loadID, pc.getLoc(),
null, zone, null, null, "", 1); null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
if (mob != null) { if (mob != null) {
mob.updateDatabase(); mob.updateDatabase();
ChatManager.chatSayInfo(pc, ChatManager.chatSayInfo(pc,

3
src/engine/devcmd/cmds/SplatMobCmd.java

@ -1,5 +1,6 @@
package engine.devcmd.cmds; package engine.devcmd.cmds;
import engine.Enum;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
@ -110,7 +111,7 @@ public class SplatMobCmd extends AbstractDevCmd {
mobile = Mob.createMob(_mobileUUID, mobile = Mob.createMob(_mobileUUID,
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange), Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
null, serverZone, null, null, "", 1); null, serverZone, null, null, "", 1, Enum.AIAgentType.MOBILE);
if (mobile != null) { if (mobile != null) {
mobile.updateDatabase(); mobile.updateDatabase();

6
src/engine/gameManager/BuildingManager.java

@ -535,7 +535,7 @@ public enum BuildingManager {
if (NPC.ISWallArcher(contract)) { if (NPC.ISWallArcher(contract)) {
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank); mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDWALLARCHER);
if (mobile == null) if (mobile == null)
return false; return false;
@ -554,7 +554,7 @@ public enum BuildingManager {
if (NPC.ISGuardCaptain(contract.getContractID())) { if (NPC.ISGuardCaptain(contract.getContractID())) {
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank); mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
if (mobile == null) if (mobile == null)
return false; return false;
@ -574,7 +574,7 @@ public enum BuildingManager {
if (contract.getContractID() == 910) { if (contract.getContractID() == 910) {
//guard dog //guard dog
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank); mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
if (mobile == null) if (mobile == null)
return false; return false;

26
src/engine/mobileAI/MobAI.java

@ -166,7 +166,7 @@ public class MobAI {
if (playercity != null) if (playercity != null)
for (Mob guard : playercity.getParent().zoneMobSet) for (Mob guard : playercity.getParent().zoneMobSet)
if (guard.behaviourType != null && guard.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) if (guard.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
if (guard.getCombatTarget() == null && !guard.getGuild().equals(mob.getGuild())) if (guard.getCombatTarget() == null && !guard.getGuild().equals(mob.getGuild()))
guard.setCombatTarget(mob); guard.setCombatTarget(mob);
@ -261,7 +261,7 @@ public class MobAI {
//guard captains inherit barracks patrol points dynamically //guard captains inherit barracks patrol points dynamically
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) { if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) {
Building barracks = mob.building; Building barracks = mob.building;
@ -281,7 +281,7 @@ public class MobAI {
MovementUtilities.aiMove(mob, mob.destination, true); MovementUtilities.aiMove(mob, mob.destination, true);
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet())
//make sure mob is out of combat stance //make sure mob is out of combat stance
@ -313,7 +313,7 @@ public class MobAI {
int contractID; int contractID;
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion)) if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
contractID = mob.guardCaptain.contract.getContractID(); contractID = mob.guardCaptain.contract.getContractID();
else else
contractID = mob.contract.getContractID(); contractID = mob.contract.getContractID();
@ -615,7 +615,7 @@ public class MobAI {
if (mob.despawned && mob.isPlayerGuard()) { if (mob.despawned && mob.isPlayerGuard()) {
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion)) { if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
if (mob.guardCaptain.isAlive() == false || ((Mob) mob.guardCaptain).despawned == true) { if (mob.guardCaptain.isAlive() == false || ((Mob) mob.guardCaptain).despawned == true) {
//minions don't respawn while guard captain is dead //minions don't respawn while guard captain is dead
@ -632,7 +632,7 @@ public class MobAI {
//check to send mob home for player guards to prevent exploit of dragging guards away and then teleporting //check to send mob home for player guards to prevent exploit of dragging guards away and then teleporting
if (mob.behaviourType.equals(Enum.MobBehaviourType.Pet1) == false) if (!mob.agentType.equals(Enum.AIAgentType.PET))
CheckToSendMobHome(mob); CheckToSendMobHome(mob);
return; return;
@ -653,7 +653,7 @@ public class MobAI {
return; return;
} }
if (mob.behaviourType.equals(Enum.MobBehaviourType.Pet1) == false) if (mob.agentType.equals(Enum.AIAgentType.PET) == false)
CheckToSendMobHome(mob); CheckToSendMobHome(mob);
if (mob.getCombatTarget() != null) { if (mob.getCombatTarget() != null) {
@ -908,7 +908,7 @@ public class MobAI {
return; return;
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false && if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false &&
mob.behaviourType.equals(Enum.MobBehaviourType.Pet1) == false) { mob.agentType.equals(Enum.AIAgentType.PET) == false) {
mob.setCombatTarget(null); mob.setCombatTarget(null);
return; return;
@ -927,7 +927,7 @@ public class MobAI {
if (mob.behaviourType.isAgressive) { if (mob.behaviourType.isAgressive) {
if (mob.isPlayerGuard()) { if (mob.isPlayerGuard()) {
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
CheckForPlayerGuardAggro(mob); CheckForPlayerGuardAggro(mob);
} else { } else {
CheckForAggro(mob); CheckForAggro(mob);
@ -947,7 +947,7 @@ public class MobAI {
PowersManager.useMobPower(mob, mob, recall, 40); PowersManager.useMobPower(mob, mob, recall, 40);
mob.setCombatTarget(null); mob.setCombatTarget(null);
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain) && mob.isAlive()) { if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) && mob.isAlive()) {
//guard captain pulls his minions home with him //guard captain pulls his minions home with him
@ -1028,7 +1028,7 @@ public class MobAI {
if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))) if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)))
continue; continue;
if (aggroMob.behaviourType.equals(Enum.MobBehaviourType.Pet1)) if (aggroMob.agentType.equals(Enum.AIAgentType.PET))
continue; continue;
if (mob.getLoc().distanceSquared2D(aggroMob.getLoc()) > sqr(50)) if (mob.getLoc().distanceSquared2D(aggroMob.getLoc()) > sqr(50))
@ -1259,7 +1259,7 @@ public class MobAI {
if (mob.getGuild().getNation().equals(target.getGuild().getNation())) if (mob.getGuild().getNation().equals(target.getGuild().getNation()))
return false; return false;
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion)) { if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
if (((Mob) mob.guardCaptain).building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) { if (((Mob) mob.guardCaptain).building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
return true; return true;
} }
@ -1344,7 +1344,7 @@ public class MobAI {
MovementUtilities.aiMove(mob, mob.destination, true); MovementUtilities.aiMove(mob, mob.destination, true);
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) { if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) {
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) { for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
//make sure mob is out of combat stance //make sure mob is out of combat stance

5
src/engine/objects/Mob.java

@ -398,11 +398,12 @@ public class Mob extends AbstractIntelligenceAgent {
writer.putInt(mob.currentID); writer.putInt(mob.currentID);
} }
public static Mob createMob(int loadID, Vector3fImmutable spawn, Guild guild, Zone parent, Building building, Contract contract, String pirateName, int level) { public static Mob createMob(int loadID, Vector3fImmutable spawn, Guild guild, Zone parent, Building building, Contract contract, String pirateName, int level, AIAgentType mobType) {
Mob mobile = new Mob(); Mob mobile = new Mob();
mobile.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET; mobile.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
mobile.agentType = AIAgentType.MOBILE; //mobile.agentType = AIAgentType.MOBILE; this method is only called to make guard captains and wall archers
mobile.agentType = mobType;
mobile.behaviourType = MobBehaviourType.None; mobile.behaviourType = MobBehaviourType.None;
mobile.loadID = loadID; mobile.loadID = loadID;
mobile.level = (short) level; mobile.level = (short) level;

Loading…
Cancel
Save