summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player-stats.cc
diff options
context:
space:
mode:
authorChris Campbell <chriscampbell89@gmail.com>2012-04-30 17:13:05 +0100
committerChris Campbell <chriscampbell89@gmail.com>2012-04-30 17:13:05 +0100
commit659c08067b742ab0ce7a101fad623eb132cde3ea (patch)
tree444598e3b4282619fea8895f48655db68d65f1c5 /crawl-ref/source/player-stats.cc
parent503c9c2ad4a606151ee65232d17bcd56b10c487c (diff)
downloadcrawl-ref-659c08067b742ab0ce7a101fad623eb132cde3ea.tar.gz
crawl-ref-659c08067b742ab0ce7a101fad623eb132cde3ea.zip
Give full protection from stat loss under vitalisation, instead of one level of sustab
Diffstat (limited to 'crawl-ref/source/player-stats.cc')
-rw-r--r--crawl-ref/source/player-stats.cc37
1 files changed, 22 insertions, 15 deletions
diff --git a/crawl-ref/source/player-stats.cc b/crawl-ref/source/player-stats.cc
index f97c2d689a..9ce8e567d8 100644
--- a/crawl-ref/source/player-stats.cc
+++ b/crawl-ref/source/player-stats.cc
@@ -445,6 +445,21 @@ static int _stat_modifier(stat_type stat)
}
}
+static std::string _stat_name(stat_type stat)
+{
+ switch (stat)
+ {
+ case STAT_STR:
+ return ("strength");
+ case STAT_INT:
+ return ("intelligence");
+ case STAT_DEX:
+ return ("dexterity");
+ default:
+ die("invalid stat");
+ }
+}
+
bool lose_stat(stat_type which_stat, int stat_loss, bool force,
const char *cause, bool see_source)
{
@@ -455,6 +470,13 @@ bool lose_stat(stat_type which_stat, int stat_loss, bool force,
// permissible because stat_loss is unsigned: {dlb}
if (!force)
{
+ if (you.duration[DUR_DIVINE_STAMINA] > 0)
+ {
+ mprf("Your divine stamina protects you from %s loss.",
+ _stat_name(which_stat).c_str());
+ return (false);
+ }
+
int sust = player_sust_abil();
stat_loss >>= sust;
@@ -543,21 +565,6 @@ bool lose_stat(stat_type which_stat, int stat_loss,
return lose_stat(which_stat, stat_loss, force, verb + " " + name, true);
}
-static std::string _stat_name(stat_type stat)
-{
- switch (stat)
- {
- case STAT_STR:
- return ("strength");
- case STAT_INT:
- return ("intelligence");
- case STAT_DEX:
- return ("dexterity");
- default:
- die("invalid stat");
- }
-}
-
static stat_type _random_lost_stat()
{
stat_type choice = NUM_STATS;