Hylics 2: Fix invalid multiworld data, use `self.random` instead of `self.multiworld.random` ()

* Hylics 2: Fixes

* Rewrite loop
This commit is contained in:
Trevor L 2024-03-28 18:26:58 -06:00 committed by GitHub
parent 4391d1f4c1
commit 9dc708978b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 35 additions and 44 deletions
worlds/hylics2

View File

@ -34,8 +34,6 @@ class Hylics2World(World):
location_name_to_id = {data["name"]: loc_id for loc_id, data in all_locations.items()}
option_definitions = Options.hylics2_options
topology_present: bool = True
data_version = 3
start_location = "Waynehouse"
@ -51,10 +49,6 @@ class Hylics2World(World):
return Hylics2Item(name, self.all_items[item_id]["classification"], item_id, player=self.player)
def add_item(self, name: str, classification: ItemClassification, code: int) -> "Item":
return Hylics2Item(name, classification, code, self.player)
def create_event(self, event: str):
return Hylics2Item(event, ItemClassification.progression_skip_balancing, None, self.player)
@ -62,7 +56,7 @@ class Hylics2World(World):
# set random starting location if option is enabled
def generate_early(self):
if self.multiworld.random_start[self.player]:
i = self.multiworld.random.randint(0, 3)
i = self.random.randint(0, 3)
if i == 0:
self.start_location = "Waynehouse"
elif i == 1:
@ -77,26 +71,26 @@ class Hylics2World(World):
pool = []
# add regular items
for i, data in Items.item_table.items():
if data["count"] > 0:
for j in range(data["count"]):
pool.append(self.add_item(data["name"], data["classification"], i))
for item in Items.item_table.values():
if item["count"] > 0:
for _ in range(item["count"]):
pool.append(self.create_item(item["name"]))
# add party members if option is enabled
if self.multiworld.party_shuffle[self.player]:
for i, data in Items.party_item_table.items():
pool.append(self.add_item(data["name"], data["classification"], i))
for item in Items.party_item_table.values():
pool.append(self.create_item(item["name"]))
# handle gesture shuffle
if not self.multiworld.gesture_shuffle[self.player]: # add gestures to pool like normal
for i, data in Items.gesture_item_table.items():
pool.append(self.add_item(data["name"], data["classification"], i))
for item in Items.gesture_item_table.values():
pool.append(self.create_item(item["name"]))
# add '10 Bones' items if medallion shuffle is enabled
if self.multiworld.medallion_shuffle[self.player]:
for i, data in Items.medallion_item_table.items():
for j in range(data["count"]):
pool.append(self.add_item(data["name"], data["classification"], i))
for item in Items.medallion_item_table.values():
for _ in range(item["count"]):
pool.append(self.create_item(item["name"]))
# add to world's pool
self.multiworld.itempool += pool
@ -107,48 +101,45 @@ class Hylics2World(World):
if self.multiworld.gesture_shuffle[self.player] == 2: # vanilla locations
gestures = Items.gesture_item_table
self.multiworld.get_location("Waynehouse: TV", self.player)\
.place_locked_item(self.add_item(gestures[200678]["name"], gestures[200678]["classification"], 200678))
.place_locked_item(self.create_item("POROMER BLEB"))
self.multiworld.get_location("Afterlife: TV", self.player)\
.place_locked_item(self.add_item(gestures[200683]["name"], gestures[200683]["classification"], 200683))
.place_locked_item(self.create_item("TELEDENUDATE"))
self.multiworld.get_location("New Muldul: TV", self.player)\
.place_locked_item(self.add_item(gestures[200679]["name"], gestures[200679]["classification"], 200679))
.place_locked_item(self.create_item("SOUL CRISPER"))
self.multiworld.get_location("Viewax's Edifice: TV", self.player)\
.place_locked_item(self.add_item(gestures[200680]["name"], gestures[200680]["classification"], 200680))
.place_locked_item(self.create_item("TIME SIGIL"))
self.multiworld.get_location("TV Island: TV", self.player)\
.place_locked_item(self.add_item(gestures[200681]["name"], gestures[200681]["classification"], 200681))
.place_locked_item(self.create_item("CHARGE UP"))
self.multiworld.get_location("Juice Ranch: TV", self.player)\
.place_locked_item(self.add_item(gestures[200682]["name"], gestures[200682]["classification"], 200682))
.place_locked_item(self.create_item("FATE SANDBOX"))
self.multiworld.get_location("Foglast: TV", self.player)\
.place_locked_item(self.add_item(gestures[200684]["name"], gestures[200684]["classification"], 200684))
.place_locked_item(self.create_item("LINK MOLLUSC"))
self.multiworld.get_location("Drill Castle: TV", self.player)\
.place_locked_item(self.add_item(gestures[200688]["name"], gestures[200688]["classification"], 200688))
.place_locked_item(self.create_item("NEMATODE INTERFACE"))
self.multiworld.get_location("Sage Airship: TV", self.player)\
.place_locked_item(self.add_item(gestures[200685]["name"], gestures[200685]["classification"], 200685))
.place_locked_item(self.create_item("BOMBO - GENESIS"))
elif self.multiworld.gesture_shuffle[self.player] == 1: # TVs only
gestures = list(Items.gesture_item_table.items())
tvs = list(Locations.tv_location_table.items())
gestures = [gesture["name"] for gesture in Items.gesture_item_table.values()]
tvs = [tv["name"] for tv in Locations.tv_location_table.values()]
# if Extra Items in Logic is enabled place CHARGE UP first and make sure it doesn't get
# placed at Sage Airship: TV or Foglast: TV
if self.multiworld.extra_items_in_logic[self.player]:
tv = self.multiworld.random.choice(tvs)
gest = gestures.index((200681, Items.gesture_item_table[200681]))
while tv[1]["name"] == "Sage Airship: TV" or tv[1]["name"] == "Foglast: TV":
tv = self.multiworld.random.choice(tvs)
self.multiworld.get_location(tv[1]["name"], self.player)\
.place_locked_item(self.add_item(gestures[gest][1]["name"], gestures[gest][1]["classification"],
gestures[gest]))
gestures.remove(gestures[gest])
tv = self.random.choice(tvs)
while tv == "Sage Airship: TV" or tv == "Foglast: TV":
tv = self.random.choice(tvs)
self.multiworld.get_location(tv, self.player)\
.place_locked_item(self.create_item("CHARGE UP"))
gestures.remove("CHARGE UP")
tvs.remove(tv)
for i in range(len(gestures)):
gest = self.multiworld.random.choice(gestures)
tv = self.multiworld.random.choice(tvs)
self.multiworld.get_location(tv[1]["name"], self.player)\
.place_locked_item(self.add_item(gest[1]["name"], gest[1]["classification"], gest[0]))
gestures.remove(gest)
tvs.remove(tv)
self.random.shuffle(gestures)
self.random.shuffle(tvs)
while gestures:
gesture = gestures.pop()
tv = tvs.pop()
self.get_location(tv).place_locked_item(self.create_item(gesture))
def fill_slot_data(self) -> Dict[str, Any]: