diff options
Diffstat (limited to 'crawl-ref/settings')
-rw-r--r-- | crawl-ref/settings/pickup_butcher_tool.txt | 56 |
1 files changed, 21 insertions, 35 deletions
diff --git a/crawl-ref/settings/pickup_butcher_tool.txt b/crawl-ref/settings/pickup_butcher_tool.txt index 3257d9967d..d6408811d1 100644 --- a/crawl-ref/settings/pickup_butcher_tool.txt +++ b/crawl-ref/settings/pickup_butcher_tool.txt @@ -1,47 +1,33 @@ # Pick up a butchering weapon if we don't already have one - < do -local function can_butcher(it) - if item.name(it):find("distort", 0, true) then +local function can_butcher(it, name) + if not item.can_cut_meat(it) then return false end - local skill = item.weap_skill(it) - -- have to handle polearms separately, since only some of them can butcher - if skill == "Polearms" or skill == "Staves" then - local butcherable_polearms = { - "scythe", "lajatang", "halberd", "bardiche", "glaive" - } - for _, weap in ipairs(butcherable_polearms) do - if item.name(it):find(weap, 0, true) then return true end - end + if item.cursed(it) then + return false + end + if name:find("distort", 0, true) then return false - else - return skill:find("Blades", 0, true) or skill == "Axes" end + return true end -function pickup_butcher(it) - if item.class(it, true) == "weapon" then - local need_blade = true - -- Trolls and Ghouls don't need weapons to butcher things, and Mummies - -- and Spriggans can't eat chunks. Ideally, we could detect a player - -- with the claws mutation here too, but that's not currently possible - if you.race() == "Troll" or - you.race() == "Ghoul" or - you.race() == "Mummy" or - you.race() == "Spriggan" then - need_blade = false - else - for _, inv_it in pairs(item.inventory()) do - if item.class(inv_it, true) == "weapon" and - can_butcher(inv_it) then - need_blade = false - end - end - end - return need_blade and not item.cursed(it) and can_butcher(it) - else +function pickup_butcher(it, name) + if you.has_claws() > 0 then + return false + end + if not you.can_consume_corpses() and not you.god_likes_butchery() then + return false + end + if not can_butcher(it, name) then return false end + for _, inv_it in pairs(item.inventory()) do + if can_butcher(inv_it, item.name(inv_it)) then + return false + end + end + return true end add_autopickup_func(pickup_butcher) end > |