Skip to content

Commit

Permalink
Fixes for PR
Browse files Browse the repository at this point in the history
  • Loading branch information
gaithern committed Apr 25, 2024
1 parent 407b781 commit 04b4812
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
4 changes: 2 additions & 2 deletions worlds/kh1/Items.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("HAW", code = 264_1213, classification = ItemClassification.progression, max_quantity = 1, weight = 10),
"Torn Page 3": KH1ItemData("HAW", code = 264_1214, 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 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),
Expand Down
15 changes: 9 additions & 6 deletions worlds/kh1/Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ def has_postcards(state: CollectionState, player: int, postcards_required: int)
return postcards_available >= postcards_required

def has_puppies(state: CollectionState, player: int, puppies_required: int) -> bool:
puppies_available = 0
for i in range(1,100):
if state.has("Puppy " + str(i).rjust(2,"0"), player):
puppies_available = puppies_available + 1
for i in range(1,34):
if state.has("Puppies " + str(3*(i-1)+1).rjust(2, "0") + "-" + str(3*(i-1)+3).rjust(2, "0"), player):
puppies_available = puppies_available + 3
if state.has("All Puppies", player):
return True
if state.has_group("Puppies TRP", player, -(puppies_required//-3)):
return True
if state.has_group("Puppies IND", player, puppies_required):
return True
return False
puppies_available = puppies_available + 99
return puppies_available >= puppies_required

def has_torn_pages(state: CollectionState, player: int, pages_required: int) -> bool:
pages_available = 0
Expand Down
25 changes: 14 additions & 11 deletions worlds/kh1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,27 @@ def create_items(self):
total_locations = total_locations - 5
elif self.options.goal.current_key != "final_ansem" and self.options.require_final_ansem:
total_locations = total_locations - 1
non_filler_item_categories = ["Key", "Magic", "Worlds", "Trinities", "Cups", "Summons", "Abilities", "Shared Abilities", "Keyblades", "Accessory", "Weapons"]
if self.options.puppies == "full":
non_filler_item_categories.append("Puppies ALL")
if self.options.puppies == "triplets":
non_filler_item_categories.append("Puppies TRP")
if self.options.puppies == "individual":
non_filler_item_categories.append("Puppies IND")
if self.options.atlantica:
non_filler_item_categories.append("AL")
non_filler_item_categories = ["Key", "Magic", "Worlds", "Trinities", "Cups", "Summons", "Abilities", "Shared Abilities", "Keyblades", "Accessory", "Weapons", "Puppies"]
if self.options.hundred_acre_wood:
non_filler_item_categories.append("HAW")
non_filler_item_categories.append("Torn Pages")
for name, data in item_table.items():
quantity = data.max_quantity

# Ignore filler, it will be added in a later stage.
if data.category not in non_filler_item_categories:
continue
item_pool += [self.create_item(name) for _ in range(0, quantity)]
if data.category == "Puppies":
if self.options.puppies == "triplets" and "-" in name:
item_pool += [self.create_item(name) for _ in range(0, quantity)]
if self.options.puppies == "individual" and "Puppy" in name:
item_pool += [self.create_item(name) for _ in range(0, quantity)]
if self.options.puppies == "full" and name == "All Puppies":
item_pool += [self.create_item(name) for _ in range(0, quantity)]
elif name == "Atlantica" or name == "Mermaid Kick":
if self.options.atlantica:
item_pool += [self.create_item(name) for _ in range(0, quantity)]
else:
item_pool += [self.create_item(name) for _ in range(0, quantity)]

reports_in_pool = max(int(self.options.required_reports), int(self.options.reports_in_pool))
if self.options.goal.current_key == "super_boss_hunt":
Expand Down

0 comments on commit 04b4812

Please sign in to comment.