Browse Source

Auto-leveling camps

NovaTest
kevin 4 months ago
parent
commit
dd4f4bffe9
  1. 10
      src/engine/mobileAI/Threads/MobRespawnThread.java
  2. 4
      src/engine/objects/Zone.java
  3. 3
      src/engine/util/ZoneLevel.java

10
src/engine/mobileAI/Threads/MobRespawnThread.java

@ -11,6 +11,7 @@ package engine.mobileAI.Threads; @@ -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;
/**
@ -39,6 +40,15 @@ public class MobRespawnThread implements Runnable { @@ -39,6 +40,15 @@ public class MobRespawnThread implements Runnable {
try {
for (Zone zone : ZoneManager.getAllZones()) {
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);
}
if (zone.respawnQue.isEmpty() == false && zone.lastRespawn + 100 < System.currentTimeMillis()) {
Mob respawner = zone.respawnQue.iterator().next();

4
src/engine/objects/Zone.java

@ -116,6 +116,10 @@ public class Zone extends AbstractGameObject { @@ -116,6 +116,10 @@ public class Zone extends AbstractGameObject {
{
this.campLvl = ZoneLevel.campMaxLvl;
}
else if (this.campLvl < 0)
{
this.campLvl = 0;
}
if (this.campLvl > ZoneLevel.campLvlAnnounceThreshold)
{

3
src/engine/util/ZoneLevel.java

@ -13,6 +13,9 @@ public class ZoneLevel { @@ -13,6 +13,9 @@ public class ZoneLevel {
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;
private static final String[] nameMap =
{
"",

Loading…
Cancel
Save