summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/item_use.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-27 05:02:30 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-27 05:02:30 +0000
commit43518236036483ba293dd97c2a84b15383671ae2 (patch)
tree9285a06a8732a91fb4fbef76c95274343a6bb554 /crawl-ref/source/item_use.cc
parente2d64de47db5a383b9ed863954bcb2296baa957e (diff)
downloadcrawl-ref-43518236036483ba293dd97c2a84b15383671ae2.tar.gz
crawl-ref-43518236036483ba293dd97c2a84b15383671ae2.zip
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
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r--crawl-ref/source/item_use.cc13
1 files changed, 10 insertions, 3 deletions
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...