forked from ArchipelagoMW/Archipelago
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRules.py
161 lines (137 loc) · 9.84 KB
/
Rules.py
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
from typing import List
from BaseClasses import MultiWorld, Region, Location
from ..AutoWorld import LogicMixin
from ..generic.Rules import set_rule
class WargrooveLogic(LogicMixin):
def _wargroove_has_item(self, player: int, item: str) -> bool:
return self.has(item, player)
def _wargroove_has_region(self, player: int, region: str) -> bool:
return self.can_reach(region, 'Region', player)
def _wargroove_has_item_and_region(self, player: int, item: str, region: str) -> bool:
return self.can_reach(region, 'Region', player) and self.has(item, player)
def set_rules(world: MultiWorld, player: int):
# Final Level
set_rule(world.get_location('Wargroove Finale: Victory', player),
lambda state: state._wargroove_has_item(player, "Final Bridges") and
state._wargroove_has_item(player, "Final Walls") and
state._wargroove_has_item(player, "Final Sickle"))
# Level 1
set_rule(world.get_location('Humble Beginnings: Caesar', player), lambda state: True)
set_rule(world.get_location('Humble Beginnings: Chest 1', player), lambda state: True)
set_rule(world.get_location('Humble Beginnings: Chest 2', player), lambda state: True)
set_rule(world.get_location('Humble Beginnings: Victory', player), lambda state: True)
set_region_exit_rules(world.get_region('Humble Beginnings', player),
[world.get_location('Humble Beginnings: Victory', player)])
# Levels 2A-2C
set_rule(world.get_location('Best Friendssss: Find Sedge', player), lambda state: True)
set_rule(world.get_location('Best Friendssss: Victory', player), lambda state: True)
set_region_exit_rules(world.get_region('Best Friendssss', player),
[world.get_location('Best Friendssss: Victory', player)])
set_rule(world.get_location('A Knight\'s Folly: Caesar', player), lambda state: True)
set_rule(world.get_location('A Knight\'s Folly: Victory', player), lambda state: True)
set_region_exit_rules(world.get_region('A Knight\'s Folly', player),
[world.get_location('A Knight\'s Folly: Victory', player)])
set_rule(world.get_location('Denrunaway: Chest', player), lambda state: True)
set_rule(world.get_location('Denrunaway: Victory', player), lambda state: True)
set_region_exit_rules(world.get_region('Denrunaway', player), [world.get_location('Denrunaway: Victory', player)])
# Levels 3AA-3AC
set_rule(world.get_location('Dragon Freeway: Victory', player),
lambda state: state._wargroove_has_item(player, 'Mage'))
set_region_exit_rules(world.get_region('Dragon Freeway', player),
[world.get_location('Dragon Freeway: Victory', player)])
set_rule(world.get_location('Deep Thicket: Find Sedge', player),
lambda state: state._wargroove_has_item(player, 'Mage'))
set_rule(world.get_location('Deep Thicket: Victory', player),
lambda state: state._wargroove_has_item(player, 'Mage'))
set_region_exit_rules(world.get_region('Deep Thicket', player),
[world.get_location('Deep Thicket: Victory', player)])
set_rule(world.get_location('Corrupted Inlet: Victory', player),
lambda state: state._wargroove_has_item(player, 'Barge') or
state._wargroove_has_item(player, 'Merfolk') or
state._wargroove_has_item(player, 'Warship'))
set_region_exit_rules(world.get_region('Corrupted Inlet', player),
[world.get_location('Corrupted Inlet: Victory', player)])
# Levels 3BA-3BC
set_rule(world.get_location('Mage Mayhem: Caesar', player),
lambda state: state._wargroove_has_item(player, 'Harpy') or state._wargroove_has_item(player, 'Dragon'))
set_rule(world.get_location('Mage Mayhem: Victory', player),
lambda state: state._wargroove_has_item(player, 'Harpy') or state._wargroove_has_item(player, 'Dragon'))
set_region_exit_rules(world.get_region('Mage Mayhem', player), [world.get_location('Mage Mayhem: Victory', player)])
set_rule(world.get_location('Endless Knight: Victory', player),
lambda state: state._wargroove_has_item(player, 'Eastern Bridges') and (
state._wargroove_has_item(player, 'Spearman') or
state._wargroove_has_item(player, 'Harpy') or
state._wargroove_has_item(player, 'Dragon')))
set_region_exit_rules(world.get_region('Endless Knight', player),
[world.get_location('Endless Knight: Victory', player)])
set_rule(world.get_location('Ambushed in the Middle: Victory (Blue)', player),
lambda state: state._wargroove_has_item(player, 'Spearman'))
set_rule(world.get_location('Ambushed in the Middle: Victory (Green)', player),
lambda state: state._wargroove_has_item(player, 'Spearman'))
set_region_exit_rules(world.get_region('Ambushed in the Middle', player),
[world.get_location('Ambushed in the Middle: Victory (Blue)', player),
world.get_location('Ambushed in the Middle: Victory (Green)', player)])
# Levels 3CA-3CC
set_rule(world.get_location('The Churning Sea: Victory', player),
lambda state: (state._wargroove_has_item(player, 'Merfolk') or state._wargroove_has_item(player, 'Turtle'))
and state._wargroove_has_item(player, 'Harpoon Ship'))
set_region_exit_rules(world.get_region('The Churning Sea', player),
[world.get_location('The Churning Sea: Victory', player)])
set_rule(world.get_location('Frigid Archery: Light the Torch', player),
lambda state: state._wargroove_has_item(player, 'Archer') and
state._wargroove_has_item(player, 'Southern Walls'))
set_rule(world.get_location('Frigid Archery: Victory', player),
lambda state: state._wargroove_has_item(player, 'Archer'))
set_region_exit_rules(world.get_region('Frigid Archery', player),
[world.get_location('Frigid Archery: Victory', player)])
set_rule(world.get_location('Archery Lessons: Chest', player),
lambda state: state._wargroove_has_item(player, 'Knight') and
state._wargroove_has_item(player, 'Southern Walls'))
set_rule(world.get_location('Archery Lessons: Victory', player),
lambda state: state._wargroove_has_item(player, 'Knight') and
state._wargroove_has_item(player, 'Southern Walls'))
set_region_exit_rules(world.get_region('Archery Lessons', player),
[world.get_location('Archery Lessons: Victory', player)])
# Levels 4AA-4AC
set_rule(world.get_location('Surrounded: Caesar', player),
lambda state: state._wargroove_has_item_and_region(player, 'Knight', 'Surrounded'))
set_rule(world.get_location('Surrounded: Victory', player),
lambda state: state._wargroove_has_item_and_region(player, 'Knight', 'Surrounded'))
set_rule(world.get_location('Darkest Knight: Victory', player),
lambda state: state._wargroove_has_item_and_region(player, 'Spearman', 'Darkest Knight'))
set_rule(world.get_location('Robbed: Victory', player),
lambda state: state._wargroove_has_item_and_region(player, 'Thief', 'Robbed') and
state._wargroove_has_item(player, 'Rifleman'))
# Levels 4BA-4BC
set_rule(world.get_location('Open Season: Caesar', player),
lambda state: state._wargroove_has_item_and_region(player, 'Mage', 'Open Season') and
state._wargroove_has_item(player, 'Knight'))
set_rule(world.get_location('Open Season: Victory', player),
lambda state: state._wargroove_has_item_and_region(player, 'Mage', 'Open Season') and
state._wargroove_has_item(player, 'Knight'))
set_rule(world.get_location('Doggo Mountain: Find all the Dogs', player),
lambda state: state._wargroove_has_item_and_region(player, 'Knight', 'Doggo Mountain'))
set_rule(world.get_location('Doggo Mountain: Victory', player),
lambda state: state._wargroove_has_item_and_region(player, 'Knight', 'Doggo Mountain'))
set_rule(world.get_location('Tenri\'s Fall: Victory', player),
lambda state: state._wargroove_has_item_and_region(player, 'Mage', 'Tenri\'s Fall') and
state._wargroove_has_item(player, 'Thief'))
set_rule(world.get_location('Foolish Canal: Victory', player),
lambda state: state._wargroove_has_item_and_region(player, 'Mage', 'Foolish Canal') and
state._wargroove_has_item(player, 'Spearman'))
# Levels 4CA-4CC
set_rule(world.get_location('Master of the Lake: Victory', player),
lambda state: state._wargroove_has_item_and_region(player, 'Warship', 'Master of the Lake'))
set_rule(world.get_location('A Ballista\'s Revenge: Victory', player),
lambda state: state._wargroove_has_item_and_region(player, 'Ballista', 'A Ballista\'s Revenge'))
set_rule(world.get_location('Rebel Village: Victory (Pink)', player),
lambda state: state._wargroove_has_item_and_region(player, 'Spearman', 'Rebel Village'))
set_rule(world.get_location('Rebel Village: Victory (Red)', player),
lambda state: state._wargroove_has_item_and_region(player, 'Spearman', 'Rebel Village'))
def set_region_exit_rules(region: Region, locations: List[Location], operator: str = "or"):
if operator == "or":
exit_rule = lambda state: any(location.access_rule(state) for location in locations)
else:
exit_rule = lambda state: all(location.access_rule(state) for location in locations)
for region_exit in region.exits:
region_exit.access_rule = exit_rule