diff options
Diffstat (limited to 'server/lib/core/commands/add_monster_command.dart')
| -rw-r--r-- | server/lib/core/commands/add_monster_command.dart | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/server/lib/core/commands/add_monster_command.dart b/server/lib/core/commands/add_monster_command.dart new file mode 100644 index 0000000..0aeba27 --- /dev/null +++ b/server/lib/core/commands/add_monster_command.dart @@ -0,0 +1,30 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AddMonsterCommand extends Command { + final String _name; + final int? _level; + final bool _isAlly; + Monster? monster; + + AddMonsterCommand( + this._name, + this._level, + this._isAlly, { + required GameState gameState, + }) { + monster = MonsterMethods.createMonster(stateAccess, _name, _level, _isAlly); + } + + @override + void execute() { + final m = monster; + if (m == null) return; + RoundMethods.addToMainList(stateAccess, null, m); + } + + @override + String describe() { + return commandL10n.cmdAddMonster(monster?.type.display ?? ''); + } +} |
