-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathgenerate_csv_notes.py
More file actions
299 lines (252 loc) · 9.42 KB
/
generate_csv_notes.py
File metadata and controls
299 lines (252 loc) · 9.42 KB
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
from khbr.randomizer import KingdomHearts2
import random, os, json, time
# These bosses I'm not planning on ever randomizing, so can exclude them
exclusions = ["Banzai", "Barrel", "Ed", "Giant Sark", "MCP",
"Lock", "Pete OC I", "Shenzie", "Shock", "Illuminator"]
# These enemies I'm not planning on ever randomizing, so they are excluded
# Bees
# Bulky Vendor
# Demyx's Water Clones
# Scar Ghost
# Vivi Clones
# Shadow Roxas
# Gambler (version that summons darkness)
# Illuminator
######
##RUN FOR MOOSE
######
exclusions_enemies = []
kh2 = KingdomHearts2()
kh2.enemy_manager.set_enemies(moose=True)
records = kh2.enemy_manager.enemy_records
bosses = {b: records[b] for b in records if records[b]["type"] == "boss" and records[b]["name"] not in exclusions}
boss_names = sorted(bosses)
bosslines = []
allow_count = [0,0]
sources = []
names = []
for source_boss_name in boss_names:
source_boss = bosses[source_boss_name]
if source_boss["parent"] != source_boss["name"]:
continue
source_boss_compatability = [source_boss_name]
for new_boss_name in boss_names:
new_boss = bosses[new_boss_name]
if new_boss["parent"] != new_boss["name"]:
continue
if new_boss["name"] in source_boss["available"]:
source_room = None if not source_boss["msn"] else source_boss["msn"][:4]
if source_room in new_boss["forced_variations"]:
compat = 'F'
else:
compat = ''
allow_count[0] += 1
allow_count[1] += 1
elif new_boss["name"] in source_boss["gimmick_source"]:
compat = 'G'
allow_count[0] += 1
allow_count[1] += 1
else:
compat = 'X'
allow_count[1] += 1
source_boss_compatability.append(compat)
names.append(new_boss_name)
sources.append(source_boss_compatability)
print(f"MOOSE Boss Replacements: {allow_count[0]}/{allow_count[1]}")
bosslines.append(["Destination/Source"]+sorted(set(names)))
bosslines += sources
with open("boss_compat_moose.csv", "w") as f:
# bosslines is a 2 dimensional list, where each row is a list of strings
# reverse the x and y axis to make it easier to read
f.write("\n".join([",".join(s) for s in zip(*bosslines)]))
bosslines_nightmare =[]
allow_count = [0,0]
sources_nightmare = []
names_nightmare = []
for source_boss_name in boss_names:
source_boss = bosses[source_boss_name]
if source_boss["parent"] != source_boss["name"]:
continue
source_boss_compatability = [source_boss_name]
for new_boss_name in boss_names:
new_boss = bosses[new_boss_name]
if not new_boss["isnightmare"]:
continue
if new_boss["parent"] != new_boss["name"]:
continue
if new_boss["name"] in source_boss["available"]:
source_room = None if not source_boss["msn"] else source_boss["msn"][:4]
if source_room in new_boss["forced_variations"]:
compat = 'F'
else:
compat = ''
allow_count[0] += 1
allow_count[1] += 1
elif new_boss["name"] in source_boss["gimmick_source"]:
compat = 'G'
allow_count[0] += 1
allow_count[1] += 1
else:
compat = 'X'
allow_count[1] += 1
source_boss_compatability.append(compat)
names_nightmare.append(new_boss_name)
sources_nightmare.append(source_boss_compatability)
print(f"MOOSE Nightmare Boss Replacements: {allow_count[0]}/{allow_count[1]}")
bosslines_nightmare.append(["Destination/Source"]+sorted(set(names_nightmare)))
bosslines_nightmare += sources_nightmare
with open("boss_compat_nightmare_moose.csv", "w") as f:
f.write("\n".join([",".join(s) for s in zip(*bosslines_nightmare)]))
# title_rows = []
# lines = []
# enemies = kh2.get_enemies()
# enemies_dict = {}
# for v in enemies:
# k = v["name"]
# enemies_dict[k] = v
# categories = kh2.categorize_enemies(enemies)
# for c in categories:
# lines.append([c])
# title_rows.append(len(lines))
# for e in sorted(categories[c]):
# enemy = enemies_dict[e]
# if enemy["name"] == enemy["parent"]:
# lines.append(sorted(enemy["children"]))
# with open("enemy_cats.csv", "w") as f:
# f.write("\n".join([",".join(s) for s in lines]))
# title_rows_nightmare = []
# lines_nightmare = []
# enemies = kh2.get_enemies()
# enemies_dict = {}
# for v in enemies:
# k = v["name"]
# enemies_dict[k] = v
# categories = kh2.categorize_enemies(enemies)
# for c in categories:
# lines_nightmare.append([c])
# title_rows_nightmare.append(len(lines_nightmare))
# for e in sorted(categories[c]):
# enemy = enemies_dict[e]
# if enemy["name"] == enemy["parent"] and enemy["isnightmare"]:
# lines_nightmare.append(sorted(enemy["children"]))
# with open("enemy_cats_nightmare.csv", "w") as f:
# f.write("\n".join([",".join(s) for s in lines_nightmare]))
######
##RUN FOR PS2
######
exclusions_enemies = []
kh2 = KingdomHearts2()
kh2.enemy_manager.set_enemies(moose=False)
records = kh2.enemy_manager.enemy_records
bosses = {b: records[b] for b in records if records[b]["type"] == "boss" and records[b]["name"] not in exclusions}
boss_names = sorted(bosses)
bosslines = []
allow_count = [0,0]
sources = []
names = []
for source_boss_name in boss_names:
source_boss = bosses[source_boss_name]
if source_boss["parent"] != source_boss["name"]:
continue
source_boss_compatability = [source_boss_name]
for new_boss_name in boss_names:
new_boss = bosses[new_boss_name]
if new_boss["parent"] != new_boss["name"]:
continue
if new_boss["name"] in source_boss["available"]:
source_room = None if not source_boss["msn"] else source_boss["msn"][:4]
if source_room in new_boss["forced_variations"]:
compat = 'F'
else:
compat = ''
allow_count[0] += 1
allow_count[1] += 1
elif new_boss["name"] in source_boss["gimmick_source"]:
compat = 'G'
allow_count[0] += 1
allow_count[1] += 1
else:
compat = 'X'
allow_count[1] += 1
source_boss_compatability.append(compat)
names.append(new_boss_name)
sources.append(source_boss_compatability)
print(f"PS2 Boss Replacements: {allow_count[0]}/{allow_count[1]}")
bosslines.append(["Destination/Source"]+sorted(set(names)))
bosslines += sources
with open("boss_compat_ps2.csv", "w") as f:
# bosslines is a 2 dimensional list, where each row is a list of strings
# reverse the x and y axis to make it easier to read
f.write("\n".join([",".join(s) for s in zip(*bosslines)]))
bosslines_nightmare =[]
allow_count = [0,0]
sources_nightmare = []
names_nightmare = []
for source_boss_name in boss_names:
source_boss = bosses[source_boss_name]
if source_boss["parent"] != source_boss["name"]:
continue
source_boss_compatability = [source_boss_name]
for new_boss_name in boss_names:
new_boss = bosses[new_boss_name]
if not new_boss["isnightmare"]:
continue
if new_boss["parent"] != new_boss["name"]:
continue
if new_boss["name"] in source_boss["available"]:
source_room = None if not source_boss["msn"] else source_boss["msn"][:4]
if source_room in new_boss["forced_variations"]:
compat = 'F'
else:
compat = ''
allow_count[0] += 1
allow_count[1] += 1
elif new_boss["name"] in source_boss["gimmick_source"]:
compat = 'G'
allow_count[0] += 1
allow_count[1] += 1
else:
compat = 'X'
allow_count[1] += 1
source_boss_compatability.append(compat)
names_nightmare.append(new_boss_name)
sources_nightmare.append(source_boss_compatability)
print(f"PS2 Nightmare Boss Replacements: {allow_count[0]}/{allow_count[1]}")
bosslines_nightmare.append(["Destination/Source"]+sorted(set(names_nightmare)))
bosslines_nightmare += sources_nightmare
with open("boss_compat_nightmare_ps2.csv", "w") as f:
f.write("\n".join([",".join(s) for s in zip(*bosslines_nightmare)]))
# title_rows = []
# lines = []
# enemies = kh2.get_enemies()
# enemies_dict = {}
# for v in enemies:
# k = v["name"]
# enemies_dict[k] = v
# categories = kh2.categorize_enemies(enemies)
# for c in categories:
# lines.append([c])
# title_rows.append(len(lines))
# for e in sorted(categories[c]):
# enemy = enemies_dict[e]
# if enemy["name"] == enemy["parent"]:
# lines.append(sorted(enemy["children"]))
# with open("enemy_cats.csv", "w") as f:
# f.write("\n".join([",".join(s) for s in lines]))
# title_rows_nightmare = []
# lines_nightmare = []
# enemies = kh2.get_enemies()
# enemies_dict = {}
# for v in enemies:
# k = v["name"]
# enemies_dict[k] = v
# categories = kh2.categorize_enemies(enemies)
# for c in categories:
# lines_nightmare.append([c])
# title_rows_nightmare.append(len(lines_nightmare))
# for e in sorted(categories[c]):
# enemy = enemies_dict[e]
# if enemy["name"] == enemy["parent"] and enemy["isnightmare"]:
# lines_nightmare.append(sorted(enemy["children"]))
# with open("enemy_cats_nightmare.csv", "w") as f:
# f.write("\n".join([",".join(s) for s in lines_nightmare]))