-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrollomizer.py
More file actions
249 lines (226 loc) · 9.86 KB
/
Copy pathtrollomizer.py
File metadata and controls
249 lines (226 loc) · 9.86 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
import random
def genDungeons():
DUNGEONS = [
'Eastern Palace',
'Desert Palace',
'Tower of Hera',
'Palace of Darkness',
'Swamp Palace',
'Skull Woods',
'Thieves\' Town',
'Ice Palace',
'Misery Mire',
'Turtle Rock'
]
xtalDungeons = random.sample(DUNGEONS,7)
pendantDungeons = []
for d in DUNGEONS:
if d not in xtalDungeons:
pendantDungeons.append(d)
return xtalDungeons,pendantDungeons
def genGame(crystals):
xtalDungeons,pendantDungeons = genDungeons()
medallions = {'Misery Mire': random.choice(['Bombos','Ether','Quake']), 'Turtle Rock': random.choice(['Bombos','Ether','Quake'])}
# Moon Pearl, Hammer, ProgressiveGlove, Swords, and Bows are considered always accessible and not considered for ped
required = set()
if 'Skull Woods' in xtalDungeons:
required.add('Fire Rod')
if 'Swamp Palace' in xtalDungeons:
required.add('Magic Mirror')
required.add('Hookshot')
if 'Misery Mire' in xtalDungeons:
required.add('Progressive Glove')
required.add('Flute')
required.add(medallions['Misery Mire'])
if 'Turtle Rock' in xtalDungeons:
required.add('Progressive Glove')
required.add('Fire Rod')
required.add('Ice Rod')
required.add(medallions['Turtle Rock'])
if 'Ice Palace' in xtalDungeons:
required.add('Progressive Glove')
required.add('Flippers')
if 'Fire Rod' not in required and 'Bombos' not in required:
required.add(random.sample(['Fire Rod', 'Bombos'],1)[0])
if 'Desert Palace' in xtalDungeons and ('Flute' not in required and 'Magic Mirror' not in required):
add = random.choice([['Book of Mudora'],['Flute','Magic Mirror']])
for a in add:
required.add(a)
if 'Tower of Hera' in xtalDungeons:
if 'Magic Mirror' not in required and 'Hookshot' not in required:
required.add(random.choice(['Magic Mirror', 'Hookshot']))
pendantRequired = set()
if 'Skull Woods' in pendantDungeons:
pendantRequired.add('Fire Rod')
if 'Swamp Palace' in pendantDungeons:
pendantRequired.add('Magic Mirror')
pendantRequired.add('Hookshot')
if 'Misery Mire' in pendantDungeons:
pendantRequired.add('Progressive Glove')
pendantRequired.add('Flute')
pendantRequired.add(medallions['Misery Mire'])
if 'Turtle Rock' in pendantDungeons:
pendantRequired.add('Progressive Glove')
pendantRequired.add('Fire Rod')
pendantRequired.add('Ice Rod')
pendantRequired.add(medallions['Turtle Rock'])
if 'Ice Palace' in pendantDungeons:
pendantRequired.add('Progressive Glove')
pendantRequired.add('Flippers')
if 'Fire Rod' not in pendantRequired and 'Bombos' not in pendantRequired:
if 'Bombos' not in required:
pendantRequired.add('Bombos')
elif 'Fire Rod' not in required:
pendantRequired.add('Fire Rod')
else:
pendantRequired.add(random.sample(['Fire Rod', 'Bombos'],1)[0])
if 'Desert Palace' in pendantDungeons and ('Flute' not in pendantRequired and 'Magic Mirror' not in pendantRequired):
if 'Book of Mudora' not in required:
pendantRequired.add('Book of Mudora')
elif 'Flute' not in required and 'Magic Mirror' not in required:
pendantRequired.add('Flute')
pendantRequired.add('Magic Mirror')
else:
add = random.choice([['Book of Mudora'],['Flute','Magic Mirror']])
for a in add:
pendantRequired.add(a)
if 'Tower of Hera' in pendantDungeons:
if 'Magic Mirror' not in required:
pendantRequired.add('Magic Mirror')
if 'Hookshot' not in required:
pendantRequired.add('Hookshot')
else:
pendantRequired.add(random.choice(['Magic Mirror', 'Hookshot']))
return xtalDungeons, pendantDungeons, required, pendantRequired, medallions
def trollYamls(players,amount):
trolls = min([len(players),amount])
if trolls > 0:
return random.sample(players,trolls)
else:
return ['None']
def genTrollName():
names = [
'Gnent','Nad','Ayle','Iste','Lam','Rstynn','Tann','Oelee','Ker','Amsey','Ssag',
'Llang','Mmark','Lind','Nes','Elly','Egui','Wall','Uince','Ike','Ldoch','Atha',
'Uba','Kigm','Nell','Wiss','Nanc','Lis','Nin','Arla','Hoth','Bel','Ddiet','Rton'
]
return ' '.join(random.sample(names,2))
def trollomizer(input_yamls,parameters):
players = []
for player in input_yamls:
players.append(player)
cutslow = trollYamls(players,parameters['cutsceneslow'])
menuslow = trollYamls(players,parameters['menuslow'])
fastheart = trollYamls(players,parameters['fastheart'])
pedestal = trollYamls(players,parameters['pedestal'])
agahnim = trollYamls(players,parameters['agahnim'])
for player,settings in input_yamls.items():
if 'local_items' not in settings:
settings['local_items'] = []
if 'Moon Pearl' not in settings['local_items']:
settings['local_items'].append('Moon Pearl')
if player in cutslow:
settings['rom']['cutscenespeed'] = {'normal': 0, 'slow': 1, 'fast': 0, 'blazing': 0}
if player in menuslow:
settings['rom']['menuspeed'] = {'normal': 0, 'instant': 0, 'double': 0, 'triple': 0, 'quadruple': 0, 'half': 1}
if player in fastheart:
settings['rom']['heartbeep'] = {'double': 1, 'normal': 0, 'half': 0, 'quarter': 0, 'off': 0}
xtalDungeons, pendantDungeons, required, pendantRequired, medallions = genGame(crystals=7)
if 'plando_items' not in settings:
settings['plando_items'] = []
pedSelection = {}
for item in required:
if item not in pendantRequired:
pedSelection[item] = 1
if player in pedestal:
settings['plando_items'].append(
{
'items': pedSelection,
'world': False,
'from_pool': True,
'location': 'Master Sword Pedestal'
}
)
jackSelection = {}
for item in required:
jackSelection[item] = 1
if player in pedestal:
for item in pendantRequired:
jackSelection[item] = 1
if player in agahnim:
settings['plando_items'].append(
{
'items': jackSelection,
'world': False,
'from_pool': True,
'location': 'Lumberjack Tree'
}
)
if player in pedestal or player in agahnim:
xtalLocations = []
for dungeon in xtalDungeons:
xtalLocations.append('{} - Prize'.format(dungeon))
xtalLayout = {
'items': {
'Crystal 1': 1,
'Crystal 2': 1,
'Crystal 3': 1,
'Crystal 4': 1,
'Crystal 5': 1,
'Crystal 6': 1,
'Crystal 7': 1,
},
'world': False,
'from_pool': True,
'locations': xtalLocations
}
settings['plando_items'].append(xtalLayout)
pendantLocations = []
for dungeon in pendantDungeons:
pendantLocations.append('{} - Prize'.format(dungeon))
pendantLayout = {
'items': {
'Green Pendant': 1,
'Red Pendant': 1,
'Blue Pendant': 1
},
'world': False,
'from_pool': True,
'locations': pendantLocations
}
settings['plando_items'].append(pendantLayout)
settings['misery_mire_medallion'] = {'random': 0, 'Ether': 0, 'Bombos': 0, 'Quake': 0}
settings['misery_mire_medallion'][medallions['Misery Mire']] = 1
settings['turtle_rock_medallion'] = {'random': 0, 'Ether': 0, 'Bombos': 0, 'Quake': 0}
settings['turtle_rock_medallion'][medallions['Turtle Rock']] = 1
usefulItems = ['Pegasus Boots', 'Bug Catching Net', 'Blue Boomerang', 'Red Boomerang', 'Mushroom', 'Magic Powder', 'Lamp', 'Shovel', 'Cane of Byrna', 'Cape', 'Progressive Glove', 'Magic Upgrade (1/2)', 'Progressive Shield', 'Rupees (300)']
usefulItems += ['Boss Heart Container'] * 4
if player in agahnim or player in pedestal:
if 'Quake' not in medallions:
usefulItems += ['Quake']
if 'Ether' not in medallions:
usefulItems += ['Ether']
if 'Bombos' not in medallions:
usefulItems += ['Bombos']
usefulItems += ['Bottle ({})'.format(random.choice(['Green Potion', 'Red Potion', 'Blue Potion', 'Good Bee', 'Fairy']))]
usefulItems += ['Bottle ({})'.format(random.choice(['Green Potion', 'Red Potion', 'Blue Potion', 'Good Bee', 'Fairy']))]
start_cnt = parameters['startinventory']['min']
start_max = parameters['startinventory']['min']
while True:
if start_cnt <= start_max:
if random.random() < 0.5:
start_cnt += 1
else:
break
else:
break
if start_cnt > 0:
startItems = random.sample(usefulItems, start_cnt)
for item in startItems:
if item not in settings['startinventory']:
settings['startinventory'][item] = 1
else:
settings['startinventory'][item] += 1
if settings['name'] == 'random':
settings['name'] = genTrollName()
input_yamls[player] = settings