diff options
author | Adam Borowski <kilobyte@angband.pl> | 2013-10-03 03:20:52 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2013-10-03 13:28:14 +0200 |
commit | ca19122d8ef8fd968786eabc4905a8f272677315 (patch) | |
tree | a55451e2204021305c6193a0e38d0dcbf19e759d /crawl-ref/source/spl-tornado.cc | |
parent | 62ee6bcbdcf46ca9dbf1d8c37e0b7a6eda4d9b70 (diff) | |
download | crawl-ref-ca19122d8ef8fd968786eabc4905a8f272677315.tar.gz crawl-ref-ca19122d8ef8fd968786eabc4905a8f272677315.zip |
Fix a mapstat hang due to dying to a tornado obelisk.
It calls ouch() for 0 during the initial setup; during mapstat the player
is actually placed inside the map at some position that can be close to
the obelisk. And maxhp is 0, so 0 damage can be fatal...
Diffstat (limited to 'crawl-ref/source/spl-tornado.cc')
-rw-r--r-- | crawl-ref/source/spl-tornado.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/crawl-ref/source/spl-tornado.cc b/crawl-ref/source/spl-tornado.cc index a18077e066..28b7e11f1b 100644 --- a/crawl-ref/source/spl-tornado.cc +++ b/crawl-ref/source/spl-tornado.cc @@ -349,16 +349,18 @@ void tornado_damage(actor *caster, int dur) if (standing) float_player(); } - int dmg = victim->apply_ac( - div_rand_round(roll_dice(9, rpow), 15), - 0, AC_PROPORTIONAL); - if (dur < 0) - dmg = 0; - dprf("damage done: %d", dmg); - if (victim->is_player()) - ouch(dmg, caster->mindex(), KILLED_BY_BEAM, "tornado"); - else - victim->hurt(caster, dmg); + + if (dur > 0) + { + int dmg = victim->apply_ac( + div_rand_round(roll_dice(9, rpow), 15), + 0, AC_PROPORTIONAL); + dprf("damage done: %d", dmg); + if (victim->is_player()) + ouch(dmg, caster->mindex(), KILLED_BY_BEAM, "tornado"); + else + victim->hurt(caster, dmg); + } } if (victim->alive() && !leda && dur > 0) |