summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ouch.cc
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2009-11-02 21:01:27 -0800
committerStefan O'Rear <stefanor@cox.net>2009-11-02 21:01:27 -0800
commit8b4c163569ea3a6c18e7a3eff19a2bce2ece8536 (patch)
tree2f46fab8e26f86b66024d13448892c4c0d04d331 /crawl-ref/source/ouch.cc
parente1eac6bb01e8166348812784f31f599fd5af8094 (diff)
downloadcrawl-ref-8b4c163569ea3a6c18e7a3eff19a2bce2ece8536.tar.gz
crawl-ref-8b4c163569ea3a6c18e7a3eff19a2bce2ece8536.zip
Implement "Passive Freeze" mutation (DS)
Diffstat (limited to 'crawl-ref/source/ouch.cc')
-rw-r--r--crawl-ref/source/ouch.cc48
1 files changed, 48 insertions, 0 deletions
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 96f806bbfc..e5ae609ed7 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -34,6 +34,7 @@
#include "externs.h"
#include "artefact.h"
+#include "beam.h"
#include "chardump.h"
#include "delay.h"
#include "effects.h"
@@ -857,6 +858,52 @@ static void _yred_mirrors_injury(int dam, int death_source)
}
}
+static void _passive_freeze(kill_method_type death_type, int death_source)
+{
+ if (you.mutation[MUT_PASSIVE_FREEZE] && death_type == KILLED_BY_MONSTER)
+ {
+ if (invalid_monster_index(death_source))
+ return;
+
+ monsters *mon = &menv[death_source];
+
+ if (!mon->alive())
+ return;
+
+ bolt beam;
+ beam.flavour = BEAM_COLD;
+ beam.thrower = KILL_YOU;
+
+ const int orig_hurted = roll_dice(1, 11);
+ int hurted = mons_adjust_flavoured(mon, beam, orig_hurted);
+
+ if (!hurted)
+ return;
+
+ simple_monster_message(mon, " is very cold.");
+
+#ifndef USE_TILE
+ flash_monster_colour(mon, LIGHTBLUE, 200);
+#endif
+
+ mon->hurt(&you, hurted);
+
+ if (mon->alive())
+ {
+ mon->expose_to_element(BEAM_COLD, orig_hurted);
+ print_wounds(mon);
+
+ const int cold_res = mon->res_cold();
+
+ if (cold_res <= 0)
+ {
+ const int stun = (1 - cold_res) * random2(7);
+ mon->speed_increment -= stun;
+ }
+ }
+ }
+}
+
static void _maybe_spawn_jellies(int dam, const char* aux,
kill_method_type death_type, int death_source)
{
@@ -1029,6 +1076,7 @@ void ouch(int dam, int death_source, kill_method_type death_type,
Note(NOTE_HP_CHANGE, you.hp, you.hp_max, damage_desc.c_str()) );
_yred_mirrors_injury(dam, death_source);
+ _passive_freeze(death_type, death_source);
_maybe_spawn_jellies(dam, aux, death_type, death_source);
return;