Skip to content

Commit

Permalink
Added new Final Marluxia logic
Browse files Browse the repository at this point in the history
  • Loading branch information
gaithern committed Jan 30, 2024
1 parent 30caaf2 commit f365441
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 6 deletions.
7 changes: 7 additions & 0 deletions worlds/khrecom/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions worlds/khrecom/Items.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down
2 changes: 2 additions & 0 deletions worlds/khrecom/Locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down
17 changes: 17 additions & 0 deletions worlds/khrecom/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -46,3 +61,5 @@ class KHRECOMOptions(PerGameCommonOptions):
enemy_cards: EnemyCards
days_items: DaysItems
days_locations: DaysLocations
starting_cp: StartingCP
checks_behind_leon: ChecksBehindLeon
9 changes: 6 additions & 3 deletions worlds/khrecom/Regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]),
Expand Down Expand Up @@ -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)")
Expand Down Expand Up @@ -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")
Expand Down
5 changes: 4 additions & 1 deletion worlds/khrecom/Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions worlds/khrecom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", [])
Expand Down Expand Up @@ -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)
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

0 comments on commit f365441

Please sign in to comment.