Skip to content

Commit b109bb1

Browse files
Berserker66qwint
authored andcommitted
LttP: allow Triforce Piece as start inventory item (ArchipelagoMW#3292)
1 parent ddb2597 commit b109bb1

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

worlds/alttp/Rom.py

+14-10
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,8 @@ def chunk(l, n):
12691269
rom.write_int32(0x18020C, 0) # starting time (in frames, sint32)
12701270

12711271
# set up goals for treasure hunt
1272-
rom.write_int16(0x180163, local_world.treasure_hunt_required)
1272+
rom.write_int16(0x180163, max(0, local_world.treasure_hunt_required -
1273+
sum(1 for item in world.precollected_items[player] if item.name == "Triforce Piece")))
12731274
rom.write_bytes(0x180165, [0x0E, 0x28]) # Triforce Piece Sprite
12741275
rom.write_byte(0x180194, 1) # Must turn in triforced pieces (instant win not enabled)
12751276

@@ -1372,7 +1373,7 @@ def chunk(l, n):
13721373
'Golden Sword', 'Tempered Sword', 'Master Sword', 'Fighter Sword', 'Progressive Sword',
13731374
'Mirror Shield', 'Red Shield', 'Blue Shield', 'Progressive Shield',
13741375
'Red Mail', 'Blue Mail', 'Progressive Mail',
1375-
'Magic Upgrade (1/4)', 'Magic Upgrade (1/2)'}:
1376+
'Magic Upgrade (1/4)', 'Magic Upgrade (1/2)', 'Triforce Piece'}:
13761377
continue
13771378

13781379
set_table = {'Book of Mudora': (0x34E, 1), 'Hammer': (0x34B, 1), 'Bug Catching Net': (0x34D, 1),
@@ -2475,23 +2476,26 @@ def hint_text(dest, ped_hint=False):
24752476
tt['sahasrahla_quest_have_master_sword'] = Sahasrahla2_texts[local_random.randint(0, len(Sahasrahla2_texts) - 1)]
24762477
tt['blind_by_the_light'] = Blind_texts[local_random.randint(0, len(Blind_texts) - 1)]
24772478

2479+
triforce_pieces_required = max(0, w.treasure_hunt_required -
2480+
sum(1 for item in world.precollected_items[player] if item.name == "Triforce Piece"))
2481+
24782482
if world.goal[player] in ['triforce_hunt', 'local_triforce_hunt']:
24792483
tt['ganon_fall_in_alt'] = 'Why are you even here?\n You can\'t even hurt me! Get the Triforce Pieces.'
24802484
tt['ganon_phase_3_alt'] = 'Seriously? Go Away, I will not Die.'
24812485
if world.goal[player] == 'triforce_hunt' and world.players > 1:
24822486
tt['sign_ganon'] = 'Go find the Triforce pieces with your friends... Ganon is invincible!'
24832487
else:
24842488
tt['sign_ganon'] = 'Go find the Triforce pieces... Ganon is invincible!'
2485-
if w.treasure_hunt_required > 1:
2489+
if triforce_pieces_required > 1:
24862490
tt['murahdahla'] = "Hello @. I\nam Murahdahla, brother of\nSahasrahla and Aginah. Behold the power of\n" \
24872491
"invisibility.\n\n\n\n… … …\n\nWait! you can see me? I knew I should have\n" \
24882492
"hidden in a hollow tree. If you bring\n%d Triforce pieces out of %d, I can reassemble it." % \
2489-
(w.treasure_hunt_required, w.treasure_hunt_total)
2493+
(triforce_pieces_required, w.treasure_hunt_total)
24902494
else:
24912495
tt['murahdahla'] = "Hello @. I\nam Murahdahla, brother of\nSahasrahla and Aginah. Behold the power of\n" \
24922496
"invisibility.\n\n\n\n… … …\n\nWait! you can see me? I knew I should have\n" \
24932497
"hidden in a hollow tree. If you bring\n%d Triforce piece out of %d, I can reassemble it." % \
2494-
(w.treasure_hunt_required, w.treasure_hunt_total)
2498+
(triforce_pieces_required, w.treasure_hunt_total)
24952499
elif world.goal[player] in ['pedestal']:
24962500
tt['ganon_fall_in_alt'] = 'Why are you even here?\n You can\'t even hurt me! Your goal is at the pedestal.'
24972501
tt['ganon_phase_3_alt'] = 'Seriously? Go Away, I will not Die.'
@@ -2500,20 +2504,20 @@ def hint_text(dest, ped_hint=False):
25002504
tt['ganon_fall_in'] = Ganon1_texts[local_random.randint(0, len(Ganon1_texts) - 1)]
25012505
tt['ganon_fall_in_alt'] = 'You cannot defeat me until you finish your goal!'
25022506
tt['ganon_phase_3_alt'] = 'Got wax in\nyour ears?\nI can not die!'
2503-
if w.treasure_hunt_required > 1:
2507+
if triforce_pieces_required > 1:
25042508
if world.goal[player] == 'ganon_triforce_hunt' and world.players > 1:
25052509
tt['sign_ganon'] = 'You need to find %d Triforce pieces out of %d with your friends to defeat Ganon.' % \
2506-
(w.treasure_hunt_required, w.treasure_hunt_total)
2510+
(triforce_pieces_required, w.treasure_hunt_total)
25072511
elif world.goal[player] in ['ganon_triforce_hunt', 'local_ganon_triforce_hunt']:
25082512
tt['sign_ganon'] = 'You need to find %d Triforce pieces out of %d to defeat Ganon.' % \
2509-
(w.treasure_hunt_required, w.treasure_hunt_total)
2513+
(triforce_pieces_required, w.treasure_hunt_total)
25102514
else:
25112515
if world.goal[player] == 'ganon_triforce_hunt' and world.players > 1:
25122516
tt['sign_ganon'] = 'You need to find %d Triforce piece out of %d with your friends to defeat Ganon.' % \
2513-
(w.treasure_hunt_required, w.treasure_hunt_total)
2517+
(triforce_pieces_required, w.treasure_hunt_total)
25142518
elif world.goal[player] in ['ganon_triforce_hunt', 'local_ganon_triforce_hunt']:
25152519
tt['sign_ganon'] = 'You need to find %d Triforce piece out of %d to defeat Ganon.' % \
2516-
(w.treasure_hunt_required, w.treasure_hunt_total)
2520+
(triforce_pieces_required, w.treasure_hunt_total)
25172521

25182522
tt['kakariko_tavern_fisherman'] = TavernMan_texts[local_random.randint(0, len(TavernMan_texts) - 1)]
25192523

0 commit comments

Comments
 (0)