From 895860a717e48c8978fe63882ed9d616e7affa5a Mon Sep 17 00:00:00 2001 From: dshaligram Date: Fri, 28 Dec 2007 16:56:12 +0000 Subject: [1854279] Fixed scroll of fear not iding when resisted. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3134 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'crawl-ref/source/beam.cc') diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 251578e4e2..86a40920ee 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -1888,12 +1888,21 @@ static bool monster_resists_mass_enchantment(monsters *monster, } // Enchants all monsters in player's sight. -bool mass_enchantment( enchant_type wh_enchant, int pow, int origin ) +// If m_succumbed is non-NULL, will be set to the number of monsters that +// were enchanted. If m_attempted is non-NULL, will be set to the number of +// monsters that we tried to enchant. +bool mass_enchantment( enchant_type wh_enchant, int pow, int origin, + int *m_succumbed, int *m_attempted ) { int i; // loop variable {dlb} bool msg_generated = false; monsters *monster; + if (m_succumbed) + *m_succumbed = 0; + if (m_attempted) + *m_attempted = 0; + viewwindow(0, false); if (pow > 200) @@ -1911,11 +1920,17 @@ bool mass_enchantment( enchant_type wh_enchant, int pow, int origin ) if (monster->has_ench(wh_enchant)) continue; + if (m_attempted) + ++*m_attempted; + if (monster_resists_mass_enchantment(monster, wh_enchant, pow)) continue; if (monster->add_ench(mon_enchant(wh_enchant, 0, kc))) { + if (m_succumbed) + ++*m_succumbed; + if (player_monster_visible( monster )) { // turn message on -- cgit v1.2.3-54-g00ecf