Files
dockipelago/worlds/cat_quest/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

73 lines
3.3 KiB
Python

from __future__ import annotations
from typing import TYPE_CHECKING
from worlds.generic.Rules import add_rule
from .locationData import questLocations, templeLocations, monumentLocations
from .itemData import prog_skill_uprades, prog_skills
if TYPE_CHECKING:
from .world import CatQuestWorld
def set_all_rules(world: CatQuestWorld) -> None:
set_all_location_rules(world)
set_completion_condition(world)
def set_all_location_rules(world: CatQuestWorld) -> None:
included_locations = []
included_locations.extend(questLocations)
if world.options.include_temples:
included_locations.extend(templeLocations)
if world.options.include_monuments:
included_locations.extend(monumentLocations)
for loc in included_locations:
if loc["art"] == "water":
add_rule(world.get_location(loc["name"]),
lambda state: state.has("Royal Art of Water Walking", world.player))
elif loc["art"] == "flight":
add_rule(world.get_location(loc["name"]),
lambda state: state.has("Royal Art of Flight", world.player))
elif loc["art"] == "both":
add_rule(world.get_location(loc["name"]),
lambda state: state.has_all(("Royal Art of Flight", "Royal Art of Water Walking"), world.player))
elif loc["art"] == "either":
add_rule(world.get_location(loc["name"]),
lambda state: state.has_any(("Royal Art of Flight", "Royal Art of Water Walking"), world.player))
if loc["hasFist"]:
add_rule(world.get_location(loc["name"]),
lambda state: state.has_any(
("Flamepurr", "Lightnyan", "Freezepaw", "Cattrap", "Astropaw",
"Progressive Flamepurr", "Progressive Lightnyan", "Progressive Freezepaw", "Progressive Cattrap", "Progressive Astropaw"
), world.player))
def set_completion_condition(world: CatQuestWorld) -> None:
if world.options.goal != "max_level":
if world.options.goal == "spellmastery":
if world.options.skill_upgrade == "progressive_skills":
world.multiworld.completion_condition[world.player] = lambda state: (
state.has_all_counts({skill["name"]: 10 for skill in prog_skills}, world.player)
)
else:
world.multiworld.completion_condition[world.player] = lambda state: (
state.has_all(("Flamepurr", "Lightnyan", "Freezepaw", "Cattrap", "Astropaw", "Healing Paw", "Purrserk"), world.player) and
(
world.options.skill_upgrade == "coins" or
state.has_all_counts({upgrade["name"]: 9 for upgrade in prog_skill_uprades}, world.player) or
state.has("Progressive Magic Level", world.player, 9)
)
)
else:
world.multiworld.completion_condition[world.player] = lambda state: (
state.has_all(("Royal Art of Water Walking", "Royal Art of Flight"), world.player) and
state.has_any(("Flamepurr", "Lightnyan", "Freezepaw", "Cattrap", "Astropaw",
"Progressive Flamepurr", "Progressive Lightnyan", "Progressive Freezepaw", "Progressive Cattrap", "Progressive Astropaw"
), world.player)
)