summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/beam.cc17
-rw-r--r--crawl-ref/source/beam.h3
-rw-r--r--crawl-ref/source/item_use.cc7
3 files changed, 23 insertions, 4 deletions
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
diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h
index 0978603454..ca54558727 100644
--- a/crawl-ref/source/beam.h
+++ b/crawl-ref/source/beam.h
@@ -205,7 +205,8 @@ int mons_adjust_flavoured( struct monsters *monster, struct bolt &pbolt,
* called from: ability - item_use - spell
* returns true if messages were generated during the enchantment
* *********************************************************************** */
-bool mass_enchantment( enchant_type wh_enchant, int pow, int who );
+bool mass_enchantment( enchant_type wh_enchant, int pow, int who,
+ int *m_succumbed = NULL, int *m_attempted = NULL );
/* ***********************************************************************
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 9e49ecfe58..0f5ed83c17 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -3956,9 +3956,12 @@ void read_scroll(void)
break;
case SCR_FEAR:
- if (!mass_enchantment(ENCH_FEAR, 1000, MHITYOU))
- id_the_scroll = false;
+ {
+ int fear_influenced = 0;
+ mass_enchantment(ENCH_FEAR, 1000, MHITYOU, NULL, &fear_influenced);
+ id_the_scroll = fear_influenced;
break;
+ }
case SCR_NOISE:
mpr("You hear a loud clanging noise!");