-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcards.lua
278 lines (269 loc) · 5.51 KB
/
cards.lua
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
json = require("dkjson")
require("util")
require("stridx")
-- Most card data from disguised_monkey can be reused here.
-- So this is just the name and internal abilities.
-- Everything except the abilities is pulled from the json file.
id_to_card = {
NBABBA = {
name = "Base",
},
NBABT1 = {
name = "Tech I Building",
},
NBABT2 = {
name = "Tech II Building",
},
NBABT3 = {
name = "Tech III Building",
},
NBABTL = {
name = "Tech Lab",
},
NBABHH = {
name = "Heroes' Hall",
},
NBABTW = {
name = "Tower",
},
NBABSU = {
name = "Surplus",
},
NSTUTM = {
name = "Timely Messenger",
abilities = {"HASTE"},
},
NSTUTF = {
name = "Tenderfoot",
},
NSTUOB = {
name = "Older Brother",
},
NSTUBT = {
name = "Brick Thief",
abilities = {"ARRIVES_TRIGGER_BRICK_THIEF",
"DIES_TRIGGER_BRICK_THIEF"},
},
NSTUHT = {
name = "Helpful Turtle",
abilities = {{"UPKEEP_TRIGGER_HEALING", 1}},
},
NSTUGF = {
name = "Granfalloon Flagbearer",
abilities = {"FLAGBEARER"},
},
NSTUFN = {
name = "Fruit Ninja",
abilities = {{"FRENZY", 1}},
},
NSTSSP = {
name = "Spark",
abilities = {"SPELL_SPARK"},
},
NSTSBL = {
name = "Bloom",
abilities = {"SPELL_BLOOM"},
},
NSTSWI = {
name = "Wither",
abilities = {"SPELL_WITHER"},
},
NBAHTB = {
name = "Troq Bashar",
mid_abilities = {{"ATTACK_TRIGGER_DAMAGE_BASE", 1}},
max_abilities = {"READINESS"},
},
NBASWB = {
name = "Wrecking Ball",
abilities = {"SPELL_WRECKING_BALL"},
},
NBASTB = {
name = "The Boot",
abilities = {"SPELL_THE_BOOT"},
},
NBASIN = {
name = "Intimidate",
abilities = {"SPELL_INTIMIDATE"},
},
NBASFS = {
name = "Final Smash",
abilities = {"SPELL_FINAL_SMASH_0",
"SPELL_FINAL_SMASH_1",
"SPELL_FINAL_SMASH_2",},
},
NBAUIM = {
name = "Iron Man",
},
NBAURO = {
name = "Revolver Ocelot",
abilities = {"SPARKSHOT"},
},
NBAUSP = {
name = "Sneaky Pig",
abilities = {"HASTE", "ARRIVES_TRIGGER_SNEAKY_PIG"},
},
NBAURR = {
name = "Regular-sized Rhinoceros",
},
NBAUHS = {
name = "Hired Stomper",
abilities = {"ARRIVES_TRIGGER_HIRED_STOMPER"},
},
NBAUES = {
name = "Eggship",
abilities = {"FLYING"},
},
NBAUHR = {
name = "Harvest Reaper",
abilities = {"OVERPOWER"},
},
NBAUTD = {
name = "Trojan Duck",
abilities = {{"ATTACK_TRIGGER_OBLITERATE", 2},
"ARRIVES_TRIGGER_TROJAN_DUCK",
"ATTACK_TRIGGER_TROJAN_DUCK",},
},
NFIHRM = {
name = "River Montoya",
mid_abilities = {"TAP_SIDELINE_0_OR_1"},
max_abilities = {"CONT_COST_TECH_0_DISCOUNT"},
},
NFISHR = {
name = "Harmony",
abilities = {},
},
NFISDI = {
name = "Discord",
abilities = {},
},
NFISTS = {
name = "Two Step",
abilities = {},
},
NFISAS = {
name = "Appel Stomp",
abilities = {},
},
NFIUNF = {
name = "Nimble Fencer",
abilities = {"CONT_BUFF1_VIRTUOSO_HASTE"},
},
NFIUSS = {
name = "Star-Crossed Starlet",
abilities = {},
},
NFIUGG = {
name = "Grounded Guide",
abilities = {},
},
NFIUMA = {
name = "Maestro",
abilities = {},
},
NFIUBS = {
name = "Backstabber",
abilities = {},
},
NFIUCS = {
name = "Cloud Sprite",
abilities = {},
},
NFIULL = {
name = "Leaping Lizard",
abilities = {},
},
NFIUBM = {
name = "Blademaster",
abilities = {},
},
NFIUNF = {
name = "Nimble Fencer",
abilities = {},
},
NTOUDN = {
name = "Dancer",
abilities = {"MUSIC_TRIGGER_DANCER"},
},
NTOUAD = {
name = "Angry Dancer",
abilities = {"UNSTOPPABLE"},
},
}
spec_to_color = {}
local filenames = {"white", "blue", "black", "red", "green", "purple", "neutral", "heroes"}
local name_to_card = {}
for _,name in pairs(filenames) do
local cards = json.decode(file_contents(name..".json"))
for _,card in pairs(cards) do
if not name_to_card[card.name] then
name_to_card[card.name] = card
end
end
end
local accept_fields = arr_to_set{
"ATK",
"ATK_1",
"ATK_2",
"ATK_3",
"HP",
"HP_1",
"HP_2",
"HP_3",
"color",
"cost",
"max_level",
"mid_level",
"spec",
"starting_zone",
"subtype",
"tech_level",
"type",
}
for id,card in pairs(id_to_card) do
local read_card = name_to_card[card.name]
for k,v in pairs(read_card) do
if accept_fields[k] then
if type(v) == "string" then
v = v:lower()
end
card[k] = v
end
end
end
for id,card in pairs(id_to_card) do
if card.spec then
if spec_to_color[card.spec] then
assert(spec_to_color[card.spec] == card.color)
end
spec_to_color[card.spec] = card.color
end
if card.type == "hero" then
card.subtype = nil
end
local types = card.type:split(" ")
for k,v in ipairs(types) do
if v == "legendary" then
card.legendary = true
elseif v == "ongoing" then
card.ongoing = true
elseif v == "ultimate" then
card.ultimate = true
elseif v == "tech" then
card.tech_building = true
elseif v == "add-on" then
card.addon = true
elseif v == "minor" then
-- Don't actually care about the "minor" supertype
else
card.type = v
end
end
if card.type == "unit" or card.type == "spell" then
local subtypes = {}
if card.subtype then
subtypes = card.subtype:split(" ")
end
card.subtypes = subtypes
end
card.subtype = nil
end