Compare commits
15 Commits
Author | SHA1 | Date |
---|---|---|
kevin | f5bbc9eee0 | 2 months ago |
kevin | 4092f7f38f | 2 months ago |
kevin | a4eea2173d | 2 months ago |
kevin | d193a12554 | 2 months ago |
kevin | 96387aa4f4 | 3 months ago |
kevin | 785a5eb736 | 3 months ago |
kevin | dd4f4bffe9 | 3 months ago |
kevin | 2cdeaa4d66 | 3 months ago |
kevin | 0430fb3e42 | 3 months ago |
kevin | 5c34853293 | 3 months ago |
kevin | d991a4f2d8 | 3 months ago |
kevin | d87d3e2f41 | 3 months ago |
kevin | edf11f166f | 3 months ago |
kevin | e5c1dc7bcb | 3 months ago |
kevin | 9542034e32 | 3 months ago |
10 changed files with 321 additions and 19 deletions
@ -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'"; |
||||||
|
} |
||||||
|
} |
@ -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; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue