Update item counter for mystery

Fixed bug with door restart
Made retro keys more lenient with door shuffle
This commit is contained in:
aerinon
2021-02-13 20:58:59 -07:00
parent 2765f9bec0
commit 2caf5abe4a
6 changed files with 28 additions and 9 deletions

View File

@@ -35,7 +35,7 @@ def link_doors(world, player):
door.dest = None door.dest = None
door.entranceFlag = False door.entranceFlag = False
ent = door.entrance ent = door.entrance
if door.type != DoorType.Logical and ent.connected_region is not None: if (door.type != DoorType.Logical or door.controller) and ent.connected_region is not None:
ent.connected_region.entrances = [x for x in ent.connected_region.entrances if x != ent] ent.connected_region.entrances = [x for x in ent.connected_region.entrances if x != ent]
ent.connected_region = None ent.connected_region = None
for portal in world.dungeon_portals[player]: for portal in world.dungeon_portals[player]:
@@ -2012,6 +2012,7 @@ class DROptions(Flag):
OriginalPalettes = 0x20 OriginalPalettes = 0x20
Open_PoD_Wall = 0x40 # If on, pre opens the PoD wall, no bow required Open_PoD_Wall = 0x40 # If on, pre opens the PoD wall, no bow required
Open_Desert_Wall = 0x80 # If on, pre opens the desert wall, no fire required Open_Desert_Wall = 0x80 # If on, pre opens the desert wall, no fire required
Hide_Total = 0x100
# DATA GOES DOWN HERE # DATA GOES DOWN HERE

View File

@@ -753,6 +753,11 @@ def get_pool_core(progressive, shuffle, difficulty, timer, goal, mode, swords, r
pool = [item.replace('Arrow Upgrade (+5)','Rupees (5)') for item in pool] pool = [item.replace('Arrow Upgrade (+5)','Rupees (5)') for item in pool]
pool = [item.replace('Arrow Upgrade (+10)','Rupees (5)') for item in pool] pool = [item.replace('Arrow Upgrade (+10)','Rupees (5)') for item in pool]
pool.extend(diff.retro) pool.extend(diff.retro)
if door_shuffle != 'vanilla': # door shuffle needs more keys for retro
replace = 'Rupees (20)' if difficulty == 'normal' else 'Rupees (5)'
indices = [i for i, x in enumerate(pool) if x == replace]
for i in range(0, min(10, len(indices))):
pool[indices[i]] = 'Small Key (Universal)'
if mode == 'standard': if mode == 'standard':
if door_shuffle == 'vanilla': if door_shuffle == 'vanilla':
key_location = random.choice(['Secret Passage', 'Hyrule Castle - Boomerang Chest', 'Hyrule Castle - Map Chest', 'Hyrule Castle - Zelda\'s Chest', 'Sewers - Dark Cross']) key_location = random.choice(['Secret Passage', 'Hyrule Castle - Boomerang Chest', 'Hyrule Castle - Map Chest', 'Hyrule Castle - Zelda\'s Chest', 'Sewers - Dark Cross'])

View File

@@ -256,7 +256,7 @@ def main(args, seed=None, fish=None):
logging.warning(enemizerMsg) logging.warning(enemizerMsg)
raise EnemizerError(enemizerMsg) raise EnemizerError(enemizerMsg)
patch_rom(world, rom, player, team, enemized) patch_rom(world, rom, player, team, enemized, bool(args.outputname))
if args.race: if args.race:
patch_race_rom(rom) patch_race_rom(rom)

8
Rom.py
View File

@@ -525,7 +525,8 @@ class Sprite(object):
# split into palettes of 15 colors # split into palettes of 15 colors
return array_chunk(palette_as_colors, 15) return array_chunk(palette_as_colors, 15)
def patch_rom(world, rom, player, team, enemized):
def patch_rom(world, rom, player, team, enemized, is_mystery=False):
random.seed(world.rom_seeds[player]) random.seed(world.rom_seeds[player])
# progressive bow silver arrow hint hack # progressive bow silver arrow hint hack
@@ -714,7 +715,10 @@ def patch_rom(world, rom, player, team, enemized):
rom.write_byte(0x13f000+dungeon_id, opposite_door.roomIndex) rom.write_byte(0x13f000+dungeon_id, opposite_door.roomIndex)
elif not opposite_door: elif not opposite_door:
rom.write_byte(0x13f000+dungeon_id, 0) # no supertile preceeding boss rom.write_byte(0x13f000+dungeon_id, 0) # no supertile preceeding boss
rom.write_byte(0x138004, dr_flags.value) if is_mystery:
dr_flags |= DROptions.Hide_Total
rom.write_byte(0x138004, dr_flags.value & 0xff)
rom.write_byte(0x138005, (dr_flags.value & 0xff00) >> 8)
if dr_flags & DROptions.Town_Portal and world.mode[player] == 'inverted': if dr_flags & DROptions.Town_Portal and world.mode[player] == 'inverted':
rom.write_byte(0x138006, 1) rom.write_byte(0x138006, 1)

View File

@@ -1592,6 +1592,7 @@ def add_key_logic_rules(world, player):
if keys.opposite: if keys.opposite:
rule = or_rule(rule, create_advanced_key_rule(d_logic, player, keys.opposite)) rule = or_rule(rule, create_advanced_key_rule(d_logic, player, keys.opposite))
add_rule(spot, rule) add_rule(spot, rule)
for location in d_logic.bk_restricted: for location in d_logic.bk_restricted:
if not location.forced_item: if not location.forced_item:
forbid_item(location, d_logic.bk_name, player) forbid_item(location, d_logic.bk_name, player)
@@ -1601,6 +1602,11 @@ def add_key_logic_rules(world, player):
add_rule(world.get_entrance(door.name, player), create_rule(d_logic.bk_name, player)) add_rule(world.get_entrance(door.name, player), create_rule(d_logic.bk_name, player))
for chest in d_logic.bk_chests: for chest in d_logic.bk_chests:
add_rule(world.get_location(chest.name, player), create_rule(d_logic.bk_name, player)) add_rule(world.get_location(chest.name, player), create_rule(d_logic.bk_name, player))
if world.retro[player]:
for d_name, layout in world.key_layout[player].items():
for door in layout.flat_prop:
if world.mode[player] != 'standard' or not retro_in_hc(door.entrance):
add_rule(door.entrance, create_key_rule('Small Key (Universal)', player, 1))
def retro_in_hc(spot): def retro_in_hc(spot):

View File

@@ -15,11 +15,14 @@ HudAdditions:
LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+4 ; draw 10's digit LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+4 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+6 ; draw 1's digit LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+6 ; draw 1's digit
LDA.w #$2830 : STA !GOAL_DRAW_ADDRESS+8 ; draw slash LDA.w #$2830 : STA !GOAL_DRAW_ADDRESS+8 ; draw slash
lda $7EF33E LDA.l DRFlags : AND #$0100 : BNE +
jsr HudHexToDec4DigitCopy lda $7EF33E
LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit jsr HudHexToDec4DigitCopy
LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+12 ; draw 10's digit LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+14 ; draw 1's digit LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+12 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+14 ; draw 1's digit
BRA ++
+ LDA.w #$2405 : STA !GOAL_DRAW_ADDRESS+10 : STA !GOAL_DRAW_ADDRESS+12 : STA !GOAL_DRAW_ADDRESS+14
++ ++
LDX $1B : BNE + : RTS : + ; Skip if outdoors LDX $1B : BNE + : RTS : + ; Skip if outdoors