summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fight.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-07 01:53:07 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-07 01:53:07 +0000
commitb8044fd336d74ebc40d688f25df37c203aa4e10b (patch)
tree4cd5d49c9453c09fba400ca7ddb3585072a0eca1 /crawl-ref/source/fight.cc
parent6b01fefe35f81ddbb55cb02f887932646e8b86c0 (diff)
downloadcrawl-ref-b8044fd336d74ebc40d688f25df37c203aa4e10b.tar.gz
crawl-ref-b8044fd336d74ebc40d688f25df37c203aa4e10b.zip
Neutral monster adjustments: monsters made permanently neutral by Zin's
Recite will give half XP, a la Elyvilon; neutral monsters that have given half XP will not attack the player; and holy beings converted on sight by the player's piety will have the half XP flag set, even though they don't actually give it (on the grounds that they shouldn't be good kills if they turn hostile). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4086 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r--crawl-ref/source/fight.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index e5b8d4c830..6d128a61ec 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -3907,12 +3907,19 @@ static void mons_lose_attack_energy(monsters *attacker, int wpn_speed,
bool monster_attack(int monster_attacking)
{
monsters *attacker = &menv[monster_attacking];
-
- if (mons_friendly(attacker) && !mons_is_confused(attacker))
+
+ // Friendly monsters and neutral monsters that you got half XP from
+ // won't attack unless confused.
+ if ((mons_friendly(attacker)
+ || (mons_neutral(attacker)
+ && testbits(attacker->flags, MF_GOT_HALF_XP)))
+ && !mons_is_confused(attacker))
+ {
return false;
+ }
- // in case the monster hasn't noticed you
- // bumping into will change that
+ // In case the monster hasn't noticed you, bumping into it will
+ // change that.
behaviour_event( attacker, ME_ALERT, MHITYOU );
melee_attack attk(attacker, &you);
attk.attack();