summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-util.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-25 03:50:05 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-25 03:50:05 +0000
commitdfc3164140baf959c74be84e323534999c91958c (patch)
tree7cae5b3a86d30aeab7d80bcdedadbb8ce6a23320 /crawl-ref/source/mon-util.cc
parenta9d5ca4e091cb9435a6f91e1c0099614e3feeef2 (diff)
downloadcrawl-ref-dfc3164140baf959c74be84e323534999c91958c.tar.gz
crawl-ref-dfc3164140baf959c74be84e323534999c91958c.zip
Monsters whose primary habitat is water or lava can't drown, even if they're
lacking asphyxiation resistance. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8736 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r--crawl-ref/source/mon-util.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 6ebf1349fc..6f9be5609f 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -3587,6 +3587,18 @@ bool monsters::is_habitable_feat(dungeon_feature_type actual_grid) const
bool monsters::can_drown() const
{
+ // Presumeably a shark in lava or a lavafish in deep water could
+ // drown, but that should never happen, so this simple check should
+ // be enough.
+ switch (mons_primary_habitat(this))
+ {
+ case HT_WATER:
+ case HT_LAVA:
+ return (false);
+ default:
+ break;
+ }
+
// Mummies can fall apart in water or be incinerated in lava.
// Ghouls, vampires, and demons can drown in water or lava. Others
// just "sink like a rock", to never be seen again.