Support sealing mob skill

This commit is contained in:
P0nk
2022-08-29 19:40:24 +02:00
parent 4baf06e4f9
commit 84890ac308
4 changed files with 37 additions and 1 deletions

View File

@@ -257,6 +257,7 @@ public class CommandsExecutor {
addCommand("id", 2, IdCommand.class);
addCommand("gachalist", GachaListCommand.class);
addCommand("loot", LootCommand.class);
addCommand("mobskill", MobSkillCommand.class);
commandsNameDesc.add(levelCommandsCursor);
}

View File

@@ -0,0 +1,32 @@
package client.command.commands.gm2;
import client.Character;
import client.Client;
import client.command.Command;
import server.life.MobSkill;
import server.life.MobSkillFactory;
import java.util.Collections;
public class MobSkillCommand extends Command {
{
setDescription("Apply a mob skill to all mobs on the map. Args: <mob skill id> <skill level>");
}
@Override
public void execute(Client client, String[] params) {
if (params.length < 2) {
throw new IllegalArgumentException("Mob skill command requires two args: mob skill id and level");
}
String skillId = params[0];
String skillLevel = params[1];
MobSkill mobSkill = MobSkillFactory.getMobSkill(Integer.parseInt(skillId), Integer.parseInt(skillLevel));
if (mobSkill == null) {
throw new IllegalArgumentException("Mob skill not found. Id: %s, level: %s".formatted(skillId, skillLevel));
}
Character chr = client.getPlayer();
chr.getMap().getAllMonsters().forEach(monster -> mobSkill.applyEffect(chr, monster, false, Collections.emptyList()));
}
}

View File

@@ -243,6 +243,9 @@ public class MobSkill {
case 156:
stats.put(MonsterStatus.SPEED, x);
break;
case 157:
stats.put(MonsterStatus.SEAL_SKILL, x);
break;
case 200: // summon
int skillLimit = this.getLimit();
MapleMap map = monster.getMap();

View File

@@ -1448,7 +1448,7 @@ public class Monster extends AbstractLoadedLife {
}
public boolean canUseSkill(MobSkill toUse, boolean apply) {
if (toUse == null) {
if (toUse == null || isBuffed(MonsterStatus.SEAL_SKILL)) {
return false;
}