From 0b0f43f5bfa43c55714e859a6b70526856eda07f Mon Sep 17 00:00:00 2001 From: LLCoolDave Date: Sat, 20 May 2017 20:03:13 +0200 Subject: [PATCH] Minor bug fixes, added text to all NPCs. --- BaseClasses.py | 2 +- Main.py | 9 +++++++++ Rules.py | 28 +++++++--------------------- Text.py | 11 ++++++----- 4 files changed, 23 insertions(+), 27 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index d611aaaa..42192b63 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -62,7 +62,7 @@ class World(object): if r_location.name == location: self._location_cache[location] = r_location return r_location - raise RuntimeError('No such entrance %s' % location) + raise RuntimeError('No such location %s' % location) def find_items(self, item): return [location for location in self.get_locations() if location.item is not None and location.item.name == item] diff --git a/Main.py b/Main.py index 7f0359e8..9b2f0219 100644 --- a/Main.py +++ b/Main.py @@ -451,6 +451,15 @@ def patch_rom(world, rom): # write strings write_string_to_rom(rom, 'Ganon2', 'Did you find the silver arrows in Hyrule?') write_string_to_rom(rom, 'Uncle', 'Good Luck!\nYou will need it.') + write_string_to_rom(rom, 'Triforce', 'Product has Hole in center. Bad seller, 0 out of 5.') + write_string_to_rom(rom, 'BombShop1', 'Big Bomb?\nI Uh … Never heard of that. Move along.') + write_string_to_rom(rom, 'BombShop2', 'Bombs!\nBombs!\nBiggest!\nBestest!\nGreatest!\nBoomest!') + write_string_to_rom(rom, 'PyramidFairy', 'May I talk to you about our lord and savior, Ganon?') + write_string_to_rom(rom, 'Sahasrahla1', 'How Did you Find me?') + write_string_to_rom(rom, 'Sahasrahla2', 'You already got my item, idiot.') + write_string_to_rom(rom, 'Blind', 'I bet you expected a vision related pun?\n\nNot Today.\n Didn\'t see that coming, did you?') + write_string_to_rom(rom, 'Ganon1', '\n\n\n\n\n\n\n\n\nWhy are you reading an empty textbox?') + write_string_to_rom(rom, 'TavernMan', 'Did you know that talking to random NPCs wastes time in a race? I hope this information may be of use to you in the future.') altaritem = world.get_location('Altar').item.name if world.get_location('Altar').item is not None else 'Nothing' write_string_to_rom(rom, 'Altar', altar_text.get(altaritem, 'Unknown Item.')) diff --git a/Rules.py b/Rules.py index eb2f0e3c..a145407e 100644 --- a/Rules.py +++ b/Rules.py @@ -87,6 +87,7 @@ def global_rules(world): set_rule(world.get_location('Purple Chest'), lambda state: state.can_reach('Blacksmiths', 'Location')) set_rule(world.get_location('Piece of Heart (Zoras River)'), lambda state: state.has('Flippers')) + set_rule(world.get_entrance('Waterfall of Wishing'), lambda state: state.has('Flippers')) # can be fake flippered into, but is in weird state inside that might prevent you from doing things. Can be improved in future Todo set_rule(world.get_location('Blacksmiths'), lambda state: state.can_lift_heavy_rocks() and state.has_Mirror() and state.can_reach('West Dark World')) set_rule(world.get_location('Magic Bat'), lambda state: state.has('Magic Powder')) set_rule(world.get_location('Sick Kid'), lambda state: state.has('Bottle')) @@ -224,9 +225,9 @@ def global_rules(world): set_rule(world.get_entrance('Ice Palace Entrance Room'), lambda state: state.has('Fire Rod') or state.has('Bombos')) set_rule(world.get_location('[dungeon-D5-B5] Ice Palace - Big Chest'), lambda state: state.can_collect('Big Key (Ice Palace)')) set_rule(world.get_entrance('Ice Palace (Kholdstare)'), lambda state: state.can_lift_rocks() and state.has('Hammer') and state.can_collect('Big Key (Ice Palace)') and state.can_collect('Small Key (Ice Palace)', 2)) - set_rule(world.get_entrance('Ice Palace (East)'), lambda state: state.has('Hookshot') or (state.can_collect('Small Key(Ice Palace)', 1) and ((state.world.get_location('[dungeon-D5-B3] Ice Palace - Spike Room').item is not None and state.world.get_location('[dungeon-D5-B3] Ice Palace - Spike Room').item.name in ['Big Key (Ice Palace)']) or - (state.world.get_location('[dungeon-D5-B1] Ice Palace - Big Key Room').item is not None and state.world.get_location('[dungeon-D5-B1] Ice Palace - Big Key Room').item.name in ['Big Key (Ice Palace)']) or - (state.world.get_location('[dungeon-D5-B2] Ice Palace - Map Room').item is not None and state.world.get_location('[dungeon-D5-B2] Ice Palace - Map Room').item.name in ['Big Key (Ice Palace)'])))) # if you do ipbj and waste SKs in the basement, you have to BJ over the hookshot room to fix your mess potentially. This seems fair + set_rule(world.get_entrance('Ice Palace (East)'), lambda state: state.has('Hookshot') or (state.can_collect('Small Key (Ice Palace)', 1) and ((state.world.get_location('[dungeon-D5-B3] Ice Palace - Spike Room').item is not None and state.world.get_location('[dungeon-D5-B3] Ice Palace - Spike Room').item.name in ['Big Key (Ice Palace)']) or + (state.world.get_location('[dungeon-D5-B1] Ice Palace - Big Key Room').item is not None and state.world.get_location('[dungeon-D5-B1] Ice Palace - Big Key Room').item.name in ['Big Key (Ice Palace)']) or + (state.world.get_location('[dungeon-D5-B2] Ice Palace - Map Room').item is not None and state.world.get_location('[dungeon-D5-B2] Ice Palace - Map Room').item.name in ['Big Key (Ice Palace)'])))) # if you do ipbj and waste SKs in the basement, you have to BJ over the hookshot room to fix your mess potentially. This seems fair set_rule(world.get_entrance('Ice Palace (East Top)'), lambda state: state.can_lift_rocks() and state.has('Hammer')) for location in ['[dungeon-D5-B5] Ice Palace - Big Chest', 'Kholdstare - Heart Container']: forbid_item(world.get_location(location), 'Big Key (Ice Palace)') @@ -300,7 +301,6 @@ def global_rules(world): def no_glitches_rules(world): set_rule(world.get_entrance('Zoras River'), lambda state: state.has('Flippers') or state.can_lift_rocks()) - set_rule(world.get_entrance('Waterfall of Wishing'), lambda state: state.has('Flippers')) # can be fake flippered into set_rule(world.get_entrance('Capacity Upgrade'), lambda state: state.has('Flippers')) # can be fake flippered to set_rule(world.get_entrance('Hobo Bridge'), lambda state: state.has('Flippers')) add_rule(world.get_entrance('Ice Palace'), lambda state: state.has_Pearl() and state.has('Flippers')) @@ -313,22 +313,8 @@ def no_glitches_rules(world): # Light cones in standard depend on which world we actually are in, not which one the location would normally be # We add Lamp requirements only to those locations which lie in the dark world (or everything if open - DW_Entrances = ['Bumper Cave (Bottom)', - 'Dark Death Mountain Climb (Top)', - 'Dark Death Mountain Climb (Bottom)', - 'Hookshot Cave', - 'Bumper Cave (Top)', - 'Hookshot Cave Back Entrance', - 'Dark Death Mountain Ledge (East)', - 'Turtle Rock Isolated Ledge Entrance', - 'Thieves Town', - 'Skull Woods Final Section', - 'Ice Palace', - 'Misery Mire', - 'Palace of Darkness', - 'Swamp Palace', - 'Turtle Rock', - 'Dark Death Mountain Ledge (West)'] + DW_Entrances = ['Bumper Cave (Bottom)', 'Dark Death Mountain Climb (Top)', 'Dark Death Mountain Climb (Bottom)', 'Hookshot Cave', 'Bumper Cave (Top)', 'Hookshot Cave Back Entrance', 'Dark Death Mountain Ledge (East)', + 'Turtle Rock Isolated Ledge Entrance', 'Thieves Town', 'Skull Woods Final Section', 'Ice Palace', 'Misery Mire', 'Palace of Darkness', 'Swamp Palace', 'Turtle Rock', 'Dark Death Mountain Ledge (West)'] def check_is_dark_world(region): for entrance in region.entrances: @@ -393,5 +379,5 @@ def set_blacksmith_rules(world): def set_big_bomb_rules(world): # this is a mess and needs to be worked out properly ToDo # very broad restrictions so can always get there - set_rule(world.get_entrance('Pyramid Fairy'), lambda state: state.has_Mirror() and state.can_reach('Big Bomb Shop', 'Region') and state.can_collect('Crystal 5') and state.can_collect('Crystal 6') and + set_rule(world.get_entrance('Pyramid Fairy'), lambda state: state.has_Mirror() and state.has_Pearl() and state.can_reach('Big Bomb Shop', 'Region') and state.can_collect('Crystal 5') and state.can_collect('Crystal 6') and state.has('Ocarina') and state.has('Hammer') and state.can_lift_rocks()) diff --git a/Text.py b/Text.py index 70f38c31..aaa1b5fc 100644 --- a/Text.py +++ b/Text.py @@ -9,8 +9,7 @@ text_addresses = {'Altar': (0x180300, 256), 'Sahasrahla2': (0x180B00, 256), 'BombShop1': (0x180E00, 256), 'BombShop2': (0x180D00, 256), - 'PyramidFairy': (0x180900, 256), - } + 'PyramidFairy': (0x180900, 256)} altar_text = {'Fighter Sword': 'A pathetic\nsword rests\nhere!', @@ -119,8 +118,10 @@ def string_to_alttp_text(s, maxbytes=256): # check for max length if len(outbuf) > maxbytes - 1: outbuf = outbuf[:maxbytes - 1] + # make sure we interpret the end of box character + if outbuf[-1] == 0x00: + outbuf[-1] = 0x73 - outbuf[-1] = 0x73 outbuf.append(0x7F) return outbuf @@ -139,7 +140,7 @@ char_map = {' ': 0xFF, '.': 0xCD, '~': 0xCE, '~': 0xCE, - '\'': 0xD8, + "'": 0xD8, '’': 0xD8, '↑': 0xE0, '↓': 0xE1, @@ -308,7 +309,7 @@ char_map = {' ': 0xFF, def char_to_alttp_char(char): if 0x30 <= ord(char) <= 0x39: - return ord(char) + 0x80 + return ord(char) + 0x70 if 0x41 <= ord(char) <= 0x5A: return ord(char) + 0x69