Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 96387aa4f4 | |||
| 785a5eb736 | |||
| dd4f4bffe9 | |||
| 2cdeaa4d66 | |||
| 0430fb3e42 | |||
| 5c34853293 | |||
| d991a4f2d8 | |||
| d87d3e2f41 | |||
| edf11f166f | |||
| e5c1dc7bcb | |||
| 9542034e32 | |||
| 3649c629b7 | |||
| 1c31070fc8 | |||
| bff41967db | |||
| d3692d0fb7 | |||
| 074a799d01 | |||
| 36ffd08a72 | |||
| 58f828b3cd |
@@ -0,0 +1,61 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.*;
|
||||
|
||||
public class SetCampLevelCmd extends AbstractDevCmd {
|
||||
public SetCampLevelCmd() { super("setcamplevel"); }
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] args, AbstractGameObject target) {
|
||||
|
||||
if (args.length > 1)
|
||||
{
|
||||
this.sendUsage(pcSender);
|
||||
}
|
||||
|
||||
int targetLevel = 0;
|
||||
if (args.length == 1) {
|
||||
try {
|
||||
targetLevel = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throwbackError(pcSender, "Argument MUST be integer. Received: " + args[0]);
|
||||
} catch (Exception e) {
|
||||
throwbackError(pcSender, "Unknown command parsing provided camp level: " + args[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if ((target instanceof Mob))
|
||||
{
|
||||
// Get the camp that owns the targeted Mob
|
||||
Zone campZone = ((Mob) target).parentZone;
|
||||
|
||||
// Make sure that the zone we're targeting is valid for action
|
||||
if (campZone == null ||
|
||||
campZone.zoneMobSet.isEmpty() ||
|
||||
campZone.isPlayerCity()) {
|
||||
throwbackError(pcSender, "Current zone must own mobs, and NOT be a city.");
|
||||
return;
|
||||
}
|
||||
|
||||
campZone.setCampLvl(targetLevel);
|
||||
}
|
||||
else if (target instanceof PlayerCharacter)
|
||||
{
|
||||
PlayerCharacter pc = (PlayerCharacter)target;
|
||||
PowersManager.applyPower(pc, pc, pc.getLoc(), "CMP-001", targetLevel, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "Sets the level of the currently occupied camp to the desired level";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "'./setcamplevel levelNum'";
|
||||
}
|
||||
}
|
||||
@@ -143,6 +143,7 @@ public enum DevCmdManager {
|
||||
DevCmdManager.registerDevCmd(new ApplyBonusCmd());
|
||||
DevCmdManager.registerDevCmd(new AuditFailedItemsCmd());
|
||||
DevCmdManager.registerDevCmd(new SlotTestCmd());
|
||||
DevCmdManager.registerDevCmd(new SetCampLevelCmd());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.*;
|
||||
import engine.util.ZoneLevel;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -100,6 +101,16 @@ public enum LootManager {
|
||||
boolean hotzoneWasRan = false;
|
||||
float dropRate = 1.0f;
|
||||
|
||||
if (mob.getSafeZone() == false)
|
||||
dropRate = LootManager.NORMAL_DROP_RATE;
|
||||
|
||||
if (inHotzone == true)
|
||||
dropRate = LootManager.HOTZONE_DROP_RATE;
|
||||
|
||||
// Adjust for camp scaling
|
||||
Zone camp = mob.getParentZone();
|
||||
dropRate = dropRate * ZoneLevel.getLootDropModifier(camp);
|
||||
|
||||
// Iterate all entries in this bootySet and process accordingly
|
||||
|
||||
for (BootySetEntry bse : entries) {
|
||||
@@ -109,12 +120,6 @@ public enum LootManager {
|
||||
break;
|
||||
case "LOOT":
|
||||
|
||||
if (mob.getSafeZone() == false)
|
||||
dropRate = LootManager.NORMAL_DROP_RATE;
|
||||
|
||||
if (inHotzone == true)
|
||||
dropRate = LootManager.HOTZONE_DROP_RATE;
|
||||
|
||||
if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate))
|
||||
GenerateLootDrop(mob, bse.genTable, false); //generate normal loot drop
|
||||
|
||||
@@ -196,6 +201,9 @@ public enum LootManager {
|
||||
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// We don't want to bother with identifying gear
|
||||
outItem.setIsID(true);
|
||||
return outItem;
|
||||
}
|
||||
|
||||
@@ -306,6 +314,9 @@ public enum LootManager {
|
||||
else
|
||||
gold = (int) (gold * NORMAL_GOLD_RATE);
|
||||
|
||||
Zone camp = mob.getParentZone();
|
||||
gold = (int) (gold * ZoneLevel.getGoldDropModifier(camp));
|
||||
|
||||
if (gold > 0) {
|
||||
MobLoot goldAmount = new MobLoot(mob, gold);
|
||||
mob.getCharItemManager().addItemToInventory(goldAmount);
|
||||
|
||||
@@ -693,6 +693,8 @@ public class MobAI {
|
||||
DefaultLogic(mob);
|
||||
break;
|
||||
}
|
||||
if(mob.isAlive())
|
||||
RecoverHealth(mob);
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage());
|
||||
}
|
||||
@@ -808,7 +810,7 @@ public class MobAI {
|
||||
chaseTarget(mob);
|
||||
break;
|
||||
case GuardMinion:
|
||||
if (!mob.npcOwner.isAlive() || ((Mob) mob.npcOwner).despawned)
|
||||
if (!mob.npcOwner.isAlive() && mob.getCombatTarget() == null)
|
||||
randomGuardPatrolPoint(mob);
|
||||
else {
|
||||
if (mob.getCombatTarget() != null) {
|
||||
@@ -827,6 +829,7 @@ public class MobAI {
|
||||
chaseTarget(mob);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
|
||||
@@ -1043,7 +1046,6 @@ public class MobAI {
|
||||
mob.setCombatTarget(newTarget);
|
||||
|
||||
}
|
||||
|
||||
CheckMobMovement(mob);
|
||||
CheckForAttack(mob);
|
||||
} catch (Exception e) {
|
||||
@@ -1054,24 +1056,9 @@ public class MobAI {
|
||||
public static void GuardMinionLogic(Mob mob) {
|
||||
|
||||
try {
|
||||
if (!mob.npcOwner.isAlive()) {
|
||||
|
||||
if (mob.getCombatTarget() == null) {
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
} else {
|
||||
|
||||
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
|
||||
|
||||
if (newTarget != null) {
|
||||
|
||||
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
if (GuardCanAggro(mob, (PlayerCharacter) newTarget))
|
||||
mob.setCombatTarget(newTarget);
|
||||
} else
|
||||
mob.setCombatTarget(newTarget);
|
||||
|
||||
}
|
||||
}
|
||||
boolean isComanded = mob.npcOwner.isAlive();
|
||||
if (!isComanded) {
|
||||
GuardCaptainLogic(mob);
|
||||
}else {
|
||||
if (mob.npcOwner.getCombatTarget() != null)
|
||||
mob.setCombatTarget(mob.npcOwner.getCombatTarget());
|
||||
@@ -1110,22 +1097,6 @@ public class MobAI {
|
||||
CheckMobMovement(mob);
|
||||
|
||||
CheckForAttack(mob);
|
||||
|
||||
//recover health
|
||||
|
||||
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||
|
||||
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
||||
if (mob.getHealth() < mob.getHealthMax()) {
|
||||
|
||||
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
|
||||
mob.setHealth(mob.getHealth() + recoveredHealth);
|
||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||
|
||||
if (mob.getHealth() > mob.getHealthMax())
|
||||
mob.setHealth(mob.getHealthMax());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage());
|
||||
}
|
||||
@@ -1379,4 +1350,22 @@ public class MobAI {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void RecoverHealth(Mob mob){
|
||||
//recover health
|
||||
|
||||
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||
|
||||
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
||||
if (mob.getHealth() < mob.getHealthMax()) {
|
||||
|
||||
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
|
||||
mob.setHealth(mob.getHealth() + recoveredHealth);
|
||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||
|
||||
if (mob.getHealth() > mob.getHealthMax())
|
||||
mob.setHealth(mob.getHealthMax());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ package engine.mobileAI.Threads;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.Zone;
|
||||
import engine.util.ZoneLevel;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
/**
|
||||
@@ -25,7 +26,6 @@ import org.pmw.tinylog.Logger;
|
||||
|
||||
public class MobRespawnThread implements Runnable {
|
||||
|
||||
|
||||
public MobRespawnThread() {
|
||||
Logger.info(" MobRespawnThread thread has started!");
|
||||
|
||||
@@ -34,23 +34,85 @@ public class MobRespawnThread implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
long rollingKeepFraction = (Zone.rollingAvgMobsAliveDepth - 1) / Zone.rollingAvgMobsAliveDepth;
|
||||
long rollingAddFraction = 1 / Zone.rollingAvgMobsAliveDepth;
|
||||
|
||||
while (true) {
|
||||
|
||||
try {
|
||||
|
||||
for (Zone zone : ZoneManager.getAllZones()) {
|
||||
|
||||
if (zone.respawnQue.isEmpty() == false && zone.lastRespawn + 100 < System.currentTimeMillis()) {
|
||||
|
||||
Mob respawner = zone.respawnQue.iterator().next();
|
||||
|
||||
if (respawner == null)
|
||||
continue;
|
||||
|
||||
respawner.respawn();
|
||||
zone.respawnQue.remove(respawner);
|
||||
zone.lastRespawn = System.currentTimeMillis();
|
||||
/*
|
||||
if (zone.respawnQue.size() > ZoneLevel.queueLengthToLevelUp) {
|
||||
zone.setCampLvl(zone.getCamplvl() + 1);
|
||||
}
|
||||
else if (zone.respawnQue.isEmpty() &&
|
||||
(zone.lastRespawn + ZoneLevel.msToLevelDown < System.currentTimeMillis()) &&
|
||||
zone.getCamplvl() > 0) {
|
||||
zone.setCampLvl(zone.getCamplvl() - 1);
|
||||
}
|
||||
*/
|
||||
|
||||
int aliveCount = 0;
|
||||
int deadCount = 0;
|
||||
for (Mob mob : zone.zoneMobSet) {
|
||||
if (mob.isAlive()) {
|
||||
aliveCount = aliveCount + 1;
|
||||
}
|
||||
else {
|
||||
deadCount = deadCount + 1;
|
||||
}
|
||||
}
|
||||
|
||||
zone.rollingAvgMobsAlive =
|
||||
((zone.rollingAvgMobsAlive * (Zone.rollingAvgMobsAliveDepth - 1) + aliveCount) / Zone.rollingAvgMobsAliveDepth);
|
||||
|
||||
/*
|
||||
if (startTime + ZoneLevel.msDelayToCampLevel < System.currentTimeMillis()) {
|
||||
if (aliveCount > Math.floor(zone.zoneMobSet.size() / 2.0)) {
|
||||
if (zone.levelUpTimer == 0) {
|
||||
zone.levelUpTimer = System.currentTimeMillis();
|
||||
} else if (zone.levelUpTimer + ZoneLevel.msTolevelUp < System.currentTimeMillis()) {
|
||||
zone.setCampLvl(zone.getCampLvl() + 1);
|
||||
|
||||
zone.levelUpTimer = 0;
|
||||
}
|
||||
} else if (aliveCount == 0) {
|
||||
|
||||
if (zone.levelDownTimer == 0) {
|
||||
zone.levelDownTimer = System.currentTimeMillis();
|
||||
} else if (zone.levelDownTimer + ZoneLevel.msToLevelDown < System.currentTimeMillis()) {
|
||||
if (zone.getCampLvl() > 0) {
|
||||
zone.setCampLvl(zone.getCampLvl() + 1);
|
||||
|
||||
zone.levelDownTimer = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
zone.levelUpTimer = 0;
|
||||
zone.levelDownTimer = 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Manage mob respawn
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
if (!Zone.respawnQue.isEmpty() && Zone.lastRespawn + 100 < System.currentTimeMillis()) {
|
||||
|
||||
Mob respawner = Zone.respawnQue.iterator().next();
|
||||
|
||||
if (respawner == null)
|
||||
continue;
|
||||
|
||||
respawner.respawn();
|
||||
Zone.respawnQue.remove(respawner);
|
||||
Zone.lastRespawn = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import engine.net.client.msg.PlaceAssetMsg;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.MobPowerEntry;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.ZoneLevel;
|
||||
import org.joda.time.DateTime;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -101,6 +102,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
private DateTime upgradeDateTime = null;
|
||||
private boolean lootSync = false;
|
||||
|
||||
private String originalFirstName;
|
||||
private String originalLastName;
|
||||
|
||||
/**
|
||||
* No Id Constructor
|
||||
@@ -129,6 +132,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.lastName = "the " + contract.getName();
|
||||
}
|
||||
clearStatic();
|
||||
|
||||
originalFirstName = this.firstName;
|
||||
originalLastName = this.lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,6 +156,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.building = building;
|
||||
initializeMob(false, false, false);
|
||||
clearStatic();
|
||||
|
||||
originalFirstName = this.firstName;
|
||||
originalLastName = this.lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,6 +175,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.BehaviourType = Enum.MobBehaviourType.Pet1;
|
||||
initializeMob(true, false, false);
|
||||
clearStatic();
|
||||
|
||||
originalFirstName = this.firstName;
|
||||
originalLastName = this.lastName;
|
||||
}
|
||||
|
||||
//SIEGE CONSTRUCTOR
|
||||
@@ -180,6 +192,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.equip = new HashMap<>();
|
||||
initializeMob(false, true, isPlayerGuard);
|
||||
clearStatic();
|
||||
|
||||
originalFirstName = this.firstName;
|
||||
originalLastName = this.lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -288,6 +303,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
Logger.error("Mobile:" + this.dbID + ": " + e);
|
||||
}
|
||||
|
||||
originalFirstName = this.firstName;
|
||||
originalLastName = this.lastName;
|
||||
}
|
||||
|
||||
public static void serializeMobForClientMsgOtherPlayer(Mob mob, ByteBufferWriter writer) throws SerializationException {
|
||||
@@ -1382,6 +1399,12 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
|
||||
NPCManager.applyRuneSetEffects(this);
|
||||
|
||||
// Set Name based on parent zone level
|
||||
Zone camp = this.getParentZone();
|
||||
this.lastName = this.originalLastName + ZoneLevel.getNameSuffix(camp);
|
||||
|
||||
//PowersManager.applyPower(this, this, this.getLoc(), "CMP-001", camp.getCamplvl(), false);
|
||||
|
||||
this.recalculateStats();
|
||||
this.setHealth(this.healthMax);
|
||||
|
||||
@@ -1495,6 +1518,10 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.None));
|
||||
}
|
||||
|
||||
// Modify max health based on camp level - bad, we need to use effects for this
|
||||
Zone camp = this.getParentZone();
|
||||
h = h * ZoneLevel.getMaxHealthPctModifier(camp);
|
||||
|
||||
// Set max health, mana and stamina
|
||||
|
||||
if (h > 0)
|
||||
@@ -1595,6 +1622,11 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
Logger.error("Error: missing bonuses");
|
||||
|
||||
defense = (defense < 1) ? 1 : defense;
|
||||
|
||||
// Modify defense for camp level - bad, we need to use effects for this
|
||||
Zone camp = this.getParentZone();
|
||||
defense = defense * ZoneLevel.getDefPctModifier(camp);
|
||||
|
||||
this.defenseRating = (short) (defense + 0.5f);
|
||||
} catch (Exception e) {
|
||||
Logger.info("Mobbase ID " + this.getMobBaseID() + " returned an error. Setting to Default Defense." + e.getMessage());
|
||||
@@ -1796,6 +1828,10 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
atr *= (1 + neg_Bonus);
|
||||
}
|
||||
|
||||
// Modify atr for camp level - bad, we need to use effects for this
|
||||
Zone camp = this.getParentZone();
|
||||
atr = atr * ZoneLevel.getAtrPctModifier(camp);
|
||||
|
||||
atr = (atr < 1) ? 1 : atr;
|
||||
|
||||
// set atr
|
||||
|
||||
@@ -18,7 +18,10 @@ import engine.math.Bounds;
|
||||
import engine.math.Vector2f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.ZoneLevel;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
@@ -61,6 +64,13 @@ public class Zone extends AbstractGameObject {
|
||||
//public static ArrayList<Mob> respawnQue = new ArrayList<>();
|
||||
public static final Set<Mob> respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
public static long lastRespawn = 0;
|
||||
|
||||
private int campLvl = 0;
|
||||
public long levelUpTimer = 0;
|
||||
public long levelDownTimer = 0;
|
||||
public int rollingAvgMobsAlive = 0;
|
||||
public static final int rollingAvgMobsAliveDepth = 100;
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
@@ -100,8 +110,33 @@ public class Zone extends AbstractGameObject {
|
||||
|
||||
if (hash == null)
|
||||
setHash();
|
||||
}
|
||||
|
||||
public void setCampLvl(int level)
|
||||
{
|
||||
this.campLvl = level;
|
||||
|
||||
if (this.campLvl > ZoneLevel.campMaxLvl)
|
||||
{
|
||||
this.campLvl = ZoneLevel.campMaxLvl;
|
||||
}
|
||||
else if (this.campLvl < 0)
|
||||
{
|
||||
this.campLvl = 0;
|
||||
}
|
||||
|
||||
//if (this.campLvl > ZoneLevel.campLvlAnnounceThreshold)
|
||||
{
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, this.getName() + " has reached camp level " + this.campLvl + "! Will anyone contest?!");
|
||||
chatMsg.setMessageType(2);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
}
|
||||
}
|
||||
|
||||
public int getCampLvl()
|
||||
{
|
||||
return this.campLvl;
|
||||
}
|
||||
|
||||
public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) {
|
||||
|
||||
@@ -288,6 +288,7 @@ public class WorldServer {
|
||||
|
||||
private boolean init() {
|
||||
|
||||
Logger.info("Server Code: [NovaTest] Branch");
|
||||
Logger.info("MAGICBANE SERVER GREETING:");
|
||||
Logger.info(ConfigManager.MB_WORLD_GREETING.getValue());
|
||||
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package engine.util;
|
||||
|
||||
import engine.objects.Zone;
|
||||
|
||||
public class ZoneLevel {
|
||||
|
||||
private static final float healthPctPerLevel = (float)0.2;
|
||||
private static final float atrPctPerLevel = (float)0.2;
|
||||
private static final float defPctPerLevel = (float)0.2;
|
||||
private static final float lootPctPerLevel = (float)0.1;
|
||||
private static final float goldPctPerLevel = (float)0.2;
|
||||
|
||||
public static final int campLvlAnnounceThreshold = 5;
|
||||
public static final int campMaxLvl = 10;
|
||||
|
||||
public static final int queueLengthToLevelUp = 5;
|
||||
public static final int msToLevelDown = 60 * 1000;
|
||||
public static final int msTolevelUp = 60 * 1000;
|
||||
public static final long msDelayToCampLevel = 60 * 1000;
|
||||
|
||||
private static final String[] nameMap =
|
||||
{
|
||||
"",
|
||||
" I",
|
||||
" II",
|
||||
" III",
|
||||
" IV",
|
||||
" V",
|
||||
" VI",
|
||||
" VII",
|
||||
" VIII",
|
||||
" IX",
|
||||
" X"
|
||||
};
|
||||
|
||||
public static String getNameSuffix(Zone zone)
|
||||
{
|
||||
try {
|
||||
return nameMap[zone.getCampLvl()];
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static float getMaxHealthPctModifier(Zone zone)
|
||||
{
|
||||
return getGenericModifier(zone, healthPctPerLevel);
|
||||
}
|
||||
|
||||
public static float getAtrPctModifier(Zone zone)
|
||||
{
|
||||
return getGenericModifier(zone, atrPctPerLevel);
|
||||
}
|
||||
|
||||
public static float getDefPctModifier(Zone zone)
|
||||
{
|
||||
return getGenericModifier(zone, defPctPerLevel);
|
||||
}
|
||||
|
||||
public static float getLootDropModifier(Zone zone)
|
||||
{
|
||||
return getGenericModifier(zone, lootPctPerLevel);
|
||||
}
|
||||
|
||||
public static float getGoldDropModifier(Zone zone)
|
||||
{
|
||||
return getGenericModifier(zone, goldPctPerLevel);
|
||||
}
|
||||
|
||||
private static float getGenericModifier(Zone zone, float modifierPerLevel)
|
||||
{
|
||||
float modifier = (float)1.0;
|
||||
|
||||
if (zone != null)
|
||||
{
|
||||
modifier += zone.getCampLvl() * modifierPerLevel;
|
||||
}
|
||||
|
||||
return modifier;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user