summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/mon-util.cc14
-rw-r--r--crawl-ref/source/monstuff.cc18
2 files changed, 19 insertions, 13 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index b320eac21b..1c1a22e2ae 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -5217,9 +5217,17 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet)
break;
case ENCH_FEAR:
- snprintf( info, INFO_SIZE, " seems to regain %s courage.",
- mons_pronoun(static_cast<monster_type>(this->type),
- PRONOUN_NOCAP_POSSESSIVE));
+ if (holiness() == MH_NONLIVING || has_ench(ENCH_BERSERK))
+ {
+ // This should only happen because of fleeing Sanctuary
+ strcpy( info, " stops retreating.");
+ }
+ else
+ {
+ snprintf( info, INFO_SIZE, " seems to regain %s courage.",
+ mons_pronoun(static_cast<monster_type>(this->type),
+ PRONOUN_NOCAP_POSSESSIVE));
+ }
if (!quiet)
simple_monster_message(this, info);
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 4ad21c1801..2d6e2892aa 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -3418,13 +3418,6 @@ static void _handle_behaviour(monsters *mon)
mon->foe = new_foe;
}
-
- if (is_sanctuary(mon->target_x, mon->target_y) && mon->foe != MHITNOT
- && !isFriendly && !mons_is_pacified(mon) && mon->behaviour != BEH_FLEE
- && mon->target_pos() != mon->pos())
- {
- mon->foe = MHITNOT;
- }
}
static bool _mons_check_set_foe(monsters *mon, int x, int y,
@@ -3667,12 +3660,17 @@ static void _handle_movement(monsters *monster)
}
else if (mons_is_fleeing(monster) && inside_level_bounds(env.sanctuary_pos)
&& !is_sanctuary(monster->x, monster->y)
- && monster->target_x == env.sanctuary_pos.x
- && monster->target_y == env.sanctuary_pos.y)
+ && monster->target_pos() == env.sanctuary_pos)
{
// Once outside there's a chance they'll regain their courage.
- if (random2(5) > 2)
+ // Nonliving and berserking monsters always stop imediately,
+ // since they're only being forced out rather than actually scared.
+ if (monster->holiness() == MH_NONLIVING
+ || monster->has_ench(ENCH_BERSERK)
+ || random2(5) > 2)
+ {
monster->del_ench(ENCH_FEAR);
+ }
}
// some calculations