From b8044fd336d74ebc40d688f25df37c203aa4e10b Mon Sep 17 00:00:00 2001 From: dolorous Date: Mon, 7 Apr 2008 01:53:07 +0000 Subject: 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 --- crawl-ref/source/delay.cc | 6 ++++++ crawl-ref/source/fight.cc | 15 +++++++++++---- crawl-ref/source/religion.cc | 12 +++++++----- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index 1fc478fee5..a5748db171 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -186,6 +186,12 @@ static int recite_to_monsters(int x, int y, int pow, int unused) // permanently neutral, but same message as enchantment mons->attitude = ATT_NEUTRAL; mons->flags |= MF_WAS_NEUTRAL; + + // give half of the monster's xp + unsigned int exp_gain = 0, avail_gain = 0; + gain_exp( exper_value(mons) / 2 + 1, &exp_gain, &avail_gain ); + mons->flags |= MF_GOT_HALF_XP; + simple_monster_message(mons, " seems impressed!"); break; } 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(); diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 15172b45c5..092e2689f9 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -3480,7 +3480,7 @@ static bool moral_beings_on_level_attitude_change() { monster->attitude = ATT_HOSTILE; behaviour_event(monster, ME_ALERT, MHITYOU); - // for now CREATED_FRIENDLY/WAS_NEUTRAL stays + // for now CREATED_FRIENDLY/WAS_NEUTRAL/GOT_HALF_XP stays success = true; } @@ -3818,9 +3818,11 @@ void good_god_holy_attitude_change(monsters *holy) holy->attitude = ATT_NEUTRAL; - // not really *created* neutral, but should it become - // hostile later on, it won't count as a good kill + // not really *created* neutral, and you don't really get half XP + // for it, but should it become hostile later on, it won't count as + // a good kill holy->flags |= MF_WAS_NEUTRAL; + holy->flags |= MF_GOT_HALF_XP; // to avoid immobile "followers" behaviour_event(holy, ME_ALERT, MHITNOT); @@ -3874,8 +3876,8 @@ void beogh_convert_orc(monsters *orc, bool emergency, orc->attitude = ATT_FRIENDLY; - // not really "created" friendly, but should it become - // hostile later on, it won't count as a good kill + // not really "created" friendly, but should it become hostile later + // on, it won't count as a good kill orc->flags |= MF_CREATED_FRIENDLY; orc->flags |= MF_GOD_GIFT; -- cgit v1.2.3-54-g00ecf