Implement !clean command and f affinity

This commit is contained in:
阁主
2025-11-26 09:05:08 +08:00
committed by Melledy
parent 008cd06b32
commit 3a7d12c7b7
5 changed files with 159 additions and 4 deletions

View File

@@ -26,6 +26,7 @@ public class CommandArgs {
private int advance = -1;
private int talent = -1;
private int skill = -1;
private int affinity = -1;
private Int2IntMap map;
private ObjectSet<String> flags;
@@ -61,6 +62,9 @@ public class CommandArgs {
} else if (arg.startsWith("s")) { // Skill
this.skill = Utils.parseSafeInt(arg.substring(1));
it.remove();
} else if (arg.startsWith("f")) { // Affinity level
this.affinity = Utils.parseSafeInt(arg.substring(1));
it.remove();
}
} else if (arg.startsWith("-")) { // Flag
if (this.flags == null) this.flags = new ObjectOpenHashSet<>();
@@ -190,6 +194,16 @@ public class CommandArgs {
hasChanged = true;
}
if (this.getAffinity() >= 0) {
int target = this.getAffinity();
if (target > 50) target = 50;
if (target < 0) target = 0;
if (character.getAffinityLevel() != target) {
character.setAffinityLevel(target);
hasChanged = true;
}
}
return hasChanged;
}