summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/item_use.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-25 19:43:39 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-25 19:43:39 +0000
commita9b549f307cc59d71aac975e207f1203ebdff489 (patch)
tree41af85f2160f19e2fe6144c00bdd68386e31eae2 /crawl-ref/source/item_use.cc
parentdd016fa36134c00a8c1f919aba25b872bcba4751 (diff)
downloadcrawl-ref-a9b549f307cc59d71aac975e207f1203ebdff489.tar.gz
crawl-ref-a9b549f307cc59d71aac975e207f1203ebdff489.zip
Scroll of vulnerability shouldn't annoy friendlies.
Don't train stealth on unseen monsters. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8747 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r--crawl-ref/source/item_use.cc15
1 files changed, 6 insertions, 9 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 269984cfa6..34c092385b 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -4693,22 +4693,19 @@ static void _vulnerability_scroll()
// Go over all creatures in LOS.
for (radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri)
{
- const unsigned short targ_monst = env.mgrid(*ri);
- if (targ_monst != NON_MONSTER)
+ if (monsters* mon = monster_at(*ri))
{
// Dispel all magical enchantments.
- monsters& mon = menv[targ_monst];
for (unsigned int i = 0; i < ARRAYSZ(lost_enchantments); ++i)
- mon.del_ench(lost_enchantments[i], true, true);
+ mon->del_ench(lost_enchantments[i], true, true);
// If relevant, monsters have their MR halved.
- if (!mons_immune_magic(&mon))
- mon.add_ench(lowered_mr);
+ if (!mons_immune_magic(mon))
+ mon->add_ench(lowered_mr);
// Annoying but not enough to turn friendlies against you.
- // XXX: This will turn allies of int >= I_NORMAL hostile.
- // Not intended?
- behaviour_event(&mon, ME_ANNOY, MHITYOU);
+ if (!mons_wont_attack(mon))
+ behaviour_event(mon, ME_ANNOY, MHITYOU);
}
}