Skip to content

Commit

Permalink
Review refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbrq committed May 2, 2024
1 parent 7046a25 commit 362628a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 28 deletions.
2 changes: 1 addition & 1 deletion worlds/mlss/Items.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class ItemData(typing.NamedTuple):
code: int
itemName: str
progression: ItemClassification
classification: ItemClassification
itemID: int


Expand Down
50 changes: 27 additions & 23 deletions worlds/mlss/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class BowsersCastleSkip(Toggle):
"""
Skip straight from the entrance hall to bowletta in Bowser's Castle.
All Bowser's Castle items will be removed from the location pool.
All Bowser's Castle locations will be removed from the location pool.
"""

display_name = "Bowser's Castle Skip"
Expand All @@ -22,15 +22,15 @@ class ExtraPipes(Toggle):
class SkipMinecart(Toggle):
"""
Skip the minecart minigame that leads you through Hoohoo Mountain Base.
This will remove the 1 item in the minecart cave from the location pool.
This will remove the 1 location in the minecart cave from the location pool.
"""

display_name = "Skip Minecart Minigame"


class DisableSurf(Toggle):
"""
Remove the surf minigame item from the location pool.
Remove the surf minigame location from the location pool.
"""

display_name = "Disable Surf Minigame"
Expand All @@ -53,7 +53,7 @@ class MusicOptions(Choice):

class RandomSounds(Toggle):
"""
Randomizes every sound in the game, minus a select few that can softlock the game
Randomizes every sound in the game, minus a select few that can softlock the game.
"""

display_name = "Randomize Sounds"
Expand All @@ -77,7 +77,7 @@ class MarioColor(Choice):
option_white = 9
option_silhouette = 10
option_chaos = 11
option_truechaos = 12
option_true_chaos = 12
default = 0


Expand All @@ -99,7 +99,7 @@ class LuigiColor(Choice):
option_white = 9
option_silhouette = 10
option_chaos = 11
option_truechaos = 12
option_true_chaos = 12
default = 1


Expand Down Expand Up @@ -148,11 +148,11 @@ class LuigiPants(Choice):
class RandomizeEnemies(Choice):
"""
Randomize all normal enemy encounters in the game.
If Bowser's castle skip is enabled then enemies from Bowser's Castle will not be included.
disabled: Enemies will not be randomized
vanilla_groups: Vanilla enemy groups will be shuffled with each other. Custom enemy groups will not be made.
custom_groups: Custom enemy groups will be made and shuffled. Some enemy groups will only be semi-random.
(Groups including flying enemies or pestnuts)
If Bowser's castle skip is enabled, then enemies from Bowser's Castle will not be included.
Disabled: Enemies will not be randomized.
Vanilla Groups: Vanilla enemy groups will be shuffled with each other. Custom enemy groups will not be made.
Custom Groups: Custom enemy groups will be made and shuffled. Some enemy groups will only be semi-random,
including groups with flying enemies or pestnuts in them.
"""

display_name = "Randomize Enemies"
Expand All @@ -166,15 +166,15 @@ class RandomizeBosses(Choice):
"""
Randomize all boss encounters in the game.
If Bowser's castle skip is enabled then bosses from Bowser's Castle will not be included.
Some bosses are not randomized due to flags, and story (Such as the final boss)
Some bosses are not randomized due to flags, and story (such as the final boss).
Boss Only: Bosses will only be swapped with another boss.
Boss Normal: Bosses can be swapped with normal enemy encounters.
"""

display_name = "Randomize Bosses"
option_disabled = 0
option_bossonly = 1
option_bossnormal = 2
option_boss_only = 1
option_boss_normal = 2
default = 0


Expand All @@ -191,7 +191,6 @@ class ScaleStats(Toggle):
class XPMultiplier(Range):
"""
This will multiply any XP you receive in battle by the chosen multiplier.
"""

display_name = "XP Multiplier"
Expand All @@ -202,23 +201,26 @@ class XPMultiplier(Range):

class TattleHp(Toggle):
"""
This will display the enemies current and max health while in battle.
This will display the enemies' current and max health while in battle.
"""

display_name = "Tattle HP"


class RandomizeBackgrounds(Toggle):
"""
This randomizes the background image in battles
This randomizes the background image in battles.
"""

display_name = "Randomize Battle Backgrounds"


class HiddenVisible(Choice):
"""
This makes any hidden blocks in the game into regular item blocks.
This makes any hidden blocks in the game into regular item blocks and vice versa.
Disabled: Hidden blocks will remain invisible.
Hidden Visible: Hidden blocks will turn visible to the player.
Blocks Invisible: All item blocks will turn invisible. Hidden blocks will also remain invisible.
"""

display_name = "Item Block Visibility"
Expand Down Expand Up @@ -247,19 +249,21 @@ class HarhallsPants(Toggle):
class DifficultLogic(Toggle):
"""
This adjusts the logic to be more difficult in a few areas,
allowing for the logic to account for players getting to certain area's in unintended ways.
allowing for the logic to account for players getting to certain areas in unintended ways.
Enable at your own risk, this is not an option made for beginners.
"""

display_name = "Difficult Logic Toggle"
display_name = "Difficult Logic"


class ChuckleBeans(Choice):
"""
Choose how you want chuckle bean digspots to be randomized.
none: No chuckle bean digspots will be added into the item pool.
only_visible: Only chuckle bean digspots clearly marked with an X will be added into the item pool.
all: All chuckle bean digspots will be added into the item pool.
An amount of chuckle beans will be removed from the item pool,
equal to the amount of locations removed by the setting that you choose.
None: No chuckle bean digspots will be added into the location pool.
Only Visible: Only chuckle bean digspots clearly marked with an X will be added into the location pool.
All: All chuckle bean digspots will be added into the location pool.
"""

display_name = "Chuckle Beans"
Expand Down
8 changes: 4 additions & 4 deletions worlds/mlss/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def create_items(self) -> None:
required_items = []
precollected = [item for item in itemList if item in self.multiworld.precollected_items]
for item in itemList:
if item.progression != ItemClassification.filler and item.progression != ItemClassification.skip_balancing:
if item.classification != ItemClassification.filler and item.classification != ItemClassification.skip_balancing:
freq = item_frequencies.get(item.itemName, 1)
if item in precollected:
freq = max(freq - precollected.count(item), 0)
Expand All @@ -120,7 +120,7 @@ def create_items(self) -> None:
# Then, create our list of filler items
filler_items = []
for item in itemList:
if item.progression != ItemClassification.filler:
if item.classification != ItemClassification.filler:
continue
if item.itemName == "5 Coins" and not self.options.coins:
continue
Expand Down Expand Up @@ -167,10 +167,10 @@ def set_rules(self) -> None:

def create_item(self, name: str) -> MLSSItem:
item = item_table[name]
return MLSSItem(item.itemName, item.progression, item.code, self.player)
return MLSSItem(item.itemName, item.classification, item.code, self.player)

def get_filler_item_name(self) -> str:
return self.random.choice(list(filter(lambda item: item.progression == ItemClassification.filler, itemList)))
return self.random.choice(list(filter(lambda item: item.classification == ItemClassification.filler, itemList)))

def generate_output(self, output_directory: str) -> None:
patch = MLSSProcedurePatch(player=self.player, player_name=self.multiworld.player_name[self.player])
Expand Down

0 comments on commit 362628a

Please sign in to comment.