summaryrefslogtreecommitdiffstats
path: root/stone_soup/crawl-ref/source/lua/wield.lua
diff options
context:
space:
mode:
Diffstat (limited to 'stone_soup/crawl-ref/source/lua/wield.lua')
-rw-r--r--stone_soup/crawl-ref/source/lua/wield.lua47
1 files changed, 47 insertions, 0 deletions
diff --git a/stone_soup/crawl-ref/source/lua/wield.lua b/stone_soup/crawl-ref/source/lua/wield.lua
new file mode 100644
index 0000000000..e4fe9951e3
--- /dev/null
+++ b/stone_soup/crawl-ref/source/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