diff options
author | Chris Campbell <chriscampbell89@gmail.com> | 2011-11-15 15:05:34 +0000 |
---|---|---|
committer | Chris Campbell <chriscampbell89@gmail.com> | 2011-11-15 16:01:35 +0000 |
commit | 33db85f3765d3c61634b0de6c0cb69d3da9d0525 (patch) | |
tree | 524147a10be91bb7356641db68a23fafc54046f0 /crawl-ref/source/spl-monench.cc | |
parent | cb4f853c2be2063e6330c108614f7ad4c6fe9ba6 (diff) | |
download | crawl-ref-33db85f3765d3c61634b0de6c0cb69d3da9d0525.tar.gz crawl-ref-33db85f3765d3c61634b0de6c0cb69d3da9d0525.zip |
Re-implement Metabolic Englaciation as a mass slowing Hex
Diffstat (limited to 'crawl-ref/source/spl-monench.cc')
-rw-r--r-- | crawl-ref/source/spl-monench.cc | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/crawl-ref/source/spl-monench.cc b/crawl-ref/source/spl-monench.cc index 61fcbddc82..e2c15d532c 100644 --- a/crawl-ref/source/spl-monench.cc +++ b/crawl-ref/source/spl-monench.cc @@ -22,6 +22,43 @@ #include "terrain.h" #include "viewmap.h" +static int _englaciate_monsters(coord_def where, int pow, int, actor *actor) +{ + monster* mons = monster_at(where); + + if (!mons) + return (0); + + if (mons->res_cold() > 0 || mons_is_stationary(mons)) + { + if (!mons_is_firewood(mons)) + simple_monster_message(mons, " is unaffected."); + return (0); + } + + int duration = (roll_dice(3, pow) / 6 - random2(mons->get_experience_level())) + * BASELINE_DELAY; + + if (duration <= 0) + { + simple_monster_message(mons, " resists."); + return (0); + } + + if (mons_class_flag(mons->type, M_COLD_BLOOD)) + duration *= 2; + + return (do_slow_monster(mons, actor, duration)); +} + +spret_type cast_englaciation(int pow, bool fail) +{ + fail_check(); + mpr("You radiate an aura of cold."); + apply_area_visible(_englaciate_monsters, pow, false, &you); + return SPRET_SUCCESS; +} + bool backlight_monsters(coord_def where, int pow, int garbage) { UNUSED(pow); @@ -63,7 +100,7 @@ bool backlight_monsters(coord_def where, int pow, int garbage) return (true); } -bool do_slow_monster(monster* mon, const actor* agent) +bool do_slow_monster(monster* mon, const actor* agent, int dur) { // Try to remove haste, if monster is hasted. if (mon->del_ench(ENCH_HASTE, true)) @@ -75,7 +112,7 @@ bool do_slow_monster(monster* mon, const actor* agent) // Not hasted, slow it. if (!mon->has_ench(ENCH_SLOW) && !mons_is_stationary(mon) - && mon->add_ench(mon_enchant(ENCH_SLOW, 0, agent))) + && mon->add_ench(mon_enchant(ENCH_SLOW, 0, agent, dur))) { if (!mon->paralysed() && !mon->petrified() && simple_monster_message(mon, " seems to slow down.")) |