summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells1.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-18 15:58:09 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-18 15:58:09 +0000
commitee1127d4563cabeb91c22775d7f3f73cbbd88349 (patch)
tree2e5f8bc8b4c32c11c6e47c8d66211a8fdef61e4b /crawl-ref/source/spells1.cc
parentb673afdd95044009e7335f8237c618ae872a59eb (diff)
downloadcrawl-ref-ee1127d4563cabeb91c22775d7f3f73cbbd88349.tar.gz
crawl-ref-ee1127d4563cabeb91c22775d7f3f73cbbd88349.zip
Fix [2748638]: Try to pacify monsters before healing them instead of
afterward. Also, do the pacification check only once and use the result both times instead of doing the pacification check twice, as it has a random factor. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9622 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells1.cc')
-rw-r--r--crawl-ref/source/spells1.cc44
1 files changed, 24 insertions, 20 deletions
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index ef998c9e48..ded33ab5a2 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -730,37 +730,21 @@ static int _healing_spell(int healed, bool divine_ability,
return (0);
}
+ const bool can_pacify = _can_pacify_monster(monster, healed);
+
// Don't divinely heal a monster you can't pacify.
if (divine_ability
&& you.religion == GOD_ELYVILON
- && !_can_pacify_monster(monster, healed))
+ && !can_pacify)
{
canned_msg(MSG_NOTHING_HAPPENS);
return (0);
}
bool did_something = false;
- if (heal_monster(monster, healed, false))
- {
- did_something = true;
- mprf("You heal %s.", monster->name(DESC_NOCAP_THE).c_str());
-
- if (monster->hit_points == monster->max_hit_points)
- simple_monster_message(monster, " is completely healed.");
- else
- print_wounds(monster);
-
- if (you.religion == GOD_ELYVILON && !_mons_hostile(monster))
- {
- simple_god_message(" appreciates your healing of a fellow "
- "creature.");
- if (one_chance_in(8))
- gain_piety(1);
- }
- }
if (you.religion == GOD_ELYVILON
- && _can_pacify_monster(monster, healed)
+ && can_pacify
&& _mons_hostile(monster))
{
did_something = true;
@@ -771,6 +755,7 @@ static int _healing_spell(int healed, bool divine_ability,
else
{
const bool is_summoned = mons_is_summoned(monster);
+
simple_monster_message(monster, " turns neutral.");
mons_pacify(monster);
@@ -780,6 +765,25 @@ static int _healing_spell(int healed, bool divine_ability,
}
}
+ if (heal_monster(monster, healed, false))
+ {
+ did_something = true;
+ mprf("You heal %s.", monster->name(DESC_NOCAP_THE).c_str());
+
+ if (monster->hit_points == monster->max_hit_points)
+ simple_monster_message(monster, " is completely healed.");
+ else
+ print_wounds(monster);
+
+ if (you.religion == GOD_ELYVILON && !_mons_hostile(monster))
+ {
+ simple_god_message(" appreciates your healing of a fellow "
+ "creature.");
+ if (one_chance_in(8))
+ gain_piety(1);
+ }
+ }
+
if (!did_something)
canned_msg(MSG_NOTHING_HAPPENS);