Add /setstats mhp to set Max HP (#407)

* Fixed `/setstats hp` without changing the max hp.

The Max HP should be modified.

* Add `/setstats mhp` to set Max HP
This commit is contained in:
筱傑 2022-05-02 02:22:29 +08:00 committed by GitHub
parent 2c0576f697
commit 29c95cb1b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,9 +28,21 @@ public final class SetStatsCommand implements CommandHandler {
String stat = args.get(0); String stat = args.get(0);
switch (stat) { switch (stat) {
default: default:
CommandHandler.sendMessage(sender, "Usage: /setstats|stats <hp | def | atk | em | er | crate | cdmg> <value> for basic stats"); CommandHandler.sendMessage(sender, "Usage: /setstats|stats <hp | mhp | def | atk | em | er | crate | cdmg> <value> for basic stats");
CommandHandler.sendMessage(sender, "Usage: /stats <epyro | ecryo | ehydro | egeo | edend | eelec | ephys> <amount> for elemental bonus"); CommandHandler.sendMessage(sender, "Usage: /stats <epyro | ecryo | ehydro | egeo | edend | eelec | ephys> <amount> for elemental bonus");
return; return;
case "mhp":
try {
int health = Integer.parseInt(args.get(1));
EntityAvatar entity = sender.getTeamManager().getCurrentAvatarEntity();
entity.setFightProperty(FightProperty.FIGHT_PROP_MAX_HP, health);
entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_MAX_HP));
CommandHandler.sendMessage(sender, "MAX HP set to " + health + ".");
} catch (NumberFormatException ignored) {
CommandHandler.sendMessage(sender, "Invalid Max HP value.");
return;
}
break;
case "hp": case "hp":
try { try {
int health = Integer.parseInt(args.get(1)); int health = Integer.parseInt(args.get(1));