minor cleanup

This commit is contained in:
StructuralMike
2021-03-19 17:35:09 +01:00
parent d9d664f7ba
commit 06357f5f21
3 changed files with 15 additions and 35 deletions

View File

@@ -661,12 +661,11 @@ class CollectionState(object):
return self.has('Titans Mitts', player) return self.has('Titans Mitts', player)
def can_extend_magic(self, player, smallmagic=16, fullrefill=False): #This reflects the total magic Link has, not the total extra he has. def can_extend_magic(self, player, smallmagic=16, fullrefill=False): #This reflects the total magic Link has, not the total extra he has.
basemagic = 8
if self.has('Magic Upgrade (1/4)', player): if self.has('Magic Upgrade (1/4)', player):
basemagic = 32 basemagic = 32
elif self.has('Magic Upgrade (1/2)', player): elif self.has('Magic Upgrade (1/2)', player):
basemagic = 16 basemagic = 16
else:
basemagic = 8
if self.can_buy_unlimited('Green Potion', player) or self.can_buy_unlimited('Blue Potion', player): if self.can_buy_unlimited('Green Potion', player) or self.can_buy_unlimited('Blue Potion', player):
if self.world.difficulty_adjustments[player] == 'hard' and not fullrefill: if self.world.difficulty_adjustments[player] == 'hard' and not fullrefill:
basemagic = basemagic + int(basemagic * 0.5 * self.bottle_count(player)) basemagic = basemagic + int(basemagic * 0.5 * self.bottle_count(player))

37
Rom.py
View File

@@ -29,6 +29,7 @@ from EntranceShuffle import door_addresses, exit_ids
JAP10HASH = '03a63945398191337e896e5771f77173' JAP10HASH = '03a63945398191337e896e5771f77173'
RANDOMIZERBASEHASH = '2a9cd9b95c0ad118a3d58a77b7197eab' RANDOMIZERBASEHASH = '2a9cd9b95c0ad118a3d58a77b7197eab'
class JsonRom(object): class JsonRom(object):
def __init__(self, name=None, hash=None): def __init__(self, name=None, hash=None):
@@ -865,21 +866,6 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False):
rom.write_byte(0x18004F, 0x01) # Byrna Invulnerability: on rom.write_byte(0x18004F, 0x01) # Byrna Invulnerability: on
# Default magic consumption costs
magic_cost = {
'Fire and Ice': [0x3B070, [0x10, 0x08, 0x04]],
'Medallions': [0x3B073, [0x20, 0x10, 0x08]],
'Magic Powder': [0x3B076, [0x08, 0x04, 0x02]],
'Unknown 1': [0x3B079, [0x08, 0x04, 0x02]],
'Cane of Somaria': [0x3B07C, [0x08, 0x04, 0x02]],
'Unknown 2': [0x3B07F, [0x10, 0x08, 0x04]],
'Lamp': [0x3B082, [0x04, 0x02, 0x02]],
'Unknown 3': [0x3B085, [0x08, 0x04, 0x02]],
'Cane of Byrna Activation': [0x3B088, [0x10, 0x08, 0x04]],
'Magic Cape Residual': [0x3ADA7, [0x04, 0x08, 0x10]],
'Cane of Byrna Residual': [0x45C42, [0x04, 0x02, 0x01]]
}
# handle difficulty_adjustments # handle difficulty_adjustments
if world.difficulty_adjustments[player] == 'hard': if world.difficulty_adjustments[player] == 'hard':
rom.write_byte(0x180181, 0x01) # Make silver arrows work only on ganon rom.write_byte(0x180181, 0x01) # Make silver arrows work only on ganon
@@ -891,7 +877,7 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False):
# potion magic restore amount # potion magic restore amount
rom.write_byte(0x180085, 0x40) # Half Magic rom.write_byte(0x180085, 0x40) # Half Magic
#Cape magic cost #Cape magic cost
magic_cost['Magic Cape Residual'][1] = [0x02, 0x04, 0x08] rom.write_bytes(0x3ADA7, [0x02, 0x04, 0x08])
# Byrna Invulnerability: off # Byrna Invulnerability: off
rom.write_byte(0x18004F, 0x00) rom.write_byte(0x18004F, 0x00)
#Disable catching fairies #Disable catching fairies
@@ -911,7 +897,7 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False):
# potion magic restore amount # potion magic restore amount
rom.write_byte(0x180085, 0x20) # Quarter Magic rom.write_byte(0x180085, 0x20) # Quarter Magic
#Cape magic cost #Cape magic cost
magic_cost['Magic Cape Residual'][1] = [0x02, 0x04, 0x08] rom.write_bytes(0x3ADA7, [0x02, 0x04, 0x08])
# Byrna Invulnerability: off # Byrna Invulnerability: off
rom.write_byte(0x18004F, 0x00) rom.write_byte(0x18004F, 0x00)
#Disable catching fairies #Disable catching fairies
@@ -931,7 +917,7 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False):
# potion magic restore amount # potion magic restore amount
rom.write_byte(0x180085, 0x80) # full rom.write_byte(0x180085, 0x80) # full
#Cape magic cost #Cape magic cost
magic_cost['Magic Cape Residual'][1] = [0x04, 0x08, 0x10] rom.write_bytes(0x3ADA7, [0x04, 0x08, 0x10])
# Byrna Invulnerability: on # Byrna Invulnerability: on
rom.write_byte(0x18004F, 0x01) rom.write_byte(0x18004F, 0x01)
#Enable catching fairies #Enable catching fairies
@@ -948,9 +934,8 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False):
difficulty = world.difficulty_requirements[player] difficulty = world.difficulty_requirements[player]
#Write magic consumption rates to rom #Byrna residual magic cost
for _,values in magic_cost.items(): rom.write_bytes(0x45C42, [0x04, 0x02, 0x01])
rom.write_bytes(values[0], values[1])
#Set overflow items for progressive equipment #Set overflow items for progressive equipment
rom.write_bytes(0x180090, rom.write_bytes(0x180090,
@@ -1039,7 +1024,7 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False):
rom.write_bytes(0x184000, [ rom.write_bytes(0x184000, [
# original_item, limit, replacement_item, filler # original_item, limit, replacement_item, filler
0x12, 0x01, 0x35, 0xFF, # lamp -> 5 rupees 0x12, 0x01, 0x35, 0xFF, # lamp -> 5 rupees
0x51, 0x06, 0x52, 0xFF, # 6 +5 bomb upgrades -> +10 bomb upgrade. 0x51, 0x06, 0x52, 0xFF, # 6 +5 bomb upgrades -> +10 bomb upgrade
0x53, 0x06, 0x54, 0xFF, # 6 +5 arrow upgrades -> +10 arrow upgrade 0x53, 0x06, 0x54, 0xFF, # 6 +5 arrow upgrades -> +10 arrow upgrade
0x58, 0x01, 0x36 if world.retro[player] else 0x43, 0xFF, # silver arrows -> single arrow (red 20 in retro mode) 0x58, 0x01, 0x36 if world.retro[player] else 0x43, 0xFF, # silver arrows -> single arrow (red 20 in retro mode)
0x3E, difficulty.boss_heart_container_limit, 0x47, 0xff, # boss heart -> green 20 0x3E, difficulty.boss_heart_container_limit, 0x47, 0xff, # boss heart -> green 20
@@ -1153,12 +1138,8 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False):
rom.write_byte(0x180171, 0x01 if world.ganon_at_pyramid[player] else 0x00) # Enable respawning on pyramid after ganon death rom.write_byte(0x180171, 0x01 if world.ganon_at_pyramid[player] else 0x00) # Enable respawning on pyramid after ganon death
rom.write_byte(0x180173, 0x01) # Bob is enabled rom.write_byte(0x180173, 0x01) # Bob is enabled
rom.write_byte(0x180168, 0x08) # Spike Cave Damage rom.write_byte(0x180168, 0x08) # Spike Cave Damage
if not StartingMagic: rom.write_bytes(0x18016B, [0x04, 0x02, 0x01]) # Set spike cave and MM spike room Byrna usage
rom.write_bytes(0x18016B, [0x81, 0x04, 0x02]) # Set spike cave and MM spike room Byrna usage rom.write_bytes(0x18016E, [0x04, 0x08, 0x10]) # Set spike cave and MM spike room Cape usage
rom.write_bytes(0x18016E, [0x01, 0x04, 0x08]) # Set spike cave and MM spike room Cape usage
else:
rom.write_bytes(0x18016B, [0x04, 0x02, 0x01]) # Set spike cave and MM spike room Byrna usage
rom.write_bytes(0x18016E, [0x04, 0x08, 0x10]) # Set spike cave and MM spike room Cape usage
rom.write_bytes(0x50563, [0x3F, 0x14]) # disable below ganon chest rom.write_bytes(0x50563, [0x3F, 0x14]) # disable below ganon chest
rom.write_byte(0x50599, 0x00) # disable below ganon chest rom.write_byte(0x50599, 0x00) # disable below ganon chest
rom.write_bytes(0xE9A5, [0x7E, 0x00, 0x24]) # disable below ganon chest rom.write_bytes(0xE9A5, [0x7E, 0x00, 0x24]) # disable below ganon chest

View File

@@ -11,7 +11,7 @@ py_version = f"{sys.version_info.major}.{sys.version_info.minor}"
SETTINGS = { SETTINGS = {
'mode': ['open', 'standard', 'inverted'], 'mode': ['open'],
'goal': ['ganon', 'pedestal', 'triforcehunt', 'crystals', 'dungeons'], 'goal': ['ganon', 'pedestal', 'triforcehunt', 'crystals', 'dungeons'],
'swords': ['random', 'swordless', 'assured'], 'swords': ['random', 'swordless', 'assured'],
'shuffle': ['vanilla','simple','restricted','full','dungeonssimple','dungeonsfull', 'crossed','insanity'], 'shuffle': ['vanilla','simple','restricted','full','dungeonssimple','dungeonsfull', 'crossed','insanity'],
@@ -25,15 +25,15 @@ SETTINGS = {
} }
SETTINGS = { SETTINGS = {
'mode': ['open'], 'mode': ['open', 'inverted'],
'goal': ['ganon'], 'goal': ['ganon'],
'swords': ['random'], 'swords': ['random'],
'shuffle': ['vanilla'], 'shuffle': ['vanilla'],
'accessibility': [True], 'accessibility': [True],
'difficulty': [False], 'difficulty': [False],
'shufflepots': [False], 'shufflepots': [False],
'keydropshuffle': [False], 'keydropshuffle': [True, False],
'keysanity': [False], 'keysanity': [True, False],
'retro': [False], 'retro': [False],
'shopsanity': [False] 'shopsanity': [False]
} }
@@ -223,7 +223,7 @@ if __name__ == "__main__":
# for dr in [['vanilla', args.count if args.count else 2, 1], # for dr in [['vanilla', args.count if args.count else 2, 1],
# ['basic', args.count if args.count else 5, 1], # ['basic', args.count if args.count else 5, 1],
# ['crossed', args.count if args.count else 10, 1]]: # ['crossed', args.count if args.count else 10, 1]]:
for dr in [['basic', args.count if args.count else 2, 1]]: for dr in [['crossed', args.count if args.count else 2, 1]]:
for tense in range(1, dr[2] + 1): for tense in range(1, dr[2] + 1):
args = argparse.Namespace() args = argparse.Namespace()