summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2009-10-26 00:16:31 -0700
committerDarshan Shaligram <dshaligram@users.sourceforge.net>2009-10-26 13:40:51 +0530
commitd55c844e48e7f56c4ec9b9bb6badd21a68022ea7 (patch)
treed18c6ca3bb1d6f02e7f0fb252dedee500ee7f621 /crawl-ref/source
parent270ec5c73a1bf0f0514a8a8f95d4c191424b03bb (diff)
downloadcrawl-ref-d55c844e48e7f56c4ec9b9bb6badd21a68022ea7.tar.gz
crawl-ref-d55c844e48e7f56c4ec9b9bb6badd21a68022ea7.zip
Add stochastic torment resistance per dpeg
The mutation comes in three levels and blocks 20%, 40%, or 60% (shown to the user) of torments. Right now, you can cast Symbol of Torment with it; I doubt this is too good. It is on the tier-1 list for demonspawn mutations, and I expect it to be balanced appropriately. Signed-off-by: Darshan Shaligram <dshaligram@users.sourceforge.net>
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/effects.cc5
-rw-r--r--crawl-ref/source/enum.h2
-rw-r--r--crawl-ref/source/mutation.cc16
-rw-r--r--crawl-ref/source/output.cc4
-rw-r--r--crawl-ref/source/player.cc5
-rw-r--r--crawl-ref/source/player.h2
-rw-r--r--crawl-ref/source/spl-cast.cc2
7 files changed, 27 insertions, 9 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 0f1ecf5046..770eb74959 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -194,7 +194,7 @@ int torment_player(int pow, int caster)
// correctly.
int hploss = 0;
- if (!player_res_torment())
+ if (!player_res_torment(false))
{
// Negative energy resistance can alleviate torment.
hploss = std::max(0, you.hp * (50 - player_prot_life() * 5) / 100 - 1);
@@ -203,14 +203,13 @@ int torment_player(int pow, int caster)
// Kiku protects you from torment to a degree.
bool kiku_shielding_player =
(you.religion == GOD_KIKUBAAQUDGHA
- && !player_res_torment()
&& !player_under_penance()
&& you.piety > 80
&& you.gift_timeout == 0); // no protection during pain branding weapon
if (kiku_shielding_player)
{
- if (!player_res_torment())
+ if (hploss > 0)
{
if (random2(600) < you.piety) // 13.33% to 33.33% chance
{
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 645633bdf8..634f8db364 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -2411,6 +2411,8 @@ enum mutation_type
MUT_RED2_SCALES,
MUT_IRIDESCENT_SCALES,
MUT_PATTERNED_SCALES,
+
+ MUT_STOCHASTIC_TORMENT_RESISTANCE,
NUM_MUTATIONS,
RANDOM_MUTATION = 100,
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index 65a42c9403..807e6e522d 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -1181,7 +1181,19 @@ mutation_def mutation_defs[] = {
"Your patterned scales recede somewhat."},
"patterned scales"
- }
+ },
+ { MUT_STOCHASTIC_TORMENT_RESISTANCE, 0, 3, false, false,
+ {"You are somewhat able to resist unholy torments (1 in 5 success).",
+ "You are decently able to resist unholy torments (2 in 5 success).",
+ "You are rather able to resist unholy torments (3 in 5 success)."},
+
+ {"You feel a slight anaesthesia.",
+ "You feel a slight anaesthesia.",
+ "You feel a strange anaesthesia."},
+
+ {"","",""},
+
+ "stochastic torment resistance"},
};
const mutation_def& get_mutation_def(mutation_type mut)
@@ -2668,7 +2680,7 @@ void roll_demonspawn_mutations()
static const mutation_type awesome_muts[] = {
MUT_HEAT_RESISTANCE, MUT_FAST, MUT_TELEPORT_AT_WILL, MUT_MAPPING,
MUT_ROBUST, MUT_NEGATIVE_ENERGY_RESISTANCE, MUT_BLACK_SCALES,
- MUT_METALLIC_SCALES, MUT_RED2_SCALES
+ MUT_METALLIC_SCALES, MUT_RED2_SCALES, MUT_STOCHASTIC_TORMENT_RESISTANCE
};
// "Great" mutations define strategy in common encounters, but not
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index a03f66ff8a..9f43ad1427 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -2954,6 +2954,10 @@ std::string _status_mut_abilities()
case MUT_TORMENT_RESISTANCE:
current = "torment resistance";
break;
+ case MUT_STOCHASTIC_TORMENT_RESISTANCE:
+ snprintf(info, INFO_SIZE, "%d%% torment resistance", level*20);
+ current = info;
+ break;
case MUT_NEGATIVE_ENERGY_RESISTANCE:
snprintf(info, INFO_SIZE, "life protection %d", level);
current = info;
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 42be71c2dd..bb9224de52 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -1615,11 +1615,12 @@ bool player_control_teleport(bool calc_unid, bool temp, bool items)
|| player_mutation_level(MUT_TELEPORT_CONTROL));
}
-int player_res_torment(bool)
+int player_res_torment(bool, bool temp)
{
return (player_mutation_level(MUT_TORMENT_RESISTANCE)
|| you.attribute[ATTR_TRANSFORMATION] == TRAN_LICH
- || you.species == SP_VAMPIRE && you.hunger_state == HS_STARVING);
+ || you.species == SP_VAMPIRE && you.hunger_state == HS_STARVING
+ || temp && (20 * player_mutation_level(MUT_STOCHASTIC_TORMENT_RESISTANCE) >= random2(100)));
}
// Funny that no races are susceptible to poisons. {dlb}
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index bd07a101c8..b3ecedef1d 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -639,7 +639,7 @@ int player_res_cold(bool calc_unid = true, bool temp = true,
int player_res_acid(bool calc_unid = true, bool items = true);
int player_acid_resist_factor();
-int player_res_torment(bool calc_unid = true);
+int player_res_torment(bool calc_unid = true, bool temp = true);
bool player_item_conserve(bool calc_unid = true);
int player_mental_clarity(bool calc_unid = true, bool items = true);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 882384fa85..94fa9df9cf 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1014,7 +1014,7 @@ static bool _spell_is_uncastable(spell_type spell)
return (true);
}
- if (spell == SPELL_SYMBOL_OF_TORMENT && player_res_torment())
+ if (spell == SPELL_SYMBOL_OF_TORMENT && player_res_torment(true, false))
{
mpr("To torment others, one must first know what torment means. ");
return (true);