summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-22 19:13:35 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-22 19:13:35 +0000
commitb432e59457a38ff3f885e6da7afd2570c5dd0098 (patch)
tree21dfe97244314bbb6e9c9dc27a1d61babb824310 /crawl-ref/source/monstuff.cc
parent67c2c0fa7330cb8a10c881e3370455b8909927dc (diff)
downloadcrawl-ref-b432e59457a38ff3f885e6da7afd2570c5dd0098.tar.gz
crawl-ref-b432e59457a38ff3f885e6da7afd2570c5dd0098.zip
Add Ely's pacifying monsters effect:
When a follower of Elyvilon attempts to heal a hostile monster (via ability or wand) there's a chance, depending on the healing value, max monster hp and monster type, that Ely will make that monster become neutral. If this happens, Ely hands out a bit of piety and his follower gains half of the monster's xp value. If the pacifying attempt fails, the monster is never healed, though you still lose your ressources (mana, piety, charges). Killing neutral monsters currently means you won't get any xp. Also, Ely dislikes this and hands out penance for doing so. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3812 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc23
1 files changed, 15 insertions, 8 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index b293160a48..e08685c1cb 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -392,7 +392,7 @@ static void check_kill_milestone(const monsters *mons,
}
#endif // DGL_MILESTONES
-static void give_monster_experience( monsters *victim,
+static void _give_monster_experience( monsters *victim,
int killer_index, int experience,
bool victim_was_born_friendly )
{
@@ -421,27 +421,34 @@ static void give_adjusted_experience(monsters *monster, killer_type killer,
testbits(monster->flags, MF_CREATED_FRIENDLY);
const bool was_neutral = testbits(monster->flags, MF_WAS_NEUTRAL);
const bool no_xp = monster->has_ench(ENCH_ABJ);
+ const bool already_got_half_xp = testbits(monster->flags, MF_GOT_HALF_XP);
if (created_friendly || was_neutral || no_xp)
; // No experience if monster was created friendly or summoned.
else if (YOU_KILL(killer))
{
int old_lev = you.experience_level;
- gain_exp( experience, exp_gain, avail_gain );
+ if (already_got_half_xp)
+ gain_exp( experience / 2, exp_gain, avail_gain );
+ else
+ gain_exp( experience, exp_gain, avail_gain );
+
// Give a message for monsters dying out of sight
if (exp_gain > 0 && !mons_near(monster)
&& you.experience_level == old_lev)
+ {
mpr("You feel a bit more experienced.");
+ }
}
- else if (pet_kill)
+ else if (pet_kill && !already_got_half_xp)
gain_exp( experience / 2 + 1, exp_gain, avail_gain );
if (MON_KILL(killer) && !no_xp)
- give_monster_experience( monster, killer_index, experience,
- created_friendly );
+ _give_monster_experience( monster, killer_index, experience,
+ created_friendly );
}
-static bool is_pet_kill(killer_type killer, int i)
+static bool _is_pet_kill(killer_type killer, int i)
{
if (!MON_KILL(killer))
return (false);
@@ -670,7 +677,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent)
if (killer == KILL_YOU)
crawl_state.cancel_cmd_repeat();
- const bool pet_kill = is_pet_kill(killer, i);
+ const bool pet_kill = _is_pet_kill(killer, i);
if (monster->type == MONS_GIANT_SPORE
|| monster->type == MONS_BALL_LIGHTNING)
@@ -789,7 +796,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent)
did_god_conduct(DID_KILL_HOLY, monster->hit_dice,
true, monster);
- if (created_friendly)
+ if (was_neutral)
did_god_conduct(DID_KILL_NEUTRAL, monster->hit_dice,
true, monster);
}