Browse Source

Gave Wall Archers mob AI

master
FatBoy-DOTC 2 years ago
parent
commit
0914580bea
  1. 1
      src/engine/Enum.java
  2. 19
      src/engine/ai/MobileFSM.java
  3. 13
      src/engine/gameManager/BuildingManager.java
  4. 7
      src/engine/gameManager/NPCManager.java
  5. 19
      src/engine/objects/NPC.java

1
src/engine/Enum.java

@ -2824,6 +2824,7 @@ public class Enum { @@ -2824,6 +2824,7 @@ public class Enum {
None(null, false, false, false, false, false),
GuardCaptain(null, false, true, true, true, false),
GuardMinion(GuardCaptain, false, true, true, false, true),
GuardWallArcher(null, false, true, false, false, false),
Wanderer(null, false, false, false, false, false),
HamletGuard(null, false, false, false, false, false),
AggroWanderer(null, false, false, false, false, false);

19
src/engine/ai/MobileFSM.java

@ -502,7 +502,17 @@ public class MobileFSM { @@ -502,7 +502,17 @@ public class MobileFSM {
}
if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()){
//this is a player slotted guard minion
if(mob.isAlive() == false || mob.despawned){
if(mob.despawned){
if(System.currentTimeMillis() > mob.deathTime + (mob.spawnTime * 1000)){
if(mob.getEquipmentSetID() != ((Mob)mob.npcOwner).getEquipmentSetID()){
mob.equipmentSetID = ((Mob)mob.npcOwner).getEquipmentSetID();
mob.runAfterLoad();
}
mob.respawn();
}
return;
}
if(mob.isAlive() == false){
CheckForRespawn(mob);
return;
}
@ -663,11 +673,16 @@ public class MobileFSM { @@ -663,11 +673,16 @@ public class MobileFSM {
mobAttack(mob);
}
private static void CheckToSendMobHome(Mob mob) {
if(mob.isPlayerGuard() && ZoneManager.getCityAtLocation(mob.getLoc()).equals(mob.getGuild().getOwnedCity()) == false){
if(mob.isPlayerGuard()){
City current = ZoneManager.getCityAtLocation(mob.getLoc());
if(current == null || current.equals(mob.getGuild().getOwnedCity()) == false) {
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
PowersManager.useMobPower(mob, mob, recall, 40);
mob.setAggroTargetID(0);
mob.setCombatTarget(null);
}
}
if (mob.getLoc().distanceSquared2D(mob.getBindLoc()) > sqr(2000)) {
PowersBase recall = PowersManager.getPowerByToken(-1994153779);

13
src/engine/gameManager/BuildingManager.java

@ -481,6 +481,19 @@ public enum BuildingManager { @@ -481,6 +481,19 @@ public enum BuildingManager {
mob.setParentZone(zone);
return true;
}
if (NPC.ISWallArcher(contractID.getContractID())) {
mob = Mob.createMob( contractID.getMobbaseID(), NpcLoc, contractOwner.getGuild(), true, zone, building, contractID.getContractID());
if (mob == null)
return false;
mob.setRank(rank);
mob.setPlayerGuard(true);
mob.setParentZone(zone);
mob.BehaviourType = Enum.MobBehaviourType.GuardWallArcher;
return true;
}
npc = NPC.createNPC( pirateName, contractID.getObjectUUID(), NpcLoc, contractOwner.getGuild(), false, zone, (short) rank, false, building);
if (npc == null)

7
src/engine/gameManager/NPCManager.java

@ -319,8 +319,11 @@ public enum NPCManager { @@ -319,8 +319,11 @@ public enum NPCManager {
slot += guardCaptain.siegeMinionMap.size() + 1;
guardCaptain.siegeMinionMap.put(mob, slot);
mob.setInBuildingLoc(guardCaptain.building, guardCaptain);
mob.setBindLoc(loc.add(mob.inBuildingLoc));
//mob.setInBuildingLoc(guardCaptain.building, guardCaptain);
//mob.setBindLoc(loc.add(mob.inBuildingLoc));
mob.setLoc(guardCaptain.building.getLoc());
mob.setLastRegion(AbstractWorldObject.GetRegionByWorldObject(mob));
mob.setBindLoc(guardCaptain.building.getStuckLocation());
mob.deathTime = System.currentTimeMillis();
mob.spawnTime = 900;
mob.npcOwner = guardCaptain;

19
src/engine/objects/NPC.java

@ -295,6 +295,25 @@ public class NPC extends AbstractCharacter { @@ -295,6 +295,25 @@ public class NPC extends AbstractCharacter {
}
public static boolean ISWallArcher(int contractID) {
//838, 950, 1051, 1181, 1251, 1351, 1451, 1501, 1526, 1551, 980101,
switch(contractID) {
case 838:
case 950:
case 1051:
case 1181:
case 1251:
case 1351:
case 1451:
case 150:
case 1526:
case 1551:
case 980101:
return true;
}
return false;
}
//This method restarts an upgrade timer when a building is loaded from the database.
// Submit upgrade job for this building based upon it's current upgradeDateTime

Loading…
Cancel
Save