forked from mirror/Archipelago
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
36 lines
1.8 KiB
Python
36 lines
1.8 KiB
Python
import typing
|
|
|
|
from worlds.generic.Rules import add_rule, forbid_item
|
|
|
|
from .Data import difficulty_lambda, level_locations, obelisks, boss_regions, excluded_levels
|
|
from .Locations import get_locations_by_tags
|
|
from .Options import Goal
|
|
|
|
if typing.TYPE_CHECKING:
|
|
from . import GauntletLegendsWorld
|
|
|
|
def set_rules(world: "GauntletLegendsWorld"):
|
|
for location in get_locations_by_tags("no_obelisks") + (get_locations_by_tags("obelisk") if world.options.obelisks else []):
|
|
for item in obelisks:
|
|
if location.name not in world.disabled_locations:
|
|
forbid_item(world.get_location(location.name), item, world.player)
|
|
|
|
if not world.options.instant_max:
|
|
for level_id, locations in level_locations.items():
|
|
for location in locations:
|
|
if location.difficulty > 1:
|
|
if location.name not in world.disabled_locations:
|
|
add_rule(
|
|
world.get_location(location.name),
|
|
lambda state, level_id_=level_id >> 4, difficulty=location.difficulty - 1:
|
|
state.has("progression", world.player, max(difficulty_lambda[level_id_][difficulty] - (len(world.excluded_regions) * 4), 0))
|
|
)
|
|
|
|
def goal_conditions(state, world: "GauntletLegendsWorld") -> bool:
|
|
return state.can_reach("Gates of the Underworld", "Region", world.player) \
|
|
if world.options.goal == Goal.option_defeat_skorne else \
|
|
(sum(state.can_reach(boss, "Region", world.player)
|
|
for boss in boss_regions if boss not in
|
|
[level for region, levels in excluded_levels.items() if region in world.excluded_regions for level in levels])
|
|
>= world.options.boss_goal_count.value)
|