From f858cfc60235a5cfb86dd2a2c510dde5e130a4bf Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Fri, 6 Nov 2009 13:37:03 -0600 Subject: Move checks for the berserk state into actor::berserk(). --- crawl-ref/source/mon-behv.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/mon-behv.cc') diff --git a/crawl-ref/source/mon-behv.cc b/crawl-ref/source/mon-behv.cc index 0d67baf782..62b3a68a82 100644 --- a/crawl-ref/source/mon-behv.cc +++ b/crawl-ref/source/mon-behv.cc @@ -1192,14 +1192,14 @@ void handle_behaviour(monsters *mon) if (isFriendly && you.pet_target != MHITNOT && (mon->foe == MHITNOT || mon->foe == MHITYOU) - && !mon->has_ench(ENCH_BERSERK) - && mon->mons_species() != MONS_GIANT_SPORE ) + && !mon->berserk() + && mon->mons_species() != MONS_GIANT_SPORE) { mon->foe = you.pet_target; } // Instead, berserkers attack nearest monsters. - if ((mon->has_ench(ENCH_BERSERK) || mon->mons_species() == MONS_GIANT_SPORE) + if ((mon->berserk() || mon->mons_species() == MONS_GIANT_SPORE) && (mon->foe == MHITNOT || isFriendly && mon->foe == MHITYOU)) { // Intelligent monsters prefer to attack the player, @@ -1238,7 +1238,7 @@ void handle_behaviour(monsters *mon) // target the player, if they're healthy. if (!isFriendly && !isNeutral && mon->foe != MHITYOU && mon->foe != MHITNOT - && proxPlayer && !(mon->has_ench(ENCH_BERSERK)) && isHealthy + && proxPlayer && !mon->berserk() && isHealthy && !one_chance_in(3)) { mon->foe = MHITYOU; @@ -1802,7 +1802,7 @@ void behaviour_event(monsters *mon, mon_event_type event, int src, case ME_SCARE: // Stationary monsters can't flee, and berserking monsters // are too enraged. - if (mons_is_stationary(mon) || mon->has_ench(ENCH_BERSERK)) + if (mons_is_stationary(mon) || mon->berserk()) { mon->del_ench(ENCH_FEAR, true, true); break; -- cgit v1.2.3-54-g00ecf