summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authorDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-06 13:37:03 -0600
committerDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-06 13:37:52 -0600
commitf858cfc60235a5cfb86dd2a2c510dde5e130a4bf (patch)
treed961eaf5b7122e52a9250e3381d93b1e9c80c88b /crawl-ref/source/player.cc
parent79d8c3044d2bb75d7f1e8ebad5cf6e3692fb7605 (diff)
downloadcrawl-ref-f858cfc60235a5cfb86dd2a2c510dde5e130a4bf.tar.gz
crawl-ref-f858cfc60235a5cfb86dd2a2c510dde5e130a4bf.zip
Move checks for the berserk state into actor::berserk().
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index a7dda1eb12..e5e9333d51 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -1170,7 +1170,7 @@ int player_hunger_rate(void)
hunger += 5;
// Berserk has its own food penalty -- excluding berserk haste.
- if (you.duration[DUR_HASTE] > 0 && !you.duration[DUR_BERSERKER])
+ if (you.duration[DUR_HASTE] > 0 && !you.berserk())
hunger += 5;
}
@@ -3319,7 +3319,7 @@ int check_stealth(void)
return (1000);
#endif
- if (you.attribute[ATTR_SHADOWS] || you.duration[DUR_BERSERKER])
+ if (you.attribute[ATTR_SHADOWS] || you.berserk())
return (0);
int stealth = you.dex * 3;
@@ -3862,7 +3862,7 @@ void display_char_status()
if (you.duration[DUR_DIVINE_STAMINA])
mpr("You are divinely fortified.");
- if (you.duration[DUR_BERSERKER])
+ if (you.berserk())
mpr("You are possessed by a berserker rage.");
if (you.airborne())
@@ -4722,7 +4722,7 @@ int get_real_hp(bool trans, bool rotted)
hitp += (you.experience_level * you.skills[SK_FIGHTING]) / 5;
// Being berserk makes you resistant to damage. I don't know why.
- if (trans && you.duration[DUR_BERSERKER])
+ if (trans && you.berserk())
hitp *= 2;
if (trans)
@@ -6182,12 +6182,12 @@ void player::go_berserk(bool intentional)
bool player::can_go_berserk() const
{
- return can_go_berserk(false);
+ return (can_go_berserk(false));
}
bool player::can_go_berserk(bool verbose) const
{
- if (this->duration[DUR_BERSERKER])
+ if (berserk())
{
if (verbose)
mpr("You're already berserk!");
@@ -6195,7 +6195,7 @@ bool player::can_go_berserk(bool verbose) const
return (false);
}
- if (this->duration[DUR_EXHAUSTED])
+ if (duration[DUR_EXHAUSTED])
{
if (verbose)
mpr("You're too exhausted to go berserk.");
@@ -6211,8 +6211,8 @@ bool player::can_go_berserk(bool verbose) const
return (false);
}
- if (this->is_undead
- && (this->is_undead != US_SEMI_UNDEAD || this->hunger_state <= HS_SATIATED))
+ if (is_undead
+ && (is_undead != US_SEMI_UNDEAD || hunger_state <= HS_SATIATED))
{
if (verbose)
mpr("You cannot raise a blood rage in your lifeless body.");
@@ -6224,6 +6224,11 @@ bool player::can_go_berserk(bool verbose) const
return (true);
}
+bool player::berserk() const
+{
+ return (duration[DUR_BERSERKER]);
+}
+
void player::god_conduct(conduct_type thing_done, int level)
{
::did_god_conduct(thing_done, level);
@@ -7057,7 +7062,7 @@ void player::put_to_sleep(int)
{
ASSERT(!crawl_state.arena);
- if (duration[DUR_BERSERKER] || asleep()) // No cumulative sleeps.
+ if (berserk() || asleep()) // No cumulative sleeps.
return;
// Not all species can be put to sleep. Check holiness.