summaryrefslogtreecommitdiff
path: root/server/lib/core/commands/add_monster_command.dart
blob: 0aeba2701b816f8947a61440cb8c0212c34292a3 (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
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 ?? '');
  }
}