Moved scaling to a new power

This commit is contained in:
2024-08-18 07:02:56 -04:00
parent d991a4f2d8
commit 5c34853293
4 changed files with 49 additions and 50 deletions
+25 -29
View File
@@ -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