Browse Source

treb fix

master
FatBoy-DOTC 2 years ago
parent
commit
11e373db6f
  1. 15
      src/engine/ai/MobileFSM.java
  2. 24
      src/engine/net/client/handlers/MinionTrainingMsgHandler.java
  3. 5
      src/engine/objects/Mob.java

15
src/engine/ai/MobileFSM.java

@ -69,7 +69,7 @@ public class MobileFSM {
mob.setCombatTarget(null); mob.setCombatTarget(null);
return; return;
} }
if (CombatUtilities.inRange2D(mob, target, mob.getRange())) { if (CombatUtilities.inRangeToAttack(mob,mob.getCombatTarget())) {
//no weapons, default mob attack speed 3 seconds. //no weapons, default mob attack speed 3 seconds.
if (System.currentTimeMillis() < mob.getLastAttackTime()) if (System.currentTimeMillis() < mob.getLastAttackTime())
return; return;
@ -171,6 +171,10 @@ public class MobileFSM {
if(mob.stopPatrolTime == 0) { if(mob.stopPatrolTime == 0) {
mob.stopPatrolTime = System.currentTimeMillis(); mob.stopPatrolTime = System.currentTimeMillis();
} }
if(mob.isMoving() == true){
mob.stopPatrolTime = System.currentTimeMillis();
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();
@ -299,17 +303,18 @@ 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.despawned || !mob.isAlive()) { if(mob.despawned == true || mob.isAlive() == false) {
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) { if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) {
if (mob.npcOwner.isAlive() == false || ((Mob) mob.npcOwner).despawned == true) { if (mob.npcOwner.isAlive() == false || ((Mob) mob.npcOwner).despawned == true) {
//minions don't respawn while guard captain is dead //minions don't respawn while guard captain is dead
mob.deathTime = System.currentTimeMillis(); mob.deathTime = System.currentTimeMillis();
return; return;
} }
}
CheckForRespawn(mob); CheckForRespawn(mob);
return; return;
} }
}
if (mob.playerAgroMap.isEmpty() && mob.isPlayerGuard == false) if (mob.playerAgroMap.isEmpty() && mob.isPlayerGuard == false)
//no players loaded, no need to proceed //no players loaded, no need to proceed
return; return;
@ -402,11 +407,7 @@ public class MobileFSM {
break; break;
default: default:
if (mob.getCombatTarget() == null) { if (mob.getCombatTarget() == null) {
if(!mob.isMoving()) {
Patrol(mob); Patrol(mob);
} else{
mob.stopPatrolTime = System.currentTimeMillis();
}
}else { }else {
chaseTarget(mob); chaseTarget(mob);
} }

24
src/engine/net/client/handlers/MinionTrainingMsgHandler.java

@ -4,10 +4,8 @@ import engine.Enum;
import engine.Enum.DispatchChannel; import engine.Enum.DispatchChannel;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.BuildingManager; import engine.gameManager.*;
import engine.gameManager.DbManager; import engine.math.Vector3fImmutable;
import engine.gameManager.NPCManager;
import engine.gameManager.SessionManager;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
@ -155,9 +153,20 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
// toCreate.despawn(); // toCreate.despawn();
if (toCreate != null) { if (toCreate != null) {
toCreate.setSpawnTime(60 * 15); //test timer for treb testing
toCreate.setTimeToSpawnSiege(System.currentTimeMillis() + (60 * 15 * 1000)); toCreate.setSpawnTime(10);
toCreate.setDeathTime(System.currentTimeMillis()); //toCreate.setSpawnTime(60 * 15);
//toCreate.setTimeToSpawnSiege(System.currentTimeMillis() + (60 * 15 * 1000));
Building building = BuildingManager.getBuilding(((MinionTrainingMessage) baseMsg).getBuildingID());
int slot = ((NPC)toCreate.npcOwner).getSiegeMinionMap().get(toCreate);
Vector3fImmutable slotLocation;
toCreate.building = building;
toCreate.parentZone = zone;
BuildingLocation buildingLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot);
slotLocation = building.getLoc().add(buildingLocation.getLocation());
toCreate.setBindLoc(slotLocation);
zone.zoneMobSet.add(toCreate);
MovementManager.translocate(toCreate,toCreate.getBindLoc(),toCreate.npcOwner.region);
} }
} }
@ -289,6 +298,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (toCreate != null) { if (toCreate != null) {
toCreate.setTimeToSpawnSiege(System.currentTimeMillis() + MBServerStatics.FIFTEEN_MINUTES); toCreate.setTimeToSpawnSiege(System.currentTimeMillis() + MBServerStatics.FIFTEEN_MINUTES);
toCreate.setDeathTime(System.currentTimeMillis()); toCreate.setDeathTime(System.currentTimeMillis());
toCreate.parentZone.zoneMobSet.add(toCreate);
} }
} }

5
src/engine/objects/Mob.java

@ -825,7 +825,7 @@ public class Mob extends AbstractIntelligenceAgent {
return null; return null;
mob = new Mob(minionMobBase, guild, parent, level, new Vector3fImmutable(1, 1, 1), 0, false); mob = new Mob(minionMobBase, guild, parent, level, new Vector3fImmutable(1, 1, 1), 0, false);
mob.runAfterLoad(); //mob.runAfterLoad();
mob.despawned = true; mob.despawned = true;
DbManager.addToCache(mob); DbManager.addToCache(mob);
@ -843,7 +843,6 @@ public class Mob extends AbstractIntelligenceAgent {
owner.getSiegeMinionMap().put(mob, slot); owner.getSiegeMinionMap().put(mob, slot);
mob.setSpawnTime(10);
mob.setNpcOwner(owner); mob.setNpcOwner(owner);
mob.BehaviourType = MobBehaviourType.Pet1; mob.BehaviourType = MobBehaviourType.Pet1;
mob.BehaviourType.canRoam = false; mob.BehaviourType.canRoam = false;
@ -1376,7 +1375,7 @@ 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);
this.setHealth(this.healthMax); this.setHealth(this.healthMax);
this.stamina.set(this.staminaMax); this.stamina.set(this.staminaMax);

Loading…
Cancel
Save