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-04-25 11:28:55 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-25 11:28:55 +0000
commit51416d9fcc77d909fb88a179efdcb4f0b6caf03f (patch)
tree93d47be22b798855054a564161b239bdd620506e /crawl-ref/source/item_use.cc
parent0cc17e8e77704777c56f86675aab4865a6dcb23c (diff)
downloadcrawl-ref-51416d9fcc77d909fb88a179efdcb4f0b6caf03f.tar.gz
crawl-ref-51416d9fcc77d909fb88a179efdcb4f0b6caf03f.zip
Fix 1951213: Disallow throwing a quivered wielded cursed item.
Also, restrict wizmode cursing to item types where this will actually have an effect (weapons, armour, jewellery). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4617 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r--crawl-ref/source/item_use.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 2e540e3888..63bf8b9c88 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1376,8 +1376,7 @@ command_type fire_target_behaviour::get_command(int key)
{
std::string err;
const int selected = _fire_prompt_for_item(err);
- if (selected >= 0 &&
- _fire_validate_item(selected, err))
+ if (selected >= 0 && _fire_validate_item(selected, err))
{
m_slot = selected;
selected_from_inventory = true;
@@ -1404,10 +1403,10 @@ static bool _fire_choose_item_and_target(int& slot, dist& target)
if (was_chosen)
{
- if (you.equip[EQ_WEAPON] == slot
- && item_cursed(you.inv[slot]))
+ std::string warn;
+ if (!_fire_validate_item(slot, warn))
{
- mpr("You can't fire a cursed item!");
+ mpr(warn.c_str());
return false;
}
beh.m_slot = slot; // force item to be the prechosen one
@@ -1474,9 +1473,10 @@ static int _fire_prompt_for_item(std::string& err)
static bool _fire_validate_item(int slot, std::string& err)
{
if (slot == you.equip[EQ_WEAPON]
+ && you.inv[slot].base_type == OBJ_WEAPONS
&& item_cursed(you.inv[slot]))
{
- err = "That thing is stuck to your hand!";
+ err = "That weapon is stuck to your hand!";
return false;
}
else if ( wearing_slot(slot) )
@@ -1495,6 +1495,7 @@ static bool _fire_warn_if_impossible()
canned_msg(MSG_PRESENT_FORM);
return true;
}
+
if (you.attribute[ATTR_HELD])
{
const item_def *weapon = you.weapon();
@@ -1536,6 +1537,13 @@ void fire_thing(int item)
if (!_fire_choose_item_and_target(item, target))
return;
+ std::string warn;
+ if (!_fire_validate_item(item, warn))
+ {
+ mpr(warn.c_str());
+ return;
+ }
+
if (check_warning_inscriptions(you.inv[item], OPER_FIRE))
{
bolt beam;