summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-03 01:24:46 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-03 01:24:46 +0000
commit0a9ebf7263af1c55e14b60c32b211e34c31caa3f (patch)
treed6a76f36bd60538816c597eb82c8199765d946de /crawl-ref/source/monstuff.cc
parentddbbc1613422f16993e9e94142dd666e880ecae2 (diff)
downloadcrawl-ref-0a9ebf7263af1c55e14b60c32b211e34c31caa3f.tar.gz
crawl-ref-0a9ebf7263af1c55e14b60c32b211e34c31caa3f.zip
In monster_grid() check for monster->alive() instead of
monster->type != -1, since giant spores and ball lightning are no longer left dead while still attached to the grid. When a giant spore or ball lightning explodes, treat the explosion message as the monster's death message, between the explosion message and the actual explosion remove it from view and mark it as dead, and after the explosion don't re-attach it to the grid since it isn't there anymore. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8149 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc30
1 files changed, 21 insertions, 9 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 950f346b16..5bd0e86d35 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -859,13 +859,13 @@ static void _mummy_curse(monsters* monster, killer_type killer, int index)
}
}
-static void _spore_goes_pop(monsters *monster, killer_type killer,
+static bool _spore_goes_pop(monsters *monster, killer_type killer,
int killer_index, bool pet_kill, bool wizard)
{
if (monster->hit_points > 0 || monster->hit_points <= -15 || wizard
|| killer == KILL_RESET || killer == KILL_DISMISSED)
{
- return;
+ return false;
}
if (killer == KILL_MISC)
@@ -916,27 +916,36 @@ static void _spore_goes_pop(monsters *monster, killer_type killer,
msg::streams(MSGCH_DIAGNOSTICS) << "Unknown spore type: "
<< static_cast<int>(type)
<< std::endl;
- return;
+ return false;
}
+ bool saw = false;
if (you.can_see(monster))
{
+ saw = true;
viewwindow(true, false);
if (is_sanctuary(monster->pos()))
mpr(sanct_msg, MSGCH_GOD);
else
- mpr(msg);
+ mprf(MSGCH_MONSTER_DAMAGE, MDAM_DEAD, msg);
}
if (is_sanctuary(monster->pos()))
- return;
+ return false;
// Detach monster from the grid first, so it doesn't get hit by
// its own explosion. (GDL)
mgrd(monster->pos()) = NON_MONSTER;
+
+ // Exploding kills the monster a bit earlier than normal.
+ monster->hit_points = -16;
+ if (saw)
+ viewwindow(true, false);
+
// FIXME: show_more == mons_near(monster)
beam.explode();
- mgrd(monster->pos()) = monster_index(monster);
+
+ // Monster died in explosion, so don't re-attach it to the grid.
}
void _monster_die_cloud(const monsters* monster, bool corpse, bool silent,
@@ -1072,10 +1081,13 @@ void monster_die(monsters *monster, killer_type killer,
const bool pet_kill = _is_pet_kill(killer, killer_index);
+ bool did_death_message = false;
+
if (monster->type == MONS_GIANT_SPORE
|| monster->type == MONS_BALL_LIGHTNING)
{
- _spore_goes_pop(monster, killer, killer_index, pet_kill, wizard);
+ did_death_message =
+ _spore_goes_pop(monster, killer, killer_index, pet_kill, wizard);
}
else if (monster->type == MONS_FIRE_VORTEX
|| monster->type == MONS_SPATIAL_VORTEX)
@@ -1136,8 +1148,8 @@ void monster_die(monsters *monster, killer_type killer,
}
}
- bool death_message = (!silent && mons_near(monster)
- && player_monster_visible(monster));
+ bool death_message = !silent && !did_death_message && mons_near(monster)
+ && player_monster_visible(monster);
switch (killer)
{