summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/item_use.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-28 22:31:17 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-28 22:31:17 +0000
commitffcae9af0299c5d8510532adf7ed01eb6ce81364 (patch)
tree53e4ae24a5fa698ac0cdf6c63bfebd106440679f /crawl-ref/source/item_use.cc
parent0e02c4a6abc15d6cc0eb8eb690025cebb93410a7 (diff)
downloadcrawl-ref-ffcae9af0299c5d8510532adf7ed01eb6ce81364.tar.gz
crawl-ref-ffcae9af0299c5d8510532adf7ed01eb6ce81364.zip
Fixup of gunofdis patch for returning weapons [1744612]:
Returning brand implemented for daggers, hand axes, and spears. Monsters will pick up and use (and hopefully be occasionally generated with) returning weapons, which they can both throw for ranged attacks and use hand-to-hand. The chance of a returning weapon not returning is proportional to ranged combat skill (for the player) or HD (for monsters.) If it doesn't return, it just acts as if it was thrown normally. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1684 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r--crawl-ref/source/item_use.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index a9df7881e1..676fb0cbd1 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -514,6 +514,10 @@ void wield_effects(int item_wield_2, bool showMsgs)
mpr("You sense a holy aura.");
break;
+ case SPWPN_RETURNING:
+ mpr("It wiggles slightly.");
+ break;
+
case SPWPN_PAIN:
mpr("A searing pain shoots up your arm!");
break;
@@ -1367,6 +1371,7 @@ bool throw_it(struct bolt &pbolt, int throw_2, bool teleport, int acc_bonus)
int dice_mult = 100;
bool launched = false; // item is launched
bool thrown = false; // item is sensible thrown item
+ bool returning = false; // item will return to pack
int slayDam = 0;
if (!teleport)
@@ -1790,6 +1795,8 @@ bool throw_it(struct bolt &pbolt, int throw_2, bool teleport, int acc_bonus)
// CALCULATIONS FOR THROWN WEAPONS
if (thrown)
{
+ returning = (get_weapon_brand(item) == SPWPN_RETURNING &&
+ !one_chance_in(you.skills[SK_RANGED_COMBAT]+1));
baseHit = 0;
// since darts/rocks are missiles, they only use inv_plus
@@ -1994,10 +2001,14 @@ bool throw_it(struct bolt &pbolt, int throw_2, bool teleport, int acc_bonus)
{
// Dropping item copy, since the launched item might be different
// (e.g. venom blowgun)
- fire_beam( pbolt, &item );
+ fire_beam(pbolt, returning ? NULL : &item);
}
- dec_inv_item_quantity( throw_2, 1 );
+ if ( returning )
+ msg::stream << item.name(DESC_CAP_THE) << " returns to your pack!"
+ << std::endl;
+ else
+ dec_inv_item_quantity( throw_2, 1 );
// throwing and blowguns are silent
if (launched && lnchType != WPN_BLOWGUN)