summaryrefslogtreecommitdiff
path: root/server/lib/core/line_builder/line_builder.dart
blob: 52883dafaee3eae9891d0c81f5f649587d1209a0 (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
/// Port of the pure-logic parts of the reference app's ability-line builder.
///
/// The reference `LineBuilder` also builds Flutter widgets to render ability
/// lines (`createLines`, font metrics, shimmer animation). That rendering is
/// re-implemented by the web client in Phase 4 — only the token table and
/// element detection are kept here, along with the `debugColors` flag that
/// the ported game logic references.
class LineBuilder {
  static const bool debugColors = false;

  static const Map<String, String> tokens = {
    "attack": "Attack",
    "move": "Move",
    "teleport": "Teleport",
    "range": "Range",
    "heal": "Heal",
    "target": "Target",
    "shield": "Shield",
    "loot": "Loot",
    "retaliate": "Retaliate",
    "jump": "Jump",
    "stun": "STUN",
    "wound": "WOUND",
    "disarm": "DISARM",
    "immobilize": "IMMOBILIZE",
    "poison": "POISON",
    "invisible": "INVISIBLE",
    "strengthen": "STRENGTHEN",
    "muddle": "MUDDLE",
    "regenerate": "REGENERATE",
    "ward": "WARD",
    "impair": "IMPAIR",
    "bane": "BANE",
    "brittle": "BRITTLE",
    "chill": "CHILL",
    "infect": "INFECT",
    "rupture": "RUPTURE",
    "push": "PUSH",
    "pull": "PULL",
    "pierce": "PIERCE",
    "curse": "CURSE",
    "enfeeble": "ENFEEBLE",
    "empower": "EMPOWER",
    "bless": "BLESS",
    "safeguard": "SAFEGUARD",
    "flip": "ROLLING",
    "damage": "damage",
    "and": "and",
  };

  static bool isElement(String item) {
    if (item.contains("air") ||
        item.contains("earth") ||
        item.contains("fire") ||
        item.contains("ice") ||
        item.contains("dark") ||
        item.contains("light") ||
        item == "any") {
      return true;
    }
    return false;
  }
}