Custom Goal framework fixes

This commit is contained in:
codemann8
2025-10-29 20:17:45 -05:00
parent a5ce59c7e8
commit c5ea8e4703
6 changed files with 24 additions and 6 deletions

View File

@@ -3394,10 +3394,22 @@ class Spoiler(object):
outfile.write(f'{dungeon}:'.ljust(line_width) + '%s Medallion\n' % medallion) outfile.write(f'{dungeon}:'.ljust(line_width) + '%s Medallion\n' % medallion)
for player in range(1, self.world.players + 1): for player in range(1, self.world.players + 1):
player_name = '' if self.world.players == 1 else str(' (Player ' + str(player) + ')') player_name = '' if self.world.players == 1 else str(' (Player ' + str(player) + ')')
if self.world.crystals_gt_orig[player] == 'random': goal = self.world.custom_goals[player]['gtentry']
if goal and 'requirements' in goal and goal['requirements'][0]['condition'] != 0x00:
outfile.write('GT Entry Sign Text' + player_name + ':'.ljust(line_width) + '%s\n' % goal['goaltext'])
elif self.world.crystals_gt_orig[player] == 'random':
outfile.write(str('Crystals Required for GT' + player_name + ':').ljust(line_width) + '%s\n' % (str(self.metadata['gt_crystals'][player]))) outfile.write(str('Crystals Required for GT' + player_name + ':').ljust(line_width) + '%s\n' % (str(self.metadata['gt_crystals'][player])))
if self.world.crystals_ganon_orig[player] == 'random': goal = self.world.custom_goals[player]['ganongoal']
if goal and 'requirements' in goal and goal['requirements'][0]['condition'] != 0x00:
outfile.write('Ganon Sign Text' + player_name + ':'.ljust(line_width) + '%s\n' % goal['goaltext'])
elif self.world.crystals_ganon_orig[player] == 'random':
outfile.write(str('Crystals Required for Ganon' + player_name + ':').ljust(line_width) + '%s\n' % (str(self.metadata['ganon_crystals'][player]))) outfile.write(str('Crystals Required for Ganon' + player_name + ':').ljust(line_width) + '%s\n' % (str(self.metadata['ganon_crystals'][player])))
goal = self.world.custom_goals[player]['pedgoal']
if goal and 'requirements' in goal and goal['requirements'][0]['condition'] != 0x00:
outfile.write('Pedestal Sign Text' + player_name + ':'.ljust(line_width) + '%s\n' % goal['goaltext'])
goal = self.world.custom_goals[player]['murahgoal']
if goal and 'requirements' in goal and goal['requirements'][0]['condition'] != 0x00:
outfile.write('Murahdahla Sign Text' + player_name + ':'.ljust(line_width) + '%s\n' % goal['goaltext'])
outfile.write('\n\nPrizes:\n\n') outfile.write('\n\nPrizes:\n\n')
for dungeon, prize in self.prizes.items(): for dungeon, prize in self.prizes.items():
outfile.write(str(dungeon + ':').ljust(line_width) + '%s\n' % prize) outfile.write(str(dungeon + ':').ljust(line_width) + '%s\n' % prize)

View File

@@ -236,6 +236,7 @@ def generate_itempool(world, player):
else: else:
set_event_item(world, player, 'Ganon', 'Triforce') set_event_item(world, player, 'Ganon', 'Triforce')
goal_req = None
if world.custom_goals[player]['murahgoal'] and 'requirements' in world.custom_goals[player]['murahgoal']: if world.custom_goals[player]['murahgoal'] and 'requirements' in world.custom_goals[player]['murahgoal']:
goal_req = world.custom_goals[player]['murahgoal']['requirements'][0] goal_req = world.custom_goals[player]['murahgoal']['requirements'][0]
if world.goal[player] in ['triforcehunt', 'trinity'] or (goal_req and goal_req['condition'] != 0x00): if world.goal[player] in ['triforcehunt', 'trinity'] or (goal_req and goal_req['condition'] != 0x00):

View File

@@ -552,10 +552,12 @@ def resolve_random_settings(world, args):
req_table = { req_table = {
'Invulnerable': 0x00, 'Invulnerable': 0x00,
'Disabled': 0x00,
'Pendants': 0x01, 'Pendants': 0x01,
'Crystals': 0x02, 'Crystals': 0x02,
'PendantBosses': 0x03, 'PendantBosses': 0x03,
'CrystalBosses': 0x04, 'CrystalBosses': 0x04,
'PrizeBosses': 0x05,
'Bosses': 0x05, 'Bosses': 0x05,
'Agahnim1Defeated': 0x06, 'Agahnim1Defeated': 0x06,
'Agahnim1': 0x06, 'Agahnim1': 0x06,
@@ -577,7 +579,10 @@ def resolve_random_settings(world, args):
for r in list(goal_input['requirements']): for r in list(goal_input['requirements']):
req = {} req = {}
try: try:
req['condition'] = req_table[list(r.keys())[0]] if isinstance(r, str):
req['condition'] = req_table[r]
else:
req['condition'] = req_table[list(r.keys())[0]]
if req['condition'] == req_table['Invulnerable']: if req['condition'] == req_table['Invulnerable']:
goal['requirements']= [req] goal['requirements']= [req]
goal['logic'] = False goal['logic'] = False
@@ -647,7 +652,7 @@ def resolve_random_settings(world, args):
goal['logic']['pendant_bosses'] = req['target'] or 3 goal['logic']['pendant_bosses'] = req['target'] or 3
elif req['condition'] & 0x7F == req_table['CrystalBosses']: elif req['condition'] & 0x7F == req_table['CrystalBosses']:
goal['logic']['crystal_bosses'] = req['target'] or 7 goal['logic']['crystal_bosses'] = req['target'] or 7
elif req['condition'] & 0x7F == req_table['Bosses']: elif req['condition'] & 0x7F == req_table['PrizeBosses']:
goal['logic']['bosses'] = req['target'] or 10 goal['logic']['bosses'] = req['target'] or 10
elif req['condition'] & 0x7F == req_table['Aga1']: elif req['condition'] & 0x7F == req_table['Aga1']:
goal['logic']['aga1'] = True goal['logic']['aga1'] = True

2
Rom.py
View File

@@ -43,7 +43,7 @@ from source.enemizer.Enemizer import write_enemy_shuffle_settings
JAP10HASH = '03a63945398191337e896e5771f77173' JAP10HASH = '03a63945398191337e896e5771f77173'
RANDOMIZERBASEHASH = 'ec0ac9063daaeb39faf1282faa3fdba8' RANDOMIZERBASEHASH = '72c4b2d00057d1faced32871d8081f3a'
class JsonRom(object): class JsonRom(object):

Binary file not shown.

View File

@@ -117,7 +117,7 @@ For the various events, you may define many conditions for the player to meet. A
* `Crystals` (Default: 7) * `Crystals` (Default: 7)
* `PendantBosses` (Default: 3) * `PendantBosses` (Default: 3)
* `CrystalBosses` (Default: 7) * `CrystalBosses` (Default: 7)
* `Bosses` (Default: 10) * `PrizeBosses` (Default: 10)
* `Agahnim1Defeated` * `Agahnim1Defeated`
* `Agahnim2Defeated` * `Agahnim2Defeated`
* `TriforcePieces` (Default: set elsewhere) * `TriforcePieces` (Default: set elsewhere)