Browse Source

Moved scaling to a new power

NovaTest
kevin 3 months ago
parent
commit
5c34853293
  1. 54
      src/engine/devcmd/cmds/SetCampLevelCmd.java
  2. 13
      src/engine/objects/Mob.java
  3. 6
      src/engine/objects/Zone.java
  4. 26
      src/engine/util/ZoneLevel.java

54
src/engine/devcmd/cmds/SetCampLevelCmd.java

@ -1,6 +1,7 @@ @@ -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 { @@ -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

13
src/engine/objects/Mob.java

@ -1401,7 +1401,7 @@ public class Mob extends AbstractIntelligenceAgent { @@ -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 { @@ -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 { @@ -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());

6
src/engine/objects/Zone.java

@ -112,12 +112,12 @@ public class Zone extends AbstractGameObject { @@ -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);

26
src/engine/util/ZoneLevel.java

@ -2,8 +2,6 @@ package engine.util; @@ -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 { @@ -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 { @@ -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 { @@ -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;

Loading…
Cancel
Save