Browse Source

make wall archers great again

master
FatBoy-DOTC 2 years ago
parent
commit
09d7ff0740
  1. 22
      src/engine/ai/MobileFSM.java
  2. 3
      src/engine/gameManager/BuildingManager.java
  3. 64
      src/engine/objects/Mob.java

22
src/engine/ai/MobileFSM.java

@ -352,6 +352,16 @@ public class MobileFSM {
if (mob == null) { if (mob == null) {
return; return;
} }
if(mob.despawned == true && mob.getMobBase().getLoadID() == 13171){
//trebuchet spawn handler
CheckForRespawn(mob);
return;
}
if(mob.despawned == true && mob.isPlayerGuard == true){
//override for guards
CheckForRespawn(mob);
return;
}
if (mob.isAlive() == false) { if (mob.isAlive() == false) {
//no need to continue if mob is dead, check for respawn and move on //no need to continue if mob is dead, check for respawn and move on
CheckForRespawn(mob); CheckForRespawn(mob);
@ -362,6 +372,7 @@ public class MobileFSM {
return; return;
} }
CheckToSendMobHome(mob); CheckToSendMobHome(mob);
mob.updateLocation();
switch(mob.BehaviourType){ switch(mob.BehaviourType){
case GuardCaptain: case GuardCaptain:
GuardCaptainLogic(mob); GuardCaptainLogic(mob);
@ -484,6 +495,16 @@ public class MobileFSM {
if (mob.isAlive() == false){ if (mob.isAlive() == false){
return; return;
} }
if(MovementUtilities.inRangeDropAggro(mob,(PlayerCharacter)mob.getCombatTarget()) == false){
mob.setCombatTarget(null);
if (mob.isCombat()) {
mob.setCombat(false);
UpdateStateMsg rwss = new UpdateStateMsg();
rwss.setPlayer(mob);
DispatchMessage.sendToAllInRange(mob, rwss);
}
return;
}
if (!mob.isCombat()) { if (!mob.isCombat()) {
mob.setCombat(true); mob.setCombat(true);
UpdateStateMsg rwss = new UpdateStateMsg(); UpdateStateMsg rwss = new UpdateStateMsg();
@ -580,6 +601,7 @@ public class MobileFSM {
if(mob.getCombatTarget() != null && mob.getCombatTarget().isAlive() == false){ if(mob.getCombatTarget() != null && mob.getCombatTarget().isAlive() == false){
mob.setCombatTarget(null); mob.setCombatTarget(null);
} }
if(MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam){ if(MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam){
CheckMobMovement(mob); CheckMobMovement(mob);
} }

3
src/engine/gameManager/BuildingManager.java

@ -477,7 +477,8 @@ public enum BuildingManager {
mob.setRank(rank); mob.setRank(rank);
mob.setPlayerGuard(true); mob.setPlayerGuard(true);
mob.setParentZone(zone); mob.BehaviourType = Enum.MobBehaviourType.GuardWallArcher;
MovementManager.translocate(mob,mob.getBindLoc(),mob.getRegion());
return true; return true;
} }
if (NPC.ISGuardCaptain(contractID.getContractID())) { if (NPC.ISGuardCaptain(contractID.getContractID())) {

64
src/engine/objects/Mob.java

@ -501,51 +501,6 @@ public class Mob extends AbstractIntelligenceAgent {
writer.putInt(objectType); writer.putInt(objectType);
writer.putInt(mob.currentID); writer.putInt(mob.currentID);
} }
/**
* Generate a random quantity of gold for this mob.
*
* @return Quantity of gold
*/
public static int randomGoldAmount(Mob mob) {
// percentage chance to drop gold
//R8 mobs have 100% gold drop.
if (mob.getLevel() < 80)
if ((ThreadLocalRandom.current().nextDouble() * 100d) > MBServerStatics.GOLD_DROP_PERCENTAGE_CHANCE)
return 0;
int level = mob.getLevel();
level = Math.max(level, 0);
level = Math.min(level, 50);
double minGold;
double maxGold;
if (mob.mobBase != null) {
minGold = mob.mobBase.getMinGold();
maxGold = mob.mobBase.getMaxGold();
} else {
minGold = MBServerStatics.GOLD_DROP_MINIMUM_PER_MOB_LEVEL[level];
maxGold = MBServerStatics.GOLD_DROP_MAXIMUM_PER_MOB_LEVEL[level];
}
double gold = (ThreadLocalRandom.current().nextDouble() * (maxGold - minGold) + minGold);
//server specific gold multiplier
gold *= Float.parseFloat(ConfigManager.MB_NORMAL_DROP_RATE.getValue());
//modify for hotzone
if (ZoneManager.inHotZone(mob.getLoc()))
gold *= Float.parseFloat(ConfigManager.MB_HOTZONE_DROP_RATE.getValue());
return (int) gold;
}
public static Mob createMob(int loadID, Vector3fImmutable spawn, Guild guild, boolean isMob, Zone parent, Building building, int contractID) { public static Mob createMob(int loadID, Vector3fImmutable spawn, Guild guild, boolean isMob, Zone parent, Building building, int contractID) {
Mob mobWithoutID = new Mob("", "", (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 1, 0, false, false, false, spawn, spawn, Vector3fImmutable.ZERO, (short) 1, (short) 1, (short) 1, guild, (byte) 0, loadID, isMob, parent, building, contractID); Mob mobWithoutID = new Mob("", "", (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 1, 0, false, false, false, spawn, spawn, Vector3fImmutable.ZERO, (short) 1, (short) 1, (short) 1, guild, (byte) 0, loadID, isMob, parent, building, contractID);
@ -561,10 +516,19 @@ public class Mob extends AbstractIntelligenceAgent {
mob.setObjectTypeMask(MBServerStatics.MASK_MOB | mob.getTypeMasks()); mob.setObjectTypeMask(MBServerStatics.MASK_MOB | mob.getTypeMasks());
mob.setMob(); mob.setMob();
mob.setParentZone(parent); mob.setParentZone(parent);
mob.setInBuildingLoc(building, mob);
Vector3fImmutable buildingWorldLoc = ZoneManager.convertLocalToWorld(building, mob.inBuildingLoc);
mob.setBindLoc(buildingWorldLoc);
mob.setLoc(buildingWorldLoc);
mob.region = AbstractWorldObject.GetRegionByWorldObject(mob);
MovementManager.translocate(mob,buildingWorldLoc,mob.region);
mob.nameOverride = NPC.getPirateName(mob.getMobBaseID()) + " the " + mob.getContract().getName();
mob.runAfterLoad();
} catch (Exception e) { } catch (Exception e) {
Logger.error("SQLException:" + e.getMessage()); Logger.error("SQLException:" + e.getMessage());
mob = null; mob = null;
} }
return mob; return mob;
} }
@ -853,7 +817,7 @@ public class Mob extends AbstractIntelligenceAgent {
this.endLoc = buildingWorldLoc; this.endLoc = buildingWorldLoc;
this.stopMovement(endLoc); this.stopMovement(endLoc);
if (this.building.getBlueprintUUID() != 0 && this.building.getBlueprint().isWallPiece()) if (this.building.getBlueprintUUID() != 0 && this.building.getBlueprint().isWallPiece() && this.contract == null)
MovementManager.translocate(this, new Vector3fImmutable(this.building.getLoc().x, this.npcOwner.getLoc().y, this.building.getLoc().z), this.region); MovementManager.translocate(this, new Vector3fImmutable(this.building.getLoc().x, this.npcOwner.getLoc().y, this.building.getLoc().z), this.region);
return; return;
@ -1646,9 +1610,11 @@ public class Mob extends AbstractIntelligenceAgent {
if (npc != null) { if (npc != null) {
if (npc.getSiegeMinionMap().containsKey(this)) putSlot = npc.getSiegeMinionMap().get(this); if (npc.getSiegeMinionMap().containsKey(this)) putSlot = npc.getSiegeMinionMap().get(this);
} else if (mob != null) } else if (mob != null) {
if (mob.getSiegeMinionMap().containsKey(this)) putSlot = mob.getSiegeMinionMap().get(this); //if (mob.getSiegeMinionMap().containsKey(this)) putSlot = mob.getSiegeMinionMap().get(this);
int hirelings = mob.building.getHirelings().size();
putSlot = hirelings;
}
int count = 0; int count = 0;
for (BuildingLocation slotLoc : buildingModel.getLocations()) for (BuildingLocation slotLoc : buildingModel.getLocations())

Loading…
Cancel
Save