forked from MagicBane/Server
Moved scaling to a new power
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.PowersManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
@@ -15,42 +16,37 @@ public class SetCampLevelCmd extends AbstractDevCmd {
|
|||||||
this.sendUsage(pcSender);
|
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;
|
int targetLevel = 0;
|
||||||
if (args.length == 1)
|
if (args.length == 1) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
targetLevel = Integer.parseInt(args[0]);
|
targetLevel = Integer.parseInt(args[0]);
|
||||||
}
|
} catch (NumberFormatException nfe) {
|
||||||
catch (NumberFormatException nfe)
|
|
||||||
{
|
|
||||||
throwbackError(pcSender, "Argument MUST be integer. Received: " + args[0]);
|
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]);
|
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
|
@Override
|
||||||
|
|||||||
@@ -1401,7 +1401,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
|
|
||||||
// Set Name based on parent zone level
|
// Set Name based on parent zone level
|
||||||
Zone camp = this.getParentZone();
|
Zone camp = this.getParentZone();
|
||||||
this.lastName = this.originalLastName + ZoneLevel.GetNameSuffix(camp);
|
this.lastName = this.originalLastName + ZoneLevel.getNameSuffix(camp);
|
||||||
|
|
||||||
this.recalculateStats();
|
this.recalculateStats();
|
||||||
this.setHealth(this.healthMax);
|
this.setHealth(this.healthMax);
|
||||||
@@ -1516,9 +1516,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.None));
|
s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.None));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify max health based on camp level
|
// Modify max health based on camp level - bad, we need to use effects for this
|
||||||
Zone camp = this.getParentZone();
|
//Zone camp = this.getParentZone();
|
||||||
h = h * ZoneLevel.GetMaxHealthPctModifier(camp);
|
//h = h * ZoneLevel.getMaxHealthPctModifier(camp);
|
||||||
|
|
||||||
// Set max health, mana and stamina
|
// Set max health, mana and stamina
|
||||||
|
|
||||||
@@ -1620,6 +1620,11 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
Logger.error("Error: missing bonuses");
|
Logger.error("Error: missing bonuses");
|
||||||
|
|
||||||
defense = (defense < 1) ? 1 : defense;
|
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);
|
this.defenseRating = (short) (defense + 0.5f);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info("Mobbase ID " + this.getMobBaseID() + " returned an error. Setting to Default Defense." + e.getMessage());
|
Logger.info("Mobbase ID " + this.getMobBaseID() + " returned an error. Setting to Default Defense." + e.getMessage());
|
||||||
|
|||||||
@@ -112,12 +112,12 @@ public class Zone extends AbstractGameObject {
|
|||||||
{
|
{
|
||||||
this.campLvl = level;
|
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?!");
|
ChatSystemMsg chatMsg = new ChatSystemMsg(null, this.getName() + " has reached camp level " + this.campLvl + "! Will anyone contest?!");
|
||||||
chatMsg.setMessageType(2);
|
chatMsg.setMessageType(2);
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package engine.util;
|
|||||||
|
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
|
|
||||||
import java.util.Dictionary;
|
|
||||||
|
|
||||||
public class ZoneLevel {
|
public class ZoneLevel {
|
||||||
|
|
||||||
private static final float healthPctPerLevel = (float)0.2;
|
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 defPctPerLevel = (float)0.2;
|
||||||
private static final float lootPctPerLevel = (float)0.1;
|
private static final float lootPctPerLevel = (float)0.1;
|
||||||
|
|
||||||
public static final int CampLvlAnnounceThreshold = 5;
|
public static final int campLvlAnnounceThreshold = 5;
|
||||||
public static final int CampMaxLvl = 10;
|
public static final int campMaxLvl = 10;
|
||||||
|
|
||||||
private static final String[] nameMap =
|
private static final String[] nameMap =
|
||||||
{
|
{
|
||||||
@@ -29,7 +27,7 @@ public class ZoneLevel {
|
|||||||
" X"
|
" X"
|
||||||
};
|
};
|
||||||
|
|
||||||
public static String GetNameSuffix(Zone zone)
|
public static String getNameSuffix(Zone zone)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return nameMap[zone.getCamplvl()];
|
return nameMap[zone.getCamplvl()];
|
||||||
@@ -41,29 +39,29 @@ public class ZoneLevel {
|
|||||||
return "";
|
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;
|
float modifier = (float)1.0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user