summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells4.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/spells4.cc
parentb6bb6178f82fc4227a63414e4bec9d2916e2a9b0 (diff)
downloadcrawl-ref-30387f6a8372b62160a6c2a4441a1b5909538055.tar.gz
crawl-ref-30387f6a8372b62160a6c2a4441a1b5909538055.zip
Disintegration can be very messy.
Diffstat (limited to 'crawl-ref/source/spells4.cc')
-rw-r--r--crawl-ref/source/spells4.cc55
1 files changed, 44 insertions, 11 deletions
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 08620200b8..39f1be7c52 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -64,11 +64,12 @@ enum DEBRIS // jmf: add for shatter, dig, and Giants to throw
// Just to avoid typing this over and over.
// Returns true if monster died. -- bwr
-static bool _player_hurt_monster(monsters& m, int damage)
+static bool _player_hurt_monster(monsters& m, int damage,
+ beam_type flavour = BEAM_MISSILE)
{
if (damage > 0)
{
- m.hurt(&you, damage, BEAM_MISSILE, false);
+ m.hurt(&you, damage, flavour, false);
if (m.alive())
{
@@ -1422,7 +1423,8 @@ bool cast_fragmentation(int pow, const dist& spd)
// fizzle (since we don't actually explode wood golems). -- bwr
explode = false;
beam.damage.num = 2;
- _player_hurt_monster(*mon, beam.damage.roll());
+ _player_hurt_monster(*mon, beam.damage.roll(),
+ BEAM_DISINTEGRATION);
break;
case MONS_IRON_GOLEM:
@@ -1431,7 +1433,8 @@ bool cast_fragmentation(int pow, const dist& spd)
beam.name = "blast of metal fragments";
beam.colour = CYAN;
beam.damage.num = 4;
- if (_player_hurt_monster(*mon, beam.damage.roll()))
+ if (_player_hurt_monster(*mon, beam.damage.roll(),
+ BEAM_DISINTEGRATION))
beam.damage.num += 2;
break;
@@ -1444,7 +1447,8 @@ bool cast_fragmentation(int pow, const dist& spd)
beam.name = "blast of rock fragments";
beam.colour = BROWN;
beam.damage.num = 3;
- if (_player_hurt_monster(*mon, beam.damage.roll()))
+ if (_player_hurt_monster(*mon, beam.damage.roll(),
+ BEAM_DISINTEGRATION))
beam.damage.num++;
break;
@@ -1470,7 +1474,8 @@ bool cast_fragmentation(int pow, const dist& spd)
if (pow >= 50 && one_chance_in(10))
statue_damage = mon->hit_points;
- if (_player_hurt_monster(*mon, statue_damage))
+ if (_player_hurt_monster(*mon, statue_damage,
+ BEAM_DISINTEGRATION))
beam.damage.num += 2;
}
break;
@@ -1481,7 +1486,8 @@ bool cast_fragmentation(int pow, const dist& spd)
beam.name = "blast of crystal shards";
beam.colour = WHITE;
beam.damage.num = 4;
- if (_player_hurt_monster(*mon, beam.damage.roll()))
+ if (_player_hurt_monster(*mon, beam.damage.roll(),
+ BEAM_DISINTEGRATION))
beam.damage.num += 2;
break;
@@ -1493,7 +1499,8 @@ bool cast_fragmentation(int pow, const dist& spd)
beam.colour = WHITE;
beam.damage.num = 2;
beam.flavour = BEAM_ICE;
- if (_player_hurt_monster(*mon, beam.damage.roll()))
+ if (_player_hurt_monster(*mon, beam.damage.roll()),
+ BEAM_DISINTEGRATION);
beam.damage.num++;
break;
}
@@ -1515,7 +1522,8 @@ bool cast_fragmentation(int pow, const dist& spd)
else
{
beam.damage.num = 2;
- if (_player_hurt_monster(*mon, beam.damage.roll()))
+ if (_player_hurt_monster(*mon, beam.damage.roll(),
+ BEAM_DISINTEGRATION))
beam.damage.num += 2;
}
goto all_done; // i.e., no "Foo Explodes!"
@@ -1533,7 +1541,8 @@ bool cast_fragmentation(int pow, const dist& spd)
beam.name = "blast of petrified fragments";
beam.colour = mons_class_colour(mon->type);
beam.damage.num = petrifying ? 2 : 3;
- if (_player_hurt_monster(*mon, beam.damage.roll()))
+ if (_player_hurt_monster(*mon, beam.damage.roll(),
+ BEAM_DISINTEGRATION))
beam.damage.num++;
break;
}
@@ -1544,7 +1553,8 @@ bool cast_fragmentation(int pow, const dist& spd)
// Yes, this spell does lousy damage if the monster
// isn't susceptible. -- bwr
- _player_hurt_monster(*mon, roll_dice(1, 5 + pow / 25));
+ _player_hurt_monster(*mon, roll_dice(1, 5 + pow / 25),
+ BEAM_DISINTEGRATION);
goto do_terrain;
}
@@ -1552,6 +1562,29 @@ bool cast_fragmentation(int pow, const dist& spd)
goto all_done;
}
+ for (stack_iterator si(spd.target); si; ++si)
+ {
+ if (si->base_type == OBJ_CORPSES)
+ {
+ std::string nm = si->name(DESC_CAP_THE);
+ if (si->sub_type == CORPSE_BODY)
+ {
+ if (!explode_corpse(*si, spd.target))
+ {
+ mprf("%s seems to be exceptionally well connected.",
+ nm.c_str());
+
+ goto all_done;
+ }
+ }
+
+ mprf("%s explodes!", nm.c_str());
+ destroy_item(si.link());
+ // si invalid now!
+ goto all_done;
+ }
+ }
+
if (env.markers.property_at(spd.target, MAT_ANY,
"veto_fragmentation") == "veto")
{