From 51416d9fcc77d909fb88a179efdcb4f0b6caf03f Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Fri, 25 Apr 2008 11:28:55 +0000 Subject: 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 --- crawl-ref/source/item_use.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 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 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; -- cgit v1.2.3-54-g00ecf