summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authorCharles Otto <ottochar@gmail.com>2009-10-10 23:07:21 -0400
committerCharles Otto <ottochar@gmail.com>2009-10-10 23:24:00 -0400
commite4f58176388fa16d5f76815af0900a35d9e61627 (patch)
tree44f11ae86e2a30d9389de496933ee92e6b1e6df5 /crawl-ref/source/monstuff.cc
parentc9a5a4dea4e2dc99e9f50515c71ea71946f003c7 (diff)
downloadcrawl-ref-e4f58176388fa16d5f76815af0900a35d9e61627.tar.gz
crawl-ref-e4f58176388fa16d5f76815af0900a35d9e61627.zip
Patch 2873911 by Jude: add rain clouds
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc43
1 files changed, 40 insertions, 3 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 0ac41d1d73..e2c6672c7c 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -5429,10 +5429,11 @@ static bool _is_player_or_mon_sanct(const monsters* monster)
|| is_sanctuary(monster->pos()));
}
-bool mons_avoids_cloud(const monsters *monster, cloud_type cl_type,
+bool mons_avoids_cloud(const monsters *monster, cloud_struct cloud,
bool placement)
{
bool extra_careful = placement;
+ cloud_type cl_type = cloud.type;
if (placement)
extra_careful = true;
@@ -5517,6 +5518,28 @@ bool mons_avoids_cloud(const monsters *monster, cloud_type cl_type,
return (false);
break;
+ case CLOUD_RAIN:
+ // Fiery monsters dislike the rain.
+ if (monster->is_fiery() && extra_careful)
+ return (true);
+
+ // We don't care about what's underneath the rain cloud if we can fly.
+ if (monster->flight_mode() != FL_NONE)
+ return (false);
+
+ // These don't care about deep water.
+ if (monster_habitable_grid(monster, DNGN_DEEP_WATER))
+ return (false);
+
+ // This position could become deep water, and they might drown.
+ if (grd(cloud.pos) == DNGN_SHALLOW_WATER)
+ return (true);
+
+ // Otherwise, it's safe for everyone else.
+ return (false);
+
+ break;
+
default:
break;
}
@@ -5551,7 +5574,7 @@ bool mons_avoids_cloud(const monsters *monster, int cloud_num,
*cl_type = cloud.type;
// Is the target cloud okay?
- if (!mons_avoids_cloud(monster, cloud.type, placement))
+ if (!mons_avoids_cloud(monster, cloud, placement))
return (false);
// If we're already in a cloud that we'd want to avoid then moving
@@ -5566,7 +5589,7 @@ bool mons_avoids_cloud(const monsters *monster, int cloud_num,
const cloud_struct &our_cloud = env.cloud[our_cloud_num];
- return (!mons_avoids_cloud(monster, our_cloud.type, true));
+ return (!mons_avoids_cloud(monster, our_cloud, true));
}
//---------------------------------------------------------------
@@ -9424,6 +9447,20 @@ static void _mons_in_cloud(monsters *monster)
hurted += (10 * random2avg(12, 3)) / speed; // 3
break;
+ case CLOUD_RAIN:
+ if (monster->is_fiery())
+ {
+ if (!silenced(monster->pos()))
+ simple_monster_message(monster, " sizzles in the rain!");
+ else
+ simple_monster_message(monster, " steams in the rain!");
+
+ hurted += ((4 * random2(3)) - random2(monster->ac));
+ wake = true;
+ }
+
+ break;
+
case CLOUD_MUTAGENIC:
simple_monster_message(monster, " is engulfed in a mutagenic fog!");