-
Notifications
You must be signed in to change notification settings - Fork 0
/
token_reserves.rb
119 lines (100 loc) · 2.07 KB
/
token_reserves.rb
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
class TokenReserves
def initialize(game)
@game = game
@reserves = []
end
def to_s
@reserves.count.to_s
end
def count
@reserves.count
end
def draw
@reserves.shift
end
def replace(token)
@reserves.push(token)
end
end
class ShipTokenReserves < TokenReserves
def initialize(game)
super(game)
self.class::TOKEN_COUNT.times { @reserves.push(self.class::TOKEN_CLASS.new(game)) }
end
end
class ViperReserves < ShipTokenReserves
TOKEN_CLASS = Viper
TOKEN_COUNT = 8
end
class RaptorReserves < ShipTokenReserves
TOKEN_CLASS = Raptor
TOKEN_COUNT = 4
end
class RaiderReserves < ShipTokenReserves
TOKEN_CLASS = Raider
TOKEN_COUNT = 16
end
class HeavyRaiderReserves < ShipTokenReserves
TOKEN_CLASS = HeavyRaider
TOKEN_COUNT = 4
end
class CenturionReserves < ShipTokenReserves
TOKEN_CLASS = Centurion
TOKEN_COUNT = 4
end
class BasestarReserves < ShipTokenReserves
TOKEN_CLASS = Basestar
TOKEN_COUNT = 2
end
class DamageTokenReserves < TokenReserves
def initialize(game)
super(game)
self.class::TO_DAMAGE_CLASSES.each do | to_damage_class |
@reserves.push(self.class::TOKEN_CLASS.new(game, to_damage_class))
end
@reserves.shuffle!
end
def replace(token)
super(token)
@reserves.shuffle!
end
end
class GalacticaDamageReserves < DamageTokenReserves
TOKEN_CLASS = GalacticaDamageToken
TO_DAMAGE_CLASSES = [
Food,
Fuel,
FTLControl,
WeaponsControl,
Command,
AdmiralsQuarters,
HangarDeck,
Armory
]
end
class CivilianShipReserves < DamageTokenReserves
TOKEN_CLASS = CivilianShip
TO_DAMAGE_CLASSES = [
[],
[],
[Population],
[Population],
[Population],
[Population],
[Population],
[Population],
[Population, Fuel],
[Population, Population],
[Population, Population],
[Population, Morale]
]
end
class BasestarDamageReserves < DamageTokenReserves
TOKEN_CLASS = BasestarDamageToken
TO_DAMAGE_CLASSES = [
:critical_hit,
:disabled_hangar,
:disabled_weapons,
:structural_damage
]
end