summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/it_use2.cc2
-rw-r--r--crawl-ref/source/item_use.cc49
-rw-r--r--crawl-ref/source/itemname.cc30
-rw-r--r--crawl-ref/source/itemname.h1
-rw-r--r--crawl-ref/source/items.cc44
5 files changed, 67 insertions, 59 deletions
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc
index dd44ac75ce..6886197e7e 100644
--- a/crawl-ref/source/it_use2.cc
+++ b/crawl-ref/source/it_use2.cc
@@ -387,7 +387,7 @@ void unwield_item(char unw, bool showMsgs)
case SPWPN_DISTORTION:
// Removing the translocations skill reduction of effect,
- // it might seem sensible, but this brand is supposted
+ // it might seem sensible, but this brand is supposed
// to be dangerous because it does large bonus damage,
// as well as free teleport other side effects, and
// even with the miscast effects you can rely on the
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
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 46f7956aca..56f477c5ca 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -2344,19 +2344,24 @@ bool is_interesting_item( const item_def& item ) {
return false;
}
-bool fully_identified( const item_def& item ) {
- long flagset = ISFLAG_IDENT_MASK;
- switch ( item.base_type ) {
+// Returns the mask of interesting identify bits for this item
+// (e.g., scrolls don't have know-cursedness.)
+unsigned long full_ident_mask( const item_def& item )
+{
+ unsigned long flagset = ISFLAG_IDENT_MASK;
+ switch ( item.base_type )
+ {
+ case OBJ_FOOD:
+ flagset = 0;
+ break;
case OBJ_BOOKS:
case OBJ_MISCELLANY:
case OBJ_ORBS:
case OBJ_SCROLLS:
case OBJ_POTIONS:
+ case OBJ_STAVES:
flagset = ISFLAG_KNOW_TYPE;
break;
- case OBJ_FOOD:
- flagset = 0;
- break;
case OBJ_WANDS:
flagset = (ISFLAG_KNOW_TYPE | ISFLAG_KNOW_PLUSES);
break;
@@ -2365,6 +2370,11 @@ bool fully_identified( const item_def& item ) {
if ( ring_has_pluses(item) )
flagset |= ISFLAG_KNOW_PLUSES;
break;
+ case OBJ_MISSILES:
+ flagset = ISFLAG_KNOW_PLUSES | ISFLAG_KNOW_TYPE;
+ break;
+ case OBJ_WEAPONS:
+ case OBJ_ARMOUR:
default:
break;
}
@@ -2372,6 +2382,10 @@ bool fully_identified( const item_def& item ) {
is_fixed_artefact(item) ||
is_unrandom_artefact(item) )
flagset |= ISFLAG_KNOW_PROPERTIES;
-
- return item_ident( item, flagset );
+ return flagset;
+}
+
+bool fully_identified( const item_def& item )
+{
+ return item_ident(item, full_ident_mask(item));
}
diff --git a/crawl-ref/source/itemname.h b/crawl-ref/source/itemname.h
index 9bdc87360e..4401a72172 100644
--- a/crawl-ref/source/itemname.h
+++ b/crawl-ref/source/itemname.h
@@ -79,6 +79,7 @@ bool item_cursed( const item_def &item );
bool item_known_cursed( const item_def &item );
bool item_known_uncursed( const item_def &item );
bool fully_identified( const item_def &item );
+unsigned long full_ident_mask( const item_def& item );
bool item_type_known( const item_def &item );
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 0840427637..9a5afc4fcf 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1327,34 +1327,24 @@ bool items_stack( const item_def &item1, const item_def &item2 )
}
}
- // Check the flags, food/scrolls/potions don't care about the item's
- // ident status (scrolls and potions are known by identifying any
- // one of them, the individual status might not be the same).
- if (item1.base_type == OBJ_FOOD
- || item1.base_type == OBJ_SCROLLS
- || item1.base_type == OBJ_POTIONS)
- {
- if ((item1.flags & ~ISFLAG_IDENT_MASK)
- != (item2.flags & ~ISFLAG_IDENT_MASK))
- {
- return (false);
- }
+ // Check the ID flags
+ if ( (item1.flags & full_ident_mask(item1)) !=
+ (item2.flags & full_ident_mask(item2)) )
+ return false;
- // Thanks to mummy cursing, we can have potions of decay
- // that don't look alike... so we don't stack potions
- // if either isn't identified and they look different. -- bwr
- if (item1.base_type == OBJ_POTIONS
- && item1.special != item2.special
- && (!item_ident( item1, ISFLAG_KNOW_TYPE )
- || !item_ident( item2, ISFLAG_KNOW_TYPE )))
- {
- return (false);
- }
- }
- else if (item1.flags != item2.flags)
- {
- return (false);
- }
+ // Check the non-ID flags
+ if ((item1.flags & (~ISFLAG_IDENT_MASK)) !=
+ (item2.flags & (~ISFLAG_IDENT_MASK)))
+ return false;
+
+
+ // Thanks to mummy cursing, we can have potions of decay
+ // that don't look alike... so we don't stack potions
+ // if either isn't identified and they look different. -- bwr
+ if (item1.base_type == OBJ_POTIONS && item1.special != item2.special &&
+ (!item_ident(item1, ISFLAG_KNOW_TYPE) ||
+ !item_ident(item2, ISFLAG_KNOW_TYPE )))
+ return false;
return (true);
}