Terraria: Crate logic ()

This commit is contained in:
Seldom 2024-04-13 17:18:02 -07:00 committed by GitHub
parent fb3035a78b
commit f5ff005360
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 64 additions and 63 deletions

View File

@ -177,6 +177,7 @@ def validate_conditions(
if condition not in { if condition not in {
"npc", "npc",
"calamity", "calamity",
"grindy",
"pickaxe", "pickaxe",
"hammer", "hammer",
"mech_boss", "mech_boss",
@ -221,62 +222,60 @@ def mark_progression(
mark_progression(conditions, progression, rules, rule_indices, loc_to_item) mark_progression(conditions, progression, rules, rule_indices, loc_to_item)
def read_data() -> ( def read_data() -> Tuple[
Tuple[ # Goal to rule index that ends that goal's range and the locations required
# Goal to rule index that ends that goal's range and the locations required List[Tuple[int, Set[str]]],
List[Tuple[int, Set[str]]], # Rules
# Rules List[
List[ Tuple[
Tuple[ # Rule
# Rule str,
str, # Flag to flag arg
# Flag to flag arg Dict[str, Union[str, int, None]],
Dict[str, Union[str, int, None]], # True = or, False = and, None = N/A
# True = or, False = and, None = N/A Union[bool, None],
Union[bool, None], # Conditions
# Conditions List[
List[ Tuple[
Tuple[ # True = positive, False = negative
# True = positive, False = negative bool,
bool, # Condition type
# Condition type int,
int, # Condition name or list (True = or, False = and, None = N/A) (list shares type with outer)
# Condition name or list (True = or, False = and, None = N/A) (list shares type with outer) Union[str, Tuple[Union[bool, None], List]],
Union[str, Tuple[Union[bool, None], List]], # Condition arg
# Condition arg Union[str, int, None],
Union[str, int, None], ]
] ],
], ]
] ],
], # Rule to rule index
# Rule to rule index Dict[str, int],
Dict[str, int], # Label to rewards
# Label to rewards Dict[str, List[str]],
Dict[str, List[str]], # Reward to flags
# Reward to flags Dict[str, Set[str]],
Dict[str, Set[str]], # Item name to ID
# Item name to ID Dict[str, int],
Dict[str, int], # Location name to ID
# Location name to ID Dict[str, int],
Dict[str, int], # NPCs
# NPCs List[str],
List[str], # Pickaxe to pick power
# Pickaxe to pick power Dict[str, int],
Dict[str, int], # Hammer to hammer power
# Hammer to hammer power Dict[str, int],
Dict[str, int], # Mechanical bosses
# Mechanical bosses List[str],
List[str], # Calamity final bosses
# Calamity final bosses List[str],
List[str], # Progression rules
# Progression rules Set[str],
Set[str], # Armor to minion count,
# Armor to minion count, Dict[str, int],
Dict[str, int], # Accessory to minion count,
# Accessory to minion count, Dict[str, int],
Dict[str, int], ]:
]
):
next_id = 0x7E0000 next_id = 0x7E0000
item_name_to_id = {} item_name_to_id = {}

View File

@ -234,9 +234,9 @@ Spider Armor; ArmorMinions(3);
Cross Necklace; ; Wall of Flesh; Cross Necklace; ; Wall of Flesh;
Altar; ; Wall of Flesh & @hammer(80); Altar; ; Wall of Flesh & @hammer(80);
Begone, Evil!; Achievement; Altar; Begone, Evil!; Achievement; Altar;
Cobalt Ore; ; ((~@calamity & Altar) | (@calamity & Wall of Flesh)) & @pickaxe(100); Cobalt Ore; ; (((~@calamity & Altar) | (@calamity & Wall of Flesh)) & @pickaxe(100)) | Wall of Flesh;
Extra Shiny!; Achievement; Cobalt Ore | Mythril Ore | Adamantite Ore | Chlorophyte Ore; Extra Shiny!; Achievement; Cobalt Ore | Mythril Ore | Adamantite Ore | Chlorophyte Ore;
Cobalt Bar; ; Cobalt Ore; Cobalt Bar; ; Cobalt Ore | Wall of Flesh;
Cobalt Pickaxe; Pickaxe(110); Cobalt Bar; Cobalt Pickaxe; Pickaxe(110); Cobalt Bar;
Soul of Night; ; Wall of Flesh | (@calamity & Altar); Soul of Night; ; Wall of Flesh | (@calamity & Altar);
Hallow; ; Wall of Flesh; Hallow; ; Wall of Flesh;
@ -249,7 +249,7 @@ Blessed Apple; ;
Rod of Discord; ; Hallow; Rod of Discord; ; Hallow;
Gelatin World Tour; Achievement | Grindy; Dungeon & Wall of Flesh & Hallow & #King Slime; Gelatin World Tour; Achievement | Grindy; Dungeon & Wall of Flesh & Hallow & #King Slime;
Soul of Flight; ; Wall of Flesh; Soul of Flight; ; Wall of Flesh;
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 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
Bunny; Npc; Zoologist & Wall of Flesh; // Extremely simplified Bunny; Npc; Zoologist & Wall of Flesh; // Extremely simplified
Forbidden Fragment; ; Sandstorm & Wall of Flesh; Forbidden Fragment; ; Sandstorm & Wall of Flesh;
Astral Infection; Calamity; Wall of Flesh; Astral Infection; Calamity; Wall of Flesh;
@ -274,13 +274,13 @@ Pirate; Npc;
Queen Slime; Location | Item; Hallow; Queen Slime; Location | Item; Hallow;
// Aquatic Scourge // Aquatic Scourge
Mythril Ore; ; ((~@calamity & Altar) | (@calamity & @mech_boss(1))) & @pickaxe(110); Mythril Ore; ; (((~@calamity & Altar) | (@calamity & @mech_boss(1))) & @pickaxe(110)) | (Wall of Flesh & (~@calamity | @mech_boss(1)));
Mythril Bar; ; Mythril Ore; Mythril Bar; ; Mythril Ore | (Wall of Flesh & (~@calamity | @mech_boss(1)));
Hardmode Anvil; ; Mythril Bar; Hardmode Anvil; ; Mythril Bar;
Mythril Pickaxe; Pickaxe(150); Hardmode Anvil & Mythril Bar; Mythril Pickaxe; Pickaxe(150); Hardmode Anvil & Mythril Bar;
Adamantite Ore; ; ((~@calamity & Altar) | (@calamity & @mech_boss(2))) & @pickaxe(150); Adamantite Ore; ; (((~@calamity & Altar) | (@calamity & @mech_boss(2))) & @pickaxe(150)) | (Wall of Flesh & (~@calamity | @mech_boss(2)));
Hardmode Forge; ; Hardmode Anvil & Adamantite Ore & Hellforge; Hardmode Forge; ; Hardmode Anvil & Adamantite Ore & Hellforge;
Adamantite Bar; ; Hardmode Forge & Adamantite Ore; Adamantite Bar; ; (Hardmode Forge & Adamantite Ore) | (Wall of Flesh & (~@calamity | @mech_boss(2)));
Adamantite Pickaxe; Pickaxe(180); Hardmode Anvil & Adamantite Bar; Adamantite Pickaxe; Pickaxe(180); Hardmode Anvil & Adamantite Bar;
Forbidden Armor; ArmorMinions(2); Hardmode Anvil & Adamantite Bar & Forbidden Fragment; Forbidden Armor; ArmorMinions(2); Hardmode Anvil & Adamantite Bar & Forbidden Fragment;
Aquatic Scourge; Calamity | Location | Item; Aquatic Scourge; Calamity | Location | Item;

View File

@ -240,6 +240,8 @@ class TerrariaWorld(World):
return not sign return not sign
elif condition == "calamity": elif condition == "calamity":
return sign == self.calamity return sign == self.calamity
elif condition == "grindy":
return sign == (self.multiworld.achievements[self.player].value >= 2)
elif condition == "pickaxe": elif condition == "pickaxe":
if type(arg) is not int: if type(arg) is not int:
raise Exception("@pickaxe requires an integer argument") raise Exception("@pickaxe requires an integer argument")