From f365441c33861868abaf5e7d6290c1ccb0763547 Mon Sep 17 00:00:00 2001 From: gaithern Date: Tue, 30 Jan 2024 15:25:38 -0600 Subject: [PATCH] Added new Final Marluxia logic --- worlds/khrecom/Client.py | 7 +++++++ worlds/khrecom/Items.py | 1 + worlds/khrecom/Locations.py | 2 ++ worlds/khrecom/Options.py | 17 +++++++++++++++++ worlds/khrecom/Regions.py | 9 ++++++--- worlds/khrecom/Rules.py | 5 ++++- worlds/khrecom/__init__.py | 9 +++++++-- 7 files changed, 44 insertions(+), 6 deletions(-) diff --git a/worlds/khrecom/Client.py b/worlds/khrecom/Client.py index 60b2f5909144..34ee9f3eae8c 100644 --- a/worlds/khrecom/Client.py +++ b/worlds/khrecom/Client.py @@ -86,6 +86,13 @@ def on_package(self, cmd: str, args: dict): filename = f"send{ss}" with open(os.path.join(self.game_communication_path, filename), 'w') as f: f.close() + if "Starting CP" in list(args['slot_data'].keys()): + starting_cp = args['slot_data']["Starting CP"] + else: + starting_cp = 275 + with open(os.path.join(self.game_communication_path, "startcp.cfg"), 'w') as f: + f.write(str(starting_cp)) + f.close() if cmd in {"ReceivedItems"}: start_index = args["index"] if start_index != len(self.items_received): diff --git a/worlds/khrecom/Items.py b/worlds/khrecom/Items.py index 5543fd1c7ebe..72a2c156255a 100644 --- a/worlds/khrecom/Items.py +++ b/worlds/khrecom/Items.py @@ -304,6 +304,7 @@ def get_items_by_category(category: str, disclude: list) -> Dict[str, KHRECOMIte "Friend Card Beast": KHRECOMItemData("Friend Cards", code = 268_5005, classification = ItemClassification.progression, max_quantity = 1, weight = 1), "Friend Card Peter Pan": KHRECOMItemData("Friend Cards", code = 268_5006, classification = ItemClassification.progression, max_quantity = 1, weight = 1), "Friend Card Jack": KHRECOMItemData("Friend Cards", code = 268_5007, classification = ItemClassification.progression, max_quantity = 1, weight = 1), + "Friend Card Pluto": KHRECOMItemData("Friend Cards", code = 268_5008, classification = ItemClassification.progression, max_quantity = 1, weight = 1), } event_item_table: Dict[str, KHRECOMItemData] = { diff --git a/worlds/khrecom/Locations.py b/worlds/khrecom/Locations.py index 98fc274ccab1..ad0b43924491 100644 --- a/worlds/khrecom/Locations.py +++ b/worlds/khrecom/Locations.py @@ -167,6 +167,8 @@ def get_locations_by_category(category: str) -> Dict[str, KHRECOMLocationData]: "Heartless Wizard": KHRECOMLocationData("Progression", 269_1429), "Heartless Wyvern": KHRECOMLocationData("Progression", 269_1430), "Heartless Yellow Opera": KHRECOMLocationData("Progression", 269_1431), + + "Final Marluxia": KHRECOMLocationData("Progression", 269_9999), } event_location_table: Dict[str, KHRECOMLocationData] = { diff --git a/worlds/khrecom/Options.py b/worlds/khrecom/Options.py index 8d5594cf55e8..a342a5787298 100644 --- a/worlds/khrecom/Options.py +++ b/worlds/khrecom/Options.py @@ -38,6 +38,21 @@ class DaysLocations(Toggle): """ display_name = "Days Locations" +class StartingCP(Range): + """ + Adjust your starting CP. + """ + display_name = "Starting CP" + range_start = 275 + range_end = 600 + default = 275 + +class ChecksBehindLeon(Toggle): + """ + Toggle whether to include checks behind the Leon sleight tutorial. If left off, the player can safely skip that room. + """ + display_name = "Checks Behind Leon" + @dataclass class KHRECOMOptions(PerGameCommonOptions): zeroes: Zeroes @@ -46,3 +61,5 @@ class KHRECOMOptions(PerGameCommonOptions): enemy_cards: EnemyCards days_items: DaysItems days_locations: DaysLocations + starting_cp: StartingCP + checks_behind_leon: ChecksBehindLeon diff --git a/worlds/khrecom/Regions.py b/worlds/khrecom/Regions.py index a03799841ac0..4a3ac7d5cbae 100644 --- a/worlds/khrecom/Regions.py +++ b/worlds/khrecom/Regions.py @@ -9,7 +9,7 @@ class KHRECOMRegionData(NamedTuple): region_exits: Optional[List[str]] -def create_regions(multiworld: MultiWorld, player: int, days: bool): +def create_regions(multiworld: MultiWorld, player: int, days: bool, checks_behind_leon: bool): regions: Dict[str, RLRegionData] = { "Menu": KHRECOMRegionData(None, ["Floor 1"]), "Floor 1": KHRECOMRegionData([], ["Warp"]), @@ -39,8 +39,9 @@ def create_regions(multiworld: MultiWorld, player: int, days: bool): regions["Floor 1"].locations.append("Starting Checks (Magic Cards Blizzard)") regions["Floor 1"].locations.append("Starting Checks (Magic Cards Cure)") regions["Floor 1"].locations.append("Traverse Town Post Floor (Magic Cards Fire)") - regions["Floor 1"].locations.append("Traverse Town Room of Beginnings") - regions["Floor 1"].locations.append("Traverse Town Room of Beginnings (Summon Cards Simba)") + if checks_behind_leon: + regions["Floor 1"].locations.append("Traverse Town Room of Beginnings") + regions["Floor 1"].locations.append("Traverse Town Room of Beginnings (Summon Cards Simba)") regions["Floor 1"].locations.append("Traverse Town Room of Guidance") regions["Floor 1"].locations.append("Traverse Town Room of Truth") regions["Floor 1"].locations.append("Traverse Town Room of Truth (Enemy Cards Guard Armor)") @@ -157,6 +158,8 @@ def create_regions(multiworld: MultiWorld, player: int, days: bool): #regions["Floor 13"].locations.append("Castle Oblivion Bounty (Enemy Cards Lexaeus)") regions["Floor 13"].locations.append("Castle Oblivion Room of Rewards (Attack Cards Star Seeker)") + regions["Floor 13"].locations.append("Final Marluxia") + regions["Heartless"].locations.append("Heartless Air Pirate") regions["Heartless"].locations.append("Heartless Air Soldier") regions["Heartless"].locations.append("Heartless Aquatank") diff --git a/worlds/khrecom/Rules.py b/worlds/khrecom/Rules.py index 4432049168db..7889d84a0dc8 100644 --- a/worlds/khrecom/Rules.py +++ b/worlds/khrecom/Rules.py @@ -11,7 +11,10 @@ # return state.has_all({"Key of Beginnings F" + floor_num, "Key of Guidance F" + floor_num, "Key to Truth F" + floor_num}, player) def has_castle_oblivion(state: CollectionState, player: int) -> bool: - return state.has_all({"Friend Card Donald", "Friend Card Goofy", "Friend Card Aladdin", "Friend Card Ariel", "Friend Card Beast", "Friend Card Jack", "Friend Card Peter Pan", "World Card Halloween Town", "World Card Atlantica", "World Card Destiny Islands"}, player) and has_x_worlds(state, player, 8) + return state.has_all({"Friend Card Donald", "Friend Card Goofy", "Friend Card Aladdin", "Friend Card Ariel"\ + , "Friend Card Beast", "Friend Card Jack", "Friend Card Peter Pan", "Friend Card Pluto"\ + , "World Card Halloween Town", "World Card Atlantica", "World Card Destiny Islands"\ + }, player) and has_x_worlds(state, player, 8) def has_x_worlds(state: CollectionState, player: int, num_of_worlds) -> bool: locations = 0 diff --git a/worlds/khrecom/__init__.py b/worlds/khrecom/__init__.py index 387a73179cfe..65e3981d0053 100644 --- a/worlds/khrecom/__init__.py +++ b/worlds/khrecom/__init__.py @@ -49,7 +49,8 @@ class KHRECOMWorld(World): def create_items(self): item_pool: List[KHRECOMItem] = [] - self.multiworld.get_location("Castle Oblivion Field Marluxia", self.player).place_locked_item(self.create_item("Victory")) + self.multiworld.get_location("Destiny Islands Post Floor (Enemy Cards Larxene)", self.player).place_locked_item(self.create_item("Friend Card Pluto")) + self.multiworld.get_location("Final Marluxia", self.player).place_locked_item(self.create_item("Victory")) starting_locations = get_locations_by_category("Starting") starting_locations = random.sample(list(starting_locations.keys()),4) starting_worlds = get_items_by_category("World Unlocks", []) @@ -118,4 +119,8 @@ def set_rules(self): set_rules(self.multiworld, self.player, self.options.days_locations) def create_regions(self): - create_regions(self.multiworld, self.player, self.options.days_locations) \ No newline at end of file + create_regions(self.multiworld, self.player, self.options.days_locations, self.options.checks_behind_leon) + + def fill_slot_data(self) -> dict: + slot_data = {"Starting CP": int(self.options.starting_cp)} + return slot_data \ No newline at end of file