-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRules.py
More file actions
42 lines (34 loc) · 2.15 KB
/
Copy pathRules.py
File metadata and controls
42 lines (34 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import typing
from worlds.generic.Rules import add_rule, forbid_item
from .Data import difficulty_lambda, level_locations, obelisks, boss_regions, excluded_levels, spawner_trap_ids
from .Items import items_by_id
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)
for location in get_locations_by_tags("no_spawner"):
for item in spawner_trap_ids:
if location.name not in world.disabled_locations:
forbid_item(world.get_location(location.name), items_by_id[item].item_name, 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)