summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/item_use.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-21 07:30:33 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-21 07:30:33 +0000
commit9b55168648a4ddc1887d0ae560ec00d8f1ff3b23 (patch)
treee4c268b925a397f19f74cb6e4bbc3f6378a12c01 /crawl-ref/source/item_use.cc
parent98e3c24887ee5a4670cf58eaa614084a720b5853 (diff)
downloadcrawl-ref-9b55168648a4ddc1887d0ae560ec00d8f1ff3b23.tar.gz
crawl-ref-9b55168648a4ddc1887d0ae560ec00d8f1ff3b23.zip
Fix 1941612: Zapping wands known to be empty shouldn't cost a turn, but
empty wands with unknown charges should cost a turn. Experimentally add a "Really fire through friendly creature?" prompt when a beam tracer passes through a friend. This currently uses the existing monster tracer and probably has huge problems because of this. In any case, it appears to only work sometimes, though consistently for wands in my testing, possibly because the range is fixed (?) when compared to spells. (This is part of FR 1962548.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5171 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r--crawl-ref/source/item_use.cc49
1 files changed, 32 insertions, 17 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 596ef98904..5150573186 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -3266,11 +3266,14 @@ void zap_wand( int slot )
if (slot != -1)
item_slot = slot;
else
+ {
item_slot = prompt_invent_item( "Zap which item?",
MT_INVLIST,
OBJ_WANDS,
true, true, true, 0, NULL,
OPER_ZAP );
+ }
+
if (item_slot == PROMPT_ABORT)
{
canned_msg( MSG_OK );
@@ -3288,24 +3291,26 @@ void zap_wand( int slot )
if (you.equip[EQ_WEAPON] == item_slot)
you.wield_change = true;
- if ( wand.plus < 1 )
+ bool has_charges = true;
+ if (wand.plus < 1)
{
- // it's an empty wand, inscribe it that way
- canned_msg(MSG_NOTHING_HAPPENS);
- wand.plus2 = ZAPCOUNT_EMPTY;
- you.turn_is_over = true;
- return;
+ if (wand.plus2 == ZAPCOUNT_EMPTY)
+ {
+ mpr("This wand has no charges.");
+ return;
+ }
+ has_charges = false;
}
const bool alreadyknown = item_type_known(wand);
const bool alreadytried = item_type_tried(wand);
+ const bool dangerous = player_in_a_dangerous_place();
+
if (!alreadyknown)
beam.effect_known = false;
-
- const bool dangerous = player_in_a_dangerous_place();
- if (alreadyknown)
+ else
{
- switch ( wand.sub_type )
+ switch (wand.sub_type)
{
case WAND_DIGGING:
case WAND_TELEPORTATION:
@@ -3334,6 +3339,16 @@ void zap_wand( int slot )
return;
}
+ if (!has_charges)
+ {
+ canned_msg(MSG_NOTHING_HAPPENS);
+ // It's an empty wand; inscribe it that way.
+ wand.plus2 = ZAPCOUNT_EMPTY;
+ you.turn_is_over = true;
+ return;
+ }
+
+
if (you.duration[DUR_CONF])
{
zap_wand.tx = you.x_pos + random2(13) - 6;
@@ -3357,27 +3372,27 @@ void zap_wand( int slot )
beam.set_target(zap_wand);
// zapping() updates beam
- zapping( static_cast<zap_type>(type_zapped),
- 30 + roll_dice(2, you.skills[SK_EVOCATIONS]), beam );
+ if (!zapping( static_cast<zap_type>(type_zapped),
+ 30 + roll_dice(2, you.skills[SK_EVOCATIONS]), beam ))
+ {
+ return;
+ }
// take off a charge
wand.plus--;
// increment zap count
- if ( wand.plus2 >= 0 )
+ if (wand.plus2 >= 0)
wand.plus2++;
// identify if necessary
- if ((beam.obvious_effect || type_zapped == ZAP_FIREBALL) &&
- !alreadyknown)
+ if (!alreadyknown && (beam.obvious_effect || type_zapped == ZAP_FIREBALL))
{
set_ident_type( wand.base_type, wand.sub_type, ID_KNOWN_TYPE );
mpr(wand.name(DESC_INVENTORY_EQUIP).c_str());
}
else
- {
set_ident_type( wand.base_type, wand.sub_type, ID_TRIED_TYPE );
- }
if (item_type_known(wand)
&& (item_ident( wand, ISFLAG_KNOW_PLUSES )