summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-02 03:32:49 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-02 03:32:49 +0000
commiteea780a4ce6f65322040c52a49a56a3a60003249 (patch)
treea255c8d8c0dd57524020ddc8fdf9ea0dbe708ac0
parent635887d54e242f2150146f7f980246df04cbac5b (diff)
downloadcrawl-ref-eea780a4ce6f65322040c52a49a56a3a60003249.tar.gz
crawl-ref-eea780a4ce6f65322040c52a49a56a3a60003249.zip
Make berserking and non-living monsters stop retreating from Sanctuary as
soon as they leave it, since they're being forced out rather than actually afraid. Also give a "stops retreating" message for them instead of the "regaining courage" one. Remove faulty logic that was causing monsters to not notice the player as soon as they stopped fleeing Sanctuary. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6320 c06c8d41-db1a-0410-9941-cceddc491573
-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