mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
V6: Use new options api (#2668)
* v6: Use new options API * v6: Add display names for some options
This commit is contained in:
committed by
GitHub
parent
fe3bc8d6be
commit
d000b52ae0
@@ -1,6 +1,6 @@
|
||||
import typing
|
||||
from ..generic.Rules import add_rule
|
||||
from .Regions import connect_regions, v6areas
|
||||
from .Regions import v6areas
|
||||
|
||||
|
||||
def _has_trinket_range(state, player, start, end) -> bool:
|
||||
@@ -10,34 +10,36 @@ def _has_trinket_range(state, player, start, end) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def set_rules(world, player, area_connections: typing.Dict[int, int], area_cost_map: typing.Dict[int, int]):
|
||||
def set_rules(multiworld, options, player, area_connections: typing.Dict[int, int], area_cost_map: typing.Dict[int, int]):
|
||||
areashuffle = list(range(len(v6areas)))
|
||||
if world.AreaRandomizer[player].value:
|
||||
world.random.shuffle(areashuffle)
|
||||
if options.area_rando:
|
||||
multiworld.random.shuffle(areashuffle)
|
||||
area_connections.update({(index + 1): (value + 1) for index, value in enumerate(areashuffle)})
|
||||
area_connections.update({0: 0})
|
||||
if world.AreaCostRandomizer[player].value:
|
||||
world.random.shuffle(areashuffle)
|
||||
if options.area_cost:
|
||||
multiworld.random.shuffle(areashuffle)
|
||||
area_cost_map.update({(index + 1): (value + 1) for index, value in enumerate(areashuffle)})
|
||||
area_cost_map.update({0: 0})
|
||||
|
||||
menu_region = multiworld.get_region("Menu", player)
|
||||
for i in range(1, 5):
|
||||
connect_regions(world, player, "Menu", v6areas[area_connections[i] - 1],
|
||||
lambda state, i=i: _has_trinket_range(state, player,
|
||||
world.DoorCost[player].value * (area_cost_map[i] - 1),
|
||||
world.DoorCost[player].value * area_cost_map[i]))
|
||||
target_region = multiworld.get_region(v6areas[area_connections[i] - 1], player)
|
||||
menu_region.connect(connecting_region=target_region,
|
||||
rule=lambda state, i=i: _has_trinket_range(state, player,
|
||||
options.door_cost * (area_cost_map[i] - 1),
|
||||
options.door_cost * area_cost_map[i]))
|
||||
|
||||
# Special Rule for V
|
||||
add_rule(world.get_location("V", player), lambda state: state.can_reach("Laboratory", 'Region', player) and
|
||||
add_rule(multiworld.get_location("V", player), lambda state: state.can_reach("Laboratory", 'Region', player) and
|
||||
state.can_reach("The Tower", 'Region', player) and
|
||||
state.can_reach("Space Station 2", 'Region', player) and
|
||||
state.can_reach("Warp Zone", 'Region', player))
|
||||
|
||||
# Special Rule for NPC Trinket
|
||||
add_rule(world.get_location("NPC Trinket", player),
|
||||
add_rule(multiworld.get_location("NPC Trinket", player),
|
||||
lambda state: state.can_reach("Laboratory", 'Region', player) or
|
||||
(state.can_reach("The Tower", 'Region', player) and
|
||||
state.can_reach("Space Station 2", 'Region', player) and
|
||||
state.can_reach("Warp Zone", 'Region', player)))
|
||||
|
||||
world.completion_condition[player] = lambda state: state.can_reach("V", 'Location', player)
|
||||
multiworld.completion_condition[player] = lambda state: state.can_reach("V", 'Location', player)
|
||||
|
||||
Reference in New Issue
Block a user