summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player-stats.cc
diff options
context:
space:
mode:
authorChris Campbell <chriscampbell89@gmail.com>2013-06-17 23:13:05 +0100
committerChris Campbell <chriscampbell89@gmail.com>2013-06-17 23:18:26 +0100
commit095ef86229c4951f78cf5305eaa26feb5db59465 (patch)
tree49baa815d9eb5ef35aba522ceffea653fa2b347d /crawl-ref/source/player-stats.cc
parentf51affd27a403bb8b57dfbe2e74deca2b9beb82b (diff)
downloadcrawl-ref-095ef86229c4951f78cf5305eaa26feb5db59465.tar.gz
crawl-ref-095ef86229c4951f78cf5305eaa26feb5db59465.zip
Remove stat death, have stat loss below 0 cause damage instead
Death after spending a while with a stat at 0 no longer occurs, but the negative effects (slowing, significant stat-dependent restrictions) and the recovery period after restoring from 0 still exist, and additional stat loss when below 0 causes some irresistible damage. Actual stat death was rare, slightly spoilery in implementation (in particular the death timer being precisely 90 actions) and the stat zero restrictions remain a pretty good reason to not want to have your stats at zero for any length of time.
Diffstat (limited to 'crawl-ref/source/player-stats.cc')
-rw-r--r--crawl-ref/source/player-stats.cc66
1 files changed, 16 insertions, 50 deletions
diff --git a/crawl-ref/source/player-stats.cc b/crawl-ref/source/player-stats.cc
index 0019b84b2b..e00111af7a 100644
--- a/crawl-ref/source/player-stats.cc
+++ b/crawl-ref/source/player-stats.cc
@@ -626,26 +626,27 @@ static void _normalize_stat(stat_type stat)
you.base_stats[stat] = min<int8_t>(you.base_stats[stat], 72);
}
-// Number of turns of stat at zero you start with.
-#define STAT_ZERO_START 10
-// Number of turns of stat at zero you can survive.
-#define STAT_DEATH_TURNS 100
-// Number of turns of stat at zero after which random paralysis starts.
-#define STAT_DEATH_START_PARA 50
-
static void _handle_stat_change(stat_type stat, const char* cause, bool see_source)
{
ASSERT_RANGE(stat, 0, NUM_STATS);
- if (you.stat(stat) <= 0 && you.stat_zero[stat] == 0)
+ if (you.stat(stat) <= 0)
{
- you.stat_zero[stat] = STAT_ZERO_START;
- you.stat_zero_cause[stat] = cause;
- 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));
+ 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);
+ }
}
you.redraw_stats[stat] = true;
@@ -680,8 +681,6 @@ static void _handle_stat_change(const char* aux, bool see_source)
// Called once per turn.
void update_stat_zero()
{
- stat_type para_stat = NUM_STATS;
- int num_para = 0;
for (int i = 0; i < NUM_STATS; ++i)
{
stat_type s = static_cast<stat_type>(i);
@@ -700,38 +699,5 @@ void update_stat_zero()
}
else // no stat penalty at all
continue;
-
- if (you.stat_zero[i] > STAT_DEATH_TURNS)
- {
- ouch(INSTANT_DEATH, NON_MONSTER,
- _statloss_killtype(s), you.stat_zero_cause[i].c_str());
- }
-
- int paramax = STAT_DEATH_TURNS - STAT_DEATH_START_PARA;
- int paradiff = max(you.stat_zero[i] - STAT_DEATH_START_PARA, 0);
- if (x_chance_in_y(paradiff*paradiff, 2*paramax*paramax))
- {
- para_stat = s;
- num_para++;
- }
- }
-
- switch (num_para)
- {
- case 0:
- break;
- case 1:
- if (you.duration[DUR_PARALYSIS])
- break;
- mprf(MSGCH_WARN, "You faint for lack of %s.",
- stat_desc(para_stat, SD_NAME));
- you.increase_duration(DUR_PARALYSIS, 1 + roll_dice(1,3));
- break;
- default:
- if (you.duration[DUR_PARALYSIS])
- break;
- mpr("Your lost attributes cause you to faint.", MSGCH_WARN);
- you.increase_duration(DUR_PARALYSIS, 1 + roll_dice(num_para, 3));
- break;
}
}