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

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

@ -4,10 +4,8 @@ import engine.Enum; @@ -4,10 +4,8 @@ import engine.Enum;
import engine.Enum.DispatchChannel;
import engine.InterestManagement.WorldGrid;
import engine.exception.MsgSendException;
import engine.gameManager.BuildingManager;
import engine.gameManager.DbManager;
import engine.gameManager.NPCManager;
import engine.gameManager.SessionManager;
import engine.gameManager.*;
import engine.math.Vector3fImmutable;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
@ -155,9 +153,20 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler { @@ -155,9 +153,20 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
// toCreate.despawn();
if (toCreate != null) {
toCreate.setSpawnTime(60 * 15);
toCreate.setTimeToSpawnSiege(System.currentTimeMillis() + (60 * 15 * 1000));
toCreate.setDeathTime(System.currentTimeMillis());
//test timer for treb testing
toCreate.setSpawnTime(10);
//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 { @@ -289,6 +298,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (toCreate != null) {
toCreate.setTimeToSpawnSiege(System.currentTimeMillis() + MBServerStatics.FIFTEEN_MINUTES);
toCreate.setDeathTime(System.currentTimeMillis());
toCreate.parentZone.zoneMobSet.add(toCreate);
}
}

5
src/engine/objects/Mob.java

@ -825,7 +825,7 @@ public class Mob extends AbstractIntelligenceAgent { @@ -825,7 +825,7 @@ public class Mob extends AbstractIntelligenceAgent {
return null;
mob = new Mob(minionMobBase, guild, parent, level, new Vector3fImmutable(1, 1, 1), 0, false);
mob.runAfterLoad();
//mob.runAfterLoad();
mob.despawned = true;
DbManager.addToCache(mob);
@ -843,7 +843,6 @@ public class Mob extends AbstractIntelligenceAgent { @@ -843,7 +843,6 @@ public class Mob extends AbstractIntelligenceAgent {
owner.getSiegeMinionMap().put(mob, slot);
mob.setSpawnTime(10);
mob.setNpcOwner(owner);
mob.BehaviourType = MobBehaviourType.Pet1;
mob.BehaviourType.canRoam = false;
@ -1376,7 +1375,7 @@ public class Mob extends AbstractIntelligenceAgent { @@ -1376,7 +1375,7 @@ public class Mob extends AbstractIntelligenceAgent {
public void respawn() {
//Commenting out Mob ID rotation.
this.despawned = false;
this.playerAgroMap.clear();
//this.playerAgroMap.clear();
this.setCombatTarget(null);
this.setHealth(this.healthMax);
this.stamina.set(this.staminaMax);

Loading…
Cancel
Save