diff --git a/Locations.py b/Locations.py index 26f4f0d..bfeeb48 100644 --- a/Locations.py +++ b/Locations.py @@ -731,6 +731,7 @@ class MLSSLocation(Location): (0x434D, 0x40, 0x1e9442), # Yellow Neon Egg (0x4345, 0x8, 0x1e9408), # Firebrand (0x4345, 0x4, 0x1e9409), # Thunder Hand + (0x42FF, 0x80, 0x251071), # Beanstone Reward ] roomException: dict[int, int] = { diff --git a/Names/LocationName.py b/Names/LocationName.py index 300899e..7e977b2 100644 --- a/Names/LocationName.py +++ b/Names/LocationName.py @@ -525,3 +525,6 @@ class LocationName(): BowsersCastleLemmyRoomMole = "Bowser's Castle Lemmy Room Mole" SurfMinigame = "Surf Minigame" BeanbeanOutskirtsThunderHandMole = "Beanbean Outskirts Thunder Hand Mole" + BadgeShopMomPiranhaFlag1 = "Badge Shop Mom Piranha Flag 1" + BadgeShopMomPiranhaFlag2 = "Badge Shop Mom Piranha Flag 2" + BadgeShopMomPiranhaFlag3 = "Badge Shop Mom Piranha Flag 3" diff --git a/Names/__pycache__/LocationName.cpython-311.pyc b/Names/__pycache__/LocationName.cpython-311.pyc index e9b7032..d1a6ff8 100644 Binary files a/Names/__pycache__/LocationName.cpython-311.pyc and b/Names/__pycache__/LocationName.cpython-311.pyc differ diff --git a/Regions.py b/Regions.py index c95d03e..2a72880 100644 --- a/Regions.py +++ b/Regions.py @@ -108,33 +108,20 @@ def connect_regions(world: MultiWorld, player: int): 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, "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, "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)) - connect(world, player, names, "TeeheeValley", "Fungitown", - lambda state: StateLogic.thunder(state, player) and StateLogic.castleTown(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, "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)) 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", "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)) @@ -142,17 +129,14 @@ def connect_regions(world: MultiWorld, player: int): 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, "JokesEntrance", "JokesMain", - lambda state: StateLogic.canCrash(state, player) and StateLogic.canDig(state, player)) + connect(world, player, names, "JokesEntrance", "JokesMain", lambda state: StateLogic.canCrash(state, player) and StateLogic.canDig(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)) 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)) - connect(world, player, names, "GwarharEntrance", "GwarharMain", - lambda state: StateLogic.canDash(state, player) and StateLogic.canCrash(state, player)) + connect(world, player, names, "Chucklehuck Woods", "Beanbean Castle Town", lambda state: StateLogic.fruits(state, player)) + connect(world, player, names, "GwarharEntrance", "GwarharMain", lambda state: StateLogic.canDash(state, player) and StateLogic.canCrash(state, player)) def create_region(world, player, name, locations, excluded): diff --git a/Rom.py b/Rom.py index a7a02ad..ce423ab 100644 --- a/Rom.py +++ b/Rom.py @@ -4,6 +4,9 @@ import hashlib import bsdiff4 import pkgutil +import Utils +import settings + from worlds.Files import APDeltaPatch from settings import get_settings @@ -53,12 +56,21 @@ def __init__(self, location, byte1, byte2, bro): def get_base_rom_as_bytes() -> bytes: - with open("Mario & Luigi - Superstar Saga (U).gba", "rb") as infile: + with open(get_base_rom_path("Mario & Luigi - Superstar Saga (U).gba"), "rb") as infile: base_rom_bytes = bytes(infile.read()) return base_rom_bytes +def get_base_rom_path(file_name: str = "") -> str: + options: settings.Settings = settings.get_settings() + if not file_name: + file_name = options["mlss_options"]["rom_file"] + if not os.path.exists(file_name): + file_name = Utils.user_path(file_name) + return file_name + + class MLSSDeltaPatch(APDeltaPatch): game = "Mario & Luigi: Superstar Saga" hash = "4b1a5897d89d9e74ec7f630eefdfd435" @@ -555,6 +567,7 @@ def insert_groups(self, enemy_data): self.stream.seek(location + 4) self.stream.write(temp_group.data) + def close(self, path): output_path = os.path.join(path, f"AP_{self.world.seed_name}_P{self.player}.gba") with open(output_path, 'wb') as outfile: diff --git a/Rules.py b/Rules.py index 3890503..1e2fc50 100644 --- a/Rules.py +++ b/Rules.py @@ -64,6 +64,8 @@ def set_rules(world: MultiWorld, player: int): lambda state: StateLogic.thunder(state, player)) add_rule(world.get_location(LocationName.BeanbeanOutskirtsEDigspot2, player), lambda state: StateLogic.thunder(state, player)) + add_rule(world.get_location(LocationName.BeanbeanOutskirtsSRoom2Block1, player), + lambda state: StateLogic.canDig(state, player)) add_rule(world.get_location(LocationName.BeanbeanOutskirtsNorthBeachDigspot3, player), lambda state: StateLogic.canDash(state, player)) add_rule(world.get_location(LocationName.WoohooHooniversityMiniMarioPuzzleSecretAreaBlock1, player), @@ -188,3 +190,15 @@ def set_rules(world: MultiWorld, player: int): 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)) diff --git a/StateLogic.py b/StateLogic.py index 641e534..6398067 100644 --- a/StateLogic.py +++ b/StateLogic.py @@ -85,11 +85,7 @@ def surfable(state, player): def postJokes(state, player): - return surfable(state, player) and canDig(state, player) and canDash(state, player) and canCrash(state, - player) and dressBeanstar( - state, player) and pieces(state, player) and fruits(state, player) and brooch(state, player) and rose(state, - - player) + return surfable(state, player) and canDig(state, player) and canDash(state, player) and canCrash(state, player) and dressBeanstar(state, player) and pieces(state, player) and fruits(state, player) and brooch(state, player) and rose(state, player) def teehee(state, player): @@ -101,4 +97,4 @@ def castleTown(state, player): def fungitown(state, player): - return castleTown(state, player) and thunder(state, player) + return castleTown(state, player) and thunder(state, player) and rose(state, player) diff --git a/__init__.py b/__init__.py index 7aca547..2080b1d 100644 --- a/__init__.py +++ b/__init__.py @@ -63,6 +63,14 @@ def create_regions(self) -> None: create_regions(self.multiworld, self.player, self.excluded_locations) connect_regions(self.multiworld, self.player) + def generate_basic(self) -> None: + item = self.create_item("Mushroom") + self.multiworld.get_location(LocationName.ShopStartingFlag1, self.player).place_locked_item(item) + item = self.create_item("Syrup") + self.multiworld.get_location(LocationName.ShopStartingFlag2, self.player).place_locked_item(item) + item = self.create_item("1-UP Mushroom") + self.multiworld.get_location(LocationName.ShopStartingFlag3, self.player).place_locked_item(item) + def create_items(self) -> None: # First add in all progression and useful items required_items = [] @@ -112,12 +120,14 @@ def generate_output(self, output_directory: str) -> None: rom = Rom(self.multiworld, self.player) for location_name in location_table.keys(): - if (self.multiworld.skip_minecart[self.player] and "Minecart" 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): + 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): continue location = self.multiworld.get_location(location_name, self.player) item = location.item address = [address for address in all_locations if address.name == location.name] rom.item_inject(location.address, address[0].itemType, item) + if "Shop" in location_name and item.player != self.player: + dummy = 0 rom.patch_options() diff --git a/data/basepatch.bsdiff b/data/basepatch.bsdiff index 636ebca..5a423dc 100644 Binary files a/data/basepatch.bsdiff and b/data/basepatch.bsdiff differ