Skip to content

Commit 1517255

Browse files
authored
Merge pull request #6 from JaggerTSG/patch-10
PYR second pass
2 parents 23fb6a5 + ab8a47a commit 1517255

3 files changed

Lines changed: 136 additions & 73 deletions

File tree

worlds/metroidfusion/Options.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from dataclasses import dataclass
22

33
from Options import Toggle, Range, Choice, PerGameCommonOptions, DefaultOnToggle, StartInventoryPool, OptionGroup, \
4-
DeathLink, Removed
4+
ItemSet, DeathLink, Removed
55

66

77
# Main Options
@@ -123,7 +123,7 @@ class StartingMajorUpgrades(Range):
123123
"""How many major upgrades you begin with.
124124
Note that depending on your StartingLocation and EarlyProgression settings, you may receive more than specified here
125125
in order to successfully generate the game. Upgrades are taken from the general item pool and will be replaced
126-
by a random minor tank.
126+
by a random filler item.
127127
These will be applied in addition to your start_inventory and start_inventory_from_pool items.
128128
These will be sent by the client once you're connected.
129129
This is a Custom Game Mode option and will only be applied if GameMode is set to Custom."""
@@ -135,14 +135,22 @@ class StartingMajorUpgrades(Range):
135135
class StartingEnergyTanks(Range):
136136
"""How many Energy Tanks you begin with.
137137
This will be overridden by the number specified in start_inventory and start_inventory_from_pool, if applicable.
138-
Energy tanks are taken from the general item pool and will be replaced by a random minor tank.
138+
Energy tanks are taken from the general item pool and will be replaced by a random filler item.
139139
These will be sent by the client once you're connected.
140140
This is a Custom Game Mode option and will only be applied if GameMode is set to Custom."""
141141
display_name = "Starting Energy Tanks"
142142
range_start = 0
143143
range_end = 20
144144
default = 0
145145

146+
class FillerItems(ItemSet):
147+
"""Which Items are used as filler when Items are removed from the pool
148+
Whenever an item is removed from the pool by start_inventory_from_pool, StartingMajorUpgrades, StartingEnergyTanks,
149+
or for other reasons, it will be replaced with a random item from this list.
150+
This is a Custom Game Mode option and will only be applied if GameMode is set to Custom."""
151+
display_name = "Filler Items"
152+
default = ["Missile Tank", "Power Bomb Tank"]
153+
146154
class OpenSectorElevators(Toggle):
147155
"""Determines if the sector elevators in the Sector Hub are locked by their vanilla keycard requirements.
148156
This is a Custom Game Mode option and will only be applied if GameMode is set to Custom."""
@@ -243,6 +251,7 @@ class MetroidFusionOptions(PerGameCommonOptions):
243251
StartingLocation: StartingLocation
244252
StartingMajorUpgrades: StartingMajorUpgrades
245253
StartingEnergyTanks: StartingEnergyTanks
254+
FillerItems: FillerItems
246255
OpenSectorElevators: OpenSectorElevators
247256
SectorNavigationRoomHintLocks: SectorNavigationRoomHintLocks
248257

@@ -283,6 +292,7 @@ class MetroidFusionOptions(PerGameCommonOptions):
283292
StartingLocation,
284293
StartingMajorUpgrades,
285294
StartingEnergyTanks,
295+
FillerItems,
286296
OpenSectorElevators,
287297
SectorNavigationRoomHintLocks
288298
]),

worlds/metroidfusion/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class MetroidFusionWorld(World):
103103
starting_region: Region
104104
starting_major_upgrades: int = 0
105105
starting_energy_tanks: int = 0
106+
filler_items: list[str] = None
106107
open_sector_elevators: bool = False
107108
navigation_room_hint_locks: bool = False
108109

@@ -126,7 +127,6 @@ class MetroidFusionWorld(World):
126127

127128
def __init__(self, multiworld: MultiWorld, player: int):
128129
super().__init__(multiworld, player)
129-
self.filler_items = None
130130
self.hint_text = None
131131
self.hint_pairs = None
132132
self.region_map = dict()
@@ -154,6 +154,7 @@ def parse_game_mode_options(self):
154154
self.starting_location_object = main_deck_hub
155155
self.starting_major_upgrades = 0
156156
self.starting_energy_tanks = 0
157+
self.filler_items = None
157158
self.open_sector_elevators = False
158159
self.navigation_room_hint_locks = False
159160
elif self.options.GameMode == self.options.GameMode.option_open_sector_hub:
@@ -163,6 +164,7 @@ def parse_game_mode_options(self):
163164
self.starting_location_object = sector_hub
164165
self.starting_major_upgrades = 1
165166
self.starting_energy_tanks = 1
167+
self.filler_items = None
166168
self.open_sector_elevators = True
167169
self.navigation_room_hint_locks = True
168170
elif self.options.GameMode == self.options.GameMode.option_custom:
@@ -185,6 +187,7 @@ def parse_game_mode_options(self):
185187
self.starting_location_object = main_deck_hub
186188
self.starting_major_upgrades = self.options.StartingMajorUpgrades.value
187189
self.starting_energy_tanks = self.options.StartingEnergyTanks.value
190+
self.filler_items = self.options.FillerItems.value
188191
self.open_sector_elevators = bool(self.options.OpenSectorElevators.value)
189192
self.navigation_room_hint_locks = bool(self.options.SectorNavigationRoomHintLocks.value)
190193

@@ -886,6 +889,8 @@ def get_filler_item_name(self) -> str:
886889
if self.filler_items is None:
887890
self.filler_items = [item for item in item_table if
888891
item_table[item].classification == ItemClassification.filler]
892+
if len(self.filler_items) == 0:
893+
self.filler_items = ["Nothing"]
889894
return self.random.choice(self.filler_items)
890895

891896
def fill_slot_data(self) -> Dict[str, Any]:

0 commit comments

Comments
 (0)