summaryrefslogtreecommitdiffstats
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
parente1eac6bb01e8166348812784f31f599fd5af8094 (diff)
downloadcrawl-ref-8b4c163569ea3a6c18e7a3eff19a2bce2ece8536.tar.gz
crawl-ref-8b4c163569ea3a6c18e7a3eff19a2bce2ece8536.zip
Implement "Passive Freeze" mutation (DS)
-rw-r--r--crawl-ref/source/cloud.cc8
-rw-r--r--crawl-ref/source/enum.h1
-rw-r--r--crawl-ref/source/mutation.cc7
-rw-r--r--crawl-ref/source/ouch.cc48
4 files changed, 63 insertions, 1 deletions
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index 523d7cd8f3..1916914ed1 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -530,6 +530,8 @@ int max_cloud_damage(cloud_type cl_type, int power)
// Intentional fall-throuigh
case CLOUD_COLD:
+ if (you.mutation[MUT_PASSIVE_FREEZE])
+ return (0);
if (cl_type == CLOUD_COLD)
resist = player_res_cold();
@@ -665,6 +667,9 @@ void in_a_cloud()
break;
case CLOUD_COLD:
+ if (you.mutation[MUT_PASSIVE_FREEZE])
+ break;
+
mpr("You are engulfed in freezing vapours!");
resist = player_res_cold();
@@ -791,8 +796,9 @@ bool is_damaging_cloud(cloud_type type, bool temp)
if (temp && you.duration[DUR_FIRE_SHIELD])
return (false);
case CLOUD_CHAOS:
- case CLOUD_COLD:
return (true);
+ case CLOUD_COLD:
+ return (!you.mutation[MUT_PASSIVE_FREEZE]);
// Only harmful if the player doesn't have the necessary resistances.
// Takes into account what the player can *know* and what s/he can
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 069a081841..9967fbd948 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -2424,6 +2424,7 @@ enum mutation_type
MUT_ICEMAIL,
MUT_CONSERVE_SCROLLS,
MUT_CONSERVE_POTIONS,
+ MUT_PASSIVE_FREEZE,
NUM_MUTATIONS,
RANDOM_MUTATION = 100,
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index 69362b8a6d..1c7594290b 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -1217,6 +1217,13 @@ mutation_def mutation_defs[] = {
{"", "", ""},
"conserve potions",
},
+
+ { MUT_PASSIVE_FREEZE, 0, 1, false, false,
+ {"A frigid envelope surrounds you and freezes all who hurt you.", "", ""},
+ {"Your skin feels very cold...", "", ""},
+ {"", "", ""},
+ "passive freeze",
+ },
};
const mutation_def& get_mutation_def(mutation_type mut)
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;