summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/it_use2.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-13 17:31:31 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-13 17:31:31 +0000
commitd733df05e5309444cb83c028c0515467c87ae4c6 (patch)
treeceafd9ecdfdea838a3a3ba59937154b74b58d784 /crawl-ref/source/it_use2.cc
parent74114bc4feef8e1edcea61cc836b9f4946b17223 (diff)
downloadcrawl-ref-d733df05e5309444cb83c028c0515467c87ae4c6.tar.gz
crawl-ref-d733df05e5309444cb83c028c0515467c87ae4c6.zip
Changed unwield_item() to actually unwield the item, and to have it
unwield your weapon rather than something arbitrary (I found no cases in the code where this wasn't what was wanted.) Implemented some of David's deck changes: - decks weigh half as much - names changed - Draw Card doesn't cost piety; cost upped to 2 MP - Nemelex card power bonus now applies even when not praying - Damnation can now banish extra targets (your own chance of banishment remains the same.) - Nemelex doesn't accept sacrificed decks. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2082 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/it_use2.cc')
-rw-r--r--crawl-ref/source/it_use2.cc29
1 files changed, 13 insertions, 16 deletions
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc
index fd96c674aa..de7f018b9d 100644
--- a/crawl-ref/source/it_use2.cc
+++ b/crawl-ref/source/it_use2.cc
@@ -358,8 +358,13 @@ bool potion_effect( potion_type pot_eff, int pow )
return (effect);
} // end potion_effect()
-void unwield_item(char unw, bool showMsgs)
+void unwield_item(bool showMsgs)
{
+ const int unw = you.equip[EQ_WEAPON];
+ if ( unw == -1 )
+ return;
+
+ you.equip[EQ_WEAPON] = -1;
you.special_wield = SPWLD_NONE;
you.wield_change = true;
@@ -392,7 +397,8 @@ void unwield_item(char unw, bool showMsgs)
case SPWPN_STAFF_OF_WUCAD_MU:
you.inv[unw].plus = 0;
you.inv[unw].plus2 = 0;
- miscast_effect( SPTYP_DIVINATION, 9, 90, 100, "the Staff of Wucad Mu" );
+ miscast_effect( SPTYP_DIVINATION, 9, 90, 100,
+ "the Staff of Wucad Mu" );
break;
default:
break;
@@ -401,14 +407,14 @@ void unwield_item(char unw, bool showMsgs)
return;
}
- int brand = get_weapon_brand( you.inv[unw] );
+ const int brand = get_weapon_brand( you.inv[unw] );
if (is_random_artefact( you.inv[unw] ))
unuse_randart(unw);
if (brand != SPWPN_NORMAL)
{
- std::string msg = you.inv[unw].name(DESC_CAP_YOUR);
+ const std::string msg = you.inv[unw].name(DESC_CAP_YOUR);
switch (brand)
{
@@ -459,7 +465,8 @@ void unwield_item(char unw, bool showMsgs)
// if it's to be allowed as a player spell. -- bwr
// int effect = 9 - random2avg( you.skills[SK_TRANSLOCATIONS] * 2, 2 );
- miscast_effect( SPTYP_TRANSLOCATION, 9, 90, 100, "a distortion effect" );
+ miscast_effect( SPTYP_TRANSLOCATION, 9, 90, 100,
+ "a distortion effect" );
break;
// when more are added here, *must* duplicate unwielding
@@ -470,24 +477,14 @@ void unwield_item(char unw, bool showMsgs)
{
you.duration[DUR_WEAPON_BRAND] = 0;
set_item_ego_type( you.inv[unw], OBJ_WEAPONS, SPWPN_NORMAL );
- // we're letting this through
+ // we're letting this through even if hiding messages
mpr("Your branding evaporates.");
}
} // end if
}
if (player_equip( EQ_STAFF, STAFF_POWER ))
- {
- // XXX: Ugly hack so that this currently works (don't want to
- // mess with the fact that currently this function doesn't
- // actually unwield the item, but we need it out of the player's
- // hand for this to work. -- bwr
- int tmp = you.equip[ EQ_WEAPON ];
-
- you.equip[ EQ_WEAPON ] = -1;
calc_mp();
- you.equip[ EQ_WEAPON ] = tmp;
- }
return;
} // end unwield_item()