-- Example automatizer definition for use with the T.o.M.E. Classic -- T-Engine module (). To use this file, copy -- it into the save/ folder of your T-Engine data, where your save files -- live; it will apply to all characters. -- [Loosely transliterated from the corresponding example file for the -- now-defunct Autoparse project: -- ] -- Matches demongear when player has non-zero Demonology skill. newAutomatizerRule { name = 'demongear with Demonology', action = 'match', match = [[ name oneof 'Demonblade', 'Demonshield', 'Demonhorn' and skill('Demonology') > 0 ]], } -- Matches Mimicry cloaks when player has non-zero Mimicry skill. newAutomatizerRule { name = 'usable mimicry cloak', action = 'match', match = [[ full_type == 'armor/cloak' and name oneof 'Mouse Fur', 'Feathers Cloak', 'Wolf Pelt', 'Spider Web', 'Entish Bark', 'Cloak of Mist', 'Snakeskin Cloak', 'Mumak Hide', 'Abominable Cloak' and skill('Mimicry') > 0 ]], } -- Destroy stuff that pseudo-ID's bad (except for some stuff that -- Alchemists might be able to use anyway). newAutomatizerRule { name = "bad pseudo-ID", action = 'destroy', match = [[ ((type oneof 'ammo', 'weapon' or full_type oneof 'tool/digging', 'misc/trapkit' or (type == 'armor' and not (has_ability('Artifact Creation') and name == 'Filthy Rag')) or (not has_ability("Artifact Creation") and (name oneof "Amulet of Wisdom", "Ring of Extra Attacks", "Ring of Acid", "Ring of Lightning", "Ring of Speed", "Ring of Strength", "Ring of Intelligence", "Ring of Dexterity", "Ring of Constitution")) or name oneof "Amulet of Infravision", "Amulet of Charisma", "Amulet of Searching", "Amulet of Brilliance", "Amulet of Devotion", "Amulet of Weaponmastery", "Amulet of Trickery", "Amulet of the Serpents", "Ring of Ice", "Ring of Flames", "Ring of Protection", "Ring of Searching", "Ring of Slaying", "Ring of Damage", "Ring of Accuracy") and status oneof "terrible", "very bad", "bad") ]], } -- Destroy some stuff that pseudo-ID's average, starting at level 12, -- except for things that have special utility in certain cases: Mage -- Staffs for spellcasters, Mimicry cloaks for Mimics, Dark Swords for -- Unbelievers, demongear for Demonologists, gloves for Alchemists, plus -- material components for adding various flags to Alchemy-created -- artifacts. newAutomatizerRule { name = "avg pseudo-ID", action = 'destroy', match = [[ ( (type == 'ammo' and skill("Archery") >= 30) or (full_type == 'weapon/magestaff' and not class oneof "Mage", "Sorceror", "Elementalist", "Warper", "Runecrafter", "Thaumaturgist", "Geomancer") or (full_type == 'armor/cloak' and not rule('usable mimicry cloak')) or (full_type == 'weapon/sword' and not (name == "Dark Sword" and skill("Antimagic") > 0) and not (name == "Blade of Chaos" and has_ability("Artifact Creation"))) or (full_type == 'tool/digger' and (name == "Shovel" or (name == "Pick" and not has_ability("Artifact Creation")))) or (full_type oneof 'weapon/boomeraing', 'misc/trapkit', 'weapon/axe', 'weapon/hafted', 'weapon_polearm', 'shooter/bow', 'armor/footwear', 'armor/headwear', 'armor/shield', 'armor/light', 'armor/heavy' and not ( has_ability("Artifact Creation") and name oneof "Filthy Rag", "Whip", "Large Metal Shield", "Pair of Soft Leather Boots" )) or (full_type == 'armor/handwear' and not (name == "Set of Leather Gloves" and skill("Alchemy") > 0)) ) and not rule('demongear with Demonology') and status == "average" and level >= 12 ]], } -- Destroy {good} weapons and Mage Staffs if we're wielding an identified -- weapon or Mage Staff that's {excellent} or better (or {good} if it -- matches our Weaponmastery submastery and the weapon to be destroyed -- doesn't), or if Barehand-combat or Bearform-combat skill is 30 or -- higher. Exceptions: don't destroy {good} demongear if Demonology skill -- is nonzero. newAutomatizerRule { name = "good weapons", action = 'destroy', match = [[ type == 'weapon' and status == "good" and not rule('demongear with Demonology') and (is_identified or skill("Combat") > 10) and (equipment { (type == 'weapon' or name == 'Demonblade') and is_identified and status oneof "very good", "special" } or (skill("Sword-mastery") > 0 and full_type != 'weapon/sword' and equipment { full_type == 'weapon/sword' and status == "good" }) or (skill("Demonology") > 0 and full_type == 'weapon/sword' and equipment { name == 'Demonblade' and status == "good" }) or (skill("Axe-mastery") > 0 and full_type != 'weapon/axe' and equipment { full_type == 'weapon/axe' and status == "good" }) or (skill("Hafted-mastery") > 0 and full_type != 'weapon/hafted' and equipment { full_type == 'weapon/hafted' and status == "good" }) or (skill("Polearm-mastery") > 0 and full_type != 'weapon/polearm' and equipment { full_type == 'weapon/polearm' and status == "good" }) or skill("Barehand-combat") >= 30 or skill("Bearform-conbat") >= 30) ]], } -- Destroy {good} armor if we're wielding identified {excellent} or better -- armor in the same slot, or if Dodging skill is 30 or higher, or if -- Bearform-cobat skill is 30 or higher and the armor is of a type that -- can't be worn while in bear form. Exceptions: don't destroy {good} -- demongear if Demonology skill is nonzero; treat Elven Cloaks, Shadow -- Cloaks and Dragon Scale Mail as excellent for the purpose of this rule. newAutomatizerRule { name = "good armor", action = 'destroy', match = [[ type == 'armor' and status == "good" and (is_identified or skill("COMBAT") > 10) and ( (subtype == 'footwear' and equipment { full_type == 'armor/footwear' and is_identified and status oneof "very good", "special" }) or (subtype == 'handwear' and equipment { full_type == 'armor/handwear' and is_identified and status oneof "very good", "special" }) or (subtype == 'headwear' and not rule('demongear with Demonology') and equipment { full_type == 'armor/headwear' and is_identified and status oneof "very good", "special" }) or (subtype == 'headwear' and name != 'Demonhorn' and skill("Demonology") > 0 and equipment { name == 'Demonhorn' and status == "good" }) or (subtype == 'shield' and not rule('demongear with Demonology') and equipment { full_type == 'armor/shield' and is_identified and status oneof "very good", "special" }) or (subtype == 'shield' and name != 'Demonshield' and skill("Demonology") > 0 and equipment { name == 'Demonshield' and status == "good" }) or (subtype == 'cloak' and not name oneof "Elven Cloak", "Shadow Cloak" and not rule('usable mimicry cloak') and equipment { full_type == 'armor/cloak' and is_identified and (status oneof "very good", "special" or name oneof "Elven Cloak", "Shadow Cloak") }) or (full_type oneof 'armor/light', 'armor/heavy' and equipment { ((full_type oneof 'armor/light', 'armor/heavy' and is_identified and status oneof "very good", "special") or name contains 'Dragon Scale Mail') }) or ((subtype oneof 'footwear', 'handwear', 'headwear', 'shield', 'cloak', 'light', 'heavy' and not rule('demonology with Demongear')) and skill ("Dodging") >= 30) or ((subtype oneof 'footwear', 'handwear', 'shield' and not rule ('demonology with Demongear')) and skill ("Bearform-combat") >= 30) ) ]], } -- Destroy {good} shields if we're not wearing a shield but we're wielding -- a two-handed or one/two-handed weapon with a corresponding -- {wpntype}-mastery skill of 25 or above, on the theory that we're -- eschewing shields to get maximum damage from our weapon. We don't do -- this for Mage Staffs, since (a) there is no corresponding -mastery skill -- for it and (b) most wielders of a Mage Staff aren't hitting anything -- with it anyway. newAutomatizerRule { name = "shld vs 2H weap", action = 'destroy', match = [[ full_type == 'armor/shield' and not equipment { full_type == 'armor/shield' } and status == "good" and (is_identified or skill("Combat") > 10) and ( (skill("Sword-mastery") > 25 and equipment { full_type == 'weapon/sword' and name oneof "Bastard Sword", "Two-Handed Sword", "Executioner's Sword", "Katana", "Zweihander", "Claymore", "Espadon", "Great Scimitar" }) or (skill("Hafted-mastery") > 25 and equipment { full_type == 'weapon/hafted' and name oneof "Ball-and-Chain", "Flail", "Fauchard", "Two-Handed Flail", "Mace", "Guisarme", "Quarterstaff", "War Hammer", "Lead-Filled-Mace", "Heavy Lance", "Mace of Disruption", "Lucerne Hammer", "Mighty Hammer" }) or (skill("Polearm-mastery") > 25 and equipment { full_type == 'weapon/polearm' and name oneof "Beaked Axe", "Glaive", "Halberd", "Awl-Pike", "Pike", "Trident", "Lance", "Lochaber Axe", "Battle Axe", "Scythe", "Scythe of Slicing", "Flamberge" }) or (skill("Axe-mastery") > 25 and equipment { full_type == 'weapon/axe' and name oneof "Great Axe", "Broad Axe", "Hatchet" }) ) ]], } -- Destroy {average} or {good} ammo if we're wielding a launcher for a -- different type of ammo, an {excellent} or better boomerang, or an -- instrument, at the same level at which we start destroying {average} -- stuff in general. newAutomatizerRule { name = "off-type ammo", action = 'destroy', match = [[ ( (full_type == 'ammo/arrows' and equipment { full_type oneof 'shooter/sling', 'shooter/crossbow' }) or (full_type == 'ammo/shots' and equipment { full_type oneof 'shooter/bow', 'shooter/crossbow' }) or (full_type == 'ammo/bolts' and equipment { full_type oneof 'shooter/sling', 'shooter/bow' }) or (type == 'ammo' and equipment { full_type == 'equipment/instrument' or (full_type == 'weapon/boomerang' and is_identified and status oneof "very good", "special") }) ) and (status == "average" or (status == "good" and (skill("Combat") > 10 or is_identified))) and level >= 12 ]], } -- Destroy {good} launchers if we're wielding an identified {excellent} or -- better launcher of the same type; destroy {good} boomerangs if we're -- wielding an identified {excellent} or better boomerang or launcher of -- any type. newAutomatizerRule { name = "good launchers", action = 'destroy', match = [[ status == "good" and (is_identified or skill("Combat") > 10) and ( (full_type == 'shooter/sling' and equipment { full_type == 'shooter/sling' and is_identified and status oneof 'very good', 'special' }) or (full_type == 'shooter/bow' and equipment { full_type == 'shooter/bow' and is_identified and status oneof 'very good', 'special' }) or (full_type == 'shooter/crossbow' and equipment { full_type == 'shooter/crossbow' and is_identified and status oneof 'very good', 'special' }) or (full_type == 'weapon/boomerang' and equipment { (type == 'shooter' or full_type == 'weapon/boomerang') and is_identified and status oneof "very good", "special" }) ) ]], } -- Destroy {good} launchers if we have skill for another type of launcher or -- for boomerangs; destroy {good} boomerangs if we have skill for any type -- of launcher. newAutomatizerRule { name = "off-type launcher", action = 'destroy', match = [[ ( (type == 'shooter' and ( (skill("Sling-mastery") > 0 and subtype oneof 'bow', 'crossbow') or (skill("Bow-mastery") > 0 and subtype oneof 'sling', 'crossbow') or (skill("Crossbow-mastery") > 0 and subtype oneof 'sling', 'bow') or skill("Boomerang-mastery") > 0) ) or ( full_type == 'weapon/boomerang' and ( skill("Sling-mastery") > 0 or skill("Bow-mastery") > 0 or skill("Crossbow-mastery") > 0 ) ) ) and (is_identified or skill("Combat") > 10) and status == "good" and level >= 12 ]], } -- Destroy {good} launchers, ammo and boomerangs if Music skill is 25 or -- higher and we're wielding an instrument. newAutomatizerRule { name = "non-musical stuff", action = 'destroy', match = [[ (type oneof 'ammo', 'shooter' or full_type == 'weapon/boomerang') and skill("Music") >= 25 and equipment { full_type == 'equipment/instrument' } and (is_identified or skill("Combat") > 10) and status == "good" ]], } -- Destroy empty and ruined chests. newAutomatizerRule { name = "empty chests", action = 'destroy', match = [[ full_type == 'misc/chest' and (status == 'empty' or name == 'Ruined chest') ]], } -- Destroy corpses, unless we have a skill or ability that can use them. -- If we do have an appropriate skill, destroy them anyway if anything in -- our equipment or inventory is inscribed with a special tag. newAutomatizerRule { name = "corpses", action = 'destroy', match = [[ full_type == 'misc/corpse' and ( equipment { inscription == "AO:corpse" } or inventory { inscription == "AO:corpse" } or not ( skill ("Necromancy") >= 5 or skill ("Summoning") > 0 or skill ("Possession") > 0 or has_ability("Artifact Creation") ) ) ]], } -- Destroy runes if we're not a Runecrafter. newAutomatizerRule { name = "runes", action = 'destroy', match = [[ type == 'rune' and skill('Runecraft') <= 0 ]], } -- Destroy essences if we're not an Alchemist. newAutomatizerRule { name = "essences", action = 'destroy', match = [[ full_type == 'misc/alchemic' and skill('Alchemy') <= 0 ]], } -- Destroy traps unless we have the Trapping ability. newAutomatizerRule { name = "traps", action = 'destroy', match = [[ full_type == 'misc/trapkit' and not has_ability('Trapping') ]], } -- Destroy identified wands, staffs, rods and rod tips if Antimagic skill -- is nonzero. We'd like to destroy them unidentified, but the automatizer -- doesn't currently support that. newAutomatizerRule { name = "sticks", action = 'destroy', match = [[ type == 'utility' and subtype oneof 'wand', 'staff', 'rod' 'rodtip' and is_identified and skill('Antimagic') > 0 ]], } -- Destroy empty bottles unless we're carrying some (presumably leeching -- fountains) or we're an Alchemist. newAutomatizerRule { name = "bottles", action = 'destroy', match = [[ full_type == 'misc/bottle' and not ( skill('Alchemy') > 0 or inventory { full_type == 'misc/bottle' } ) ]], } -- Some junk from which essences can be extracted, or to which essences can -- be added, or which are otherwise of use to Alchemists; destroy them if -- we're not an Alchemist. newAutomatizerRule { name = "alchemy fodder", action = 'destroy', match = [[ skill("Alchemy") <= 0 and ( (name oneof "Scroll of Darkness", "Staff of Darkness" and subrace != "Vampire") or (name == "Scroll of Trap/Door Destruction" and skill ("Antimagic") < 35) or (name oneof "Wand of Heal Monster", "Wand of Haste Monster", "Staff of Haste Monsters" and skill ("Monster-lore") < 12) or name oneof "Mushroom of Weakness", "Mushroom of Stupidity", "Mushroom of Naivety", "Mushroom of Sickness", "Mushroom of Blindness", "Mushroom of Paranoia", "Mushroom of Poison", "Mushroom of Confusion", "Mushroom of Unhealth", "Mushroom of Disease", "Mushroom of Paralysis", "Mushroom of Hallucination", "Mushroom of Disease", "Mushroom of Paralysis", "Amulet of Adornment", "Amulet of Teleportation", "Potion of Corruption", "Potion of Death", "Potion of Ruination", "Potion of Slime Mold Juice", "Potion of Water", "Potion of Blindness", "Potion of Sleep", "Potion of Booze", "Potion of Slowness", "Potion of Salt Water", "Potion of Clumsiness", "Potion of Apple Juice", "Potion of Abomination", "Potion of Weakness", "Potion of Lose Memories", "Potion of Sickliness", "Potion of Ugliness", "Potion of Stupidity", "Potion of Naivety", "Potion of Poison", "Potion of Infra-vision", "Potion of Invisibility", "Scroll of Rumour", "Scroll of Rumor", "Scroll of Treasure Detection", "Scroll of Object Detection", "Scroll of Blessing", "Scroll of Trap Creation", "Scroll of Holy Chant", "Scroll of Door/Stair Location", "Scroll of Monster Confusion", "Scroll of Trap Detection", "Scroll of Holy Prayer", "Scroll of Magic Mapping", "Ring of Stupidity", "Ring of Weakness", "Ring of Teleportation", "Ring of Searching", "Wand of Nothing", "Staff of Nothing", "Ring of Nothing", "Amulet of Searching", "Amulet of Infravision", "Amulet of Nothing", "Rod Tip of Nothing", "Scroll of Nothing", "Iron Spike" ) ]], } -- Some junk from which ammo can be made; destroy them unless we have the -- ability to make ammo from them. newAutomatizerRule { name = "ammo fodder", action = 'destroy', match = [[ (full_type == 'misc/junk' and name != 'Flame Imperishable' and skill('Archery') < 10 and not has_ability('Ammo creation')) or (full_type == 'misc/boulder' and skill('Boulder-throwing') <= 0) ]], } -- Absolute junk, of no use to any character at all. newAutomatizerRule { name = "junk", action = 'destroy', match = [[ full_type == 'misc/egg' or (type == 'misc/parchment' and ( name contains "Monstrous Compendium" or name contains "Deep Thoughts" or name contains "The One Ring" or name contains "Artifact Lore" )) or name oneof "Scroll of Summon Monster", "Scroll of Summon Monsters", "Scroll of Summon Undead", "Scroll of Aggravate Monster", "Scroll of Curse Weapon", "Scroll of Curse Armour", "Scroll of Curse Armor", "Ring of Aggravate Monster", "Ring of Woe" ]], } -- Pick up ammo inscribed with '=g'. This requires ToME 2.2.0 or higher. newAutomatizerRule { name = "pick up ammo", action = 'pickup', match = [[ (type == 'ammo' or (full_type == 'misc/boulder' and skill('Boulder-throwing') > 0)) and inscription contains '=g' ]], } -- Pick up relics. Saves a step, and helps if the relic gets buried under -- a pile of other objects. newAutomatizerRule { name = "pick up relic", action = 'pickup', match = [[ name contains "Piece of the Relic of" ]], } -- Some configure rules, condensed from previous inscription runes. Said -- inscriptions included '!d!k!v!s' or '!*', and most had special '@w1' or -- equivalent tags that aren't applicable for the T2 module. newAutomatizerRule { name = "configure ask-destroy/drop", action = 'configure', config = { ask_destroy=true, ask_drop=true }, match = [[ (level <= 10 and name oneof 'Flask of oil', 'Scroll of Identify') or (level <= 6 and name == 'Brass Lantern') or (level <= 1 and name oneof 'Ration of Food', 'Harp', 'Book of Beginner Cantrips') or (class == "Runecrafter" and type == 'rune') or (class == "Bard" and full_type == 'misc/instrument') ]], } newAutomatizerRule { name = "configure ask-use/destroy/drop", action = 'configure', config = { ask_destroy=true, ask_drop=true, ask_use=true }, match = [[ level <= 10 and name oneof 'Scroll of Word of Recall', 'Scroll of Phase Door', 'Scroll of Satisfy Hunger' ]], }