Skip to content

Commit

Permalink
Hylics 2: Remove Random Start option and replace it with Start Locati…
Browse files Browse the repository at this point in the history
…on option (ArchipelagoMW#3289)

* Hylics 2: Remove Random Start option and replace it with Start Location option

* remove choice

* Readd random start to slot data

* newlines

* Add random_start as a Removed option
  • Loading branch information
chandler05 authored May 14, 2024
1 parent b78781a commit 6576b06
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 38 deletions.
29 changes: 22 additions & 7 deletions worlds/hylics2/Options.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataclasses import dataclass
from Options import Choice, Toggle, DefaultOnToggle, DeathLink, PerGameCommonOptions
from Options import Choice, Removed, Toggle, DefaultOnToggle, DeathLink, PerGameCommonOptions

class PartyShuffle(Toggle):
"""Shuffles party members into the pool.
Expand All @@ -18,10 +18,22 @@ class MedallionShuffle(Toggle):
"""Shuffles red medallions into the pool."""
display_name = "Shuffle Red Medallions"

class RandomStart(Toggle):
"""Start the randomizer in 1 of 4 positions.
(Waynehouse, Viewax's Edifice, TV Island, Shield Facility)"""
display_name = "Randomize Start Location"
class StartLocation(Choice):
"""Select the starting location from 1 of 4 positions."""
display_name = "Start Location"
option_waynehouse = 0
option_viewaxs_edifice = 1
option_tv_island = 2
option_shield_facility = 3
default = 0

@classmethod
def get_option_name(cls, value: int) -> str:
if value == 1:
return "Viewax's Edifice"
if value == 2:
return "TV Island"
return super().get_option_name(value)

class ExtraLogic(DefaultOnToggle):
"""Include some extra items in logic (CHARGE UP, 1x PAPER CUP) to prevent the game from becoming too difficult."""
Expand All @@ -37,6 +49,9 @@ class Hylics2Options(PerGameCommonOptions):
party_shuffle: PartyShuffle
gesture_shuffle: GestureShuffle
medallion_shuffle: MedallionShuffle
random_start: RandomStart
start_location: StartLocation
extra_items_in_logic: ExtraLogic
death_link: Hylics2DeathLink
death_link: Hylics2DeathLink

# Removed options
random_start: Removed
17 changes: 8 additions & 9 deletions worlds/hylics2/Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ def set_rules(hylics2world):
extra = hylics2world.options.extra_items_in_logic
party = hylics2world.options.party_shuffle
medallion = hylics2world.options.medallion_shuffle
random_start = hylics2world.options.random_start
start_location = hylics2world.start_location
start_location = hylics2world.options.start_location

# Afterlife
add_rule(world.get_location("Afterlife: TV", player),
Expand Down Expand Up @@ -499,7 +498,7 @@ def set_rules(hylics2world):
add_rule(i, lambda state: enter_hylemxylem(state, player))

# random start logic (default)
if not random_start or random_start and start_location == "Waynehouse":
if start_location == "waynehouse":
# entrances
for i in world.get_region("Viewax", player).entrances:
add_rule(i, lambda state: (
Expand All @@ -514,7 +513,7 @@ def set_rules(hylics2world):
add_rule(i, lambda state: airship(state, player))

# random start logic (Viewax's Edifice)
elif random_start and start_location == "Viewax's Edifice":
elif start_location == "viewaxs_edifice":
for i in world.get_region("Waynehouse", player).entrances:
add_rule(i, lambda state: (
air_dash(state, player)
Expand Down Expand Up @@ -544,8 +543,8 @@ def set_rules(hylics2world):
for i in world.get_region("Sage Labyrinth", player).entrances:
add_rule(i, lambda state: airship(state, player))

# random start logic (TV Island)
elif random_start and start_location == "TV Island":
# start logic (TV Island)
elif start_location == "tv_island":
for i in world.get_region("Waynehouse", player).entrances:
add_rule(i, lambda state: airship(state, player))
for i in world.get_region("New Muldul", player).entrances:
Expand All @@ -563,8 +562,8 @@ def set_rules(hylics2world):
for i in world.get_region("Sage Labyrinth", player).entrances:
add_rule(i, lambda state: airship(state, player))

# random start logic (Shield Facility)
elif random_start and start_location == "Shield Facility":
# start logic (Shield Facility)
elif start_location == "shield_facility":
for i in world.get_region("Waynehouse", player).entrances:
add_rule(i, lambda state: airship(state, player))
for i in world.get_region("New Muldul", player).entrances:
Expand All @@ -578,4 +577,4 @@ def set_rules(hylics2world):
for i in world.get_region("TV Island", player).entrances:
add_rule(i, lambda state: airship(state, player))
for i in world.get_region("Sage Labyrinth", player).entrances:
add_rule(i, lambda state: airship(state, player))
add_rule(i, lambda state: airship(state, player))
29 changes: 7 additions & 22 deletions worlds/hylics2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class Hylics2World(World):

data_version = 3

start_location = "Waynehouse"


def set_rules(self):
Rules.set_rules(self)
Expand All @@ -56,19 +54,6 @@ def create_event(self, event: str):
return Hylics2Item(event, ItemClassification.progression_skip_balancing, None, self.player)


# set random starting location if option is enabled
def generate_early(self):
if self.options.random_start:
i = self.random.randint(0, 3)
if i == 0:
self.start_location = "Waynehouse"
elif i == 1:
self.start_location = "Viewax's Edifice"
elif i == 2:
self.start_location = "TV Island"
elif i == 3:
self.start_location = "Shield Facility"

def create_items(self):
# create item pool
pool = []
Expand Down Expand Up @@ -149,8 +134,8 @@ def fill_slot_data(self) -> Dict[str, Any]:
slot_data: Dict[str, Any] = {
"party_shuffle": self.options.party_shuffle.value,
"medallion_shuffle": self.options.medallion_shuffle.value,
"random_start" : self.options.random_start.value,
"start_location" : self.start_location,
"random_start": int(self.options.start_location != "waynehouse"),
"start_location" : self.options.start_location.current_option_name,
"death_link": self.options.death_link.value
}
return slot_data
Expand Down Expand Up @@ -189,14 +174,14 @@ def create_regions(self) -> None:
# create entrance and connect it to parent and destination regions
ent = Entrance(self.player, f"{reg.name} {k}", reg)
reg.exits.append(ent)
if k == "New Game" and self.options.random_start:
if self.start_location == "Waynehouse":
if k == "New Game":
if self.options.start_location == "waynehouse":
ent.connect(region_table[2])
elif self.start_location == "Viewax's Edifice":
elif self.options.start_location == "viewaxs_edifice":
ent.connect(region_table[6])
elif self.start_location == "TV Island":
elif self.options.start_location == "tv_island":
ent.connect(region_table[9])
elif self.start_location == "Shield Facility":
elif self.options.start_location == "shield_facility":
ent.connect(region_table[11])
else:
for name, num in Exits.exit_lookup_table.items():
Expand Down

0 comments on commit 6576b06

Please sign in to comment.