summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player-stats.cc
diff options
context:
space:
mode:
authorChris Campbell <chriscampbell89@gmail.com>2013-06-17 23:47:48 +0100
committerChris Campbell <chriscampbell89@gmail.com>2013-06-17 23:48:26 +0100
commit73abbcd7535420a7c06cd7a347ebec4e60419526 (patch)
tree43ac4241bc625b83f9c80e2dd6a2ba7b49a95a7e /crawl-ref/source/player-stats.cc
parentf8b3364d7c942cbb6c5f49328d267024b73641d9 (diff)
downloadcrawl-ref-73abbcd7535420a7c06cd7a347ebec4e60419526.tar.gz
crawl-ref-73abbcd7535420a7c06cd7a347ebec4e60419526.zip
Only deal stat loss damage on actual stat loss
Including stat loss while still recovering from draining, now.
Diffstat (limited to 'crawl-ref/source/player-stats.cc')
-rw-r--r--crawl-ref/source/player-stats.cc29
1 files changed, 13 insertions, 16 deletions
diff --git a/crawl-ref/source/player-stats.cc b/crawl-ref/source/player-stats.cc
index e00111af7a..2688f703fd 100644
--- a/crawl-ref/source/player-stats.cc
+++ b/crawl-ref/source/player-stats.cc
@@ -536,6 +536,11 @@ bool lose_stat(stat_type which_stat, int stat_loss, bool force,
you.stat_loss[which_stat] = min<int>(100,
you.stat_loss[which_stat] + stat_loss);
_handle_stat_change(which_stat, cause, see_source);
+ if (you.stat_zero[which_stat] > 0)
+ {
+ mprf(MSGCH_DANGER, "You convulse from lack of %s!", stat_desc(which_stat, SD_NAME));
+ ouch(5 + random2(you.hp_max / 10), NON_MONSTER, _statloss_killtype(which_stat), cause);
+ }
return true;
}
else
@@ -630,23 +635,15 @@ static void _handle_stat_change(stat_type stat, const char* cause, bool see_sour
{
ASSERT_RANGE(stat, 0, NUM_STATS);
- if (you.stat(stat) <= 0)
+ if (you.stat(stat) <= 0 && you.stat_zero[stat] == 0)
{
- if (you.stat_zero[stat] == 0)
- {
- // Turns required for recovery once the stat is restored, randomised slightly.
- you.stat_zero[stat] += 10 + random2(10);
- mprf(MSGCH_WARN, "You have lost your %s.", stat_desc(stat, SD_NAME));
- take_note(Note(NOTE_MESSAGE, 0, 0, make_stringf("Lost %s.",
- stat_desc(stat, SD_NAME)).c_str()), true);
- // 2 to 5 turns of paralysis (XXX: decremented right away?)
- you.increase_duration(DUR_PARALYSIS, 2 + random2(3));
- }
- else // Further stat drain below 0 deals damage.
- {
- mprf(MSGCH_DANGER, "You convulse from lack of %s!", stat_desc(stat, SD_NAME));
- ouch(5 + random2(you.hp_max / 10), NON_MONSTER, _statloss_killtype(stat), cause);
- }
+ // Turns required for recovery once the stat is restored, randomised slightly.
+ you.stat_zero[stat] += 10 + random2(10);
+ mprf(MSGCH_WARN, "You have lost your %s.", stat_desc(stat, SD_NAME));
+ take_note(Note(NOTE_MESSAGE, 0, 0, make_stringf("Lost %s.",
+ stat_desc(stat, SD_NAME)).c_str()), true);
+ // 2 to 5 turns of paralysis (XXX: decremented right away?)
+ you.increase_duration(DUR_PARALYSIS, 2 + random2(3));
}
you.redraw_stats[stat] = true;