From 43518236036483ba293dd97c2a84b15383671ae2 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Fri, 27 Jun 2008 05:02:30 +0000 Subject: Only stimulate Xom when zapping a wand of random effects or an unknown wand if a monster or the player is targeted, or if an invisible enemy is nearby. This prevents the player from maximally stimulating Xom by just wasting a turn while near a dangerous monster via aming a wand of random effects away from all monsters. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6167 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/item_use.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'crawl-ref/source/item_use.cc') diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 1bab2e6f70..573a30ab62 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -3402,7 +3402,8 @@ void zap_wand( int slot ) const bool alreadyknown = item_type_known(wand); const bool alreadytried = item_type_tried(wand); - const bool dangerous = player_in_a_dangerous_place(); + bool invis_enemy = false; + const bool dangerous = player_in_a_dangerous_place(&invis_enemy); if (!alreadyknown) beam.effect_known = false; @@ -3476,7 +3477,13 @@ void zap_wand( int slot ) return; } - if (dangerous && alreadyknown && wand.sub_type == WAND_RANDOM_EFFECTS) + // Zapping the wand isn't risky if you aim it away from all monsters + // and yourself, unless there's a nearby invisible enemy and you're + // trying to hit it at random. + const bool risky = dangerous && (beam.fr_count || beam.foe_count + || invis_enemy || beam.aimed_at_feet); + + if (risky && alreadyknown && wand.sub_type == WAND_RANDOM_EFFECTS) { // Xom loves it when you use a Wand of Random Effects and // there is a dangerous monster nearby... @@ -3520,7 +3527,7 @@ void zap_wand( int slot ) exercise( SK_EVOCATIONS, 1 ); alert_nearby_monsters(); - if (!alreadyknown && !alreadytried && dangerous) + if (!alreadyknown && !alreadytried && risky) { // Xom loves it when you use an unknown wand and there is a // dangerous monster nearby... -- cgit v1.2.3-54-g00ecf