From 3d5fefebe798a09088c4a13af2c6c1bb27d0987f Mon Sep 17 00:00:00 2001 From: gaithern Date: Sat, 25 May 2024 10:43:40 -0500 Subject: [PATCH] Added event locations for vanilla items --- worlds/kh1/Items.py | 6 ++++-- worlds/kh1/Locations.py | 10 ++++++++++ worlds/kh1/Regions.py | 14 ++++++++++++++ worlds/kh1/Rules.py | 33 ++++++++++++++++++--------------- worlds/kh1/__init__.py | 14 ++++++++++++++ 5 files changed, 60 insertions(+), 17 deletions(-) diff --git a/worlds/kh1/Items.py b/worlds/kh1/Items.py index 34b21530f0ac..e9ddbff5d4c8 100644 --- a/worlds/kh1/Items.py +++ b/worlds/kh1/Items.py @@ -239,8 +239,8 @@ def get_items_by_category(category: str, disclude: list) -> Dict[str, KH1ItemDat #"Crystal Trident": KH1ItemData("Key", code = 264_1210, classification = ItemClassification.progression, max_quantity = 1, weight = 10), "Postcard": KH1ItemData("Key", code = 264_1211, classification = ItemClassification.progression, max_quantity = 3, weight = 10), #"Torn Page 1": KH1ItemData("Key", code = 264_1212, classification = ItemClassification.progression, max_quantity = 1, weight = 10), - "Torn Page 2": KH1ItemData("Torn Pages", code = 264_1213, classification = ItemClassification.progression, max_quantity = 1, weight = 10), - "Torn Page 3": KH1ItemData("Torn Pages", code = 264_1214, classification = ItemClassification.progression, max_quantity = 1, weight = 10), + "Torn Page 1": KH1ItemData("Torn Pages", code = 264_1213, classification = ItemClassification.progression, max_quantity = 1, weight = 10), + "Torn Page 2": KH1ItemData("Torn Pages", code = 264_1214, classification = ItemClassification.progression, max_quantity = 1, weight = 10), #"Torn Page 4": KH1ItemData("Key", code = 264_1215, classification = ItemClassification.progression, max_quantity = 1, weight = 10), #"Torn Page 5": KH1ItemData("Key", code = 264_1216, classification = ItemClassification.progression, max_quantity = 1, weight = 10), "Slide 1": KH1ItemData("Key", code = 264_1217, classification = ItemClassification.progression, max_quantity = 1, weight = 10), @@ -523,6 +523,8 @@ def get_items_by_category(category: str, disclude: list) -> Dict[str, KH1ItemDat } event_item_table: Dict[str, KH1ItemData] = { + "Vanilla Postcard": KH1ItemData("Event", classification = ItemClassification.progression), + "Vanilla Torn Page": KH1ItemData("Event", classification = ItemClassification.progression), } #Make item categories diff --git a/worlds/kh1/Locations.py b/worlds/kh1/Locations.py index fa0b2c6901cc..40bea8bcc179 100644 --- a/worlds/kh1/Locations.py +++ b/worlds/kh1/Locations.py @@ -552,6 +552,16 @@ def get_locations_by_category(category: str) -> Dict[str, KH1LocationData]: } event_location_table: Dict[str, KH1LocationData] = { + "Traverse Town Item Shop Postcard": KH1LocationData("Event"), + "Traverse Town 1st District Safe Postcard": KH1LocationData("Event"), + "Traverse Town Gizmo Shop Postcard 1": KH1LocationData("Event"), + "Traverse Town Gizmo Shop Postcard 2": KH1LocationData("Event"), + "Traverse Town Item Workshop Postcard": KH1LocationData("Event"), + "Traverse Town 3rd District Balcony Postcard": KH1LocationData("Event"), + "Traverse Town Geppetto's House Postcard": KH1LocationData("Event"), + "Traverse Town Piano Room Return 50 Puppies Torn Page": KH1LocationData("Event"), + "Halloween Town Lab Torn Page": KH1LocationData("Event"), + "Atlantica Ariel's Grotto Torn Page": KH1LocationData("Event") } lookup_id_to_name: typing.Dict[int, str] = {data.code: item_name for item_name, data in location_table.items() if data.code} diff --git a/worlds/kh1/Regions.py b/worlds/kh1/Regions.py index 0d710da68eb1..eb4eb42f2664 100644 --- a/worlds/kh1/Regions.py +++ b/worlds/kh1/Regions.py @@ -486,6 +486,20 @@ def create_regions(multiworld: MultiWorld, player: int, options): if options.goal.current_key == "final_ansem": regions["End of the World"].locations.append("Final Ansem") + + + #Set up event locations: + regions["Traverse Town"].locations.append("Traverse Town Item Shop Postcard") + regions["Traverse Town"].locations.append("Traverse Town 1st District Safe Postcard") + regions["Traverse Town"].locations.append("Traverse Town Gizmo Shop Postcard 1") + regions["Traverse Town"].locations.append("Traverse Town Gizmo Shop Postcard 2") + regions["Traverse Town"].locations.append("Traverse Town Item Workshop Postcard") + regions["Traverse Town"].locations.append("Traverse Town 3rd District Balcony Postcard") + regions["Traverse Town"].locations.append("Traverse Town Geppetto's House Postcard") + regions["Traverse Town"].locations.append("Traverse Town Piano Room Return 50 Puppies Torn Page") + regions["Halloween Town"].locations.append("Halloween Town Lab Torn Page") + if options.atlantica: + regions["Atlantica"].locations.append("Atlantica Ariel's Grotto Torn Page") # Set up the regions correctly. for name, data in regions.items(): diff --git a/worlds/kh1/Rules.py b/worlds/kh1/Rules.py index 2825632ef4a2..c1870e5a60b0 100644 --- a/worlds/kh1/Rules.py +++ b/worlds/kh1/Rules.py @@ -26,14 +26,9 @@ def has_at_least(state: CollectionState, player: int, item: str, x: int) -> bool return state.count(item, player) >= x def has_postcards(state: CollectionState, player: int, postcards_required: int) -> bool: - postcards_available = 3 #You can get three postcards without any items - if has_item(state, player, "Progressive Thunder"): - postcards_available = postcards_available + 2 #Gizmo Shop Postcards - if has_item(state, player, "Green Trinity"): - postcards_available = postcards_available + 1 #After locking Traverse Town, examine the Synthesis Shop poster. - if has_item(state, player, "Monstro") and has_item(state, player, "High Jump"): - postcards_available = postcards_available + 1 #Gepetto's House Pot on Shelf - postcards_available = postcards_available + state.count("Postcard", player) #3 can be found in chests/events + postcards_available = 0 + postcards_available = postcards_available + state.count("Vanilla Postcard", player) + postcards_available = postcards_available + state.count("Postcard", player) return postcards_available >= postcards_required def has_puppies(state: CollectionState, player: int, puppies_required: int) -> bool: @@ -50,14 +45,9 @@ def has_puppies(state: CollectionState, player: int, puppies_required: int) -> b def has_torn_pages(state: CollectionState, player: int, pages_required: int) -> bool: pages_available = 0 - if state.has("Atlantica", player): - pages_available = pages_available + 1 - if state.has("Halloween Town", player): - pages_available = pages_available + 1 - if has_puppies(state, player, 51): - pages_available = pages_available + 1 + pages_available = pages_available + state.count("Vanilla Torn Page", player) + pages_available = pages_available + state.count("Torn Page 1", player) pages_available = pages_available + state.count("Torn Page 2", player) - pages_available = pages_available + state.count("Torn Page 3", player) return pages_available >= pages_required def has_all_arts(state: CollectionState, player: int) -> bool: @@ -543,6 +533,19 @@ def set_rules(multiworld: MultiWorld, player: int, options, eotw_required_report multiworld.get_location("Final Ansem" , player).access_rule = lambda state: has_final_rest_door(state, player, final_rest_door_requirement, final_rest_door_required_reports) for i in range(options.level_checks): multiworld.get_location("Level " + str(i+1).rjust(3,'0') , player).access_rule = lambda state, level_num=i: has_x_worlds(state, player, min(((level_num//10)*2), 8)) + + #Set up event location rules + #multiworld.get_location("Traverse Town Item Shop Postcard" , player).access_rule = lambda state: has_item(state, player, "") + #multiworld.get_location("Traverse Town 1st District Safe Postcard" , player).access_rule = lambda state: has_item(state, player, "") + multiworld.get_location("Traverse Town Gizmo Shop Postcard 1" , player).access_rule = lambda state: has_item(state, player, "Progressive Thunder") + multiworld.get_location("Traverse Town Gizmo Shop Postcard 2" , player).access_rule = lambda state: has_item(state, player, "Progressive Thunder") + multiworld.get_location("Traverse Town Item Workshop Postcard" , player).access_rule = lambda state: has_item(state, player, "Green Trinity") + #multiworld.get_location("Traverse Town 3rd District Balcony Postcard" , player).access_rule = lambda state: has_item(state, player, "") + multiworld.get_location("Traverse Town Geppetto's House Postcard" , player).access_rule = lambda state: has_item(state, player, "Monstro") and has_item(state, player, "High Jump") + multiworld.get_location("Traverse Town Piano Room Return 50 Puppies Torn Page" , player).access_rule = lambda state: has_puppies(state, player, 50) + #multiworld.get_location("Halloween Town Lab Torn Page" , player).access_rule = lambda state: has_item(state, player, "") + #if options.atlantica: + # multiworld.get_location("Atlantica Ariel's Grotto Torn Page" , player).access_rule = lambda state: has_item(state, player, "") # Region rules. multiworld.get_entrance("Wonderland" , player).access_rule = lambda state: has_item(state, player,"Wonderland") diff --git a/worlds/kh1/__init__.py b/worlds/kh1/__init__.py index f6f81df9ee0f..326cca284429 100644 --- a/worlds/kh1/__init__.py +++ b/worlds/kh1/__init__.py @@ -199,6 +199,20 @@ def set_rules(self): def create_regions(self): create_regions(self.multiworld, self.player, self.options) + self._place_events() + + def _place_events(self): + self.multiworld.get_location("Traverse Town Item Shop Postcard" , self.player).place_locked_item(self.create_event("Vanilla Postcard")) + self.multiworld.get_location("Traverse Town 1st District Safe Postcard" , self.player).place_locked_item(self.create_event("Vanilla Postcard")) + self.multiworld.get_location("Traverse Town Gizmo Shop Postcard 1" , self.player).place_locked_item(self.create_event("Vanilla Postcard")) + self.multiworld.get_location("Traverse Town Gizmo Shop Postcard 2" , self.player).place_locked_item(self.create_event("Vanilla Postcard")) + self.multiworld.get_location("Traverse Town Item Workshop Postcard" , self.player).place_locked_item(self.create_event("Vanilla Postcard")) + self.multiworld.get_location("Traverse Town 3rd District Balcony Postcard" , self.player).place_locked_item(self.create_event("Vanilla Postcard")) + self.multiworld.get_location("Traverse Town Geppetto's House Postcard" , self.player).place_locked_item(self.create_event("Vanilla Postcard")) + self.multiworld.get_location("Traverse Town Piano Room Return 50 Puppies Torn Page", self.player).place_locked_item(self.create_event("Vanilla Torn Page")) + self.multiworld.get_location("Halloween Town Lab Torn Page" , self.player).place_locked_item(self.create_event("Vanilla Torn Page")) + if self.options.atlantica: + self.multiworld.get_location("Atlantica Ariel's Grotto Torn Page" , self.player).place_locked_item(self.create_event("Vanilla Torn Page")) def get_numbers_of_reports_to_consider(self) -> int: numbers_to_consider = []