ae := autopickup_exceptions

#### inclusions ###

# Autopickup runes by default.
ae = <rune of Zot

### exclusions ###

# Exclude items useless in general or for your current character (such as
# inedible food or armour you can't wear).
ae += useless_item

# Exclude potentially useful items of high risk, like ?torment or
# !mutation.
ae += dangerous_item

# Exclude items which your god disapproves of.
ae += forbidden

# Ignore books that you have already seen
ae += [^n]identified.*spellbook

: add_autopickup_func(function (it, name)
:         if you.god() == "Trog" then
:             if it.class(true) == "book" and not it.name():find("manual") then
:                 return true
:             end
:         end
: end)

# Don't pick up misc items when duplication doesn't help.
:add_autopickup_func(function (it, name)
:  local itname = it.name(true) -- Not the name parameter, which includes prefixes.
:  if string.find(itname, "lamp of fire")
:  or string.find(itname, "phial of floods")
:  or string.find(itname, "fan of gales")
:  or string.find(itname, "disc of storms")
:  or string.find(itname, "crystal ball of energy") then
:    for inv in iter.invent_iterator:new(items.inventory()) do
:      if itname == inv.name() then
:        return false
:      end
:    end
:  end
:  return
:end)

# If you've sacrificed a hand, don't pick up pointless duplicate rings
:add_autopickup_func(function (it, name)
:  local itsubtype = it.subtype()
:  if you.mutation("missing a hand") == 1 and you.race() ~= "octopode"
:  and it.class(true) == "jewellery"
:  and (itsubtype == "ring of positive energy"
:   or itsubtype == "ring of flight"
:   or itsubtype == "ring of poison resistance"
:   or itsubtype == "ring of wizardry"
:   or itsubtype == "ring of stealth"
:   or itsubtype == "ring of teleportation"
:   or itsubtype == "ring of protection from fire"
:   or itsubtype == "ring of protection from cold"
:   or itsubtype == "ring of resist corrosion"
:   or itsubtype == "ring of see invisible"
:   or itsubtype == "ring of magical power"
:   or itsubtype == "ring of ice"
:   or itsubtype == "ring of fire") then
:    for inv in iter.invent_iterator:new(items.inventory()) do
:      if it.class(true) == inv.class(true)
:      and itsubtype == inv.subtype() then
:        return false
:      end
:    end
:  end
:  return
:end)

: add_autopickup_func(function (it, name)
:   return it.stacks() or nil
: end)

# Excluding amulets as you only need one of each. (If you know the subtype
# that means you already have one of it.). Some items may already be excluded
# as bad_item, e.g. inaccuracy.
ae += amulet of (nothing|inaccuracy|the gourmand|regeneration|harm)
ae += amulet of (rage|guardian spirit|faith|magic regeneration)

# Likewise for some rings.
ae += ring of (see invisible|flight|poison resistance|resist corrosion)
