Skip to content

Commit

Permalink
beta-4
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbrq committed Nov 25, 2023
1 parent 20a6029 commit fe0a6b4
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 37 deletions.
1 change: 1 addition & 0 deletions Locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down
3 changes: 3 additions & 0 deletions Names/LocationName.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Binary file modified Names/__pycache__/LocationName.cpython-311.pyc
Binary file not shown.
42 changes: 13 additions & 29 deletions Regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,51 +108,35 @@ 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))
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, "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):
Expand Down
15 changes: 14 additions & 1 deletion Rom.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import hashlib
import bsdiff4
import pkgutil
import Utils
import settings


from worlds.Files import APDeltaPatch
from settings import get_settings
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down
14 changes: 14 additions & 0 deletions Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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))
8 changes: 2 additions & 6 deletions StateLogic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
12 changes: 11 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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()

Expand Down
Binary file modified data/basepatch.bsdiff
Binary file not shown.

0 comments on commit fe0a6b4

Please sign in to comment.