diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-09 18:18:52 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-09 18:18:52 +0000 |
commit | 2ee0afe954a7c72856fd5f0f7d3080012638bb98 (patch) | |
tree | e74d1ada80812f82ebcd67c8928b9c9a3f2a0a81 /crawl-ref/source/dat/lua | |
parent | 2ef8bb80a61c7b8aec6264babac49b04de264e96 (diff) | |
download | crawl-ref-2ee0afe954a7c72856fd5f0f7d3080012638bb98.tar.gz crawl-ref-2ee0afe954a7c72856fd5f0f7d3080012638bb98.zip |
Remove pickup.lua.
Make menu_colour_item_prefix also apply for autopickup_exceptions, so
you can exclude, for example, all evil_eating at once.
Fix Vampires "continuing draining" after having "stopped".
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5666 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/dat/lua')
-rw-r--r-- | crawl-ref/source/dat/lua/pickup.lua | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/crawl-ref/source/dat/lua/pickup.lua b/crawl-ref/source/dat/lua/pickup.lua deleted file mode 100644 index 254d17994b..0000000000 --- a/crawl-ref/source/dat/lua/pickup.lua +++ /dev/null @@ -1,125 +0,0 @@ ------------------------------------------------------------- --- pickup.lua: --- Smarter autopickup handling that takes into account the --- item type in combination with your character's race, --- religion, knowledge, and eating habits. --- --- To use this, add this line to your init.txt: --- lua_file = lua/pickup.lua --- --- Notes: --- * This script only handles items of classes with --- autopickup on. --- * Any result can still be overridden using --- autopickup_exceptions. ------------------------------------------------------------- - -function make_hash(ls) - local h = { } - for _, i in ipairs(ls) do - h[i] = true - end - return h -end - --- don't count Vampires here because of all those exceptions -function you_real_undead() - return you.race() == "Mummy" or you.race() == "Ghoul" -end - --- not identified -function unknown_potion(type) - return type == 0 -end - -function good_potion(type) - return type == 1 -end - -function bad_potion(type) - return type == 2 -end - --- special cases -function spec_potion(type) - return type == 3 -end - -function ch_autopickup(it) - local spells = make_hash( you.spells() ) - - if item.class(it) == "Potions" then - - local type = item.potion_type(it) - - -- "bad" potions only for Evaporate - if spells["Evaporate"] and bad_potion(type) then - return true - end - - -- no potions for Mummies - -- also: no bad potions for anyone else - if you.race() == "Mummy" or bad_potion(type) then - return false - end - - -- pickup "good" and unID'd potions - if good_potion(type) or unknown_potion(type) then - return true - end - - -- special handling - if spec_potion(type) then - - -- real undead cannot use berserk - -- or anything involving mutations - if item.subtype(it) == "berserk" - or item.subtype(it) == "gain ability" - or item.subtype(it) == "cure mutation" - or item.subtype(it) == "mutation" then - if you_real_undead() then - return false - else - return true - end - end - - -- special cases for blood, water, and porridge - if item.subtype(it) == "blood" - or item.subtype(it) == "water" - or item.subtype(it) == "porridge" then - return food.can_eat(it, false) - end - end - - -- anything not handled until here can be picked up - return true - end - - if item.class(it) == "Carrion" - or item.class(it) == "Comestibles" then - return food.can_eat(it, false) - end - - if item.class(it) == "Books" and item.subtype(it) == "spellbook" - and you.god() == "Trog" then - return false - end - - if item.class(it) == "Jewellery" then - if item.subtype(it) == "hunger" - or item.subtype(it) == "inaccuracy" then - return false - end - if you_real_undead() and - (item.subtype(it) == "regeneration" - or item.subtype(it) == "rage" - or item.subtype(it) == "sustenance" - and you.race() == "Mummy") then - return false - end - end - - -- we only get here if class autopickup ON - return true -end |