diff --git a/src/engine/devcmd/cmds/SetCampLevelCmd.java b/src/engine/devcmd/cmds/SetCampLevelCmd.java index 22dab7fc..71902aa0 100644 --- a/src/engine/devcmd/cmds/SetCampLevelCmd.java +++ b/src/engine/devcmd/cmds/SetCampLevelCmd.java @@ -1,6 +1,7 @@ package engine.devcmd.cmds; import engine.devcmd.AbstractDevCmd; +import engine.gameManager.PowersManager; import engine.gameManager.ZoneManager; import engine.objects.*; @@ -15,42 +16,37 @@ public class SetCampLevelCmd extends AbstractDevCmd { this.sendUsage(pcSender); } - if (!(target instanceof Mob)) - { - throwbackError(pcSender, "Must target a MOB while setting camp level!"); - return; - } - - // 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; - } - int targetLevel = 0; - if (args.length == 1) - { - try - { + if (args.length == 1) { + try { targetLevel = Integer.parseInt(args[0]); - } - catch (NumberFormatException nfe) - { + } catch (NumberFormatException nfe) { throwbackError(pcSender, "Argument MUST be integer. Received: " + args[0]); - } - catch (Exception e) - { + } catch (Exception e) { throwbackError(pcSender, "Unknown command parsing provided camp level: " + args[0]); } } - campZone.setCampLvl(targetLevel); + 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 diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 1360ced2..0d238e26 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1401,7 +1401,7 @@ public class Mob extends AbstractIntelligenceAgent { // Set Name based on parent zone level Zone camp = this.getParentZone(); - this.lastName = this.originalLastName + ZoneLevel.GetNameSuffix(camp); + this.lastName = this.originalLastName + ZoneLevel.getNameSuffix(camp); this.recalculateStats(); this.setHealth(this.healthMax); @@ -1516,9 +1516,9 @@ public class Mob extends AbstractIntelligenceAgent { s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.None)); } - // Modify max health based on camp level - Zone camp = this.getParentZone(); - h = h * ZoneLevel.GetMaxHealthPctModifier(camp); + // 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 @@ -1620,6 +1620,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()); diff --git a/src/engine/objects/Zone.java b/src/engine/objects/Zone.java index 1410c0cd..a4c788d1 100644 --- a/src/engine/objects/Zone.java +++ b/src/engine/objects/Zone.java @@ -112,12 +112,12 @@ public class Zone extends AbstractGameObject { { this.campLvl = level; - if (this.campLvl > ZoneLevel.CampMaxLvl) + if (this.campLvl > ZoneLevel.campMaxLvl) { - this.campLvl = ZoneLevel.CampMaxLvl; + this.campLvl = ZoneLevel.campMaxLvl; } - if (this.campLvl > ZoneLevel.CampLvlAnnounceThreshold) + if (this.campLvl > ZoneLevel.campLvlAnnounceThreshold) { ChatSystemMsg chatMsg = new ChatSystemMsg(null, this.getName() + " has reached camp level " + this.campLvl + "! Will anyone contest?!"); chatMsg.setMessageType(2); diff --git a/src/engine/util/ZoneLevel.java b/src/engine/util/ZoneLevel.java index ccf27795..e2626a9e 100644 --- a/src/engine/util/ZoneLevel.java +++ b/src/engine/util/ZoneLevel.java @@ -2,8 +2,6 @@ package engine.util; import engine.objects.Zone; -import java.util.Dictionary; - public class ZoneLevel { private static final float healthPctPerLevel = (float)0.2; @@ -11,8 +9,8 @@ public class ZoneLevel { private static final float defPctPerLevel = (float)0.2; private static final float lootPctPerLevel = (float)0.1; - public static final int CampLvlAnnounceThreshold = 5; - public static final int CampMaxLvl = 10; + public static final int campLvlAnnounceThreshold = 5; + public static final int campMaxLvl = 10; private static final String[] nameMap = { @@ -29,7 +27,7 @@ public class ZoneLevel { " X" }; - public static String GetNameSuffix(Zone zone) + public static String getNameSuffix(Zone zone) { try { return nameMap[zone.getCamplvl()]; @@ -41,29 +39,29 @@ public class ZoneLevel { return ""; } - public static float GetMaxHealthPctModifier(Zone zone) + public static float getMaxHealthPctModifier(Zone zone) { - return GetGenericModifier(zone, healthPctPerLevel); + return getGenericModifier(zone, healthPctPerLevel); } - public static float GetAtrPctModifier(Zone zone) + public static float getAtrPctModifier(Zone zone) { - return GetGenericModifier(zone, atrPctPerLevel); + return getGenericModifier(zone, atrPctPerLevel); } - public static float GetDefPctModifier(Zone zone) + public static float getDefPctModifier(Zone zone) { - return GetGenericModifier(zone, defPctPerLevel); + return getGenericModifier(zone, defPctPerLevel); } - public static float GetLootDropModifier(Zone zone) + public static float getLootDropModifier(Zone zone) { - return GetGenericModifier(zone, lootPctPerLevel); + return getGenericModifier(zone, lootPctPerLevel); } - private static float GetGenericModifier(Zone zone, float modifierPerLevel) + private static float getGenericModifier(Zone zone, float modifierPerLevel) { float modifier = (float)1.0;