From d6e0b68b50226f511107801bb2c11f6b358fbbc7 Mon Sep 17 00:00:00 2001 From: haranp Date: Sun, 21 Sep 2008 16:28:20 +0000 Subject: 1989842: freezing weapons can now slow cold-blooded monsters. Infrastructure available for unified element damage to creatures. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6964 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/mon-util.cc | 11 ++++++++++- crawl-ref/source/spells2.cc | 12 +++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 8b1afccdbb..3f2d8dbd81 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -4699,8 +4699,17 @@ void monsters::go_berserk(bool /* intentional */) simple_monster_message( this, " goes berserk!" ); } -void monsters::expose_to_element(beam_type, int) +void monsters::expose_to_element(beam_type flavour, int strength) { + switch (flavour) + { + case BEAM_COLD: + if (mons_class_flag(this->type, M_COLD_BLOOD) && coinflip()) + add_ench(ENCH_SLOW); + break; + default: + break; + } } void monsters::banish(const std::string &) diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 495f92fe42..7b28f4b04c 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -819,7 +819,7 @@ bool vampiric_drain(int pow, const dist &vmove) return (true); } -bool burn_freeze(int pow, beam_type flavour, int targetmon ) +bool burn_freeze(int pow, beam_type flavour, int targetmon) { pow = std::min(25, pow); @@ -862,23 +862,21 @@ bool burn_freeze(int pow, beam_type flavour, int targetmon ) beam.flavour = flavour; beam.thrower = KILL_YOU; - int hurted = roll_dice(1, 3 + pow / 3); - hurted = mons_adjust_flavoured(monster, beam, hurted); + const int orig_hurted = roll_dice(1, 3 + pow / 3); + int hurted = mons_adjust_flavoured(monster, beam, orig_hurted); monster->hurt(&you, hurted); if (monster->alive()) { + monster->expose_to_element(flavour, orig_hurted); print_wounds(monster); if (flavour == BEAM_COLD) { - if (mons_class_flag(monster->type, M_COLD_BLOOD) && coinflip()) - monster->add_ench(ENCH_SLOW); - const int cold_res = mons_res_cold( monster ); if (cold_res <= 0) { - const int stun = (1 - cold_res) * random2( 2 + pow / 5 ); + const int stun = (1 - cold_res) * random2(2 + pow/5); monster->speed_increment -= stun; } } -- cgit v1.2.3-54-g00ecf