mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00

* Commit for PR * Commit for PR * Update worlds/mlss/Client.py Co-authored-by: Silvris <58583688+Silvris@users.noreply.github.com> * Update worlds/mlss/__init__.py Co-authored-by: Silvris <58583688+Silvris@users.noreply.github.com> * Update worlds/mlss/__init__.py Co-authored-by: Silvris <58583688+Silvris@users.noreply.github.com> * Update worlds/mlss/docs/setup_en.md Co-authored-by: Silvris <58583688+Silvris@users.noreply.github.com> * Remove deprecated import. Updated settings and romfile syntax * Updated Options to new system. Changed all references from MultiWorld to World * Changed switch statements to if else * Update en_Mario & Luigi Superstar Saga.md * Updated client.py * Update Client.py * Update worlds/mlss/docs/en_Mario & Luigi Superstar Saga.md Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com> * Updated logic, Updated patch implementation, Removed unused imports, Cleaned up Code * Update __init__.py * Changed reference from world to mlssworld * Update worlds/mlss/docs/en_Mario & Luigi Superstar Saga.md Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com> * Update worlds/mlss/docs/en_Mario & Luigi Superstar Saga.md Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com> * Update worlds/mlss/docs/en_Mario & Luigi Superstar Saga.md Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com> * Update worlds/mlss/docs/en_Mario & Luigi Superstar Saga.md Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com> * Update worlds/mlss/docs/en_Mario & Luigi Superstar Saga.md Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com> * Update worlds/mlss/docs/en_Mario & Luigi Superstar Saga.md Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com> * Fix merge conflict + update prep * v1.2 * Leftover print commands * Update basepatch.bsdiff * Update basepatch.bsdiff * v1.3 * Update Rom.py * Change tracker locations to serverside, no longer locations. Various code cleanup and logic changes. * Event removal continuation. * Partial Implementation of APPP (Incomplete)) * v1.4 Implemented APPP * Docs Updated * Update Rom.py * Update setup_en.md * Update Rom.py * Update Rules.py * Fix for APPP being broken on webhost * Update Rom.py * Update Rom.py * Location name fixes + pants color fixes * Update Rules.py * Fix for ultra hammer cutscene * Fixed compat. issues with python ver. 3.8 * Updated hidden block yaml option * pre-v1.5 * Update Client.py * Update basepatch.bsdiff * v1.5 * Update XP multiplier to have a minimum of 0 * Update 'Beanfruit' to 'Bean Fruit' * v1.6 * Update Rom.py * Update basepatch.bsdiff * Initial review refactor * Revert state logic changes. Continuation of refactor. * Fixed failed generations. Finished refactor. * Reworked colors. Removed all .txt files * Actually removed the .txt files this time * Update Rom.py * Update README.md Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> * Update worlds/mlss/Options.py Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> * Update worlds/mlss/Client.py Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> * Update worlds/mlss/docs/en_Mario & Luigi Superstar Saga.md Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> * Update worlds/mlss/__init__.py Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> * Update worlds/mlss/docs/en_Mario & Luigi Superstar Saga.md Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> * Update worlds/mlss/Data.py Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> * Review refactor. * Update README.md Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> * Update worlds/mlss/Rules.py Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> * Add coin blocks to LocationName * Refactor. * Update Items.py * Delete mlss.apworld * Small asm bugfix * Update basepatch.bsdiff * Client sends less messages to server * Update basepatch.bsdiff --------- Co-authored-by: Silvris <58583688+Silvris@users.noreply.github.com> Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com> Co-authored-by: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com> Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
324 lines
12 KiB
Python
324 lines
12 KiB
Python
import typing
|
|
|
|
from BaseClasses import Region, Entrance
|
|
from .Locations import (
|
|
MLSSLocation,
|
|
mainArea,
|
|
chucklehuck,
|
|
castleTown,
|
|
startingFlag,
|
|
chuckolatorFlag,
|
|
piranhaFlag,
|
|
kidnappedFlag,
|
|
beanstarFlag,
|
|
birdoFlag,
|
|
surfable,
|
|
hooniversity,
|
|
gwarharEntrance,
|
|
gwarharMain,
|
|
fungitown,
|
|
fungitownBeanstar,
|
|
fungitownBirdo,
|
|
teeheeValley,
|
|
winkle,
|
|
sewers,
|
|
airport,
|
|
bowsers,
|
|
bowsersMini,
|
|
jokesEntrance,
|
|
jokesMain,
|
|
theater,
|
|
booStatue,
|
|
oasis,
|
|
postJokes,
|
|
baseUltraRocks,
|
|
coins,
|
|
)
|
|
from . import StateLogic
|
|
|
|
if typing.TYPE_CHECKING:
|
|
from . import MLSSWorld
|
|
|
|
|
|
def create_regions(world: "MLSSWorld", excluded: typing.List[str]):
|
|
menu_region = Region("Menu", world.player, world.multiworld)
|
|
world.multiworld.regions.append(menu_region)
|
|
|
|
create_region(world, "Main Area", mainArea, excluded)
|
|
create_region(world, "Chucklehuck Woods", chucklehuck, excluded)
|
|
create_region(world, "Beanbean Castle Town", castleTown, excluded)
|
|
create_region(world, "Shop Starting Flag", startingFlag, excluded)
|
|
create_region(world, "Shop Chuckolator Flag", chuckolatorFlag, excluded)
|
|
create_region(world, "Shop Mom Piranha Flag", piranhaFlag, excluded)
|
|
create_region(world, "Shop Enter Fungitown Flag", kidnappedFlag, excluded)
|
|
create_region(world, "Shop Beanstar Complete Flag", beanstarFlag, excluded)
|
|
create_region(world, "Shop Birdo Flag", birdoFlag, excluded)
|
|
create_region(world, "Surfable", surfable, excluded)
|
|
create_region(world, "Hooniversity", hooniversity, excluded)
|
|
create_region(world, "GwarharEntrance", gwarharEntrance, excluded)
|
|
create_region(world, "GwarharMain", gwarharMain, excluded)
|
|
create_region(world, "TeeheeValley", teeheeValley, excluded)
|
|
create_region(world, "Winkle", winkle, excluded)
|
|
create_region(world, "Sewers", sewers, excluded)
|
|
create_region(world, "Airport", airport, excluded)
|
|
create_region(world, "JokesEntrance", jokesEntrance, excluded)
|
|
create_region(world, "JokesMain", jokesMain, excluded)
|
|
create_region(world, "PostJokes", postJokes, excluded)
|
|
create_region(world, "Theater", theater, excluded)
|
|
create_region(world, "Fungitown", fungitown, excluded)
|
|
create_region(world, "Fungitown Shop Beanstar Complete Flag", fungitownBeanstar, excluded)
|
|
create_region(world, "Fungitown Shop Birdo Flag", fungitownBirdo, excluded)
|
|
create_region(world, "BooStatue", booStatue, excluded)
|
|
create_region(world, "Oasis", oasis, excluded)
|
|
create_region(world, "BaseUltraRocks", baseUltraRocks, excluded)
|
|
|
|
if world.options.coins:
|
|
create_region(world, "Coins", coins, excluded)
|
|
|
|
if not world.options.castle_skip:
|
|
create_region(world, "Bowser's Castle", bowsers, excluded)
|
|
create_region(world, "Bowser's Castle Mini", bowsersMini, excluded)
|
|
|
|
|
|
def connect_regions(world: "MLSSWorld"):
|
|
names: typing.Dict[str, int] = {}
|
|
|
|
connect(world, names, "Menu", "Main Area")
|
|
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),
|
|
)
|
|
connection = connect(
|
|
world,
|
|
names,
|
|
"Fungitown",
|
|
"Fungitown Shop Beanstar Complete Flag",
|
|
lambda state: StateLogic.pieces(state, world.player) or StateLogic.fungitown_birdo_shop(state, world.player),
|
|
True,
|
|
)
|
|
world.multiworld.register_indirect_condition(world.get_region("Fungitown Shop Birdo Flag"), connection)
|
|
connect(world, names, "Main Area", "Shop Starting Flag")
|
|
connection = connect(
|
|
world,
|
|
names,
|
|
"Shop Starting Flag",
|
|
"Shop Chuckolator Flag",
|
|
lambda state: (
|
|
StateLogic.brooch(state, world.player)
|
|
and StateLogic.fruits(state, world.player)
|
|
and (
|
|
StateLogic.thunder(state, world.player)
|
|
or StateLogic.fire(state, world.player)
|
|
or StateLogic.hammers(state, world.player)
|
|
)
|
|
)
|
|
or (
|
|
StateLogic.piranha_shop(state, world.player)
|
|
or StateLogic.fungitown_shop(state, world.player)
|
|
or StateLogic.star_shop(state, world.player)
|
|
or StateLogic.birdo_shop(state, world.player)
|
|
),
|
|
True,
|
|
)
|
|
world.multiworld.register_indirect_condition(world.get_region("Shop Mom Piranha Flag"), connection)
|
|
world.multiworld.register_indirect_condition(world.get_region("Shop Enter Fungitown Flag"), connection)
|
|
world.multiworld.register_indirect_condition(world.get_region("Shop Beanstar Complete Flag"), connection)
|
|
world.multiworld.register_indirect_condition(world.get_region("Shop Birdo Flag"), connection)
|
|
connection = connect(
|
|
world,
|
|
names,
|
|
"Shop Starting Flag",
|
|
"Shop Mom Piranha Flag",
|
|
lambda state: StateLogic.thunder(state, world.player)
|
|
or (
|
|
StateLogic.fungitown_shop(state, world.player)
|
|
or StateLogic.star_shop(state, world.player)
|
|
or StateLogic.birdo_shop(state, world.player)
|
|
),
|
|
True,
|
|
)
|
|
world.multiworld.register_indirect_condition(world.get_region("Shop Enter Fungitown Flag"), connection)
|
|
world.multiworld.register_indirect_condition(world.get_region("Shop Beanstar Complete Flag"), connection)
|
|
world.multiworld.register_indirect_condition(world.get_region("Shop Birdo Flag"), connection)
|
|
connection = connect(
|
|
world,
|
|
names,
|
|
"Shop Starting Flag",
|
|
"Shop Enter Fungitown Flag",
|
|
lambda state: StateLogic.fungitown(state, world.player)
|
|
or (StateLogic.star_shop(state, world.player) or StateLogic.birdo_shop(state, world.player)),
|
|
True,
|
|
)
|
|
world.multiworld.register_indirect_condition(world.get_region("Shop Beanstar Complete Flag"), connection)
|
|
world.multiworld.register_indirect_condition(world.get_region("Shop Birdo Flag"), connection)
|
|
connection = 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 StateLogic.birdo_shop(state, world.player),
|
|
True,
|
|
)
|
|
world.multiworld.register_indirect_condition(world.get_region("Shop Birdo Flag"), connection)
|
|
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)
|
|
and (
|
|
StateLogic.hammers(state, world.player)
|
|
or StateLogic.fire(state, world.player)
|
|
or StateLogic.thunder(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))
|
|
connect(
|
|
world,
|
|
names,
|
|
"Shop Starting Flag",
|
|
"Shop Birdo Flag",
|
|
lambda state: StateLogic.postJokes(state, world.player),
|
|
)
|
|
connect(
|
|
world,
|
|
names,
|
|
"Fungitown",
|
|
"Fungitown Shop Birdo Flag",
|
|
lambda state: StateLogic.postJokes(state, world.player),
|
|
)
|
|
else:
|
|
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),
|
|
)
|
|
connect(
|
|
world,
|
|
names,
|
|
"Shop Starting Flag",
|
|
"Shop Birdo Flag",
|
|
lambda state: StateLogic.canCrash(state, world.player) and StateLogic.postJokes(state, world.player),
|
|
)
|
|
connect(
|
|
world,
|
|
names,
|
|
"Fungitown",
|
|
"Fungitown Shop Birdo Flag",
|
|
lambda state: StateLogic.canCrash(state, world.player) and StateLogic.postJokes(state, world.player),
|
|
)
|
|
|
|
|
|
def create_region(world: "MLSSWorld", name, locations, excluded):
|
|
ret = Region(name, world.player, world.multiworld)
|
|
for location in locations:
|
|
loc = MLSSLocation(world.player, location.name, location.id, ret)
|
|
if location.name in excluded:
|
|
continue
|
|
ret.locations.append(loc)
|
|
world.multiworld.regions.append(ret)
|
|
|
|
|
|
def connect(
|
|
world: "MLSSWorld",
|
|
used_names: typing.Dict[str, int],
|
|
source: str,
|
|
target: str,
|
|
rule: typing.Optional[typing.Callable] = None,
|
|
reach: typing.Optional[bool] = False,
|
|
) -> Entrance | None:
|
|
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
|
|
name = target
|
|
else:
|
|
used_names[target] += 1
|
|
name = target + (" " * used_names[target])
|
|
|
|
connection = Entrance(world.player, name, source_region)
|
|
|
|
if rule:
|
|
connection.access_rule = rule
|
|
|
|
source_region.exits.append(connection)
|
|
connection.connect(target_region)
|
|
if reach:
|
|
return connection
|
|
else:
|
|
return None
|