summaryrefslogtreecommitdiff
path: root/server/lib/core/state/figure_state.dart
blob: d14275fe536f9433d02f627be39ed560c08934af (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
part of 'game_state.dart';

// ignore_for_file: library_private_types_in_public_api
class FigureState {
  List<Condition> _conditions = [];

  List<Condition> get conditions => _conditions;

  int _level = 1;
  int _health = 0;
  int _maxHealth = 0;
  int _chill = 0;
  int _plague = 0;
  final Set<Condition> _conditionsAddedThisTurn = {};
  final Set<Condition> _conditionsAddedPreviousTurn = {};

  int get level => _level;
  int get health => _health;
  int get maxHealth => _maxHealth;
  int get chill => _chill;
  int get plague => _plague;
  BuiltSet<Condition> get conditionsAddedThisTurn =>
      BuiltSet.of(_conditionsAddedThisTurn);
  BuiltSet<Condition> get conditionsAddedPreviousTurn =>
      BuiltSet.of(_conditionsAddedPreviousTurn);

  void setHealth(_StateModifier _, int value) {
    _health = value;
  }

  void setFigureLevel(_StateModifier _, int value) {
    _level = value;
  }

  void setMaxHealth(_StateModifier _, int value) {
    _maxHealth = value;
  }

  void setChill(_StateModifier _, int value) {
    _chill = value;
  }

  void setPlague(_StateModifier _, int value) {
    _plague = value;
  }

  void setConditions(_StateModifier _, List<Condition> value) {
    _conditions = value;
  }

  void addToConditionsThisTurn(_StateModifier _, Condition condition) {
    _conditionsAddedThisTurn.add(condition);
  }

  void removeFromConditionsThisTurn(_StateModifier _, Condition condition) {
    _conditionsAddedThisTurn.remove(condition);
  }

  void removeFromConditionsPreviousTurn(_StateModifier _, Condition condition) {
    _conditionsAddedPreviousTurn.remove(condition);
  }
}