-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegions.py
207 lines (165 loc) · 6.49 KB
/
Regions.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import typing
from BaseClasses import Entrance, Region
from .Locations import (
GLLocation,
arctic_docks,
battle_towers,
battle_trenches,
castle_courtyard,
castle_treasury,
chimeras_keep,
cliffs_of_desolation,
crystal_mine,
dagger_peak,
desecrated_temple,
dragons_lair,
dungeon_of_torment,
erupting_fissure,
frozen_camp,
gates_of_the_underworld,
haunted_cemetery,
infernal_fortress,
lost_cave,
plague_fiend,
poisoned_fields,
tower_armory,
toxic_air_ship,
valley_of_fire,
venomous_spire,
volcanic_cavern,
yeti,
)
if typing.TYPE_CHECKING:
from . import GauntletLegendsWorld
def create_regions(world: "GauntletLegendsWorld"):
world.multiworld.regions.append(Region("Menu", world.player, world.multiworld))
create_region(world, "Valley of Fire", valley_of_fire)
create_region(world, "Dagger Peak", dagger_peak)
create_region(world, "Cliffs of Desolation", cliffs_of_desolation)
create_region(world, "Lost Cave", lost_cave)
create_region(world, "Volcanic Caverns", volcanic_cavern)
create_region(world, "Dragon's Lair", dragons_lair)
create_region(world, "Castle Courtyard", castle_courtyard)
create_region(world, "Dungeon of Torment", dungeon_of_torment)
create_region(world, "Tower Armory", tower_armory)
create_region(world, "Castle Treasury", castle_treasury)
create_region(world, "Chimera's Keep", chimeras_keep)
create_region(world, "Poisonous Fields", poisoned_fields)
create_region(world, "Haunted Cemetery", haunted_cemetery)
create_region(world, "Venomous Spire", venomous_spire)
create_region(world, "Toxic Air Ship", toxic_air_ship)
create_region(world, "Vat of the Plague Fiend", plague_fiend)
create_region(world, "Arctic Docks", arctic_docks)
create_region(world, "Frozen Camp", frozen_camp)
create_region(world, "Crystal Mine", crystal_mine)
create_region(world, "Erupting Fissure", erupting_fissure)
create_region(world, "Yeti", yeti)
create_region(world, "Desecrated Temple", desecrated_temple)
create_region(world, "Battle Trenches", battle_trenches)
create_region(world, "Battle Towers", battle_towers)
create_region(world, "Infernal Fortress", infernal_fortress)
create_region(world, "Gates of the Underworld", gates_of_the_underworld)
def connect_regions(world: "GauntletLegendsWorld"):
names: typing.Dict[str, int] = {}
connect(world, names, "Menu", "Valley of Fire")
connect(world, names, "Menu", "Dagger Peak")
connect(world, names, "Menu", "Cliffs of Desolation")
connect(world, names, "Menu", "Lost Cave")
connect(world, names, "Menu", "Volcanic Caverns")
connect(world, names, "Menu", "Dragon's Lair")
connect(
world,
names,
"Menu",
"Castle Courtyard",
lambda state: state.has("Mountain Obelisk 1", world.player)
and state.has("Mountain Obelisk 2", world.player)
and state.has("Mountain Obelisk 3", world.player),
)
connect(world, names, "Castle Courtyard", "Dungeon of Torment")
connect(world, names, "Castle Courtyard", "Tower Armory")
connect(world, names, "Castle Courtyard", "Castle Treasury")
connect(world, names, "Castle Courtyard", "Chimera's Keep")
connect(
world,
names,
"Menu",
"Poisonous Fields",
lambda state: state.has("Castle Obelisk 1", world.player)
and state.has("Castle Obelisk 2", world.player),
)
connect(world, names, "Poisonous Fields", "Haunted Cemetery")
connect(world, names, "Poisonous Fields", "Venomous Spire")
connect(world, names, "Poisonous Fields", "Toxic Air Ship")
connect(world, names, "Toxic Air Ship", "Vat of the Plague Fiend")
connect(
world,
names,
"Menu",
"Arctic Docks",
lambda state: state.has("Town Obelisk 1", world.player)
and state.has("Town Obelisk 2", world.player),
)
connect(world, names, "Arctic Docks", "Frozen Camp")
connect(world, names, "Arctic Docks", "Crystal Mine")
connect(world, names, "Arctic Docks", "Erupting Fissure")
connect(world, names, "Erupting Fissure", "Yeti")
connect(
world,
names,
"Menu",
"Desecrated Temple",
lambda state: state.has("Dragon Mirror Shard", world.player)
and state.has("Chimera Mirror Shard", world.player)
and state.has("Plague Fiend Mirror Shard", world.player)
and state.has("Yeti Mirror Shard", world.player),
)
connect(world, names, "Desecrated Temple", "Battle Trenches")
connect(world, names, "Desecrated Temple", "Battle Towers")
connect(world, names, "Desecrated Temple", "Infernal Fortress")
connect(
world,
names,
"Menu",
"Gates of the Underworld",
lambda state: state.has("Runestone 1", world.player)
and state.has("Runestone 2", world.player)
and state.has("Runestone 3", world.player)
and state.has("Runestone 4", world.player)
and state.has("Runestone 5", world.player)
and state.has("Runestone 6", world.player)
and state.has("Runestone 7", world.player)
and state.has("Runestone 8", world.player)
and state.has("Runestone 9", world.player)
and state.has("Runestone 10", world.player)
and state.has("Runestone 11", world.player)
and state.has("Runestone 12", world.player)
and state.has("Runestone 13", world.player),
)
def create_region(world: "GauntletLegendsWorld", name, locations):
reg = Region(name, world.player, world.multiworld)
for location in locations:
if location.name not in world.disabled_locations:
loc = GLLocation(world.player, location.name, location.id, reg)
reg.locations.append(loc)
world.multiworld.regions.append(reg)
def connect(
world: "GauntletLegendsWorld",
used_names: typing.Dict[str, int],
source: str,
target: str,
rule: typing.Optional[typing.Callable] = None,
):
source_region = world.multiworld.get_region(source, world.player)
target_region = world.multiworld.get_region(target, world.player)
if target not in used_names:
used_names[target] = 1
name = target
else:
used_names[target] += 1
name = target + (" " * used_names[target])
connection = Entrance(world.player, name, source_region)
if rule:
connection.access_rule = rule
source_region.exits.append(connection)
connection.connect(target_region)