All futuro code - apart from logic

This commit is contained in:
StructuralMike
2021-03-03 13:38:37 +01:00
parent 6f39648666
commit 8a203c3158
4 changed files with 101 additions and 11 deletions

58
Rom.py
View File

@@ -830,6 +830,21 @@ def patch_rom(world, rom, player, team, enemized):
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
if world.difficulty_adjustments[player] == 'hard':
rom.write_byte(0x180181, 0x01) # Make silver arrows work only on ganon
@@ -841,7 +856,7 @@ def patch_rom(world, rom, player, team, enemized):
# potion magic restore amount
rom.write_byte(0x180085, 0x40) # Half Magic
#Cape magic cost
rom.write_bytes(0x3ADA7, [0x02, 0x04, 0x08])
magic_cost['Magic Cape Residual'][1] = [0x02, 0x04, 0x08]
# Byrna Invulnerability: off
rom.write_byte(0x18004F, 0x00)
#Disable catching fairies
@@ -861,7 +876,7 @@ def patch_rom(world, rom, player, team, enemized):
# potion magic restore amount
rom.write_byte(0x180085, 0x20) # Quarter Magic
#Cape magic cost
rom.write_bytes(0x3ADA7, [0x02, 0x04, 0x08])
magic_cost['Magic Cape Residual'][1] = [0x02, 0x04, 0x08]
# Byrna Invulnerability: off
rom.write_byte(0x18004F, 0x00)
#Disable catching fairies
@@ -881,7 +896,7 @@ def patch_rom(world, rom, player, team, enemized):
# potion magic restore amount
rom.write_byte(0x180085, 0x80) # full
#Cape magic cost
rom.write_bytes(0x3ADA7, [0x04, 0x08, 0x10])
magic_cost['Magic Cape Residual'][1] = [0x04, 0x08, 0x10]
# Byrna Invulnerability: on
rom.write_byte(0x18004F, 0x01)
#Enable catching fairies
@@ -896,11 +911,21 @@ def patch_rom(world, rom, player, team, enemized):
else:
overflow_replacement = GREEN_TWENTY_RUPEES
#Byrna residual magic cost
rom.write_bytes(0x45C42, [0x04, 0x02, 0x01])
difficulty = world.difficulty_requirements[player]
#Shift magic consumption costs if futuro
if world.futuro[player]:
for item in magic_cost:
magic_cost[item][1][2] = magic_cost[item][1][1]
magic_cost[item][1][1] = magic_cost[item][1][0]
magic_cost[item][1][0] = 0x81
# Cape consumpion is a cost/X tick thing
magic_cost['Magic Cape Residual'][1][0] = 0x01
#Write magic consumption rates to rom
for _,values in magic_cost.items():
rom.write_bytes(values[0], values[1])
#Set overflow items for progressive equipment
rom.write_bytes(0x180090,
[difficulty.progressive_sword_limit if world.swords[player] != 'swordless' else 0, overflow_replacement,
@@ -990,7 +1015,7 @@ def patch_rom(world, rom, player, team, enemized):
rom.write_bytes(0x184000, [
# original_item, limit, replacement_item, filler
0x12, 0x01, 0x35, 0xFF, # lamp -> 5 rupees
0x51, 0x06, 0x52, 0xFF, # 6 +5 bomb upgrades -> +10 bomb upgrade
0x51, 0x00 if world.futuro[player] else 0x06, 0x31 if world.futuro[player] else 0x52, 0xFF, # 6 +5 bomb upgrades -> +10 bomb upgrade. If bomb-futuro, turns into Bombs (10)
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)
0x3E, difficulty.boss_heart_container_limit, 0x47, 0xff, # boss heart -> green 20
@@ -1103,8 +1128,12 @@ def patch_rom(world, rom, player, team, enemized):
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(0x180168, 0x08) # Spike Cave Damage
rom.write_bytes(0x18016B, [0x04, 0x02, 0x01]) #Set spike cave and MM spike room Cape usage
rom.write_bytes(0x18016E, [0x04, 0x08, 0x10]) #Set spike cave and MM spike room Cape usage
if world.futuro[player]:
rom.write_bytes(0x18016B, [0x81, 0x04, 0x02]) # Set spike cave and MM spike room Byrna 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_byte(0x50599, 0x00) # disable below ganon chest
rom.write_bytes(0xE9A5, [0x7E, 0x00, 0x24]) # disable below ganon chest
@@ -1123,7 +1152,10 @@ def patch_rom(world, rom, player, team, enemized):
equip[0x36C] = 0x18
equip[0x36D] = 0x18
equip[0x379] = 0x68
starting_max_bombs = 10
if world.futuro[player]:
starting_max_bombs = 0
else:
starting_max_bombs = 10
starting_max_arrows = 30
startingstate = CollectionState(world)
@@ -1259,6 +1291,12 @@ def patch_rom(world, rom, player, team, enemized):
else:
raise RuntimeError(f'Unsupported item in starting equipment: {item.name}')
# Set basepatch switches for the futuro mode
if world.futuro[player]:
rom.write_byte(0x18008D, 0x00)
else:
rom.write_byte(0x18008E, 0x01)
equip[0x343] = min(equip[0x343], starting_max_bombs)
rom.write_byte(0x180034, starting_max_bombs)
equip[0x377] = min(equip[0x377], starting_max_arrows)