diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-11-22 12:16:28 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-11-22 12:16:28 +0000 |
commit | c160159882457fde2b8b9d46ee5cf3f7554a4d6a (patch) | |
tree | 82c644bfbe119ae831a767d417f11a28345e7f88 | |
parent | 9ec81b9ef7c3c19373745b155c49da5006502785 (diff) | |
download | crawl-ref-c160159882457fde2b8b9d46ee5cf3f7554a4d6a.tar.gz crawl-ref-c160159882457fde2b8b9d46ee5cf3f7554a4d6a.zip |
[1597621] Auto-eat only offers rotten chunks to the appropriate races.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@461 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/lua/eat.lua | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/crawl-ref/source/lua/eat.lua b/crawl-ref/source/lua/eat.lua index 2e5bda2432..5a4b11d658 100644 --- a/crawl-ref/source/lua/eat.lua +++ b/crawl-ref/source/lua/eat.lua @@ -26,6 +26,21 @@ function prompt_eat(i) return res end +function chunk_maybe_safe(chunk) + local rot = food.rotting(chunk) + local race = you.race() + + if rot then + return race == "Ghoul" + or race == "Kobold" + or race == "Troll" + or race == "Hill Orc" + or race == "Ogre" + end + + return true +end + function is_chunk_safe(chunk) local rot = food.rotting(chunk) local race = you.race() @@ -77,7 +92,7 @@ function c_eat(floor, inv) for i, it in ipairs(inv) do -- If we have chunks in inventory that the player can eat, prompt. - if food.ischunk(it) and food.can_eat(it) then + if food.ischunk(it) and food.can_eat(it) and chunk_maybe_safe(it) then local answer = prompt_eat(it) if answer == "q" then break |