summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/effects.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/effects.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/effects.cc')
-rw-r--r--crawl-ref/source/effects.cc19
1 files changed, 8 insertions, 11 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index fb50a9b7ad..ca1839fd75 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2461,7 +2461,7 @@ static void _set_friendly_foes(bool allow_patrol = false)
}
// Berserking monsters cannot be ordered around.
- if (mon->has_ench(ENCH_BERSERK))
+ if (mon->berserk())
continue;
mon->foe = (allow_patrol && mon->is_patrolling() ? MHITNOT
@@ -2478,7 +2478,7 @@ static void _set_allies_patrol_point(bool clear = false)
continue;
// Berserking monsters cannot be ordered around.
- if (mon->has_ench(ENCH_BERSERK))
+ if (mon->berserk())
continue;
mon->patrol_point = (clear ? coord_def(0, 0) : mon->pos());
@@ -2553,7 +2553,7 @@ void yell(bool force)
mpr("What do you say?", MSGCH_PROMPT);
mprf(" t - %s!", cap_shout.c_str());
- if (!you.duration[DUR_BERSERKER])
+ if (!you.berserk())
{
std::string previous;
if (!(you.prev_targ == MHITNOT || you.prev_targ == MHITYOU))
@@ -2569,7 +2569,7 @@ void yell(bool force)
mprf("Orders for allies: a - Attack new target.%s", previous.c_str());
mpr( " s - Stop attacking.");
mpr( " w - Wait here. f - Follow me.");
- }
+ }
mprf(" Anything else - Stay silent%s.",
one_chance_in(20) ? " (and be thought a fool)" : "");
@@ -2605,7 +2605,7 @@ void yell(bool force)
break;
case 'p':
- if (you.duration[DUR_BERSERKER])
+ if (you.berserk())
{
canned_msg(MSG_TOO_BERSERK);
return;
@@ -2619,7 +2619,7 @@ void yell(bool force)
// fall through
case 'a':
- if (you.duration[DUR_BERSERKER])
+ if (you.berserk())
{
canned_msg(MSG_TOO_BERSERK);
return;
@@ -3730,11 +3730,8 @@ void handle_time(long time_delta)
if (you.duration[DUR_INVIS] && x_chance_in_y(6, 10))
added_contamination++;
- if (you.duration[DUR_HASTE] && !you.duration[DUR_BERSERKER]
- && x_chance_in_y(6, 10))
- {
+ if (you.duration[DUR_HASTE] && !you.berserk() && x_chance_in_y(6, 10))
added_contamination++;
- }
bool mutagenic_randart = false;
if (const int artefact_glow = scan_artefacts(ARTP_MUTAGENIC))
@@ -3911,7 +3908,7 @@ void handle_time(long time_delta)
}
// Exercise stealth skill:
else if (you.burden_state == BS_UNENCUMBERED
- && !you.duration[DUR_BERSERKER]
+ && !you.berserk()
&& !you.attribute[ATTR_SHADOWS])
{
// Diminishing returns for stealth training by waiting.