V6: fix area cost always referencing last area cost, instead of current index (#348)
* V6: fix area cost always referencing last area cost, instead of current index * V6: autoformat Rules.py * V6: correct a location name for rule application
This commit is contained in:
parent
3b128c8512
commit
3c2933d587
|
@ -3,9 +3,9 @@ from ..generic.Rules import add_rule
|
||||||
from .Regions import connect_regions, v6areas
|
from .Regions import connect_regions, v6areas
|
||||||
|
|
||||||
|
|
||||||
def _has_trinket_range(state,player,start,end) -> bool:
|
def _has_trinket_range(state, player, start, end) -> bool:
|
||||||
for i in range(start,end):
|
for i in range(start, end):
|
||||||
if (not state.has("Trinket " + str(i+1).zfill(2), player)):
|
if not state.has("Trinket " + str(i + 1).zfill(2), player):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -14,27 +14,30 @@ def set_rules(world, player, area_connections: typing.Dict[int, int], area_cost_
|
||||||
areashuffle = list(range(len(v6areas)))
|
areashuffle = list(range(len(v6areas)))
|
||||||
if world.AreaRandomizer[player].value:
|
if world.AreaRandomizer[player].value:
|
||||||
world.random.shuffle(areashuffle)
|
world.random.shuffle(areashuffle)
|
||||||
area_connections.update({(index+1): (value+1) for index, value in enumerate(areashuffle)})
|
area_connections.update({(index + 1): (value + 1) for index, value in enumerate(areashuffle)})
|
||||||
area_connections.update({0:0})
|
area_connections.update({0: 0})
|
||||||
if world.AreaCostRandomizer[player].value:
|
if world.AreaCostRandomizer[player].value:
|
||||||
world.random.shuffle(areashuffle)
|
world.random.shuffle(areashuffle)
|
||||||
area_cost_map.update({(index+1): (value+1) for index, value in enumerate(areashuffle)})
|
area_cost_map.update({(index + 1): (value + 1) for index, value in enumerate(areashuffle)})
|
||||||
area_cost_map.update({0:0})
|
area_cost_map.update({0: 0})
|
||||||
|
|
||||||
for i in range(1,5):
|
for i in range(1, 5):
|
||||||
connect_regions(world, player, "Menu", v6areas[area_connections[i]-1], lambda state: _has_trinket_range(state,player,world.DoorCost[player].value*(area_cost_map[i]-1),
|
connect_regions(world, player, "Menu", v6areas[area_connections[i] - 1],
|
||||||
world.DoorCost[player].value*area_cost_map[i]))
|
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]))
|
||||||
|
|
||||||
#Special Rule for V
|
# Special Rule for V
|
||||||
add_rule(world.get_location("V",player), lambda state : state.can_reach("Laboratory",'Region',player) and
|
add_rule(world.get_location("V", player), lambda state: state.can_reach("Laboratory", 'Region', player) and
|
||||||
state.can_reach("The Tower",'Region',player) and
|
state.can_reach("The Tower", 'Region', player) and
|
||||||
state.can_reach("Space Station 2",'Region',player) and
|
state.can_reach("Space Station 2", 'Region', player) and
|
||||||
state.can_reach("Warp Zone",'Region',player))
|
state.can_reach("Warp Zone", 'Region', player))
|
||||||
|
|
||||||
#Special Rule for NPC Trinket
|
# Special Rule for NPC Trinket
|
||||||
add_rule(world.get_location("V",player), lambda state : state.can_reach("Laboratory",'Region',player) or
|
add_rule(world.get_location("NPC Trinket", player),
|
||||||
( state.can_reach("The Tower",'Region',player) and
|
lambda state: state.can_reach("Laboratory", 'Region', player) or
|
||||||
state.can_reach("Space Station 2",'Region',player) and
|
(state.can_reach("The Tower", 'Region', player) and
|
||||||
state.can_reach("Warp Zone",'Region',player) ))
|
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)
|
world.completion_condition[player] = lambda state: state.can_reach("V", 'Location', player)
|
||||||
|
|
Loading…
Reference in New Issue