summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/misc.cc
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2009-11-04 02:24:58 -0800
committerStefan O'Rear <stefanor@cox.net>2009-11-04 02:25:24 -0800
commit30387f6a8372b62160a6c2a4441a1b5909538055 (patch)
treec742100bf2aadfddd53e496e9798acce4f7879b7 /crawl-ref/source/misc.cc
parentb6bb6178f82fc4227a63414e4bec9d2916e2a9b0 (diff)
downloadcrawl-ref-30387f6a8372b62160a6c2a4441a1b5909538055.tar.gz
crawl-ref-30387f6a8372b62160a6c2a4441a1b5909538055.zip
Disintegration can be very messy.
Diffstat (limited to 'crawl-ref/source/misc.cc')
-rw-r--r--crawl-ref/source/misc.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 94566c96e4..94603039d3 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1147,6 +1147,39 @@ void bleed_onto_floor(const coord_def& where, monster_type montype,
_maybe_bloodify_square(where, damage, spatter, smell_alert);
}
+void blood_spray(const coord_def& origin, monster_type montype, int level)
+{
+ los_def ld(origin, opc_solid);
+
+ ld.update();
+
+ int tries = 0;
+ for (int i = 0; i < level; ++i)
+ {
+ // Blood drops are small and light and suffer a lot of wind
+ // resistance.
+ int range = random2(8) + 1;
+
+ while (tries < 5000)
+ {
+ ++tries;
+
+ coord_def bloody = origin;
+ bloody.x += random_range(-range, range);
+ bloody.y += random_range(-range, range);
+
+ if (in_bounds(bloody) && ld.see_cell(bloody))
+ {
+ if (feat_is_solid(grd(bloody)) && coinflip())
+ continue;
+
+ bleed_onto_floor(bloody, montype, 99);
+ break;
+ }
+ }
+ }
+}
+
static void _spatter_neighbours(const coord_def& where, int chance)
{
for (adjacent_iterator ai(where, false); ai; ++ai)