diff options
author | Stefan O'Rear <stefanor@cox.net> | 2009-11-04 02:24:58 -0800 |
---|---|---|
committer | Stefan O'Rear <stefanor@cox.net> | 2009-11-04 02:25:24 -0800 |
commit | 30387f6a8372b62160a6c2a4441a1b5909538055 (patch) | |
tree | c742100bf2aadfddd53e496e9798acce4f7879b7 /crawl-ref/source/misc.cc | |
parent | b6bb6178f82fc4227a63414e4bec9d2916e2a9b0 (diff) | |
download | crawl-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.cc | 33 |
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) |