Files
dockipelago/worlds/papermario/Rules.py
Jonathan Tinney 7971961166
Some checks failed
Analyze modified files / flake8 (push) Failing after 2m28s
Build / build-win (push) Has been cancelled
Build / build-ubuntu2204 (push) Has been cancelled
ctest / Test C++ ubuntu-latest (push) Has been cancelled
ctest / Test C++ windows-latest (push) Has been cancelled
Analyze modified files / mypy (push) Has been cancelled
Build and Publish Docker Images / Push Docker image to Docker Hub (push) Successful in 5m4s
Native Code Static Analysis / scan-build (push) Failing after 5m2s
type check / pyright (push) Successful in 1m7s
unittests / Test Python 3.11.2 ubuntu-latest (push) Failing after 16m23s
unittests / Test Python 3.12 ubuntu-latest (push) Failing after 28m19s
unittests / Test Python 3.13 ubuntu-latest (push) Failing after 14m49s
unittests / Test hosting with 3.13 on ubuntu-latest (push) Successful in 5m0s
unittests / Test Python 3.13 macos-latest (push) Has been cancelled
unittests / Test Python 3.11 windows-latest (push) Has been cancelled
unittests / Test Python 3.13 windows-latest (push) Has been cancelled
add schedule I, sonic 1/frontiers/heroes, spirit island
2026-04-02 23:46:36 -07:00

38 lines
2.2 KiB
Python

from typing import TYPE_CHECKING
from .data.LocationsList import exclude_from_trap_placement
from worlds.generic.Rules import set_rule, add_rule, add_item_rule
from .data.ItemList import item_multiples_ids
from .items import ap_id_to_pm_data
if TYPE_CHECKING:
from . import PaperMarioWorld
def set_rules(world: "PaperMarioWorld") -> None:
world.multiworld.completion_condition[world.player] = lambda state: state.has("STARROD", world.player)
# Coin gets glitchy graphic on the sign for some reason
add_item_rule(world.multiworld.get_location("GR Goomba Road 2 On the Sign", world.player),
lambda item: item.player != world.player or item.name != "Coin")
# Items in the storeroom in the second Toad Town shop can cause a crash when entering the screen
# This is caused by the game attempting to spawn a local item that has already been collected
# While this shouldn't normally be possible, we're going to safeguard this from occurring+
add_item_rule(world.multiworld.get_location("TT Residental District Storeroom Item 1", world.player),
lambda item: item.player != world.player or item.id not in item_multiples_ids.keys())
add_item_rule(world.multiworld.get_location("TT Residental District Storeroom Item 2", world.player),
lambda item: item.player != world.player or item.id not in item_multiples_ids.keys())
add_item_rule(world.multiworld.get_location("TT Residental District Storeroom Item 3", world.player),
lambda item: item.player != world.player or item.id not in item_multiples_ids.keys())
add_item_rule(world.multiworld.get_location("TT Residental District Storeroom Item 4", world.player),
lambda item: item.player != world.player or item.id not in item_multiples_ids.keys())
# Damage traps cannot be in shops or over spinning flowers
untrappable_locations = list(filter(lambda location: location.name in exclude_from_trap_placement,
world.multiworld.get_locations(player=world.player)))
for loc in untrappable_locations:
add_item_rule(loc, lambda item: item.player != world.player or item.name != "Damage Trap")