forked from MagicBane/Server
Gave Wall Archers mob AI
This commit is contained in:
@@ -2824,6 +2824,7 @@ public class Enum {
|
|||||||
None(null, false, false, false, false, false),
|
None(null, false, false, false, false, false),
|
||||||
GuardCaptain(null, false, true, true, true, false),
|
GuardCaptain(null, false, true, true, true, false),
|
||||||
GuardMinion(GuardCaptain, false, true, true, false, true),
|
GuardMinion(GuardCaptain, false, true, true, false, true),
|
||||||
|
GuardWallArcher(null, false, true, false, false, false),
|
||||||
Wanderer(null, false, false, false, false, false),
|
Wanderer(null, false, false, false, false, false),
|
||||||
HamletGuard(null, false, false, false, false, false),
|
HamletGuard(null, false, false, false, false, false),
|
||||||
AggroWanderer(null, false, false, false, false, false);
|
AggroWanderer(null, false, false, false, false, false);
|
||||||
|
|||||||
@@ -502,7 +502,17 @@ public class MobileFSM {
|
|||||||
}
|
}
|
||||||
if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()){
|
if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()){
|
||||||
//this is a player slotted guard minion
|
//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);
|
CheckForRespawn(mob);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -663,11 +673,16 @@ public class MobileFSM {
|
|||||||
mobAttack(mob);
|
mobAttack(mob);
|
||||||
}
|
}
|
||||||
private static void CheckToSendMobHome(Mob 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);
|
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||||
mob.setAggroTargetID(0);
|
mob.setAggroTargetID(0);
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (mob.getLoc().distanceSquared2D(mob.getBindLoc()) > sqr(2000)) {
|
if (mob.getLoc().distanceSquared2D(mob.getBindLoc()) > sqr(2000)) {
|
||||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||||
|
|||||||
@@ -481,6 +481,19 @@ public enum BuildingManager {
|
|||||||
mob.setParentZone(zone);
|
mob.setParentZone(zone);
|
||||||
return true;
|
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);
|
npc = NPC.createNPC( pirateName, contractID.getObjectUUID(), NpcLoc, contractOwner.getGuild(), false, zone, (short) rank, false, building);
|
||||||
|
|
||||||
if (npc == null)
|
if (npc == null)
|
||||||
|
|||||||
@@ -319,8 +319,11 @@ public enum NPCManager {
|
|||||||
slot += guardCaptain.siegeMinionMap.size() + 1;
|
slot += guardCaptain.siegeMinionMap.size() + 1;
|
||||||
|
|
||||||
guardCaptain.siegeMinionMap.put(mob, slot);
|
guardCaptain.siegeMinionMap.put(mob, slot);
|
||||||
mob.setInBuildingLoc(guardCaptain.building, guardCaptain);
|
//mob.setInBuildingLoc(guardCaptain.building, guardCaptain);
|
||||||
mob.setBindLoc(loc.add(mob.inBuildingLoc));
|
//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.deathTime = System.currentTimeMillis();
|
||||||
mob.spawnTime = 900;
|
mob.spawnTime = 900;
|
||||||
mob.npcOwner = guardCaptain;
|
mob.npcOwner = guardCaptain;
|
||||||
|
|||||||
@@ -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.
|
//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
|
// Submit upgrade job for this building based upon it's current upgradeDateTime
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user