summaryrefslogtreecommitdiff
path: root/server/lib/core/commands/remove_character_command.dart
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/core/commands/remove_character_command.dart')
-rw-r--r--server/lib/core/commands/remove_character_command.dart30
1 files changed, 30 insertions, 0 deletions
diff --git a/server/lib/core/commands/remove_character_command.dart b/server/lib/core/commands/remove_character_command.dart
new file mode 100644
index 0000000..ea1d982
--- /dev/null
+++ b/server/lib/core/commands/remove_character_command.dart
@@ -0,0 +1,30 @@
+import '../game_methods.dart';
+import '../state/game_state.dart';
+import 'command_l10n.dart';
+
+class RemoveCharacterCommand extends Command {
+ final List<Character> names;
+
+ RemoveCharacterCommand(this.names, {required GameState gameState});
+
+ @override
+ void execute() {
+ CharacterMethods.removeCharacters(stateAccess, names);
+
+ if (names.length != 1 ||
+ !GameMethods.isObjectiveOrEscort(names.first.characterClass)) {
+ ScenarioMethods.applyDifficulty(stateAccess);
+ }
+ }
+
+ @override
+ String describe() {
+ if (names.length > 1) {
+ return commandL10n.cmdRemoveAllCharacters;
+ }
+ if (names.isNotEmpty) {
+ return commandL10n.cmdRemoveCharacter(names.first.id);
+ }
+ return commandL10n.cmdRemoveNoCharacters;
+ }
+}