summaryrefslogtreecommitdiff
path: root/server/lib/core/commands/draw_command.dart
blob: fa1d38abc61f4716d28edc30b187c6ac4f531888 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;
  }
}