From 95b51d4ade19620054f439b75d7362f39cda0584 Mon Sep 17 00:00:00 2001 From: gaithern Date: Fri, 12 Jan 2024 09:18:39 -0600 Subject: [PATCH] Consolidated goals into one choice --- worlds/kh1/Options.py | 20 ++++++++++++++++--- worlds/kh1/Regions.py | 14 +++++++------- worlds/kh1/Rules.py | 16 +++++++-------- worlds/kh1/__init__.py | 44 +++++++++++++++++++++--------------------- 4 files changed, 54 insertions(+), 40 deletions(-) diff --git a/worlds/kh1/Options.py b/worlds/kh1/Options.py index 4174311373cc..5513f7614462 100644 --- a/worlds/kh1/Options.py +++ b/worlds/kh1/Options.py @@ -83,11 +83,25 @@ class Atlantica(Toggle): """ display_name = "Atlantica" +class Goal(Choice): + """ + Determines the goal of your run. + """ + display_name = "Goal" + option_final_rest = 0 + option_deep_jungle = 1 + option_agrabah = 2 + option_monstro = 3 + option_atlantica = 4 + option_halloween_town = 5 + option_neverland = 6 + option_sephiroth = 7 + option_unknown = 8 + default = 0 + @dataclass class KH1Options(PerGameCommonOptions): - sephiroth: Sephiroth - world_complete: WorldComplete - unknown: Unknown + goal: Goal atlantica: Atlantica strength_increase: StrengthIncrease defense_increase: DefenseIncrease diff --git a/worlds/kh1/Regions.py b/worlds/kh1/Regions.py index 0bcec32f03db..603975152b91 100644 --- a/worlds/kh1/Regions.py +++ b/worlds/kh1/Regions.py @@ -9,7 +9,7 @@ class KH1RegionData(NamedTuple): region_exits: Optional[List[str]] -def create_regions(multiworld: MultiWorld, player: int, sephiroth: bool, world_complete: bool, unknown:bool, atlantica: bool, levels: int): +def create_regions(multiworld: MultiWorld, player: int, goal: str, atlantica: bool, levels: int): regions: Dict[str, KH1RegionData] = { "Menu": KH1RegionData(None, ["Awakening", "Levels"]), "Awakening": KH1RegionData([], ["Destiny Islands"]), @@ -134,7 +134,7 @@ def create_regions(multiworld: MultiWorld, player: int, sephiroth: bool, world_c regions["Monstro"].locations.append("Monstro Chamber 6 Platform Near Chamber 5 Entrance Chest"), regions["Monstro"].locations.append("Monstro Chamber 6 Raised Area Near Chamber 1 Entrance Chest"), regions["Monstro"].locations.append("Monstro Chamber 6 Low Chest"), - if atlantica: + if atlantica or goal == "atlantica": regions["Atlantica"].locations.append("Atlantica Sunken Ship In Flipped Boat Chest"), regions["Atlantica"].locations.append("Atlantica Sunken Ship Seabed Chest"), regions["Atlantica"].locations.append("Atlantica Sunken Ship Inside Ship Chest"), @@ -261,21 +261,21 @@ def create_regions(multiworld: MultiWorld, player: int, sephiroth: bool, world_c #regions["Awakening"].locations.append("Awakening Chest"), missable #regions["End of the World"].locations.append("Chronicles Sora's Story") - if not sephiroth and not world_complete: #Not possible if HB is complete, could interefere with other win cons if 4 emblems is not go-mode + if goal in ["final_rest", "unknown"]: #Not possible if HB is complete, could interefere with other win cons if 4 emblems is not go-mode regions["Wonderland"].locations.append("Chronicles Wonderland") regions["Olympus Coliseum"].locations.append("Chronicles Olympus Coliseum") regions["Deep Jungle"].locations.append("Chronicles Deep Jungle") regions["Agrabah"].locations.append("Chronicles Agrabah") regions["Monstro"].locations.append("Chronicles Monstro") #regions["100 Acre Wood"].locations.append("Chronicles 100 Acre Wood") - if atlantica: + if atlantica or goal == "atlantica": regions["Atlantica"].locations.append("Chronicles Atlantica") regions["Halloween Town"].locations.append("Chronicles Halloween Town") #regions["Neverland"].locations.append("Chronicles Neverland") regions["Agrabah"].locations.append("Ansem's Secret Report 1") regions["Hollow Bastion"].locations.append("Ansem's Secret Report 2") - if atlantica: + if atlantica or goal == "atlantica": regions["Atlantica"].locations.append("Ansem's Secret Report 3") regions["Hollow Bastion"].locations.append("Ansem's Secret Report 4") regions["Hollow Bastion"].locations.append("Ansem's Secret Report 5") @@ -285,9 +285,9 @@ def create_regions(multiworld: MultiWorld, player: int, sephiroth: bool, world_c regions["Neverland"].locations.append("Ansem's Secret Report 9") regions["Hollow Bastion"].locations.append("Ansem's Secret Report 10") #regions["Agrabah"].locations.append("Ansem's Secret Report 11") - if sephiroth: + if goal == "sephiroth": regions["Olympus Coliseum"].locations.append("Ansem's Secret Report 12") - if unknown: + if goal == "unknown": regions["Hollow Bastion"].locations.append("Ansem's Secret Report 13") for i in range(levels): diff --git a/worlds/kh1/Rules.py b/worlds/kh1/Rules.py index 3208d827b90e..a1224d4df132 100644 --- a/worlds/kh1/Rules.py +++ b/worlds/kh1/Rules.py @@ -47,7 +47,7 @@ def has_item(state: CollectionState, player: int, item) -> bool: def has_at_least(state: CollectionState, player: int, item, x) -> bool: return state.count(item, player) >= x -def set_rules(multiworld: MultiWorld, player: int, sephiroth: bool, world_complete: bool, unknown: bool, atlantica: bool): +def set_rules(multiworld: MultiWorld, player: int, goal: str, atlantica: bool): #Location rules. #Keys #multiworld.get_location("Destiny Islands Chest" , player).access_rule = lambda state: has_item(state, player, "") @@ -151,7 +151,7 @@ def set_rules(multiworld: MultiWorld, player: int, sephiroth: bool, world_comple #multiworld.get_location("Monstro Chamber 6 Platform Near Chamber 5 Entrance Chest" , player).access_rule = lambda state: has_item(state, player, "") multiworld.get_location("Monstro Chamber 6 Raised Area Near Chamber 1 Entrance Chest" , player).access_rule = lambda state: has_item(state, player, "High Jump") or can_glide(state, player) #multiworld.get_location("Monstro Chamber 6 Low Chest" , player).access_rule = lambda state: has_item(state, player, "") - if atlantica: + if atlantica or goal == "atlantica": #multiworld.get_location("Atlantica Sunken Ship In Flipped Boat Chest" , player).access_rule = lambda state: has_item(state, player, "") #multiworld.get_location("Atlantica Sunken Ship Seabed Chest" , player).access_rule = lambda state: has_item(state, player, "") #multiworld.get_location("Atlantica Sunken Ship Inside Ship Chest" , player).access_rule = lambda state: has_item(state, player, "") @@ -278,20 +278,20 @@ def set_rules(multiworld: MultiWorld, player: int, sephiroth: bool, world_comple #multiworld.get_location("Awakening Chest" , player).access_rule = lambda state: has_item(state, player, "") #multiworld.get_location("Chronicles Sora's Story" , player).access_rule = lambda state: has_item(state, player,"Hollow Bastion") and has_x_worlds(state, player, 7) and has_item(state, player, "High Jump") and has_item(state, player, "Glide") and has_emblems(state, player) - if not sephiroth and not world_complete: #Not possible if HB is complete, could interefere with other win cons if 4 emblems is not go-mode + if goal in ["final_rest", "unknown"]: #Not possible if HB is complete, could interefere with other win cons if 4 emblems is not go-mode multiworld.get_location("Chronicles Wonderland" , player).access_rule = lambda state: has_evidence(state, player) #multiworld.get_location("Chronicles Olympus Coliseum" , player).access_rule = lambda state: has_item(state, player, "") multiworld.get_location("Chronicles Deep Jungle" , player).access_rule = lambda state: has_slides(state, player) #multiworld.get_location("Chronicles Agrabah" , player).access_rule = lambda state: has_item(state, player, "") multiworld.get_location("Chronicles Monstro" , player).access_rule = lambda state: has_item(state, player, "High Jump") #multiworld.get_location("Chronicles 100 Acre Wood" , player).access_rule = lambda state: has_item(state, player, "") - if atlantica: + if atlantica or goal == "atlantica": multiworld.get_location("Chronicles Atlantica" , player).access_rule = lambda state: has_item(state, player, "Mermaid Kick") multiworld.get_location("Chronicles Halloween Town" , player).access_rule = lambda state: has_item(state, player, "Jack-In-The-Box") and has_item(state, player, "Progressive Fire") #multiworld.get_location("Chronicles Neverland" , player).access_rule = lambda state: has_item(state, player, "Green Trinity") #multiworld.get_location("Ansem's Secret Report 1" , player).access_rule = lambda state: has_item(state, player, "") multiworld.get_location("Ansem's Secret Report 2" , player).access_rule = lambda state: has_emblems(state, player) - if atlantica: + if atlantica or goal == "atlantica": multiworld.get_location("Ansem's Secret Report 3" , player).access_rule = lambda state: has_item(state, player, "Mermaid Kick") multiworld.get_location("Ansem's Secret Report 4" , player).access_rule = lambda state: has_emblems(state, player) multiworld.get_location("Ansem's Secret Report 5" , player).access_rule = lambda state: has_emblems(state, player) @@ -301,9 +301,9 @@ def set_rules(multiworld: MultiWorld, player: int, sephiroth: bool, world_comple multiworld.get_location("Ansem's Secret Report 9" , player).access_rule = lambda state: has_item(state, player, "Green Trinity") multiworld.get_location("Ansem's Secret Report 10" , player).access_rule = lambda state: has_emblems(state, player) #multiworld.get_location("Ansem's Secret Report 11" , player).access_rule = lambda state: has_item(state, player, "") - if sephiroth: + if goal == "sephiroth": multiworld.get_location("Ansem's Secret Report 12" , player).access_rule = lambda state: has_item(state, player, "Phil Cup") and has_item(state, player, "Pegasus Cup") and has_item(state, player, "Hercules Cup") - if unknown: + if goal == "unknown": multiworld.get_location("Ansem's Secret Report 13" , player).access_rule = lambda state: has_emblems(state, player) multiworld.get_location("Complete Phil Cup" , player).access_rule = lambda state: has_item(state, player, "Phil Cup") @@ -317,7 +317,7 @@ def set_rules(multiworld: MultiWorld, player: int, sephiroth: bool, world_comple multiworld.get_entrance("Deep Jungle" , player).access_rule = lambda state: has_item(state, player,"Deep Jungle") multiworld.get_entrance("Agrabah" , player).access_rule = lambda state: has_item(state, player,"Agrabah") multiworld.get_entrance("Monstro" , player).access_rule = lambda state: has_item(state, player,"Monstro") - if atlantica: + if atlantica or goal == "atlantica": multiworld.get_entrance("Atlantica" , player).access_rule = lambda state: has_item(state, player,"Atlantica") and has_x_worlds(state, player, 2) multiworld.get_entrance("Halloween Town" , player).access_rule = lambda state: has_item(state, player,"Halloween Town") and has_x_worlds(state, player, 2) multiworld.get_entrance("Neverland" , player).access_rule = lambda state: has_item(state, player,"Neverland") and has_x_worlds(state, player, 4) diff --git a/worlds/kh1/__init__.py b/worlds/kh1/__init__.py index ada2a9bdd7eb..41a049190846 100644 --- a/worlds/kh1/__init__.py +++ b/worlds/kh1/__init__.py @@ -80,28 +80,28 @@ def create_items(self): while i < len(level_up_item_pool): self.multiworld.get_location(level_up_locations[i], self.player).place_locked_item(self.create_item(level_up_item_pool[i])) i = i + 1 - if self.options.sephiroth or self.options.world_complete or self.options.unknown: - possible_win_locations = [] - if self.options.sephiroth: - possible_win_locations.append("Ansem's Secret Report 12") - if self.options.unknown: - possible_win_locations.append("Ansem's Secret Report 13") - if self.options.world_complete: - #possible_win_locations.append("Chronicles Wonderland") If completing HB1, becomes inaccessible - #possible_win_locations.append("Chronicles Olympus Coliseum") Removing, the world is just too short - possible_win_locations.append("Chronicles Deep Jungle") - possible_win_locations.append("Chronicles Agrabah") - possible_win_locations.append("Chronicles Monstro") - if self.options.atlantica: - possible_win_locations.append("Ansem's Secret Report 3") #Replaces Chronicles Atlantica as it requires world completion - possible_win_locations.append("Chronicles Halloween Town") - possible_win_locations.append("Ansem's Secret Report 9") #Complete Neverland, Chronicles Neverland is not a location - self.multiworld.get_location(random.choice(possible_win_locations), self.player).place_locked_item(self.create_item("Victory")) - else: - self.multiworld.get_location("End of the World Final Rest Chest", self.player).place_locked_item(self.create_item("Victory")) + match self.options.goal: + case "sephiroth": + self.multiworld.get_location("Ansem's Secret Report 12", self.player).place_locked_item(self.create_item("Victory")) + case "deep_jungle": + self.multiworld.get_location("Chronicles Deep Jungle", self.player).place_locked_item(self.create_item("Victory")) + case "agrabah": + self.multiworld.get_location("Chronicles Agrabah", self.player).place_locked_item(self.create_item("Victory")) + case "agrabah": + self.multiworld.get_location("Chronicles Monstro", self.player).place_locked_item(self.create_item("Victory")) + case "atlantica": + self.multiworld.get_location("Ansem's Secret Report 3", self.player).place_locked_item(self.create_item("Victory")) + case "halloween_town": + self.multiworld.get_location("Chronicles Halloween Town", self.player).place_locked_item(self.create_item("Victory")) + case "neverland": + self.multiworld.get_location("Ansem's Secret Report 9", self.player).place_locked_item(self.create_item("Victory")) + case "unknown": + self.multiworld.get_location("Ansem's Secret Report 13", self.player).place_locked_item(self.create_item("Victory")) + case "final_rest": + self.multiworld.get_location("End of the World Final Rest Chest", self.player).place_locked_item(self.create_item("Victory")) total_locations = len(self.multiworld.get_unfilled_locations(self.player)) non_filler_item_categories = ["Key", "Magic", "Worlds", "Trinities", "Cups", "Summons", "Abilities", "Shared Abilities", "Keyblades"] - if self.options.atlantica: + if self.options.atlantica or self.options.goal == "atlantica": non_filler_item_categories.append("Atlantica") for name, data in item_table.items(): quantity = data.max_quantity @@ -148,9 +148,9 @@ def create_event(self, name: str) -> KH1Item: return KH1Item(name, data.classification, data.code, self.player) def set_rules(self): - set_rules(self.multiworld, self.player, self.options.sephiroth, self.options.world_complete, self.options.unknown, self.options.atlantica) + set_rules(self.multiworld, self.player, self.options.goal, self.options.atlantica) def create_regions(self): - create_regions(self.multiworld, self.player, self.options.sephiroth, self.options.world_complete, self.options.unknown, self.options.atlantica\ + create_regions(self.multiworld, self.player, self.options.goal, self.options.atlantica\ , min((self.options.strength_increase + self.options.defense_increase + self.options.hp_increase + self.options.mp_increase\ + self.options.ap_increase + self.options.accessory_slot_increase + self.options.item_slot_increase), 100)) \ No newline at end of file