summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/itemprop.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-30 12:31:12 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-30 12:31:12 +0000
commit3aa8f2c3c6a065779bdb64db863fbb4fcf8102c8 (patch)
treebe2729a1a305593cf6562b3aa9b76e81c01a899b /crawl-ref/source/itemprop.cc
parentbeac344a52eafddd8a3ae1d67635773cf9216325 (diff)
downloadcrawl-ref-3aa8f2c3c6a065779bdb64db863fbb4fcf8102c8.tar.gz
crawl-ref-3aa8f2c3c6a065779bdb64db863fbb4fcf8102c8.zip
* Fix charge/enchantment description leaking information about
unidentified items. * Add two new inscriptions: {fully charged} and {tried on item} * Add freshness to default sort_menus (sorting chunks by age) One question: Is it guaranteed that artefacts (of any type) will have different descriptions than ego items? If so, we should probably display the "This is an ancient artefact. It cannot be modified by any means. It may have hidden properties" text for unidentified ones. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8030 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/itemprop.cc')
-rw-r--r--crawl-ref/source/itemprop.cc33
1 files changed, 30 insertions, 3 deletions
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 9d79151650..d7d4311da8 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -1324,12 +1324,30 @@ bool check_armour_shape( const item_def &item, bool quiet )
return (true);
}
-// If known is true, only returns true for *known* weapons of electrocution.
+// If known is true, only returns true for *known* weapons of electrocution,
+// and returns false for wands/rods known to be fully charged.
bool item_is_rechargeable(const item_def &it, bool known)
{
// These are obvious...
- if (it.base_type == OBJ_WANDS || item_is_rod(it))
+ if (it.base_type == OBJ_WANDS)
+ {
+ if (known && (it.plus == ZAPCOUNT_MAX_CHARGED
+ || item_ident(it, ISFLAG_KNOW_PLUSES)
+ && it.plus < 3 * wand_charge_value(it.sub_type)))
+ {
+ return (false);
+ }
+ return (true);
+ }
+ else if (item_is_rod(it))
+ {
+ if (known && item_ident(it, ISFLAG_KNOW_PLUSES))
+ {
+ return (it.plus2 < MAX_ROD_CHARGE * ROD_CHARGE_MULT
+ || it.plus < it.plus2);
+ }
return (true);
+ }
// ...but electric weapons can also be charged.
return (it.base_type == OBJ_WEAPONS
@@ -1388,7 +1406,9 @@ bool is_enchantable_weapon(const item_def &wpn, bool uncurse)
return (true);
}
-bool is_enchantable_armour(const item_def &arm, bool uncurse)
+// Returns whether a piece of armour can be enchanted further.
+// If unknown is true, unidentified armour will return true.
+bool is_enchantable_armour(const item_def &arm, bool uncurse, bool unknown)
{
if (arm.base_type != OBJ_ARMOUR)
return (false);
@@ -1397,6 +1417,13 @@ bool is_enchantable_armour(const item_def &arm, bool uncurse)
if (!you_tran_can_wear(arm) && item_is_equipped(arm))
return (false);
+ // If we don't know the plusses, assume enchanting is possible.
+ if (unknown && !is_known_artefact(arm)
+ && !item_ident(arm, ISFLAG_KNOW_PLUSES ))
+ {
+ return (true);
+ }
+
// Artefacts or highly enchanted armour cannot be enchanted, only
// uncursed.
if (is_artefact(arm) || arm.plus >= armour_max_enchant(arm))