summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-12 15:14:43 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-12 15:14:43 +0000
commit204b127021f5b62ed5420b0d4cfda7f4b161ec96 (patch)
tree7ff0ce14a86334a7c92fcabc5d0d323b2fa8da35 /crawl-ref/source/monstuff.cc
parent81e03982e3ef1c9c810276370c759ea2acb98691 (diff)
downloadcrawl-ref-204b127021f5b62ed5420b0d4cfda7f4b161ec96.tar.gz
crawl-ref-204b127021f5b62ed5420b0d4cfda7f4b161ec96.zip
Make sure the friendly monsters and good neutral monsters normally won't
attack each other. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4211 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index bd06fbb437..8c1e28af98 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -2104,6 +2104,7 @@ static void _handle_behaviour(monsters *mon)
bool changed = true;
bool isFriendly = mons_friendly(mon);
bool isNeutral = mons_neutral(mon);
+ bool wontAttack = mons_wont_attack(mon);
bool proxPlayer = mons_near(mon);
bool proxFoe;
bool isHurt = (mon->hit_points <= mon->max_hit_points / 4 - 1);
@@ -2158,7 +2159,7 @@ static void _handle_behaviour(monsters *mon)
// set friendly target, if they don't already have one
// berserking allies ignore your commands
- if (isFriendly
+ if (isFriendly
&& you.pet_target != MHITNOT
&& (mon->foe == MHITNOT || mon->foe == MHITYOU)
&& !mon->has_ench(ENCH_BERSERK))
@@ -2189,14 +2190,14 @@ static void _handle_behaviour(monsters *mon)
if (mon->foe == monster_index(mon))
mon->foe = MHITNOT;
- // friendly monsters do not attack other friendly monsters
+ // non-attacking monsters do not attack other non-attacking monsters
if (mon->foe != MHITNOT && mon->foe != MHITYOU)
{
- if (isFriendly && mons_friendly(&menv[mon->foe]))
+ if (wontAttack && mons_wont_attack(&menv[mon->foe]))
mon->foe = MHITNOT;
}
- // neutral monsters prefer not to attack players, or other neutrals.
+ // neutral monsters prefer not to attack players, or other neutrals
if (mon->foe != MHITNOT && isNeutral
&& (mon->foe == MHITYOU || mons_neutral(&menv[mon->foe])))
{
@@ -2392,7 +2393,7 @@ static void _handle_behaviour(monsters *mon)
case BEH_WANDER:
// is our foe in LOS?
// Batty monsters don't automatically reseek so that
- // they'll flitter away, we'll reset them just before
+ // they'll flitter away, we'll reset them just before
// they get movement in handle_monsters() instead. -- bwr
if (proxFoe && !testbits( mon->flags, MF_BATTY ))
{
@@ -2405,9 +2406,9 @@ static void _handle_behaviour(monsters *mon)
// XXX: This is really dumb wander behaviour... instead of
// changing the goal square every turn, better would be to
// have the monster store a direction and have the monster
- // head in that direction for a while, then shift the
- // direction to the left or right. We're changing this so
- // wandering monsters at least appear to have some sort of
+ // head in that direction for a while, then shift the
+ // direction to the left or right. We're changing this so
+ // wandering monsters at least appear to have some sort of
// attention span. -- bwr
if ((mon->x == mon->target_x && mon->y == mon->target_y)
|| one_chance_in(20)
@@ -2471,7 +2472,7 @@ static void _handle_behaviour(monsters *mon)
else
new_beh = BEH_WANDER;
}
- else
+ else
{
mon->target_x = foe_x;
mon->target_y = foe_y;