From 340725d395e6309539196285f56aeb30aed7b787 Mon Sep 17 00:00:00 2001 From: espeon65536 Date: Fri, 7 Jan 2022 00:04:04 -0500 Subject: [PATCH] OoT: add protection on starting inventory to be only giveable items --- worlds/oot/__init__.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/worlds/oot/__init__.py b/worlds/oot/__init__.py index ee936a44..20139d03 100644 --- a/worlds/oot/__init__.py +++ b/worlds/oot/__init__.py @@ -24,6 +24,7 @@ from .N64Patch import create_patch_file from .Cosmetics import patch_cosmetics from .Hints import hint_dist_keys, get_hint_area, buildWorldGossipHints from .HintList import getRequiredHints +from .SaveContext import SaveContext from Utils import get_options, output_path from BaseClasses import MultiWorld, CollectionState, RegionType @@ -471,13 +472,16 @@ class OOTWorld(World): self.remove_from_start_inventory.remove(item.name) removed_items.append(item.name) else: - self.starting_items[item.name] += 1 - if item.type == 'Song': - self.starting_songs = True - # Call the junk fill and get a replacement - if item in self.itempool: - self.itempool.remove(item) - self.itempool.append(self.create_item(*get_junk_item(pool=junk_pool))) + if item.name not in SaveContext.giveable_items: + raise Exception(f"Invalid OoT starting item: {item.name}") + else: + self.starting_items[item.name] += 1 + if item.type == 'Song': + self.starting_songs = True + # Call the junk fill and get a replacement + if item in self.itempool: + self.itempool.remove(item) + self.itempool.append(self.create_item(*get_junk_item(pool=junk_pool))) if self.start_with_consumables: self.starting_items['Deku Sticks'] = 30 self.starting_items['Deku Nuts'] = 40 @@ -718,7 +722,6 @@ class OOTWorld(World): impa = self.world.get_location("Song from Impa", self.player) if self.skip_child_zelda: if impa.item is None: - from .SaveContext import SaveContext item_to_place = self.world.random.choice(list(item for item in self.world.itempool if item.player == self.player and item.name in SaveContext.giveable_items)) impa.place_locked_item(item_to_place)