Skip to content

Commit ef0d322

Browse files
Seldom-SEEmilyV99
authored andcommitted
Terraria: Crate logic (ArchipelagoMW#2841)
1 parent e2ed26f commit ef0d322

File tree

3 files changed

+64
-63
lines changed

3 files changed

+64
-63
lines changed

worlds/terraria/Checks.py

+55-56
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ def validate_conditions(
177177
if condition not in {
178178
"npc",
179179
"calamity",
180+
"grindy",
180181
"pickaxe",
181182
"hammer",
182183
"mech_boss",
@@ -221,62 +222,60 @@ def mark_progression(
221222
mark_progression(conditions, progression, rules, rule_indices, loc_to_item)
222223

223224

224-
def read_data() -> (
225-
Tuple[
226-
# Goal to rule index that ends that goal's range and the locations required
227-
List[Tuple[int, Set[str]]],
228-
# Rules
229-
List[
230-
Tuple[
231-
# Rule
232-
str,
233-
# Flag to flag arg
234-
Dict[str, Union[str, int, None]],
235-
# True = or, False = and, None = N/A
236-
Union[bool, None],
237-
# Conditions
238-
List[
239-
Tuple[
240-
# True = positive, False = negative
241-
bool,
242-
# Condition type
243-
int,
244-
# Condition name or list (True = or, False = and, None = N/A) (list shares type with outer)
245-
Union[str, Tuple[Union[bool, None], List]],
246-
# Condition arg
247-
Union[str, int, None],
248-
]
249-
],
250-
]
251-
],
252-
# Rule to rule index
253-
Dict[str, int],
254-
# Label to rewards
255-
Dict[str, List[str]],
256-
# Reward to flags
257-
Dict[str, Set[str]],
258-
# Item name to ID
259-
Dict[str, int],
260-
# Location name to ID
261-
Dict[str, int],
262-
# NPCs
263-
List[str],
264-
# Pickaxe to pick power
265-
Dict[str, int],
266-
# Hammer to hammer power
267-
Dict[str, int],
268-
# Mechanical bosses
269-
List[str],
270-
# Calamity final bosses
271-
List[str],
272-
# Progression rules
273-
Set[str],
274-
# Armor to minion count,
275-
Dict[str, int],
276-
# Accessory to minion count,
277-
Dict[str, int],
278-
]
279-
):
225+
def read_data() -> Tuple[
226+
# Goal to rule index that ends that goal's range and the locations required
227+
List[Tuple[int, Set[str]]],
228+
# Rules
229+
List[
230+
Tuple[
231+
# Rule
232+
str,
233+
# Flag to flag arg
234+
Dict[str, Union[str, int, None]],
235+
# True = or, False = and, None = N/A
236+
Union[bool, None],
237+
# Conditions
238+
List[
239+
Tuple[
240+
# True = positive, False = negative
241+
bool,
242+
# Condition type
243+
int,
244+
# Condition name or list (True = or, False = and, None = N/A) (list shares type with outer)
245+
Union[str, Tuple[Union[bool, None], List]],
246+
# Condition arg
247+
Union[str, int, None],
248+
]
249+
],
250+
]
251+
],
252+
# Rule to rule index
253+
Dict[str, int],
254+
# Label to rewards
255+
Dict[str, List[str]],
256+
# Reward to flags
257+
Dict[str, Set[str]],
258+
# Item name to ID
259+
Dict[str, int],
260+
# Location name to ID
261+
Dict[str, int],
262+
# NPCs
263+
List[str],
264+
# Pickaxe to pick power
265+
Dict[str, int],
266+
# Hammer to hammer power
267+
Dict[str, int],
268+
# Mechanical bosses
269+
List[str],
270+
# Calamity final bosses
271+
List[str],
272+
# Progression rules
273+
Set[str],
274+
# Armor to minion count,
275+
Dict[str, int],
276+
# Accessory to minion count,
277+
Dict[str, int],
278+
]:
280279
next_id = 0x7E0000
281280
item_name_to_id = {}
282281

worlds/terraria/Rules.dsv

+7-7
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ Spider Armor; ArmorMinions(3);
234234
Cross Necklace; ; Wall of Flesh;
235235
Altar; ; Wall of Flesh & @hammer(80);
236236
Begone, Evil!; Achievement; Altar;
237-
Cobalt Ore; ; ((~@calamity & Altar) | (@calamity & Wall of Flesh)) & @pickaxe(100);
237+
Cobalt Ore; ; (((~@calamity & Altar) | (@calamity & Wall of Flesh)) & @pickaxe(100)) | Wall of Flesh;
238238
Extra Shiny!; Achievement; Cobalt Ore | Mythril Ore | Adamantite Ore | Chlorophyte Ore;
239-
Cobalt Bar; ; Cobalt Ore;
239+
Cobalt Bar; ; Cobalt Ore | Wall of Flesh;
240240
Cobalt Pickaxe; Pickaxe(110); Cobalt Bar;
241241
Soul of Night; ; Wall of Flesh | (@calamity & Altar);
242242
Hallow; ; Wall of Flesh;
@@ -249,7 +249,7 @@ Blessed Apple; ;
249249
Rod of Discord; ; Hallow;
250250
Gelatin World Tour; Achievement | Grindy; Dungeon & Wall of Flesh & Hallow & #King Slime;
251251
Soul of Flight; ; Wall of Flesh;
252-
Head in the Clouds; Achievement; (Soul of Flight & ((Hardmode Anvil & (Soul of Light | Soul of Night | Pixie Dust | Wall of Flesh | Solar Eclipse | @mech_boss(1) | Plantera | Spectre Bar | #Golem)) | (Shroomite Bar & Autohammer) | #Mourning Wood | #Pumpking)) | Steampunker | (Wall of Flesh & Witch Doctor) | (Solar Eclipse & Plantera) | #Everscream | #Old One's Army Tier 3 | #Empress of Light | #Duke Fishron | (Fragment & Luminite Bar & Ancient Manipulator); // Leaf Wings are Post-Plantera in 1.4.4
252+
Head in the Clouds; Achievement; @grindy | (Soul of Flight & ((Hardmode Anvil & (Soul of Light | Soul of Night | Pixie Dust | Wall of Flesh | Solar Eclipse | @mech_boss(1) | Plantera | Spectre Bar | #Golem)) | (Shroomite Bar & Autohammer) | #Mourning Wood | #Pumpking)) | Steampunker | (Wall of Flesh & Witch Doctor) | (Solar Eclipse & Plantera) | #Everscream | #Old One's Army Tier 3 | #Empress of Light | #Duke Fishron | (Fragment & Luminite Bar & Ancient Manipulator); // Leaf Wings are Post-Plantera in 1.4.4
253253
Bunny; Npc; Zoologist & Wall of Flesh; // Extremely simplified
254254
Forbidden Fragment; ; Sandstorm & Wall of Flesh;
255255
Astral Infection; Calamity; Wall of Flesh;
@@ -274,13 +274,13 @@ Pirate; Npc;
274274
Queen Slime; Location | Item; Hallow;
275275

276276
// Aquatic Scourge
277-
Mythril Ore; ; ((~@calamity & Altar) | (@calamity & @mech_boss(1))) & @pickaxe(110);
278-
Mythril Bar; ; Mythril Ore;
277+
Mythril Ore; ; (((~@calamity & Altar) | (@calamity & @mech_boss(1))) & @pickaxe(110)) | (Wall of Flesh & (~@calamity | @mech_boss(1)));
278+
Mythril Bar; ; Mythril Ore | (Wall of Flesh & (~@calamity | @mech_boss(1)));
279279
Hardmode Anvil; ; Mythril Bar;
280280
Mythril Pickaxe; Pickaxe(150); Hardmode Anvil & Mythril Bar;
281-
Adamantite Ore; ; ((~@calamity & Altar) | (@calamity & @mech_boss(2))) & @pickaxe(150);
281+
Adamantite Ore; ; (((~@calamity & Altar) | (@calamity & @mech_boss(2))) & @pickaxe(150)) | (Wall of Flesh & (~@calamity | @mech_boss(2)));
282282
Hardmode Forge; ; Hardmode Anvil & Adamantite Ore & Hellforge;
283-
Adamantite Bar; ; Hardmode Forge & Adamantite Ore;
283+
Adamantite Bar; ; (Hardmode Forge & Adamantite Ore) | (Wall of Flesh & (~@calamity | @mech_boss(2)));
284284
Adamantite Pickaxe; Pickaxe(180); Hardmode Anvil & Adamantite Bar;
285285
Forbidden Armor; ArmorMinions(2); Hardmode Anvil & Adamantite Bar & Forbidden Fragment;
286286
Aquatic Scourge; Calamity | Location | Item;

worlds/terraria/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ def check_condition(
240240
return not sign
241241
elif condition == "calamity":
242242
return sign == self.calamity
243+
elif condition == "grindy":
244+
return sign == (self.multiworld.achievements[self.player].value >= 2)
243245
elif condition == "pickaxe":
244246
if type(arg) is not int:
245247
raise Exception("@pickaxe requires an integer argument")

0 commit comments

Comments
 (0)