Browse Source

guards use highbred City._playerMemory.size() and Mob.playerAgroMap to go to sleep

master
FatBoy-DOTC 2 years ago
parent
commit
932daa730a
  1. 10
      src/engine/ai/MobileFSM.java
  2. 2
      src/engine/objects/City.java
  3. 2
      src/engine/objects/Mob.java

10
src/engine/ai/MobileFSM.java

@ -305,6 +305,13 @@ public class MobileFSM {
public static void DetermineAction(Mob mob) { public static void DetermineAction(Mob mob) {
if (mob == null) if (mob == null)
return; return;
if (mob.playerAgroMap.isEmpty() && !mob.isPlayerGuard)
//no players loaded, no need to proceed
return;
else{
if(mob.isPlayerGuard && mob.guardedCity._playerMemory.size() < 1 && mob.playerAgroMap.isEmpty())
return;
}
if (mob.despawned && mob.isPlayerGuard) { if (mob.despawned && mob.isPlayerGuard) {
//override for guards //override for guards
if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()){ if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()){
@ -326,9 +333,6 @@ public class MobileFSM {
CheckForRespawn(mob); CheckForRespawn(mob);
return; return;
} }
if (mob.playerAgroMap.isEmpty())
//no players loaded, no need to proceed
return;
if (mob.isCombat() && mob.getCombatTarget() == null) { if (mob.isCombat() && mob.getCombatTarget() == null) {
mob.setCombat(false); mob.setCombat(false);
UpdateStateMsg rwss = new UpdateStateMsg(); UpdateStateMsg rwss = new UpdateStateMsg();

2
src/engine/objects/City.java

@ -87,7 +87,7 @@ public class City extends AbstractWorldObject {
// Players who have entered the city (used for adding and removing affects) // Players who have entered the city (used for adding and removing affects)
private final HashSet<Integer> _playerMemory = new HashSet<>(); public final HashSet<Integer> _playerMemory = new HashSet<>();
public volatile boolean protectionEnforced = true; public volatile boolean protectionEnforced = true;
private String hash; private String hash;

2
src/engine/objects/Mob.java

@ -99,6 +99,7 @@ public class Mob extends AbstractIntelligenceAgent {
private DeferredPowerJob weaponPower; private DeferredPowerJob weaponPower;
private DateTime upgradeDateTime = null; private DateTime upgradeDateTime = null;
private boolean lootSync = false; private boolean lootSync = false;
public City guardedCity;
/** /**
* No Id Constructor * No Id Constructor
@ -806,6 +807,7 @@ public class Mob extends AbstractIntelligenceAgent {
mob.npcOwner = guardCaptain; mob.npcOwner = guardCaptain;
mob.spawnTime = (int)(-2.500 * guardCaptain.building.getRank() + 22.5) * 60; mob.spawnTime = (int)(-2.500 * guardCaptain.building.getRank() + 22.5) * 60;
mob.BehaviourType = Enum.MobBehaviourType.GuardMinion; mob.BehaviourType = Enum.MobBehaviourType.GuardMinion;
mob.guardedCity = guardCaptain.guardedCity;
mob.parentZone = parent; mob.parentZone = parent;
parent.zoneMobSet.add(mob); parent.zoneMobSet.add(mob);
return mob; return mob;

Loading…
Cancel
Save