summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/item_use.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-29 12:38:49 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-29 12:38:49 +0000
commit883d0ce492391cc7cfeed1836b4a4e5fc5f4b24e (patch)
tree89a877ee214edcab9867b8850cb381432ae2d600 /crawl-ref/source/item_use.cc
parentb69356ae0558ebc5431444fce3c9b0636e2812b5 (diff)
downloadcrawl-ref-883d0ce492391cc7cfeed1836b4a4e5fc5f4b24e.tar.gz
crawl-ref-883d0ce492391cc7cfeed1836b4a4e5fc5f4b24e.zip
Hopefully, finally squashed the stacking bug.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@728 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r--crawl-ref/source/item_use.cc49
1 files changed, 26 insertions, 23 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 4cfae49caa..2e5743a9ea 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1269,6 +1269,21 @@ bool elemental_missile_beam(int launcher_brand, int ammo_brand)
return (element);
}
+// XXX This is a bit too generous, as it lets the player determine
+// that the bolt of fire he just shot from a flaming bow is actually
+// a poison arrow. Hopefully this isn't too abusable.
+static bool determines_ammo_brand(int bow_brand, int ammo_brand)
+{
+ if (bow_brand == SPWPN_FLAME && ammo_brand == SPMSL_FLAME)
+ return false;
+ if (bow_brand == SPWPN_FROST && ammo_brand == SPMSL_ICE)
+ return false;
+ if (bow_brand == SPWPN_VENOM && ammo_brand == SPMSL_POISONED)
+ return false;
+
+ return true;
+}
+
// throw_it - currently handles player throwing only. Monster
// throwing is handled in mstuff2:mons_throw()
// Note: If dummy_target is non-NULL, throw_it fakes a bolt and calls
@@ -1518,6 +1533,15 @@ bool throw_it(struct bolt &pbolt, int throw_2, monsters *dummy_target)
exHitBonus = lnchHitBonus > 0? random2(lnchHitBonus + 1)
: -random2(-lnchHitBonus + 1);
+ // Identify ammo type if the information is there. Note
+ // that the bow is always type-identified because it's
+ // wielded.
+ if (determines_ammo_brand(bow_brand, ammo_brand))
+ {
+ set_ident_flags(item, ISFLAG_KNOW_TYPE);
+ set_ident_flags(you.inv[throw_2], ISFLAG_KNOW_TYPE);
+ }
+
// removed 2 random2(2)s from each of the learning curves, but
// left slings because they're hard enough to develop without
// a good source of shot in the dungeon.
@@ -1645,7 +1669,7 @@ bool throw_it(struct bolt &pbolt, int throw_2, monsters *dummy_target)
&& ammo_brand != SPMSL_ICE && bow_brand != SPWPN_FROST)
{
// [dshaligram] Branded arrows are much stronger.
- dice_mult = dice_mult * 150 / 100;
+ dice_mult = (dice_mult * 150) / 100;
pbolt.flavour = BEAM_FIRE;
pbolt.name = "bolt of ";
@@ -1659,19 +1683,13 @@ bool throw_it(struct bolt &pbolt, int throw_2, monsters *dummy_target)
pbolt.thrower = KILL_YOU_MISSILE;
pbolt.aux_source.clear();
- // ammo known if we can't attribute it to the bow
- if (bow_brand != SPWPN_FLAME)
- {
- set_ident_flags( item, ISFLAG_KNOW_TYPE );
- set_ident_flags( you.inv[throw_2], ISFLAG_KNOW_TYPE );
- }
}
if ((bow_brand == SPWPN_FROST || ammo_brand == SPMSL_ICE)
&& ammo_brand != SPMSL_FLAME && bow_brand != SPWPN_FLAME)
{
// [dshaligram] Branded arrows are much stronger.
- dice_mult = dice_mult * 150 / 100;
+ dice_mult = (dice_mult * 150) / 100;
pbolt.flavour = BEAM_COLD;
pbolt.name = "bolt of ";
@@ -1684,21 +1702,6 @@ bool throw_it(struct bolt &pbolt, int throw_2, monsters *dummy_target)
pbolt.type = SYM_BOLT;
pbolt.thrower = KILL_YOU_MISSILE;
pbolt.aux_source.clear();
-
- // ammo known if we can't attribute it to the bow
- if (bow_brand != SPWPN_FROST)
- {
- set_ident_flags( item, ISFLAG_KNOW_TYPE );
- set_ident_flags( you.inv[throw_2], ISFLAG_KNOW_TYPE );
- }
- }
-
- // ammo known if it cancels the effect of the bow
- if ((bow_brand == SPWPN_FLAME && ammo_brand == SPMSL_ICE)
- || (bow_brand == SPWPN_FROST && ammo_brand == SPMSL_FLAME))
- {
- set_ident_flags( item, ISFLAG_KNOW_TYPE );
- set_ident_flags( you.inv[throw_2], ISFLAG_KNOW_TYPE );
}
/* the chief advantage here is the extra damage this does