diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-11-07 21:39:26 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-11-07 21:39:26 +0000 |
commit | 356d2e3e4b9ce53e0b205ff6fd5b35a4163a0cc5 (patch) | |
tree | 80732c91254feeecfd856e40e92c739519ab061d /crawl-ref/source/fight.cc | |
parent | 100d0a3c9501882904c8d467bdd91bd43bec2d4f (diff) | |
download | crawl-ref-356d2e3e4b9ce53e0b205ff6fd5b35a4163a0cc5.tar.gz crawl-ref-356d2e3e4b9ce53e0b205ff6fd5b35a4163a0cc5.zip |
Clean up sticky flame handling.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7409 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r-- | crawl-ref/source/fight.cc | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 9e15a84cba..48a8b22f41 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -3506,6 +3506,31 @@ void melee_attack::mons_do_poison(const mon_attack_def &attk) } } +void melee_attack::mons_do_napalm() +{ + if (defender->res_sticky_flame() > 0) + return; + + if (one_chance_in(20) || (damage_done > 2 && one_chance_in(3))) + { + if (needs_message) + { + mprf("%s %s covered in liquid flames%s", + def_name(DESC_CAP_THE).c_str(), + defender->conj_verb("are").c_str(), + special_attack_punctuation().c_str()); + } + + if (defender->atype() == ACT_PLAYER) + napalm_player(random2avg(7, 3) + 1); + else + { + napalm_monster(def, mons_friendly(atk) ? KC_FRIENDLY : KC_OTHER, + std::min(4, 1 + random2(atk->hit_dice) / 2)); + } + } +} + void melee_attack::wasp_paralyse_defender() { // [dshaligram] Adopted 4.1.2's wasp mechanics, in slightly modified form. @@ -3787,28 +3812,7 @@ void melee_attack::mons_apply_attack_flavour(const mon_attack_def &attk) break; case AF_NAPALM: - if (defender->res_sticky_flame() > 0) - break; - - if (one_chance_in(20) || (damage_done > 2 && one_chance_in(3))) - { - if (needs_message) - { - mprf("%s %s covered in liquid flames%s", - def_name(DESC_CAP_THE).c_str(), - defender->conj_verb("are").c_str(), - special_attack_punctuation().c_str()); - } - - if (defender->atype() == ACT_PLAYER) - sticky_flame_player(); - else - { - sticky_flame_monster(monster_index(def), - mons_friendly(atk) ? KC_FRIENDLY : KC_OTHER, - std::min(4, 1 + random2(atk->hit_dice) / 2)); - } - } + mons_do_napalm(); break; } } |