diff options
Diffstat (limited to 'server/lib/core/commands/draw_command.dart')
| -rw-r--r-- | server/lib/core/commands/draw_command.dart | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/server/lib/core/commands/draw_command.dart b/server/lib/core/commands/draw_command.dart new file mode 100644 index 0000000..fa1d38a --- /dev/null +++ b/server/lib/core/commands/draw_command.dart @@ -0,0 +1,27 @@ +import '../enums.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class DrawCommand extends Command { + final GameState _gameState; + + DrawCommand({required GameState gameState}) : _gameState = gameState; + + @override + void execute() { + DeckMethods.drawAbilityCards(stateAccess); + RoundMethods.sortByInitiative(stateAccess); + RoundMethods.setRoundState(stateAccess, RoundState.playTurns); + if (_gameState.currentList.isNotEmpty) { + _gameState.currentList.first.setTurnState( + stateAccess, + TurnsState.current, + ); + } + } + + @override + String describe() { + return commandL10n.cmdDraw; + } +} |
