New silver arrow hints

Supporting progressive bows.
This commit is contained in:
Kevin Cathcart 2019-08-21 22:40:19 -04:00
parent 72d4e6c76a
commit c0acfdd81e
2 changed files with 36 additions and 7 deletions

29
Rom.py
View File

@ -434,6 +434,14 @@ class Sprite(object):
def patch_rom(world, player, rom):
random.seed(world.rom_seeds[player])
# progressive bow silver arrow hint hack
prog_bow_locs = world.find_items('Progressive Bow', player)
if len(prog_bow_locs) > 1:
# only pick a distingushed bow if we have at least two
distinguished_prog_bow_loc = random.choice(prog_bow_locs)
distinguished_prog_bow_loc.item.code = 0x65
# patch items
for location in world.get_locations():
if location.player != player:
@ -1321,11 +1329,28 @@ def write_strings(rom, world, player):
for location in hint_locations:
tt[location] = junk_hints.pop(0)
# We still need the older hints of course. Those are done here.
# We still need the older hints of course. Those are done here.
silverarrows = world.find_items('Silver Arrows', player)
random.shuffle(silverarrows)
silverarrow_hint = (' %s?' % hint_text(silverarrows[0]).replace('Ganon\'s', 'my')) if silverarrows else '?\nI think not!'
tt['ganon_phase_3'] = 'Did you find the silver arrows%s' % silverarrow_hint
tt['ganon_phase_3_no_silvers'] = 'Did you find the silver arrows%s' % silverarrow_hint
prog_bow_locs = world.find_items('Progressive Bow', player)
distinguished_prog_bow_loc = next((location for location in prog_bow_locs if location.item.code == 0x65), None)
if distinguished_prog_bow_loc:
prog_bow_locs.remove(distinguished_prog_bow_loc)
silverarrow_hint = (' %s?' % hint_text(distinguished_prog_bow_loc).replace('Ganon\'s', 'my'))
tt['ganon_phase_3_no_silvers'] = 'Did you find the silver arrows%s' % silverarrow_hint
if any(prog_bow_locs):
silverarrow_hint = (' %s?' % hint_text(random.choice(prog_bow_locs)).replace('Ganon\'s', 'my'))
tt['ganon_phase_3_no_silvers_alt'] = 'Did you find the silver arrows%s' % silverarrow_hint
silverarrow_hint = (' %s?' % hint_text(silverarrows[0]).replace('Ganon\'s', 'my')) if silverarrows else '?\nI think not!'
crystal5 = world.find_items('Crystal 5', player)[0]
crystal6 = world.find_items('Crystal 6', player)[0]

14
Text.py
View File

@ -535,7 +535,7 @@ class MultiByteCoreTextMapper(object):
"{INTRO}": [0x6E, 0x00, 0x77, 0x07, 0x7A, 0x03, 0x6B, 0x02, 0x67],
"{NOTEXT}": [0x6E, 0x00, 0x6B, 0x04],
"{IBOX}": [0x6B, 0x02, 0x77, 0x07, 0x7A, 0x03],
"{C:GREEN}": [0x77, 0x07],
"{C:GREEN}": [0x77, 0x07],
"{C:YELLOW}": [0x77, 0x02],
}
@ -552,10 +552,10 @@ class MultiByteCoreTextMapper(object):
linespace = wrap
line = lines.pop(0)
if line.startswith('{'):
if line == '{PAGEBREAK}':
if lineindex % 3 != 0:
# insert a wait for keypress, unless we just did so
outbuf.append(0x7E)
if line == '{PAGEBREAK}':
if lineindex % 3 != 0:
# insert a wait for keypress, unless we just did so
outbuf.append(0x7E)
lineindex = 0
outbuf.extend(cls.special_commands[line])
continue
@ -1885,5 +1885,9 @@ class TextTable(object):
text['fish_money'] = CompressedTextMapper.convert("It's a secret to everyone.")
text['sign_ganons_tower'] = CompressedTextMapper.convert("You need all 7 crystals to enter.")
text['sign_ganon'] = CompressedTextMapper.convert("You need all 7 crystals to beat Ganon.")
text['ganon_phase_3_no_bow'] = CompressedTextMapper.convert("You have no bow. Dingus!")
text['ganon_phase_3_no_silvers_alt'] = CompressedTextMapper.convert("You can't best me without silver arrows!")
text['ganon_phase_3_no_silvers'] = CompressedTextMapper.convert("You can't best me without silver arrows!")
text['ganon_phase_3_silvers'] = CompressedTextMapper.convert("Oh no! Silver! My one true weakness!")
text['end_pad_data'] = bytearray([0xfb])
text['terminator'] = bytearray([0xFF, 0xFF])