summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dat/lua/wield.lua
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-04 20:27:42 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-04 20:27:42 +0000
commit2028bc1e0de04991eed99445defc7cf09782572f (patch)
tree047d7a4b35e493e0d9f9a2e04bac932eb4c6e90e /crawl-ref/source/dat/lua/wield.lua
parent848429d68c5c4fd77461a0e44aec8b28d302cc39 (diff)
downloadcrawl-ref-2028bc1e0de04991eed99445defc7cf09782572f.tar.gz
crawl-ref-2028bc1e0de04991eed99445defc7cf09782572f.zip
For consistency, move source/lua/ to source/dat/lua/.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4867 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/dat/lua/wield.lua')
-rw-r--r--crawl-ref/source/dat/lua/wield.lua47
1 files changed, 47 insertions, 0 deletions
diff --git a/crawl-ref/source/dat/lua/wield.lua b/crawl-ref/source/dat/lua/wield.lua
new file mode 100644
index 0000000000..e4fe9951e3
--- /dev/null
+++ b/crawl-ref/source/dat/lua/wield.lua
@@ -0,0 +1,47 @@
+---------------------------------------------------------------------------
+-- wield.lua
+-- Selects extra items to wield.
+--
+-- To use this, add this line to your init.txt:
+-- lua_file = lua/wield.lua
+---------------------------------------------------------------------------
+
+function make_hash(ls)
+ local h = { }
+ for _, i in ipairs(ls) do
+ h[i] = true
+ end
+ return h
+end
+
+function ch_item_wieldable(it)
+ -- We only need to check for unusual cases - basic matching is handled
+ -- by Crawl itself.
+ local spells = make_hash( you.spells() )
+
+ if spells["Bone Shards"]
+ and string.find( item.name(it, "a"), " skeleton" )
+ then
+ return true
+ end
+
+ if (spells["Sublimation of Blood"] or spells["Simulacrum"])
+ and food.ischunk(it)
+ then
+ return true
+ end
+
+ if spells["Sandblast"]
+ and string.find( item.name(it, "a"), " stones?$" )
+ then
+ return true
+ end
+
+ if spells["Sticks to Snakes"]
+ and string.find( item.name(it, "a"), " arrows?$" )
+ then
+ return true
+ end
+
+ return false
+end