From 30387f6a8372b62160a6c2a4441a1b5909538055 Mon Sep 17 00:00:00 2001 From: Stefan O'Rear Date: Wed, 4 Nov 2009 02:24:58 -0800 Subject: Disintegration can be very messy. --- crawl-ref/source/misc.cc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'crawl-ref/source/misc.cc') 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) -- cgit v1.2.3-54-g00ecf