summaryrefslogtreecommitdiff
path: root/server/lib/core/commands/amd_remove_minus_2_command.dart
blob: 401cc8cae169e220f73b5260de5401edfee77be8 (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
28
29
30
31
32
import '../state/game_state.dart';
import 'command_l10n.dart';

class AMDRemoveMinus2Command extends Command {
  bool allies;
  bool remove = false;
  final GameState _gameState;

  AMDRemoveMinus2Command(this.allies, {required GameState gameState})
    : _gameState = gameState;

  @override
  void execute() {
    ModifierDeck deck = _gameState.modifierDeck;
    if (allies) {
      deck = _gameState.modifierDeckAllies;
    }
    remove = deck.hasMinus2();
    if (remove) {
      deck.removeMinusTwo(stateAccess);
    } else {
      deck.addMinusTwo(stateAccess);
    }
  }

  @override
  String describe() {
    return remove
        ? commandL10n.cmdRemoveMinusTwo
        : commandL10n.cmdAddBackMinusTwo;
  }
}