From b86d7ef37359a817b0a1e8edda8209ec75fb16da Mon Sep 17 00:00:00 2001 From: jamesbrq Date: Tue, 23 Jan 2024 03:16:17 -0500 Subject: [PATCH] Updated Options to new system. Changed all references from MultiWorld to World --- worlds/mlss/Enemies.py | 2 +- worlds/mlss/Options.py | 56 ++--- worlds/mlss/Regions.py | 232 +++++++++--------- worlds/mlss/Rom.py | 83 +++---- worlds/mlss/Rules.py | 516 ++++++++++++++++++++-------------------- worlds/mlss/__init__.py | 81 +++---- 6 files changed, 486 insertions(+), 484 deletions(-) diff --git a/worlds/mlss/Enemies.py b/worlds/mlss/Enemies.py index 48fee4f96c93..2f092b513f82 100644 --- a/worlds/mlss/Enemies.py +++ b/worlds/mlss/Enemies.py @@ -201,7 +201,7 @@ def __init__(self): 0x5042CC, 0x5042EC, 0x50430C, - # 0x50438C, Popple 3 + 0x50438C, 0x5045CC, 0x5045EC, 0x50460C diff --git a/worlds/mlss/Options.py b/worlds/mlss/Options.py index ad388b903b8d..7ed4a52ce646 100644 --- a/worlds/mlss/Options.py +++ b/worlds/mlss/Options.py @@ -1,5 +1,5 @@ -import typing -from Options import Choice, Option, Toggle, StartInventoryPool +from Options import Choice, Option, Toggle, StartInventoryPool, PerGameCommonOptions +from dataclasses import dataclass class IntroSkip(Toggle): @@ -245,29 +245,29 @@ class ChuckleBeans(Choice): default = 2 -mlss_options: typing.Dict[str, type(Option)] = { - "start_inventory_from_pool": StartInventoryPool, - "coins": Coins, - "difficult_logic": DifficultLogic, - "skip_intro": IntroSkip, - "castle_skip": BowsersCastleSkip, - "extra_pipes": ExtraPipes, - "skip_minecart": SkipMinecart, - "disable_surf": DisableSurf, - "harhalls_pants": HarhallsPants, - "hidden_visible": HiddenVisible, - "blocks_invisible": BlocksInvisible, - "chuckle_beans": ChuckleBeans, - "music_options": MusicOptions, - "randomize_sounds": RandomSounds, - "randomize_enemies": RandomizeEnemies, - "randomize_bosses": RandomizeBosses, - "randomize_backgrounds": RandomizeBackgrounds, - "scale_stats": ScaleStats, - "scale_pow": ScalePow, - "tattle_hp": TattleHp, - "mario_color": MarioColor, - "luigi_color": LuigiColor, - "mario_pants": MarioPants, - "luigi_pants": LuigiPants -} +@dataclass +class MLSSOptions(PerGameCommonOptions): + start_inventory_from_pool: StartInventoryPool + coins: Coins + difficult_logic: DifficultLogic + skip_intro: IntroSkip + castle_skip: BowsersCastleSkip + extra_pipes: ExtraPipes + skip_minecart: SkipMinecart + disable_surf: DisableSurf + harhalls_pants: HarhallsPants + hidden_visible: HiddenVisible + blocks_invisible: BlocksInvisible + chuckle_beans: ChuckleBeans + music_options: MusicOptions + randomize_sounds: RandomSounds + randomize_enemies: RandomizeEnemies + randomize_bosses: RandomizeBosses + randomize_backgrounds: RandomizeBackgrounds + scale_stats: ScaleStats + scale_pow: ScalePow + tattle_hp: TattleHp + mario_color: MarioColor + luigi_color: LuigiColor + mario_pants: MarioPants + luigi_pants: LuigiPants diff --git a/worlds/mlss/Regions.py b/worlds/mlss/Regions.py index 79c22b3c38e7..7d1ee60e736e 100644 --- a/worlds/mlss/Regions.py +++ b/worlds/mlss/Regions.py @@ -1,6 +1,7 @@ import typing -from BaseClasses import MultiWorld, Region, Entrance, LocationProgressType +from worlds.AutoWorld import World +from BaseClasses import Region, Entrance, LocationProgressType from worlds.generic.Rules import add_rule, set_rule from .Locations import MLSSLocation, mainArea, chucklehuck, castleTown, startingFlag, chuckolatorFlag, piranhaFlag, \ kidnappedFlag, beanstarFlag, birdoFlag, surfable, hooniversity, gwarharEntrance, gwarharMain, \ @@ -10,165 +11,164 @@ from .Names.LocationName import LocationName -def create_regions(world: MultiWorld, player: int, excluded: typing.List[str]): - menu_region = Region("Menu", player, world) - world.regions.append(menu_region) +def create_regions(world: World, excluded: typing.List[str]): + menu_region = Region("Menu", world.player, world.multiworld) + world.multiworld.regions.append(menu_region) - main_region = create_region(world, player, "Main Area", mainArea, excluded) - world.regions.append(main_region) + main_region = create_region(world, "Main Area", mainArea, excluded) + world.multiworld.regions.append(main_region) - chucklehuck_region = create_region(world, player, "Chucklehuck Woods", chucklehuck, excluded) - world.regions.append(chucklehuck_region) + chucklehuck_region = create_region(world, "Chucklehuck Woods", chucklehuck, excluded) + world.multiworld.regions.append(chucklehuck_region) - castleTown_region = create_region(world, player, "Beanbean Castle Town", castleTown, excluded) - world.regions.append(castleTown_region) + castleTown_region = create_region(world, "Beanbean Castle Town", castleTown, excluded) + world.multiworld.regions.append(castleTown_region) - startingFlag_region = create_region(world, player, "Shop Starting Flag", startingFlag, excluded) - world.regions.append(startingFlag_region) + startingFlag_region = create_region(world, "Shop Starting Flag", startingFlag, excluded) + world.multiworld.regions.append(startingFlag_region) - chuckolatorFlag_region = create_region(world, player, "Shop Chuckolator Flag", chuckolatorFlag, excluded) - world.regions.append(chuckolatorFlag_region) + chuckolatorFlag_region = create_region(world, "Shop Chuckolator Flag", chuckolatorFlag, excluded) + world.multiworld.regions.append(chuckolatorFlag_region) - piranhaFlag_region = create_region(world, player, "Shop Piranha Flag", piranhaFlag, excluded) - world.regions.append(piranhaFlag_region) + piranhaFlag_region = create_region(world, "Shop Piranha Flag", piranhaFlag, excluded) + world.multiworld.regions.append(piranhaFlag_region) - kidnappedFlag_region = create_region(world, player, "Shop Peach Kidnapped Flag", kidnappedFlag, excluded) - world.regions.append(kidnappedFlag_region) + kidnappedFlag_region = create_region(world, "Shop Peach Kidnapped Flag", kidnappedFlag, excluded) + world.multiworld.regions.append(kidnappedFlag_region) - beanstarFlag_region = create_region(world, player, "Shop Beanstar Complete Flag", beanstarFlag, excluded) - world.regions.append(beanstarFlag_region) + beanstarFlag_region = create_region(world, "Shop Beanstar Complete Flag", beanstarFlag, excluded) + world.multiworld.regions.append(beanstarFlag_region) - birdoFlag_region = create_region(world, player, "Shop Birdo Flag", birdoFlag, excluded) - world.regions.append(birdoFlag_region) + birdoFlag_region = create_region(world, "Shop Birdo Flag", birdoFlag, excluded) + world.multiworld.regions.append(birdoFlag_region) - surfable_region = create_region(world, player, "Surfable", surfable, excluded) - world.regions.append(surfable_region) + surfable_region = create_region(world, "Surfable", surfable, excluded) + world.multiworld.regions.append(surfable_region) - hooniversity_region = create_region(world, player, "Hooniversity", hooniversity, excluded) - world.regions.append(hooniversity_region) + hooniversity_region = create_region(world, "Hooniversity", hooniversity, excluded) + world.multiworld.regions.append(hooniversity_region) - gwarharEntrance_region = create_region(world, player, "GwarharEntrance", gwarharEntrance, excluded) - world.regions.append(gwarharEntrance_region) + gwarharEntrance_region = create_region(world, "GwarharEntrance", gwarharEntrance, excluded) + world.multiworld.regions.append(gwarharEntrance_region) - gwarharMain_region = create_region(world, player, "GwarharMain", gwarharMain, excluded) - world.regions.append(gwarharMain_region) + gwarharMain_region = create_region(world, "GwarharMain", gwarharMain, excluded) + world.multiworld.regions.append(gwarharMain_region) - teehee_valley_region = create_region(world, player, "TeeheeValley", teeheeValley, excluded) - world.regions.append(teehee_valley_region) + teehee_valley_region = create_region(world, "TeeheeValley", teeheeValley, excluded) + world.multiworld.regions.append(teehee_valley_region) - winkle_region = create_region(world, player, "Winkle", winkle, excluded) - world.regions.append(winkle_region) + winkle_region = create_region(world, "Winkle", winkle, excluded) + world.multiworld.regions.append(winkle_region) - sewers_region = create_region(world, player, "Sewers", sewers, excluded) - world.regions.append(sewers_region) + sewers_region = create_region(world, "Sewers", sewers, excluded) + world.multiworld.regions.append(sewers_region) - airport_region = create_region(world, player, "Airport", airport, excluded) - world.regions.append(airport_region) + airport_region = create_region(world, "Airport", airport, excluded) + world.multiworld.regions.append(airport_region) - jokesEntrance_region = create_region(world, player, "JokesEntrance", jokesEntrance, excluded) - world.regions.append(jokesEntrance_region) + jokesEntrance_region = create_region(world, "JokesEntrance", jokesEntrance, excluded) + world.multiworld.regions.append(jokesEntrance_region) - jokesMain_region = create_region(world, player, "JokesMain", jokesMain, excluded) - world.regions.append(jokesMain_region) + jokesMain_region = create_region(world, "JokesMain", jokesMain, excluded) + world.multiworld.regions.append(jokesMain_region) - postJokes_region = create_region(world, player, "PostJokes", postJokes, excluded) - world.regions.append(postJokes_region) + postJokes_region = create_region(world, "PostJokes", postJokes, excluded) + world.multiworld.regions.append(postJokes_region) - theater_region = create_region(world, player, "Theater", theater, excluded) - world.regions.append(theater_region) + theater_region = create_region(world, "Theater", theater, excluded) + world.multiworld.regions.append(theater_region) - fungitown_region = create_region(world, player, "Fungitown", fungitown, excluded) - world.regions.append(fungitown_region) + fungitown_region = create_region(world, "Fungitown", fungitown, excluded) + world.multiworld.regions.append(fungitown_region) - fungitownBeanstar_region = create_region(world, player, "FungitownBeanstar", fungitownBeanstar, excluded) - world.regions.append(fungitownBeanstar_region) + fungitownBeanstar_region = create_region(world, "FungitownBeanstar", fungitownBeanstar, excluded) + world.multiworld.regions.append(fungitownBeanstar_region) - fungitownBirdo_region = create_region(world, player, "FungitownBirdo", fungitownBirdo, excluded) - world.regions.append(fungitownBirdo_region) + fungitownBirdo_region = create_region(world, "FungitownBirdo", fungitownBirdo, excluded) + world.multiworld.regions.append(fungitownBirdo_region) - booStatue_region = create_region(world, player, "BooStatue", booStatue, excluded) - world.regions.append(booStatue_region) + booStatue_region = create_region(world, "BooStatue", booStatue, excluded) + world.multiworld.regions.append(booStatue_region) - oasis_region = create_region(world, player, "Oasis", oasis, excluded) - world.regions.append(oasis_region) + oasis_region = create_region(world, "Oasis", oasis, excluded) + world.multiworld.regions.append(oasis_region) - event_region = create_region(world, player, "Event", event, excluded) - world.regions.append(event_region) + event_region = create_region(world, "Event", event, excluded) + world.multiworld.regions.append(event_region) - if world.coins[player]: - print("CREATING REGION") - coins_region = create_region(world, player, "Coins", coins, excluded) - world.regions.append(coins_region) + if world.options.coins: + coins_region = create_region(world, "Coins", coins, excluded) + world.multiworld.regions.append(coins_region) - if not world.castle_skip[player]: - bowsers_region = create_region(world, player, "Bowser's Castle", bowsers, excluded) - world.regions.append(bowsers_region) - bowsersMini_region = create_region(world, player, "Bowser's Castle Mini", bowsersMini, excluded) - world.regions.append(bowsersMini_region) + if not world.options.castle_skip: + bowsers_region = create_region(world, "Bowser's Castle", bowsers, excluded) + world.multiworld.regions.append(bowsers_region) + bowsersMini_region = create_region(world, "Bowser's Castle Mini", bowsersMini, excluded) + world.multiworld.regions.append(bowsersMini_region) - baseUltraRocks_region = create_region(world, player, "BaseUltraRocks", baseUltraRocks, excluded) - world.regions.append(baseUltraRocks_region) + baseUltraRocks_region = create_region(world, "BaseUltraRocks", baseUltraRocks, excluded) + world.multiworld.regions.append(baseUltraRocks_region) -def connect_regions(world: MultiWorld, player: int): +def connect_regions(world: World): names: typing.Dict[str, int] = {} - connect(world, player, names, "Menu", "Main Area") - connect(world, player, names, "Main Area", "Event") - if world.coins[player]: - connect(world, player, names, "Main Area", "Coins") - connect(world, player, names, "Main Area", "BaseUltraRocks", lambda state: StateLogic.ultra(state, player)) - connect(world, player, names, "Main Area", "Chucklehuck Woods", lambda state: StateLogic.brooch(state, player)) - connect(world, player, names, "Main Area", "BooStatue", lambda state: StateLogic.canCrash(state, player)) - connect(world, player, names, "Main Area", "Hooniversity", lambda state: StateLogic.canDig(state, player) and StateLogic.canMini(state, player)) - connect(world, player, names, "Hooniversity", "Oasis") - connect(world, player, names, "Main Area", "TeeheeValley", lambda state: StateLogic.super(state, player) or StateLogic.canDash(state, player)) - connect(world, player, names, "TeeheeValley", "GwarharEntrance", lambda state: StateLogic.membership(state, player) and StateLogic.fire(state, player)) - connect(world, player, names, "TeeheeValley", "Oasis", lambda state: StateLogic.membership(state, player) and StateLogic.fire(state, player)) - connect(world, player, names, "TeeheeValley", "Fungitown", lambda state: StateLogic.thunder(state, player) and StateLogic.castleTown(state, player) and StateLogic.rose(state, player)) - connect(world, player, names, "Fungitown", "FungitownBeanstar", lambda state: StateLogic.pieces(state, player) or state.can_reach("FungitownBirdo", "Region", player)) - connect(world, player, names, "Fungitown", "FungitownBirdo", lambda state: StateLogic.postJokes(state, player)) - connect(world, player, names, "Main Area", "Shop Starting Flag", lambda state: StateLogic.brooch(state, player) or StateLogic.rose(state, player)) - connect(world, player, names, "Shop Starting Flag", "Shop Chuckolator Flag", lambda state: (StateLogic.brooch(state, player) and StateLogic.fruits(state, player)) or state.can_reach("Shop Piranha Flag", "Region", player)) - connect(world, player, names, "Shop Starting Flag", "Shop Piranha Flag", lambda state: StateLogic.thunder(state, player) or state.can_reach("Shop Peach Kidnapped Flag", "Region", player)) - connect(world, player, names, "Shop Starting Flag", "Shop Peach Kidnapped Flag", lambda state: (StateLogic.thunder(state, player) and StateLogic.fungitown(state, player)) or state.can_reach("Shop Beanstar Complete Flag", "Region", player)) - connect(world, player, names, "Shop Starting Flag", "Shop Beanstar Complete Flag", lambda state: (StateLogic.castleTown(state, player) and StateLogic.pieces(state, player) and StateLogic.rose(state, player)) or state.can_reach("Shop Birdo Flag", "Region", player)) - connect(world, player, names, "Shop Starting Flag", "Shop Birdo Flag", lambda state: StateLogic.postJokes(state, player)) - connect(world, player, names, "Main Area", "Sewers", lambda state: StateLogic.rose(state, player)) - connect(world, player, names, "Main Area", "Airport", lambda state: StateLogic.thunder(state, player)) - connect(world, player, names, "Main Area", "Theater", lambda state: StateLogic.canDash(state, player)) - connect(world, player, names, "Main Area", "Surfable", lambda state: StateLogic.surfable(state, player)) - connect(world, player, names, "Surfable", "GwarharEntrance") - connect(world, player, names, "Surfable", "Oasis") - connect(world, player, names, "Surfable", "JokesEntrance", lambda state: StateLogic.fire(state, player)) - connect(world, player, names, "JokesMain", "PostJokes", lambda state: StateLogic.postJokes(state, player)) - if not world.castle_skip[player]: - connect(world, player, names, "PostJokes", "Bowser's Castle") - connect(world, player, names, "Bowser's Castle", "Bowser's Castle Mini", lambda state: StateLogic.canMini(state, player) and StateLogic.thunder(state, player)) - connect(world, player, names, "Chucklehuck Woods", "Winkle", lambda state: StateLogic.canDash(state, player)) - connect(world, player, names, "Chucklehuck Woods", "Beanbean Castle Town", lambda state: StateLogic.fruits(state, player)) - if world.difficult_logic[player]: - connect(world, player, names, "GwarharEntrance", "GwarharMain", lambda state: StateLogic.canDash(state, player)) - connect(world, player, names, "JokesEntrance", "JokesMain", lambda state: StateLogic.canDig(state, player)) + connect(world, names, "Menu", "Main Area") + connect(world, names, "Main Area", "Event") + if world.options.coins: + connect(world, names, "Main Area", "Coins") + connect(world, names, "Main Area", "BaseUltraRocks", lambda state: StateLogic.ultra(state, world.player)) + connect(world, names, "Main Area", "Chucklehuck Woods", lambda state: StateLogic.brooch(state, world.player)) + connect(world, names, "Main Area", "BooStatue", lambda state: StateLogic.canCrash(state, world.player)) + connect(world, names, "Main Area", "Hooniversity", lambda state: StateLogic.canDig(state, world.player) and StateLogic.canMini(state, world.player)) + connect(world, names, "Hooniversity", "Oasis") + connect(world, names, "Main Area", "TeeheeValley", lambda state: StateLogic.super(state, world.player) or StateLogic.canDash(state, world.player)) + connect(world, names, "TeeheeValley", "GwarharEntrance", lambda state: StateLogic.membership(state, world.player) and StateLogic.fire(state, world.player)) + connect(world, names, "TeeheeValley", "Oasis", lambda state: StateLogic.membership(state, world.player) and StateLogic.fire(state, world.player)) + connect(world, names, "TeeheeValley", "Fungitown", lambda state: StateLogic.thunder(state, world.player) and StateLogic.castleTown(state, world.player) and StateLogic.rose(state, world.player)) + connect(world, names, "Fungitown", "FungitownBeanstar", lambda state: StateLogic.pieces(state, world.player) or state.can_reach("FungitownBirdo", "Region", world.player)) + connect(world, names, "Fungitown", "FungitownBirdo", lambda state: StateLogic.postJokes(state, world.player)) + connect(world, names, "Main Area", "Shop Starting Flag", lambda state: StateLogic.brooch(state, world.player) or StateLogic.rose(state, world.player)) + connect(world, names, "Shop Starting Flag", "Shop Chuckolator Flag", lambda state: (StateLogic.brooch(state, world.player) and StateLogic.fruits(state, world.player)) or state.can_reach("Shop Piranha Flag", "Region", world.player)) + connect(world, names, "Shop Starting Flag", "Shop Piranha Flag", lambda state: StateLogic.thunder(state, world.player) or state.can_reach("Shop Peach Kidnapped Flag", "Region", world.player)) + connect(world, names, "Shop Starting Flag", "Shop Peach Kidnapped Flag", lambda state: (StateLogic.thunder(state, world.player) and StateLogic.fungitown(state, world.player)) or state.can_reach("Shop Beanstar Complete Flag", "Region", world.player)) + connect(world, names, "Shop Starting Flag", "Shop Beanstar Complete Flag", lambda state: (StateLogic.castleTown(state, world.player) and StateLogic.pieces(state, world.player) and StateLogic.rose(state, world.player)) or state.can_reach("Shop Birdo Flag", "Region", world.player)) + connect(world, names, "Shop Starting Flag", "Shop Birdo Flag", lambda state: StateLogic.postJokes(state, world.player)) + connect(world, names, "Main Area", "Sewers", lambda state: StateLogic.rose(state, world.player)) + connect(world, names, "Main Area", "Airport", lambda state: StateLogic.thunder(state, world.player)) + connect(world, names, "Main Area", "Theater", lambda state: StateLogic.canDash(state, world.player)) + connect(world, names, "Main Area", "Surfable", lambda state: StateLogic.surfable(state, world.player)) + connect(world, names, "Surfable", "GwarharEntrance") + connect(world, names, "Surfable", "Oasis") + connect(world, names, "Surfable", "JokesEntrance", lambda state: StateLogic.fire(state, world.player)) + connect(world, names, "JokesMain", "PostJokes", lambda state: StateLogic.postJokes(state, world.player)) + if not world.options.castle_skip: + connect(world, names, "PostJokes", "Bowser's Castle") + connect(world, names, "Bowser's Castle", "Bowser's Castle Mini", lambda state: StateLogic.canMini(state, world.player) and StateLogic.thunder(state, world.player)) + connect(world, names, "Chucklehuck Woods", "Winkle", lambda state: StateLogic.canDash(state, world.player)) + connect(world, names, "Chucklehuck Woods", "Beanbean Castle Town", lambda state: StateLogic.fruits(state, world.player)) + if world.options.difficult_logic: + connect(world, names, "GwarharEntrance", "GwarharMain", lambda state: StateLogic.canDash(state, world.player)) + connect(world, names, "JokesEntrance", "JokesMain", lambda state: StateLogic.canDig(state, world.player)) else: - connect(world, player, names, "GwarharEntrance", "GwarharMain", lambda state: StateLogic.canDash(state, player) and StateLogic.canCrash(state, player)) - connect(world, player, names, "JokesEntrance", "JokesMain", lambda state: StateLogic.canCrash(state, player) and StateLogic.canDig(state, player)) + connect(world, names, "GwarharEntrance", "GwarharMain", lambda state: StateLogic.canDash(state, world.player) and StateLogic.canCrash(state, world.player)) + connect(world, names, "JokesEntrance", "JokesMain", lambda state: StateLogic.canCrash(state, world.player) and StateLogic.canDig(state, world.player)) -def create_region(world, player, name, locations, excluded): - ret = Region(name, player, world) +def create_region(world: World, name, locations, excluded): + ret = Region(name, world.player, world.multiworld) for location in locations: - loc = MLSSLocation(player, location.name, location.id, ret) + loc = MLSSLocation(world.player, location.name, location.id, ret) if location.name in excluded: continue ret.locations.append(loc) return ret -def connect(world: MultiWorld, player: int, used_names: typing.Dict[str, int], source: str, target: str, +def connect(world: World, used_names: typing.Dict[str, int], source: str, target: str, rule: typing.Optional[typing.Callable] = None): - source_region = world.get_region(source, player) - target_region = world.get_region(target, player) + source_region = world.multiworld.get_region(source, world.player) + target_region = world.multiworld.get_region(target, world.player) if target not in used_names: used_names[target] = 1 @@ -177,7 +177,7 @@ def connect(world: MultiWorld, player: int, used_names: typing.Dict[str, int], s used_names[target] += 1 name = target + (' ' * used_names[target]) - connection = Entrance(player, name, source_region) + connection = Entrance(world.player, name, source_region) if rule: connection.access_rule = rule diff --git a/worlds/mlss/Rom.py b/worlds/mlss/Rom.py index 14b087b6ec2d..eed069f4a31d 100644 --- a/worlds/mlss/Rom.py +++ b/worlds/mlss/Rom.py @@ -1,15 +1,17 @@ import io import os -import bsdiff4 import pkgutil -import Utils -import settings +import bsdiff4 +import Utils +import settings +from BaseClasses import Item, Location +from worlds.AutoWorld import World +from settings import get_settings from worlds.Files import APDeltaPatch -from BaseClasses import MultiWorld, Item, Location -from .Items import item_table from .Enemies import enemies, bosses, EnemyRandomize, Enemy, EnemyGroup +from .Items import item_table from .Locations import shop, badge, pants @@ -83,14 +85,13 @@ def get_source_data(cls) -> bytes: class Rom: hash = "4b1a5897d89d9e74ec7f630eefdfd435" - def __init__(self, world: MultiWorld, player: int): - with open("Mario & Luigi - Superstar Saga (U).gba", 'rb') as file: - content = file.read() + def __init__(self, world: World): + content = get_base_rom_as_bytes() patched = self.apply_delta(content) - self.random = world.per_slot_randoms[player] + self.random = world.multiworld.per_slot_randoms[world.player] self.stream = io.BytesIO(patched) self.world = world - self.player = player + self.player = world.player def swap_colors(self, color, bro): temp = pkgutil.get_data(__name__, "colors/" + color + ".txt") @@ -113,8 +114,8 @@ def swap_colors(self, color, bro): self.stream.write(bytes([c.byte1, c.byte2])) def swap_pants(self, color, bro): - mario_color = self.world.mario_color[self.player] - luigi_color = self.world.luigi_color[self.player] + mario_color = self.world.options.mario_color + luigi_color = self.world.options.luigi_color if bro == 0 and (colors[mario_color] == "TrueChaos" or colors[mario_color] == "Silhouette"): return if bro == 1 and (colors[luigi_color] == "TrueChaos" or colors[luigi_color] == "Silhouette"): @@ -149,10 +150,10 @@ def item_inject(self, location: int, item_type: int, item: Item): self.stream.write(bytes([code])) self.stream.seek(location - 6, 0) b = self.stream.read(1) - if b[0] == 0x10 and self.world.hidden_visible[self.player]: + if b[0] == 0x10 and self.world.options.hidden_visible: self.stream.seek(location - 6, 0) self.stream.write(bytes([0x0])) - if b[0] == 0x0 and self.world.blocks_invisible[self.player]: + if b[0] == 0x0 and self.world.options.blocks_invisible: self.stream.seek(location - 6, 0) self.stream.write(bytes([0x10])) elif item_type == 1: @@ -188,60 +189,60 @@ def item_inject(self, location: int, item_type: int, item: Item): self.stream.write(bytes([0x18])) def patch_options(self): - name = self.world.player_name[self.player].encode("UTF-8") + name = self.world.multiworld.player_name[self.player].encode("UTF-8") self.stream.seek(0xB0, 0) self.stream.write(name) self.stream.seek(0xAF, 0) self.stream.write(self.player.to_bytes(1, 'little')) - if self.world.skip_intro[self.player]: + if self.world.options.skip_intro: # Enable Skip Intro in ROM self.stream.seek(0x244D08, 0) self.stream.write(bytes([0x88, 0x0, 0x19, 0x91, 0x1, 0x20, 0x58, 0x1, 0xF, 0xA0, 0x3, 0x15, 0x27, 0x8])) - if self.world.extra_pipes[self.player]: + if self.world.options.extra_pipes: # Spawn in extra pipes in ROM self.stream.seek(0xD00001, 0) self.stream.write(bytes([0x1])) - if self.world.castle_skip[self.player]: + if self.world.options.castle_skip: # Enable Bowser's castle skip in ROM self.stream.seek(0x3AEAB0, 0) self.stream.write(bytes([0xC1, 0x67, 0x0, 0x6, 0x1C, 0x08, 0x3])) self.stream.seek(0x3AEC18, 0) self.stream.write(bytes([0x89, 0x65, 0x0, 0xE, 0xA, 0x08, 0x1])) - if self.world.skip_minecart[self.player]: + if self.world.options.skip_minecart: # Enable minecart skip in ROM self.stream.seek(0x3AC728, 0) self.stream.write(bytes([0x89, 0x13, 0x0, 0x10, 0xF, 0x08, 0x1])) self.stream.seek(0x3AC56C, 0) self.stream.write(bytes([0x49, 0x16, 0x0, 0x8, 0x8, 0x08, 0x1])) - if self.world.randomize_sounds[self.player]: + if self.world.options.randomize_sounds: self.randomize_sounds() - if self.world.music_options[self.player] == 1: + if self.world.options.music_options == 1: self.randomize_music() - if self.world.music_options[self.player] == 2: + if self.world.options.music_options == 2: self.disable_music() - if self.world.randomize_backgrounds[self.player]: + if self.world.options.randomize_backgrounds: self.randomize_backgrounds() - if self.world.randomize_enemies[self.player] or self.world.randomize_bosses[self.player]: + if self.world.options.randomize_enemies or self.world.options.randomize_bosses: self.enemy_randomize() - if self.world.scale_stats[self.player]: + if self.world.options.scale_stats: self.stream.seek(0x1E9418, 0) self.stream.write(bytes([0x1])) - if self.world.scale_pow[self.player]: + if self.world.options.scale_pow: self.stream.seek(0x1E9419, 0) self.stream.write(bytes([0x1])) - if self.world.tattle_hp[self.player]: + if self.world.options.tattle_hp: self.stream.seek(0xD00000, 0) self.stream.write(bytes([0x1])) @@ -258,18 +259,18 @@ def patch_options(self): self.stream.seek(0x25FE57, 0) self.stream.write(bytes([0x48, 0x30, 0x08, 0x80, 0xE4, 0x0, 0xF])) - self.swap_colors(colors[self.world.mario_color[self.player]], 0) - self.swap_colors(colors[self.world.luigi_color[self.player]], 1) - self.swap_pants(cpants[self.world.mario_pants[self.player]], 0) - self.swap_pants(cpants[self.world.luigi_pants[self.player]], 1) + self.swap_colors(colors[self.world.options.mario_color], 0) + self.swap_colors(colors[self.world.options.luigi_color], 1) + self.swap_pants(cpants[self.world.options.mario_pants], 0) + self.swap_pants(cpants[self.world.options.luigi_pants], 1) def enemy_randomize(self): enemy_data = EnemyRandomize() - if self.world.randomize_enemies[self.player]: + if self.world.options.randomize_enemies: enemy_data = self.populate_enemy_array(enemy_data) enemy_data = self.generate_groups(enemy_data) - if self.world.randomize_bosses[self.player]: + if self.world.options.randomize_bosses: enemy_data = self.generate_boss_groups(enemy_data) self.insert_groups(enemy_data) @@ -354,7 +355,7 @@ def populate_enemy_array(self, enemy_data_) -> EnemyRandomize: i = 0 count = 0 while True: - if 0x50402C < e < 0x50434C and self.world.castle_skip[self.player]: + if 0x50402C < e < 0x50434C and self.world.options.castle_skip: break stream_seek_position = e + 10 + (i * 4) self.stream.seek(stream_seek_position, os.SEEK_SET) @@ -474,7 +475,7 @@ def generate_boss_groups(self, enemy_data_) -> EnemyRandomize: enemy_data = enemy_data_ for boss_val in bosses: - if 0x50402C < boss_val < 0x50434C and self.world.castle_skip[self.player]: + if 0x50402C < boss_val < 0x50434C and self.world.options.castle_skip: continue stream_seek_position = boss_val + 2 self.stream.seek(stream_seek_position, os.SEEK_SET) @@ -504,7 +505,7 @@ def generate_boss_groups(self, enemy_data_) -> EnemyRandomize: return enemy_data def insert_groups(self, enemy_data): - do_boss = self.world.randomize_bosses[self.player] + do_boss = self.world.options.randomize_bosses if do_boss != 1: enemy_data.groups.extend(enemy_data.bossGroups) @@ -520,7 +521,7 @@ def insert_groups(self, enemy_data): for location in locations: if len(enemy_data.groups) > 0: - if self.world.castle_skip[self.player] and 0x50402C < location < 0x50434C: + if self.world.options.castle_skip and 0x50402C < location < 0x50434C: continue count += 1 temp_group = enemy_data.groups[0] @@ -547,7 +548,7 @@ def insert_groups(self, enemy_data): if do_boss == 1: for location in bosses: - if self.world.castle_skip[self.player] and 0x50402C < location < 0x50434C: + if self.world.options.castle_skip and 0x50402C < location < 0x50434C: continue self.random.shuffle(enemy_data.bossGroups) count += 1 @@ -603,17 +604,17 @@ def desc_inject(self, location: Location, item: Item): case _: index = value.index(location.address) + 66 - dstring = f"{self.world.player_name[item.player]}: {item.name}" + dstring = f"{self.world.multiworld.player_name[item.player]}: {item.name}" self.stream.seek(0xD11000 + (index * 0x40), 0) self.stream.write(dstring.encode("UTF8")) def close(self, path): - output_path = os.path.join(path, f"AP_{self.world.seed_name}_P{self.player}_{self.world.player_name[self.player]}.gba") + output_path = os.path.join(path, f"AP_{self.world.multiworld.seed_name}_P{self.player}_{self.world.multiworld.player_name[self.player]}.gba") with open(output_path, 'wb') as outfile: outfile.write(self.stream.getvalue()) patch = MLSSDeltaPatch(os.path.splitext(output_path)[0] + ".apmlss", player=self.player, - player_name=self.world.player_name[self.player], patched_path=output_path) + player_name=self.world.multiworld.player_name[self.player], patched_path=output_path) patch.write() os.unlink(output_path) self.stream.close() diff --git a/worlds/mlss/Rules.py b/worlds/mlss/Rules.py index f261d1488e0b..2408b2b1889a 100644 --- a/worlds/mlss/Rules.py +++ b/worlds/mlss/Rules.py @@ -1,278 +1,278 @@ from worlds.generic.Rules import add_rule, forbid_item -from BaseClasses import MultiWorld +from worlds.AutoWorld import World from .Names.LocationName import LocationName from .Locations import all_locations, hidden from . import StateLogic -def set_rules(world: MultiWorld, player: int, excluded): +def set_rules(world: World, excluded): for location in all_locations: if "Digspot" in location.name: - if (world.skip_minecart[player] and "Minecart" in location.name) or (world.castle_skip[player] and "Bowser" in location.name): + if (world.options.skip_minecart and "Minecart" in location.name) or (world.options.castle_skip and "Bowser" in location.name): continue - if world.chuckle_beans[player] == 0 or world.chuckle_beans[player] == 1 and location.id in hidden: + if world.options.chuckle_beans == 0 or world.options.chuckle_beans == 1 and location.id in hidden: continue - add_rule(world.get_location(location.name, player), lambda state: StateLogic.canDig(state, player)) + add_rule(world.multiworld.get_location(location.name, world.player), lambda state: StateLogic.canDig(state, world.player)) if "Beanstone" in location.name: - add_rule(world.get_location(location.name, player), lambda state: StateLogic.canDig(state, player)) + add_rule(world.multiworld.get_location(location.name, world.player), lambda state: StateLogic.canDig(state, world.player)) if "Shop" in location.name and "Coffee" not in location.name and location.name not in excluded: - forbid_item(world.get_location(location.name, player), "Hammers", player) + forbid_item(world.multiworld.get_location(location.name, world.player), "Hammers", world.player) if location.itemType != 0 and location.name not in excluded: - if "Bowser" in location.name and world.castle_skip[player]: + if "Bowser" in location.name and world.options.castle_skip: continue - forbid_item(world.get_location(location.name, player), "5 Coins", player) + forbid_item(world.multiworld.get_location(location.name, world.player), "5 Coins", world.player) - if world.chuckle_beans[player] == 2: - add_rule(world.get_location(LocationName.HoohooVillageSuperHammerCaveDigspot, player), - lambda state: StateLogic.canCrash(state, player) or StateLogic.super(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsFarmRoomDigspot2, player), - lambda state: StateLogic.thunder(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsFarmRoomDigspot3, player), - lambda state: StateLogic.thunder(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsWhiteFruitRoomDigspot3, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.JokesEndJojoraRoomDigspot, player), - lambda state: StateLogic.canDash(state, player)) + if world.options.chuckle_beans == 2: + add_rule(world.multiworld.get_location(LocationName.HoohooVillageSuperHammerCaveDigspot, world.player), + lambda state: StateLogic.canCrash(state, world.player) or StateLogic.super(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsFarmRoomDigspot2, world.player), + lambda state: StateLogic.thunder(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsFarmRoomDigspot3, world.player), + lambda state: StateLogic.thunder(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsWhiteFruitRoomDigspot3, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.JokesEndJojoraRoomDigspot, world.player), + lambda state: StateLogic.canDash(state, world.player)) - if world.chuckle_beans[player] == 1 or world.chuckle_beans[player] == 2: - add_rule(world.get_location(LocationName.HoohooMountainBaseBoostatueRoomDigspot2, player), - lambda state: StateLogic.canCrash(state, player) or StateLogic.super(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsFarmRoomDigspot1, player), - lambda state: StateLogic.thunder(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsWhiteFruitRoomDigspot2, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.TeeheeValleyPastUltraHammersDigspot1, player), - lambda state: StateLogic.ultra(state, player)) - add_rule(world.get_location(LocationName.TeeheeValleyPastUltraHammersDigspot3, player), - lambda state: StateLogic.ultra(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsNorthBeachDigspot3, player), - lambda state: StateLogic.canDash(state, player) or StateLogic.super(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsEDigspot2, player), - lambda state: StateLogic.thunder(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsNEDigspot1, player), - lambda state: StateLogic.thunder(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsSRoom1Digspot2, player), - lambda state: StateLogic.ultra(state, player) and StateLogic.thunder(state, player)) + if world.options.chuckle_beans == 1 or world.options.chuckle_beans == 2: + add_rule(world.multiworld.get_location(LocationName.HoohooMountainBaseBoostatueRoomDigspot2, world.player), + lambda state: StateLogic.canCrash(state, world.player) or StateLogic.super(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsFarmRoomDigspot1, world.player), + lambda state: StateLogic.thunder(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsWhiteFruitRoomDigspot2, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.TeeheeValleyPastUltraHammersDigspot1, world.player), + lambda state: StateLogic.ultra(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.TeeheeValleyPastUltraHammersDigspot3, world.player), + lambda state: StateLogic.ultra(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsNorthBeachDigspot3, world.player), + lambda state: StateLogic.canDash(state, world.player) or StateLogic.super(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsEDigspot2, world.player), + lambda state: StateLogic.thunder(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsNEDigspot1, world.player), + lambda state: StateLogic.thunder(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsSRoom1Digspot2, world.player), + lambda state: StateLogic.ultra(state, world.player) and StateLogic.thunder(state, world.player)) - forbid_item(world.get_location(LocationName.SSChuckolaMembershipCard, player), "Nuts", player) # Bandaid Fix + forbid_item(world.multiworld.get_location(LocationName.SSChuckolaMembershipCard, world.player), "Nuts", world.player) # Bandaid Fix - add_rule(world.get_location(LocationName.HoohooVillageHammerHouseBlock, player), - lambda state: StateLogic.hammers(state, player)) - add_rule(world.get_location(LocationName.HoohooMountainBaseBoostatueRoomBlock2, player), - lambda state: StateLogic.canCrash(state, player) or StateLogic.super(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsBooStatueMole, player), - lambda state: StateLogic.canMini(state, player) and StateLogic.canDig(state, player)) - add_rule(world.get_location(LocationName.HoohooVillageSuperHammerCaveBlock, player), - lambda state: StateLogic.canCrash(state, player) or StateLogic.super(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsFarmRoomMoleReward1, player), - lambda state: StateLogic.thunder(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsFarmRoomMoleReward2, player), - lambda state: StateLogic.thunder(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsThunderHandMole, player), - lambda state: StateLogic.thunder(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsNWBlock, player), - lambda state: StateLogic.super(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsBeanFruit1, player), - lambda state: StateLogic.canDig(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsBeanFruit2, player), - lambda state: StateLogic.canDig(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsBeanFruit3, player), - lambda state: StateLogic.canDig(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsBeanFruit4, player), - lambda state: StateLogic.super(state, player) and StateLogic.canDig(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsBeanFruit5, player), - lambda state: StateLogic.super(state, player) and StateLogic.canDig(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsBeanFruit6, player), - lambda state: StateLogic.canDig(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsBeanFruit7, player), - lambda state: StateLogic.teehee(state, player) and StateLogic.canDig(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsSRoom1Block, player), - lambda state: StateLogic.ultra(state, player) and StateLogic.thunder(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsSRoom2Block1, player), - lambda state: StateLogic.canDig(state, player)) - add_rule(world.get_location(LocationName.WoohooHooniversityMiniMarioPuzzleSecretAreaBlock1, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.WoohooHooniversityMiniMarioPuzzleSecretAreaBlock2, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.WoohooHooniversityMiniMarioPuzzleSecretAreaBlock3, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.WoohooHooniversityMiniMarioPuzzleSecretAreaBlock4, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.WoohooHooniversityMiniMarioPuzzleBlock, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsSecretScroll1, player), - lambda state: StateLogic.thunder(state, player) and StateLogic.super(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsSecretScroll2, player), - lambda state: StateLogic.thunder(state, player) and StateLogic.ultra(state, player)) - add_rule(world.get_location(LocationName.HoohooVillageMoleBehindTurtle, player), - lambda state: StateLogic.canDash(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsNESoloMarioMole1, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsNESoloMarioMole2, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.HoohooVillageMoleBehindTurtle, player), - lambda state: StateLogic.thunder(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsSuperHammerUpgrade, player), - lambda state: StateLogic.thunder(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsUltraHammerUpgrade, player), - lambda state: StateLogic.thunder(state, player) and StateLogic.pieces(state, player) and StateLogic.castleTown(state, player) and StateLogic.rose(state, player)) - add_rule(world.get_location(LocationName.BeanbeanOutskirtsSoloLuigiCaveMole, player), - lambda state: StateLogic.canDig(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsRedChuckolaFruit, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsWhiteChuckolaFruit, player), - lambda state: StateLogic.canDig(state, player) and StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsAfterChucklerootBlock1, player), - lambda state: StateLogic.fruits(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsAfterChucklerootBlock2, player), - lambda state: StateLogic.fruits(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsAfterChucklerootBlock3, player), - lambda state: StateLogic.fruits(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsAfterChucklerootBlock4, player), - lambda state: StateLogic.fruits(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsAfterChucklerootBlock5, player), - lambda state: StateLogic.fruits(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsAfterChucklerootBlock6, player), - lambda state: StateLogic.fruits(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsRoom7Block1, player), - lambda state: StateLogic.hammers(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsRoom7Block2, player), - lambda state: StateLogic.hammers(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsRoom4Block1, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsRoom4Block2, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsRoom4Block3, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsPipeRoomBlock1, player), - lambda state: StateLogic.hammers(state, player)) - add_rule(world.get_location(LocationName.ChucklehuckWoodsPipeRoomBlock2, player), - lambda state: StateLogic.hammers(state, player)) - add_rule(world.get_location(LocationName.BeanbeanCastleTownMiniMarioBlock1, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.BeanbeanCastleTownMiniMarioBlock2, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.BeanbeanCastleTownMiniMarioBlock3, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.BeanbeanCastleTownMiniMarioBlock4, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.BeanbeanCastleTownMiniMarioBlock5, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.BeanbeanCastleFakeBeastar, player), - lambda state: StateLogic.pieces(state, player) and StateLogic.rose(state, player)) - add_rule(world.get_location(LocationName.BeanbeanCastlePeachsExtraDress, player), - lambda state: StateLogic.pieces(state, player) and StateLogic.rose(state, player)) - add_rule(world.get_location(LocationName.SewersRoom5Block1, player), - lambda state: StateLogic.hammers(state, player)) - add_rule(world.get_location(LocationName.SewersRoom5Block2, player), - lambda state: StateLogic.hammers(state, player)) - add_rule(world.get_location(LocationName.GwarharLagoonFirstUnderwaterAreaRoom1Block, player), - lambda state: StateLogic.canDash(state, player)) - add_rule(world.get_location(LocationName.GwarharLagoonFirstUnderwaterAreaRoom2Block1, player), - lambda state: StateLogic.canDash(state, player)) - add_rule(world.get_location(LocationName.GwarharLagoonFirstUnderwaterAreaRoom2Block2, player), - lambda state: StateLogic.canDash(state, player)) - add_rule(world.get_location(LocationName.GwarharLagoonRedPearlBean, player), - lambda state: StateLogic.fire(state, player) and StateLogic.thunder(state, player)) - add_rule(world.get_location(LocationName.GwarharLagoonGreenPearlBean, player), - lambda state: StateLogic.fire(state, player) and StateLogic.thunder(state, player)) - add_rule(world.get_location(LocationName.TeeheeValleyPastUltraHammersBlock1, player), - lambda state: StateLogic.ultra(state, player)) - add_rule(world.get_location(LocationName.TeeheeValleyPastUltraHammersBlock2, player), - lambda state: StateLogic.ultra(state, player)) - add_rule(world.get_location(LocationName.TeeheeValleySoloLuigiMazeRoom1Block, player), - lambda state: StateLogic.ultra(state, player)) - add_rule(world.get_location(LocationName.OhoOasisFirebrand, player), - lambda state: StateLogic.canMini(state, player)) - add_rule(world.get_location(LocationName.OhoOasisThunderhand, player), - lambda state: StateLogic.canDig(state, player)) - add_rule(world.get_location(LocationName.BeanstarPieceYoshiTheater, player), - lambda state: StateLogic.neon(state, player)) - add_rule(world.get_location(LocationName.YoshiTheaterAzureYoshi, player), - lambda state: StateLogic.beanFruit(state, player)) - add_rule(world.get_location(LocationName.YoshiTheaterBlueYoshi, player), - lambda state: StateLogic.beanFruit(state, player)) - add_rule(world.get_location(LocationName.YoshiTheaterGreenYoshi, player), - lambda state: StateLogic.beanFruit(state, player)) - add_rule(world.get_location(LocationName.YoshiTheaterOrangeYoshi, player), - lambda state: StateLogic.beanFruit(state, player)) - add_rule(world.get_location(LocationName.YoshiTheaterPurpleYoshi, player), - lambda state: StateLogic.beanFruit(state, player)) - add_rule(world.get_location(LocationName.YoshiTheaterRedYoshi, player), - lambda state: StateLogic.beanFruit(state, player)) - add_rule(world.get_location(LocationName.YoshiTheaterYellowYoshi, player), - lambda state: StateLogic.beanFruit(state, player)) - add_rule(world.get_location(LocationName.WinkleAreaBeanstarRoomBlock, player), - lambda state: StateLogic.winkle(state, player)) - add_rule(world.get_location(LocationName.BeanstarPieceWinkleArea, player), - lambda state: StateLogic.winkle(state, player)) - add_rule(world.get_location(LocationName.GwarharLagoonSpangleReward, player), - lambda state: StateLogic.spangle(state, player)) - add_rule(world.get_location(LocationName.PantsShopMomPiranhaFlag1, player), - lambda state: StateLogic.brooch(state, player) or StateLogic.rose(state, player)) - add_rule(world.get_location(LocationName.PantsShopMomPiranhaFlag2, player), - lambda state: StateLogic.brooch(state, player) or StateLogic.rose(state, player)) - add_rule(world.get_location(LocationName.PantsShopMomPiranhaFlag3, player), - lambda state: StateLogic.brooch(state, player) or StateLogic.rose(state, player)) - add_rule(world.get_location(LocationName.BadgeShopMomPiranhaFlag1, player), - lambda state: StateLogic.brooch(state, player) or StateLogic.rose(state, player)) - add_rule(world.get_location(LocationName.BadgeShopMomPiranhaFlag2, player), - lambda state: StateLogic.brooch(state, player) or StateLogic.rose(state, player)) - add_rule(world.get_location(LocationName.BadgeShopMomPiranhaFlag3, player), - lambda state: StateLogic.brooch(state, player) or StateLogic.rose(state, player)) - add_rule(world.get_location(LocationName.ChateauGreenGoblet, player), - lambda state: StateLogic.brooch(state, player) and StateLogic.canDig(state, player)) - add_rule(world.get_location(LocationName.ChateauRedGoblet, player), - lambda state: StateLogic.brooch(state, player) and StateLogic.canMini(state, player)) - if world.difficult_logic[player]: - add_rule(world.get_location(LocationName.GwarharLagoonSpangleReward, player), - lambda state: StateLogic.canCrash(state, player)) - add_rule(world.get_location(LocationName.BeanstarPieceHermie, player), - lambda state: StateLogic.canCrash(state, player)) - add_rule(world.get_location(LocationName.GwarharLagoonPastHermieDigspot, player), - lambda state: StateLogic.canCrash(state, player)) + add_rule(world.multiworld.get_location(LocationName.HoohooVillageHammerHouseBlock, world.player), + lambda state: StateLogic.hammers(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.HoohooMountainBaseBoostatueRoomBlock2, world.player), + lambda state: StateLogic.canCrash(state, world.player) or StateLogic.super(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsBooStatueMole, world.player), + lambda state: StateLogic.canMini(state, world.player) and StateLogic.canDig(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.HoohooVillageSuperHammerCaveBlock, world.player), + lambda state: StateLogic.canCrash(state, world.player) or StateLogic.super(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsFarmRoomMoleReward1, world.player), + lambda state: StateLogic.thunder(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsFarmRoomMoleReward2, world.player), + lambda state: StateLogic.thunder(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsThunderHandMole, world.player), + lambda state: StateLogic.thunder(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsNWBlock, world.player), + lambda state: StateLogic.super(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsBeanFruit1, world.player), + lambda state: StateLogic.canDig(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsBeanFruit2, world.player), + lambda state: StateLogic.canDig(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsBeanFruit3, world.player), + lambda state: StateLogic.canDig(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsBeanFruit4, world.player), + lambda state: StateLogic.super(state, world.player) and StateLogic.canDig(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsBeanFruit5, world.player), + lambda state: StateLogic.super(state, world.player) and StateLogic.canDig(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsBeanFruit6, world.player), + lambda state: StateLogic.canDig(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsBeanFruit7, world.player), + lambda state: StateLogic.teehee(state, world.player) and StateLogic.canDig(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsSRoom1Block, world.player), + lambda state: StateLogic.ultra(state, world.player) and StateLogic.thunder(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsSRoom2Block1, world.player), + lambda state: StateLogic.canDig(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.WoohooHooniversityMiniMarioPuzzleSecretAreaBlock1, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.WoohooHooniversityMiniMarioPuzzleSecretAreaBlock2, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.WoohooHooniversityMiniMarioPuzzleSecretAreaBlock3, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.WoohooHooniversityMiniMarioPuzzleSecretAreaBlock4, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.WoohooHooniversityMiniMarioPuzzleBlock, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsSecretScroll1, world.player), + lambda state: StateLogic.thunder(state, world.player) and StateLogic.super(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsSecretScroll2, world.player), + lambda state: StateLogic.thunder(state, world.player) and StateLogic.ultra(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.HoohooVillageMoleBehindTurtle, world.player), + lambda state: StateLogic.canDash(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsNESoloMarioMole1, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsNESoloMarioMole2, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.HoohooVillageMoleBehindTurtle, world.player), + lambda state: StateLogic.thunder(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsSuperHammerUpgrade, world.player), + lambda state: StateLogic.thunder(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsUltraHammerUpgrade, world.player), + lambda state: StateLogic.thunder(state, world.player) and StateLogic.pieces(state, world.player) and StateLogic.castleTown(state, world.player) and StateLogic.rose(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanOutskirtsSoloLuigiCaveMole, world.player), + lambda state: StateLogic.canDig(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsRedChuckolaFruit, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsWhiteChuckolaFruit, world.player), + lambda state: StateLogic.canDig(state, world.player) and StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsAfterChucklerootBlock1, world.player), + lambda state: StateLogic.fruits(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsAfterChucklerootBlock2, world.player), + lambda state: StateLogic.fruits(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsAfterChucklerootBlock3, world.player), + lambda state: StateLogic.fruits(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsAfterChucklerootBlock4, world.player), + lambda state: StateLogic.fruits(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsAfterChucklerootBlock5, world.player), + lambda state: StateLogic.fruits(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsAfterChucklerootBlock6, world.player), + lambda state: StateLogic.fruits(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsRoom7Block1, world.player), + lambda state: StateLogic.hammers(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsRoom7Block2, world.player), + lambda state: StateLogic.hammers(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsRoom4Block1, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsRoom4Block2, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsRoom4Block3, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsPipeRoomBlock1, world.player), + lambda state: StateLogic.hammers(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChucklehuckWoodsPipeRoomBlock2, world.player), + lambda state: StateLogic.hammers(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanCastleTownMiniMarioBlock1, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanCastleTownMiniMarioBlock2, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanCastleTownMiniMarioBlock3, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanCastleTownMiniMarioBlock4, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanCastleTownMiniMarioBlock5, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanCastleFakeBeastar, world.player), + lambda state: StateLogic.pieces(state, world.player) and StateLogic.rose(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanbeanCastlePeachsExtraDress, world.player), + lambda state: StateLogic.pieces(state, world.player) and StateLogic.rose(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.SewersRoom5Block1, world.player), + lambda state: StateLogic.hammers(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.SewersRoom5Block2, world.player), + lambda state: StateLogic.hammers(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.GwarharLagoonFirstUnderwaterAreaRoom1Block, world.player), + lambda state: StateLogic.canDash(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.GwarharLagoonFirstUnderwaterAreaRoom2Block1, world.player), + lambda state: StateLogic.canDash(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.GwarharLagoonFirstUnderwaterAreaRoom2Block2, world.player), + lambda state: StateLogic.canDash(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.GwarharLagoonRedPearlBean, world.player), + lambda state: StateLogic.fire(state, world.player) and StateLogic.thunder(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.GwarharLagoonGreenPearlBean, world.player), + lambda state: StateLogic.fire(state, world.player) and StateLogic.thunder(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.TeeheeValleyPastUltraHammersBlock1, world.player), + lambda state: StateLogic.ultra(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.TeeheeValleyPastUltraHammersBlock2, world.player), + lambda state: StateLogic.ultra(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.TeeheeValleySoloLuigiMazeRoom1Block, world.player), + lambda state: StateLogic.ultra(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.OhoOasisFirebrand, world.player), + lambda state: StateLogic.canMini(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.OhoOasisThunderhand, world.player), + lambda state: StateLogic.canDig(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanstarPieceYoshiTheater, world.player), + lambda state: StateLogic.neon(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.YoshiTheaterAzureYoshi, world.player), + lambda state: StateLogic.beanFruit(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.YoshiTheaterBlueYoshi, world.player), + lambda state: StateLogic.beanFruit(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.YoshiTheaterGreenYoshi, world.player), + lambda state: StateLogic.beanFruit(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.YoshiTheaterOrangeYoshi, world.player), + lambda state: StateLogic.beanFruit(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.YoshiTheaterPurpleYoshi, world.player), + lambda state: StateLogic.beanFruit(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.YoshiTheaterRedYoshi, world.player), + lambda state: StateLogic.beanFruit(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.YoshiTheaterYellowYoshi, world.player), + lambda state: StateLogic.beanFruit(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.WinkleAreaBeanstarRoomBlock, world.player), + lambda state: StateLogic.winkle(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanstarPieceWinkleArea, world.player), + lambda state: StateLogic.winkle(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.GwarharLagoonSpangleReward, world.player), + lambda state: StateLogic.spangle(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.PantsShopMomPiranhaFlag1, world.player), + lambda state: StateLogic.brooch(state, world.player) or StateLogic.rose(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.PantsShopMomPiranhaFlag2, world.player), + lambda state: StateLogic.brooch(state, world.player) or StateLogic.rose(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.PantsShopMomPiranhaFlag3, world.player), + lambda state: StateLogic.brooch(state, world.player) or StateLogic.rose(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BadgeShopMomPiranhaFlag1, world.player), + lambda state: StateLogic.brooch(state, world.player) or StateLogic.rose(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BadgeShopMomPiranhaFlag2, world.player), + lambda state: StateLogic.brooch(state, world.player) or StateLogic.rose(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BadgeShopMomPiranhaFlag3, world.player), + lambda state: StateLogic.brooch(state, world.player) or StateLogic.rose(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChateauGreenGoblet, world.player), + lambda state: StateLogic.brooch(state, world.player) and StateLogic.canDig(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.ChateauRedGoblet, world.player), + lambda state: StateLogic.brooch(state, world.player) and StateLogic.canMini(state, world.player)) + if world.options.difficult_logic: + add_rule(world.multiworld.get_location(LocationName.GwarharLagoonSpangleReward, world.player), + lambda state: StateLogic.canCrash(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.BeanstarPieceHermie, world.player), + lambda state: StateLogic.canCrash(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.GwarharLagoonPastHermieDigspot, world.player), + lambda state: StateLogic.canCrash(state, world.player)) - if world.coins[player]: - add_rule(world.get_location(LocationName.HoohooMountainBaseBooStatueCaveCoinBlock1, player), - lambda state: StateLogic.canCrash(state, player) or StateLogic.super(state, player)) - add_rule(world.get_location("Hoohoo Mountain Base Boo Statue Cave Coin Block 2", player), - lambda state: StateLogic.canCrash(state, player) or StateLogic.super(state, player)) - add_rule(world.get_location("Hoohoo Mountain Base Boo Statue Cave Coin Block 3", player), - lambda state: StateLogic.canCrash(state, player) or StateLogic.super(state, player)) - add_rule(world.get_location("Beanbean Outskirts NW Coin Block", player), - lambda state: StateLogic.super(state, player)) - add_rule(world.get_location("Beanbean Outskirts S Room 1 Coin Block", player), - lambda state: StateLogic.ultra(state, player) and StateLogic.thunder(state, player)) - add_rule(world.get_location("Beanbean Outskirts S Room 2 Coin Block", player), - lambda state: StateLogic.canCrash(state, player)) - add_rule(world.get_location("Chateau Popple Room Coin Block 1", player), - lambda state: StateLogic.brooch(state, player)) - add_rule(world.get_location("Chateau Popple Room Coin Block 2", player), - lambda state: StateLogic.brooch(state, player)) - add_rule(world.get_location("Chucklehuck Woods Cave Room 1 Coin Block", player), - lambda state: StateLogic.brooch(state, player)) - add_rule(world.get_location("Chucklehuck Woods Cave Room 2 Coin Block", player), - lambda state: StateLogic.brooch(state, player)) - add_rule(world.get_location("Chucklehuck Woods Cave Room 3 Coin Block", player), - lambda state: StateLogic.brooch(state, player)) - add_rule(world.get_location("Chucklehuck Woods Pipe 5 Room Coin Block", player), - lambda state: StateLogic.brooch(state, player) and StateLogic.hammers(state, player)) - add_rule(world.get_location("Chucklehuck Woods Room 7 Coin Block", player), - lambda state: StateLogic.brooch(state, player) and StateLogic.hammers(state, player)) - add_rule(world.get_location("Chucklehuck Woods After Chuckleroot Coin Block", player), - lambda state: StateLogic.brooch(state, player) and StateLogic.fruits(state, player)) - add_rule(world.get_location("Chucklehuck Woods Koopa Room Coin Block", player), - lambda state: StateLogic.brooch(state, player)) - add_rule(world.get_location("Chucklehuck Woods Winkle Area Cave Coin Block", player), - lambda state: StateLogic.brooch(state, player) and StateLogic.canDash(state, player)) - add_rule(world.get_location("Sewers Prison Room Coin Block", player), - lambda state: StateLogic.rose(state, player)) - add_rule(world.get_location("Teehee Valley Past Ultra Hammer Rocks Coin Block", player), - lambda state: StateLogic.ultra(state, player)) - add_rule(world.get_location("S.S Chuckola Storage Room Coin Block 1", player), - lambda state: StateLogic.super(state, player) or StateLogic.canDash(state, player)) - add_rule(world.get_location("S.S Chuckola Storage Room Coin Block 2", player), - lambda state: StateLogic.super(state, player) or StateLogic.canDash(state, player)) - add_rule(world.get_location("Jokes End Second Floor West Room Coin Block", player), - lambda state: StateLogic.ultra(state, player) and StateLogic.fire(state, player) and (StateLogic.membership(state, player) or (StateLogic.canDig(state, player) and StateLogic.canMini(state, player)))) + if world.options.coins: + add_rule(world.multiworld.get_location(LocationName.HoohooMountainBaseBooStatueCaveCoinBlock1, world.player), + lambda state: StateLogic.canCrash(state, world.player) or StateLogic.super(state, world.player)) + add_rule(world.multiworld.get_location("Hoohoo Mountain Base Boo Statue Cave Coin Block 2", world.player), + lambda state: StateLogic.canCrash(state, world.player) or StateLogic.super(state, world.player)) + add_rule(world.multiworld.get_location("Hoohoo Mountain Base Boo Statue Cave Coin Block 3", world.player), + lambda state: StateLogic.canCrash(state, world.player) or StateLogic.super(state, world.player)) + add_rule(world.multiworld.get_location("Beanbean Outskirts NW Coin Block", world.player), + lambda state: StateLogic.super(state, world.player)) + add_rule(world.multiworld.get_location("Beanbean Outskirts S Room 1 Coin Block", world.player), + lambda state: StateLogic.ultra(state, world.player) and StateLogic.thunder(state, world.player)) + add_rule(world.multiworld.get_location("Beanbean Outskirts S Room 2 Coin Block", world.player), + lambda state: StateLogic.canCrash(state, world.player)) + add_rule(world.multiworld.get_location("Chateau Popple Room Coin Block 1", world.player), + lambda state: StateLogic.brooch(state, world.player)) + add_rule(world.multiworld.get_location("Chateau Popple Room Coin Block 2", world.player), + lambda state: StateLogic.brooch(state, world.player)) + add_rule(world.multiworld.get_location("Chucklehuck Woods Cave Room 1 Coin Block", world.player), + lambda state: StateLogic.brooch(state, world.player)) + add_rule(world.multiworld.get_location("Chucklehuck Woods Cave Room 2 Coin Block", world.player), + lambda state: StateLogic.brooch(state, world.player)) + add_rule(world.multiworld.get_location("Chucklehuck Woods Cave Room 3 Coin Block", world.player), + lambda state: StateLogic.brooch(state, world.player)) + add_rule(world.multiworld.get_location("Chucklehuck Woods Pipe 5 Room Coin Block", world.player), + lambda state: StateLogic.brooch(state, world.player) and StateLogic.hammers(state, world.player)) + add_rule(world.multiworld.get_location("Chucklehuck Woods Room 7 Coin Block", world.player), + lambda state: StateLogic.brooch(state, world.player) and StateLogic.hammers(state, world.player)) + add_rule(world.multiworld.get_location("Chucklehuck Woods After Chuckleroot Coin Block", world.player), + lambda state: StateLogic.brooch(state, world.player) and StateLogic.fruits(state, world.player)) + add_rule(world.multiworld.get_location("Chucklehuck Woods Koopa Room Coin Block", world.player), + lambda state: StateLogic.brooch(state, world.player)) + add_rule(world.multiworld.get_location("Chucklehuck Woods Winkle Area Cave Coin Block", world.player), + lambda state: StateLogic.brooch(state, world.player) and StateLogic.canDash(state, world.player)) + add_rule(world.multiworld.get_location("Sewers Prison Room Coin Block", world.player), + lambda state: StateLogic.rose(state, world.player)) + add_rule(world.multiworld.get_location("Teehee Valley Past Ultra Hammer Rocks Coin Block", world.player), + lambda state: StateLogic.ultra(state, world.player)) + add_rule(world.multiworld.get_location("S.S Chuckola Storage Room Coin Block 1", world.player), + lambda state: StateLogic.super(state, world.player) or StateLogic.canDash(state, world.player)) + add_rule(world.multiworld.get_location("S.S Chuckola Storage Room Coin Block 2", world.player), + lambda state: StateLogic.super(state, world.player) or StateLogic.canDash(state, world.player)) + add_rule(world.multiworld.get_location("Jokes End Second Floor West Room Coin Block", world.player), + lambda state: StateLogic.ultra(state, world.player) and StateLogic.fire(state, world.player) and (StateLogic.membership(state, world.player) or (StateLogic.canDig(state, world.player) and StateLogic.canMini(state, world.player)))) diff --git a/worlds/mlss/__init__.py b/worlds/mlss/__init__.py index 07fde8e53fab..c04789856784 100644 --- a/worlds/mlss/__init__.py +++ b/worlds/mlss/__init__.py @@ -4,11 +4,8 @@ from BaseClasses import Tutorial, ItemClassification from worlds.AutoWorld import WebWorld, World from .Locations import all_locations, location_table, bowsers, bowsersMini, event, hidden, coins -from .Options import mlss_options -from .Regions import create_regions, connect_regions -from .Rules import set_rules +from .Options import MLSSOptions from .Items import MLSSItem, itemList, item_frequencies, item_table -from .Rom import Rom from .Names.LocationName import LocationName from .Client import MLSSClient @@ -33,7 +30,7 @@ class RomFile(settings.UserFilePath): """File name of the MLSS US rom""" copy_to = "Mario & Luigi - Superstar Saga (U).gba" description = "MLSS ROM File" - md5s = [Rom.hash] + md5s = ["4b1a5897d89d9e74ec7f630eefdfd435"] rom_file: RomFile = RomFile(RomFile.copy_to) rom_start: bool = True @@ -47,7 +44,8 @@ class MLSSWorld(World): game = "Mario & Luigi Superstar Saga" web = MLSSWebWorld() data_version = 1 - option_definitions = mlss_options + options_dataclass = MLSSOptions + options: MLSSOptions settings: typing.ClassVar[MLSSSettings] item_name_to_id = {name: data.code for name, data in item_table.items()} location_name_to_id = {loc_data.name: loc_data.id for loc_data in all_locations} @@ -57,34 +55,35 @@ class MLSSWorld(World): def generate_early(self) -> None: self.excluded_locations = [] - if self.multiworld.chuckle_beans[self.player] == 0: + if self.options.chuckle_beans == 0: self.excluded_locations += [location.name for location in all_locations if "Digspot" in location.name] - if self.multiworld.castle_skip[self.player]: + if self.options.castle_skip: self.excluded_locations += [location.name for location in all_locations if "Bowser" in location.name] - if self.multiworld.chuckle_beans[self.player] == 1: + if self.options.chuckle_beans == 1: self.excluded_locations = [location.name for location in all_locations if location.id in hidden] - if self.multiworld.skip_minecart[self.player]: + if self.options.skip_minecart: self.excluded_locations += [LocationName.HoohooMountainBaseMinecartCaveDigspot] - if self.multiworld.disable_surf[self.player]: + if self.options.disable_surf: self.excluded_locations += [LocationName.SurfMinigame] - if self.multiworld.harhalls_pants[self.player]: + if self.options.harhalls_pants: self.excluded_locations += [LocationName.HarhallsPants] - if not self.multiworld.coins[self.player]: + if not self.options.coins: self.excluded_locations += [location.name for location in all_locations if location in coins] def create_regions(self) -> None: - create_regions(self.multiworld, self.player, self.excluded_locations) - connect_regions(self.multiworld, self.player) + from .Regions import create_regions, connect_regions + create_regions(self, self.excluded_locations) + connect_regions(self) def fill_slot_data(self) -> dict: return { - "CastleSkip": self.multiworld.castle_skip[self.player].value, - "SkipMinecart": self.multiworld.skip_minecart[self.player].value, - "DisableSurf": self.multiworld.disable_surf[self.player].value, - "HarhallsPants": self.multiworld.harhalls_pants[self.player].value, - "ChuckleBeans": self.multiworld.chuckle_beans[self.player].value, - "DifficultLogic": self.multiworld.difficult_logic[self.player].value, - "Coins": self.multiworld.coins[self.player].value + "CastleSkip": self.options.castle_skip.value, + "SkipMinecart": self.options.skip_minecart.value, + "DisableSurf": self.options.disable_surf.value, + "HarhallsPants": self.options.harhalls_pants.value, + "ChuckleBeans": self.options.chuckle_beans.value, + "DifficultLogic": self.options.difficult_logic.value, + "Coins": self.options.coins.value } def generate_basic(self) -> None: @@ -116,13 +115,13 @@ def generate_basic(self) -> None: def create_items(self) -> None: # First add in all progression and useful items required_items = [] - precollected = [item for item in itemList if item in self.multiworld.precollected_items[self.player]] + 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 and item not in precollected: freq = item_frequencies.get(item.itemName, 1) if freq is None: freq = 1 - if self.multiworld.harhalls_pants[self.player] and "Harhall's" in item.itemName: + if self.options.harhalls_pants and "Harhall's" in item.itemName: continue required_items += [item.itemName for _ in range(freq)] @@ -133,13 +132,13 @@ def create_items(self) -> None: filler_items = [] for item in itemList: if item.progression == ItemClassification.filler: - if item.itemName == "5 Coins" and not self.multiworld.coins[self.player]: + if item.itemName == "5 Coins" and not self.options.coins: continue freq = item_frequencies.get(item.itemName) - if self.multiworld.chuckle_beans[self.player] == 0: + if self.options.chuckle_beans == 0: if item.itemName == "Chuckle Bean": continue - if self.multiworld.chuckle_beans[self.player] == 1: + if self.options.chuckle_beans == 1: if item.itemName == "Chuckle Bean": freq -= 59 if freq is None: @@ -147,19 +146,19 @@ def create_items(self) -> None: filler_items += [item.itemName for _ in range(freq)] remaining = len(all_locations) - len(required_items) - len(event) - 3 - if self.multiworld.castle_skip[self.player]: + if self.options.castle_skip: remaining -= (len(bowsers) + len(bowsersMini)) - if self.multiworld.skip_minecart[self.player]: + if self.options.skip_minecart: remaining -= 1 - if self.multiworld.disable_surf[self.player]: + if self.options.disable_surf: remaining -= 1 - if self.multiworld.harhalls_pants[self.player]: + if self.options.harhalls_pants: remaining -= 1 - if self.multiworld.chuckle_beans[self.player] == 0: + if self.options.chuckle_beans == 0: remaining -= 186 - if self.multiworld.chuckle_beans[self.player] == 1: - remaining -= 59 - if not self.multiworld.coins[self.player]: + if self.options.chuckle_beans == 1: + remaining -= 58 + if not self.options.coins: remaining -= len(coins) for i in range(remaining): filler_item_name = self.multiworld.random.choice(filler_items) @@ -168,7 +167,8 @@ def create_items(self) -> None: filler_items.remove(filler_item_name) def set_rules(self) -> None: - set_rules(self.multiworld, self.player, self.excluded_locations) + from .Rules import set_rules + set_rules(self, self.excluded_locations) self.multiworld.completion_condition[self.player] = \ lambda state: state.can_reach("PostJokes", "Region", self.player) @@ -177,14 +177,15 @@ def create_item(self, name: str) -> MLSSItem: return MLSSItem(item.itemName, item.progression, item.code, self.player) def generate_output(self, output_directory: str) -> None: - rom = Rom(self.multiworld, self.player) + from .Rom import Rom + rom = Rom(self) for location_name in location_table.keys(): - if (self.multiworld.skip_minecart[self.player] and "Minecart" in location_name and "After" not in location_name) or (self.multiworld.castle_skip[self.player] and "Bowser" in location_name) or (self.multiworld.disable_surf[self.player] and "Surf Minigame" in location_name) or (self.multiworld.harhalls_pants[self.player] and "Harhall's" in location_name): + if (self.options.skip_minecart and "Minecart" in location_name and "After" not in location_name) or (self.options.castle_skip and "Bowser" in location_name) or (self.options.disable_surf and "Surf Minigame" in location_name) or (self.options.harhalls_pants and "Harhall's" in location_name): continue - if (self.multiworld.chuckle_beans[self.player] == 0 and "Digspot" in location_name) or (self.multiworld.chuckle_beans[self.player] == 1 and location_table[location_name] in hidden): + if (self.options.chuckle_beans == 0 and "Digspot" in location_name) or (self.options.chuckle_beans == 1 and location_table[location_name] in hidden): continue - if not self.multiworld.coins[self.player] and "Coin" in location_name: + if not self.options.coins and "Coin" in location_name: continue location = self.multiworld.get_location(location_name, self.player) if location in self.multiworld.get_region("Event", self.player).locations: