Browse Source

guard minion logic work

master
FatBoy-DOTC 2 years ago
parent
commit
e52b8e894b
  1. 15
      src/engine/ai/MobileFSM.java
  2. 3
      src/engine/objects/Mob.java

15
src/engine/ai/MobileFSM.java

@ -199,7 +199,7 @@ public class MobileFSM {
mob.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex); mob.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex);
MovementUtilities.aiMove(mob, mob.destination, true); MovementUtilities.aiMove(mob, mob.destination, true);
mob.lastPatrolPointIndex += 1; mob.lastPatrolPointIndex += 1;
if (mob.isPlayerGuard()) { if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
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
if (minion.getKey().isCombat() && minion.getKey().getCombatTarget() == null) { if (minion.getKey().isCombat() && minion.getKey().getCombatTarget() == null) {
@ -320,6 +320,12 @@ public class MobileFSM {
if (mob.playerAgroMap.isEmpty()) if (mob.playerAgroMap.isEmpty())
//no players loaded, no need to proceed //no players loaded, no need to proceed
return; return;
if (mob.isCombat() && mob.getCombatTarget() == null) {
mob.setCombat(false);
UpdateStateMsg rwss = new UpdateStateMsg();
rwss.setPlayer(mob);
DispatchMessage.sendToAllInRange(mob, rwss);
}
CheckToSendMobHome(mob); CheckToSendMobHome(mob);
mob.updateLocation(); mob.updateLocation();
switch (mob.BehaviourType) { switch (mob.BehaviourType) {
@ -378,6 +384,8 @@ public class MobileFSM {
return; return;
mob.updateLocation(); mob.updateLocation();
if (mob.BehaviourType != Enum.MobBehaviourType.Pet1) { if (mob.BehaviourType != Enum.MobBehaviourType.Pet1) {
if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal() && ((Mob)mob.npcOwner).despawned == true)
return;
if (mob.getCombatTarget() == null) if (mob.getCombatTarget() == null)
Patrol(mob); Patrol(mob);
else else
@ -505,11 +513,6 @@ public class MobileFSM {
CheckForAttack(mob); CheckForAttack(mob);
} }
public static void GuardMinionLogic(Mob mob) { public static void GuardMinionLogic(Mob mob) {
if (mob.despawned || !mob.isAlive()) {
if (System.currentTimeMillis() > mob.deathTime + (mob.spawnTime * 1000))
mob.respawn();
return;
}
if (!mob.npcOwner.isAlive() && mob.getCombatTarget() == null) { if (!mob.npcOwner.isAlive() && mob.getCombatTarget() == null) {
CheckForPlayerGuardAggro(mob); CheckForPlayerGuardAggro(mob);
return; return;

3
src/engine/objects/Mob.java

@ -1285,7 +1285,6 @@ public class Mob extends AbstractIntelligenceAgent {
public void respawn() { public void respawn() {
//Commenting out Mob ID rotation. //Commenting out Mob ID rotation.
this.despawned = false; this.despawned = false;
this.playerAgroMap.clear(); this.playerAgroMap.clear();
this.setCombatTarget(null); this.setCombatTarget(null);
@ -1304,7 +1303,7 @@ public class Mob extends AbstractIntelligenceAgent {
this.recalculateStats(); this.recalculateStats();
this.setHealth(this.healthMax); this.setHealth(this.healthMax);
this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z);
if (!this.isSiege && !this.isPlayerGuard && contract == null) loadInventory(); if (!this.isSiege && !this.isPlayerGuard && contract == null) loadInventory();
} }

Loading…
Cancel
Save