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

24 lines
1.1 KiB
Python

from typing import TYPE_CHECKING
from .items import get_progression_medal
from .locations import get_series_name
from worlds.generic.Rules import set_rule
if TYPE_CHECKING:
from . import TrackmaniaWorld
def set_rules(world: "TrackmaniaWorld"):
medal_total: int = world.series_data[0]["MedalTotal"]
for i in range(1,world.options.series_number):
set_series_rules(world, i, medal_total)
medal_total += world.series_data[i]["MedalTotal"]
final_medal_requirement: int = medal_total
set_rule(world.multiworld.get_entrance("Victory!", world.player),
lambda state: state.has(get_progression_medal(world), world.player, final_medal_requirement))
world.multiworld.completion_condition[world.player] = lambda state: state.has("Victory!", world.player)
def set_series_rules(world: "TrackmaniaWorld", series_index : int, medal_total: int):
entrance_name: str = f"{get_series_name(series_index - 1)} -> {get_series_name(series_index)}"
set_rule(world.multiworld.get_entrance(entrance_name, world.player),
lambda state: state.has(get_progression_medal(world), world.player, medal_total))