From 59897185868ff8627a2f88e21874366c6abed3e1 Mon Sep 17 00:00:00 2001 From: Kevin Cathcart Date: Sat, 24 Feb 2018 16:16:50 -0500 Subject: [PATCH] Easy mode lamp update You can find all 3 lamps before dark rooms for easy mode. --- BaseClasses.py | 1 + ItemList.py | 19 ++++++++++++++----- Main.py | 3 ++- Rules.py | 8 ++++---- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index 26d74849..fe772105 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -61,6 +61,7 @@ class World(object): self.difficulty_requirements = None self.fix_fake_world = True self.spoiler = Spoiler(self) + self.lamps_needed_for_dark_rooms = 1 def intialize_regions(self): for region in self.regions: diff --git a/ItemList.py b/ItemList.py index 3976bd79..7b9bf34a 100644 --- a/ItemList.py +++ b/ItemList.py @@ -40,7 +40,7 @@ hardbaseitems = (['Silver Arrows', 'Single Arrow', 'Single Bomb'] + ['Rupees (30 ['Boss Heart Container'] * 5 + ['Piece of Heart'] * 24) hardfirst20extra = ['Single Bomb'] * 7 + ['Rupees (5)'] * 8 + ['Rupee (1)'] * 2 + ['Rupees (20)'] * 2 + ['Arrows (10)'] hardsecond10extra = ['Rupees (5)'] * 7 + ['Rupee (1)'] * 3 -hardthird10extra = ['Arrows (10)'] * 4 + ['Rupees (20)'] * 3 + ['Single Bomb'] * 3 +hardthird10extra = ['Arrows (10)'] * 4 + ['Rupees (20)'] * 3 + ['Single Bomb'] * 3 hardfourth10extra = ['Rupees (5)'] * 3 + ['Single Arrow'] * 5 + ['Single Bomb'] * 2 hardfinal20extra = ['Single Bomb'] * 4 + ['Rupees (5)'] * 2 + ['Single Arrow'] * 14 @@ -217,14 +217,15 @@ def generate_itempool(world): # set up item pool if world.custom: - (pool, placed_items, clock_mode, treasure_hunt_count, treasure_hunt_icon) = make_custom_item_pool(world.progressive, world.shuffle, world.difficulty, world.timer, world.goal, world.mode, world.customitemarray) + (pool, placed_items, clock_mode, treasure_hunt_count, treasure_hunt_icon, lamps_needed_for_dark_rooms) = make_custom_item_pool(world.progressive, world.shuffle, world.difficulty, world.timer, world.goal, world.mode, world.customitemarray) world.rupoor_cost = min(world.customitemarray[67], 9999) else: - (pool, placed_items, clock_mode, treasure_hunt_count, treasure_hunt_icon) = get_pool_core(world.progressive, world.shuffle, world.difficulty, world.timer, world.goal, world.mode) + (pool, placed_items, clock_mode, treasure_hunt_count, treasure_hunt_icon, lamps_needed_for_dark_rooms) = get_pool_core(world.progressive, world.shuffle, world.difficulty, world.timer, world.goal, world.mode) world.itempool = ItemFactory(pool) for (location, item) in placed_items: world.push_item(location, ItemFactory(item), False) world.get_location(location).event = True + world.lamps_needed_for_dark_rooms = lamps_needed_for_dark_rooms if clock_mode is not None: world.clock_mode = clock_mode if treasure_hunt_count is not None: @@ -299,6 +300,10 @@ def get_pool_core(progressive, shuffle, difficulty, timer, goal, mode): else: pool.extend(basicgloves) + lamps_needed_for_dark_rooms = 1 + if difficulty == 'easy': + lamps_needed_for_dark_rooms = 3 + # insanity shuffle doesn't have fake LW/DW logic so for now guaranteed Mirror and Moon Pearl at the start if shuffle == 'insanity_legacy': placed_items.append(('Link\'s House', 'Magic Mirror')) @@ -377,7 +382,7 @@ def get_pool_core(progressive, shuffle, difficulty, timer, goal, mode): if goal == 'pedestal': placed_items.append(('Master Sword Pedestal', 'Triforce')) - return (pool, placed_items, clock_mode, treasure_hunt_count, treasure_hunt_icon) + return (pool, placed_items, clock_mode, treasure_hunt_count, treasure_hunt_icon, lamps_needed_for_dark_rooms) def make_custom_item_pool(progressive, shuffle, difficulty, timer, goal, mode, customitemarray): pool = [] @@ -461,6 +466,10 @@ def make_custom_item_pool(progressive, shuffle, difficulty, timer, goal, mode, c diff = difficulties[difficulty] + lamps_needed_for_dark_rooms = 1 + if difficulty == 'easy': + lamps_needed_for_dark_rooms = customitemarray[12] + # expert+ difficulties produce the same contents for # all bottles, since only one bottle is available if diff.same_bottle: @@ -515,7 +524,7 @@ def make_custom_item_pool(progressive, shuffle, difficulty, timer, goal, mode, c if itemtotal < total_items_to_place: pool.extend(['Nothing'] * (total_items_to_place - itemtotal)) - return (pool, placed_items, clock_mode, treasure_hunt_count, treasure_hunt_icon) + return (pool, placed_items, clock_mode, treasure_hunt_count, treasure_hunt_icon, lamps_needed_for_dark_rooms) # A quick test to ensure all combinations generate the correct amount of items. def test(): diff --git a/Main.py b/Main.py index 20987065..8d4916ee 100644 --- a/Main.py +++ b/Main.py @@ -146,7 +146,8 @@ def copy_world(world): ret.can_access_trock_eyebridge = world.can_access_trock_eyebridge ret.can_take_damage = world.can_take_damage ret.difficulty_requirements = world.difficulty_requirements - ret.fix_fake_world = ret.fix_fake_world + ret.fix_fake_world = world.fix_fake_world + ret.lamps_needed_for_dark_rooms = world.lamps_needed_for_dark_rooms create_regions(ret) create_dungeons(ret) diff --git a/Rules.py b/Rules.py index d29c360b..484abe64 100644 --- a/Rules.py +++ b/Rules.py @@ -53,7 +53,7 @@ def add_rule(spot, rule, combine='and'): def add_lamp_requirement(spot): - add_rule(spot, lambda state: state.has('Lamp')) + add_rule(spot, lambda state: state.has('Lamp', state.world.lamps_needed_for_dark_rooms)) def forbid_item(location, item): @@ -437,9 +437,9 @@ def no_glitches_rules(world): add_conditional_lamp('Eastern Palace - Prize', 'Eastern Palace', 'Location') if not world.sewer_light_cone: - add_rule(world.get_location('Sewers - Dark Cross'), lambda state: state.has('Lamp')) - add_rule(world.get_entrance('Sewers Back Door'), lambda state: state.has('Lamp')) - add_rule(world.get_entrance('Throne Room'), lambda state: state.has('Lamp')) + add_lamp_requirement(world.get_location('Sewers - Dark Cross')) + add_lamp_requirement(world.get_entrance('Sewers Back Door')) + add_lamp_requirement(world.get_entrance('Throne Room')) def open_rules(world):