summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/arena.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-06 10:27:55 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-06 10:27:55 +0000
commit0b83e4380f54f6d75309fa2990f347a8f7658f01 (patch)
tree2933a56d2ba1ca87d2f28fb3bb45dac13360ce2a /crawl-ref/source/arena.cc
parentf739b7d8bb5d57d55a69b93c24bf88dc3299ab21 (diff)
downloadcrawl-ref-0b83e4380f54f6d75309fa2990f347a8f7658f01.tar.gz
crawl-ref-0b83e4380f54f6d75309fa2990f347a8f7658f01.zip
Get the arena tied-round and giant spore logic working again, partially by
making self-initiated explosions happen directly in melee_attack::mons_self_destructs() and by calling arena_monster_died() after the spore has exploded instead of before. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8268 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/arena.cc')
-rw-r--r--crawl-ref/source/arena.cc54
1 files changed, 28 insertions, 26 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;
}
}