From b3d8365da8efb695a18b85146a4e50ee0e9d7698 Mon Sep 17 00:00:00 2001 From: dolorous Date: Mon, 16 Jun 2008 19:27:45 +0000 Subject: Clean up and consolidate most of the monster pacification routines. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5885 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/mon-util.cc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/mon-util.cc') diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index e6930fad96..b87f450e3f 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -2127,10 +2127,10 @@ mon_attitude_type mons_attitude(const monsters *m) return ATT_HOSTILE; } -bool mons_is_submerged(const monsters *mon) +bool mons_is_submerged(const monsters *m) { // FIXME, switch to 4.1's MF_SUBMERGED system which is much cleaner. - return (mon->has_ench(ENCH_SUBMERGED)); + return (m->has_ench(ENCH_SUBMERGED)); } bool mons_is_paralysed(const monsters *m) @@ -2214,6 +2214,21 @@ bool mons_looks_distracted(const monsters *m) || mons_is_petrifying(m))); } +void mons_pacify(monsters *mon) +{ + // Make the monster permanently neutral. + mon->attitude = ATT_NEUTRAL; + mon->flags |= MF_WAS_NEUTRAL; + + if (!testbits(mon->flags, MF_GOT_HALF_XP)) + { + // Give the player half of the monster's XP. + unsigned int exp_gain = 0, avail_gain = 0; + gain_exp(exper_value(mon) / 2 + 1, &exp_gain, &avail_gain); + mon->flags |= MF_GOT_HALF_XP; + } +} + bool mons_should_fire(struct bolt &beam) { #ifdef DEBUG_DIAGNOSTICS -- cgit v1.2.3-54-g00ecf