summaryrefslogtreecommitdiff
path: root/server/lib/core/commands/add_standee_command.dart
blob: ec10701fdbdfdf3e2268da715c6ce04d56c4d879 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import 'package:x_haven_server/core/state/game_state.dart';

import '../enums.dart';
import 'command_l10n.dart';

class AddStandeeCommand extends Command {
  final int nr;
  final SummonData? summon;
  final MonsterType type;
  final String ownerId;
  final bool addAsSummon;
  final GameState _gameState;

  AddStandeeCommand(
    this.nr,
    this.summon,
    this.ownerId,
    this.type,
    this.addAsSummon, {
    required GameState gameState,
  }) : _gameState = gameState;

  @override
  void execute() {
    MonsterMethods.executeAddStandee(
      stateAccess,
      nr,
      summon,
      type,
      ownerId,
      addAsSummon,
    );

    _gameState.notifyListeners();
  }

  @override
  String describe() {
    final sum = summon;
    String name = sum == null ? ownerId : sum.name;

    return commandL10n.cmdAddStandee(name, nr);
  }
}

class SummonData {
  int standeeNr;
  String name;
  int health;
  int move;
  int attack;
  int range;
  String gfx;

  SummonData(
    this.standeeNr,
    this.name,
    this.health,
    this.move,
    this.attack,
    this.range,
    this.gfx,
  );
}