summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/arena.cc54
-rw-r--r--crawl-ref/source/fight.cc2
-rw-r--r--crawl-ref/source/monstuff.cc6
3 files changed, 33 insertions, 29 deletions
diff --git a/crawl-ref/source/arena.cc b/crawl-ref/source/arena.cc
index cfbd012772..df989b32db 100644
--- a/crawl-ref/source/arena.cc
+++ b/crawl-ref/source/arena.cc
@@ -528,7 +528,7 @@ namespace arena
faction_a.won = false;
faction_b.won = false;
}
- return true;
+ return (true);
}
// Sync up our book-keeping with the actual state, and report
@@ -939,35 +939,37 @@ void arena_monster_died(monsters *monster, killer_type killer,
else if (monster->attitude == ATT_HOSTILE)
arena::faction_b.active_members--;
- if (arena::faction_a.active_members > 0
- && arena::faction_b.active_members <= 0)
- {
- arena::faction_a.won = true;
- return;
- }
- else if (arena::faction_b.active_members > 0
- && arena::faction_a.active_members <= 0)
- {
- arena::faction_b.won = true;
- return;
- }
+ const monsters* atk =
+ (invalid_monster_index(killer_index) || menv[killer_index].type == -1)
+ ? NULL : &menv[killer_index];
- // Was the death caused by the suicide attack of a gas spore or
- // ball lightning which was the final member of its faction?
- if (arena::faction_a.active_members <= 0
- && arena::faction_b.active_members <= 0
- && !invalid_monster_index(killer_index)
- && menv[killer_index].type != -1)
+ if (atk && atk->alive())
{
- const monsters* atk = &menv[killer_index];
-
- if (monster->attitude != atk->attitude && mons_self_destructs(atk))
+ if (arena::faction_a.active_members > 0
+ && arena::faction_b.active_members <= 0)
{
- if (atk->attitude == ATT_FRIENDLY)
- arena::faction_a.won = true;
- else if (atk->attitude == ATT_HOSTILE)
- arena::faction_b.won = true;
+ arena::faction_a.won = true;
}
+ else if (arena::faction_b.active_members > 0
+ && arena::faction_a.active_members <= 0)
+ {
+ arena::faction_b.won = true;
+ }
+ }
+ // If all monsters are dead and the last one to die is a giant spore
+ // or ball lightning then that monster's faction is the winner,
+ // since self destruction is their purpose. But if a trap causes
+ // the spore to explode and that kills everything it's a tie since
+ // it counts as the trap killing everyone.
+ else if (arena::faction_a.active_members <= 0
+ && arena::faction_b.active_members <= 0
+ && mons_self_destructs(monster)
+ && MON_KILL(killer))
+ {
+ if (monster->attitude == ATT_FRIENDLY)
+ arena::faction_a.won = true;
+ else if (monster->attitude == ATT_HOSTILE)
+ arena::faction_b.won = true;
}
}
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index ab4b1a3c9d..6ac9990b9e 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -3819,6 +3819,8 @@ bool melee_attack::mons_self_destructs()
if (atk->type == MONS_GIANT_SPORE || atk->type == MONS_BALL_LIGHTNING)
{
atk->hit_points = -1;
+ // Do the explosion right now.
+ monster_die(atk, KILL_MON, atk->mindex());
return (true);
}
return (false);
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 38389666f9..48121c8ec9 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -1004,9 +1004,6 @@ void monster_die(monsters *monster, killer_type killer,
if (!silent && _monster_avoided_death(monster, killer, killer_index))
return;
- if (crawl_state.arena)
- arena_monster_died(monster, killer, killer_index, silent);
-
mons_clear_trapping_net(monster);
// Update list of monsters beholding player.
@@ -1156,6 +1153,9 @@ void monster_die(monsters *monster, killer_type killer,
}
}
+ if (crawl_state.arena)
+ arena_monster_died(monster, killer, killer_index, silent);
+
bool death_message = !silent && !did_death_message && mons_near(monster)
&& (player_monster_visible(monster)
|| crawl_state.arena);