From a117fb1baf5f81a56014a174f0400622cdf2ab5d Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Tue, 24 Jun 2008 14:06:28 +0000 Subject: Modify quiver to only quiver ammunition explicitly chosen by the player (via (,) or i, or by the new quivering command). Ammo that just happens to come next in the fire order is not quivered anymore even if you continue firing. Add a new quiver command on Q, and while I was at it, restrict the items offered when firing (fi) or quivering to actual throwables. (This was a long outstanding FR.) I think that's it... git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6112 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/invent.cc | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'crawl-ref/source/invent.cc') diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index b623a73411..e2955ca7db 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -357,6 +357,8 @@ static std::string _no_selectables_message(int item_selector) return("You aren't carrying any books or scrolls."); case OBJ_WANDS: return("You aren't carrying any wands."); + case OSEL_THROWABLE: + return("You aren't carrying any items that might be thrown or fired."); } return("You aren't carrying any such object."); @@ -804,33 +806,55 @@ static bool _item_class_selected(const item_def &i, int selector) { case OSEL_UNIDENT: return !fully_identified(i); + case OBJ_MISSILES: return (itype == OBJ_MISSILES || itype == OBJ_WEAPONS); + + case OSEL_THROWABLE: + { + if (i.base_type != OBJ_WEAPONS && i.base_type != OBJ_MISSILES) + return (false); + + const launch_retval projected = is_launched(&you, you.weapon(), i); + + if (projected == LRET_FUMBLED) + return (false); + + return (true); + } case OBJ_WEAPONS: case OSEL_WIELD: return (itype == OBJ_WEAPONS || itype == OBJ_STAVES || itype == OBJ_MISCELLANY); + case OSEL_MEMORISE: return (itype == OBJ_BOOKS && i.sub_type != BOOK_MANUAL && (i.sub_type != BOOK_DESTRUCTION || !item_type_known(i))); + case OBJ_SCROLLS: return (itype == OBJ_SCROLLS || itype == OBJ_BOOKS); + case OSEL_RECHARGE: return (item_is_rechargable(i, true)); + case OSEL_ENCH_ARM: return (is_enchantable_armour(i, true)); + case OSEL_VAMP_EAT: return (itype == OBJ_CORPSES && i.sub_type == CORPSE_BODY && !food_is_rotten(i) && mons_has_blood(i.plus)); + case OSEL_DRAW_DECK: return (is_deck(i)); + case OSEL_EQUIP: for (int eq = 0; eq < NUM_EQUIP; eq++) { if (you.equip[eq] == i.link) return (true); } - // fall through + return (false); + default: return (false); } -- cgit v1.2.3-54-g00ecf