Browse Source

optimized slot for siege engines

mobile-class-refactor
FatBoy-DOTC 1 year ago
parent
commit
36cc23457a
  1. 9
      src/engine/gameManager/NPCManager.java
  2. 4
      src/engine/jobs/EndFearJob.java
  3. 1
      src/engine/objects/AbstractCharacter.java
  4. 8
      src/engine/objects/Mob.java
  5. 2
      src/engine/powers/poweractions/FearPowerAction.java

9
src/engine/gameManager/NPCManager.java

@ -341,9 +341,14 @@ public enum NPCManager {
if (abstractCharacter.building.getBlueprint() != null && abstractCharacter.building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL) && abstractCharacter.building.getRank() == 8) if (abstractCharacter.building.getBlueprint() != null && abstractCharacter.building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL) && abstractCharacter.building.getRank() == 8)
buildingSlot = BuildingManager.getLastAvailableSlot(abstractCharacter.building); buildingSlot = BuildingManager.getLastAvailableSlot(abstractCharacter.building);
else else {
if(abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob)abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) {
Mob mob = (Mob)abstractCharacter;
buildingSlot = mob.guardCaptain.siegeMinionMap.size() + 1;
}else {
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building); buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
}
}
if (buildingSlot == -1) if (buildingSlot == -1)
Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID()); Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());

4
src/engine/jobs/EndFearJob.java

@ -29,7 +29,7 @@ public class EndFearJob extends AbstractEffectJob {
if (this.target == null || (!(this.target instanceof Mob))) if (this.target == null || (!(this.target instanceof Mob)))
return; return;
((Mob) this.target).setFearedObject(null); ((Mob) this.target).fearedObject = null;
} }
@Override @Override
@ -40,6 +40,6 @@ public class EndFearJob extends AbstractEffectJob {
if (this.target == null || (!(this.target instanceof Mob))) if (this.target == null || (!(this.target instanceof Mob)))
return; return;
((Mob) this.target).setFearedObject(null); ((Mob) this.target).fearedObject = null;
} }
} }

1
src/engine/objects/AbstractCharacter.java

@ -120,6 +120,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
private float hateValue = 0; private float hateValue = 0;
private long lastHateUpdate = 0; private long lastHateUpdate = 0;
private byte aoecntr = 0; private byte aoecntr = 0;
public final ConcurrentHashMap<Mob, Integer> siegeMinionMap = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
public AbstractCharacter() { public AbstractCharacter() {
super(); super();

8
src/engine/objects/Mob.java

@ -48,7 +48,7 @@ public class Mob extends AbstractIntelligenceAgent {
private static int staticID = 0; private static int staticID = 0;
//mob specific //mob specific
public final ConcurrentHashMap<Integer, Boolean> playerAgroMap = new ConcurrentHashMap<>(); public final ConcurrentHashMap<Integer, Boolean> playerAgroMap = new ConcurrentHashMap<>();
public final ConcurrentHashMap<Mob, Integer> siegeMinionMap = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
public final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); public final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
public long nextCastTime = 0; public long nextCastTime = 0;
public long nextCallForHelp = 0; public long nextCallForHelp = 0;
@ -73,7 +73,7 @@ public class Mob extends AbstractIntelligenceAgent {
private int currentID; private int currentID;
private AbstractWorldObject fearedObject = null; public AbstractWorldObject fearedObject = null;
private long lastAttackTime = 0; private long lastAttackTime = 0;
private int lastMobPowerToken = 0; private int lastMobPowerToken = 0;
private HashMap<Integer, MobEquipment> equip = null; private HashMap<Integer, MobEquipment> equip = null;
@ -737,10 +737,6 @@ public class Mob extends AbstractIntelligenceAgent {
return this.guild.getObjectUUID(); return this.guild.getObjectUUID();
} }
public void setFearedObject(AbstractWorldObject awo) {
this.fearedObject = awo;
}
@Override @Override
public Vector3fImmutable getBindLoc() { public Vector3fImmutable getBindLoc() {

2
src/engine/powers/poweractions/FearPowerAction.java

@ -59,7 +59,7 @@ public class FearPowerAction extends AbstractPowerAction {
int duration = 10 + ((int) (trains * 0.5)); int duration = 10 + ((int) (trains * 0.5));
String stackType = ab.getStackType(); String stackType = ab.getStackType();
EndFearJob efj = new EndFearJob(source, awo, stackType, trains, ab, pb, null); EndFearJob efj = new EndFearJob(source, awo, stackType, trains, ab, pb, null);
((Mob) awo).setFearedObject(source); ((Mob) awo).fearedObject = source;
JobScheduler.getInstance().scheduleJob(efj, duration * 1000); JobScheduler.getInstance().scheduleJob(efj, duration * 1000);
} }

Loading…
Cancel
Save