summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-29 19:38:30 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-29 19:38:30 +0000
commitcf5a7d069c6c1e8980beb9e1132a4178417a7d38 (patch)
tree741dd077f7906c3f65615a3b7d48c93243852cc2
parent85e282c81b99e4c0a1f6433a25a55179f8481b0d (diff)
downloadcrawl-ref-cf5a7d069c6c1e8980beb9e1132a4178417a7d38.tar.gz
crawl-ref-cf5a7d069c6c1e8980beb9e1132a4178417a7d38.zip
Actually use MAX_WPN_ENCHANT instead of hardcoding +9 everywhere.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8022 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/defines.h4
-rw-r--r--crawl-ref/source/describe.cc20
-rw-r--r--crawl-ref/source/itemprop.cc7
3 files changed, 23 insertions, 8 deletions
diff --git a/crawl-ref/source/defines.h b/crawl-ref/source/defines.h
index 52d805cd60..a2e960c0ce 100644
--- a/crawl-ref/source/defines.h
+++ b/crawl-ref/source/defines.h
@@ -196,8 +196,10 @@ const int LABYRINTH_BORDER = 4;
#define SL_TRAP_ZOT 30
// Maximum enchantment on weapons/armour/secondary armours
+// This is the same as for ammunition.
+#define MAX_WPN_ENCHANT 9
+
// Note: use armour_max_enchant(item) to get the correct limit for item
-#define MAX_WPN_ENCHANT 5
#define MAX_ARM_ENCHANT 5
#define MAX_SEC_ENCHANT 2
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 1ec8ed1c21..3f3be7e6c6 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -1119,12 +1119,18 @@ static std::string _describe_weapon(const item_def &item, bool verbose)
if (!is_artefact(item))
{
if (item_ident( item, ISFLAG_KNOW_PLUSES )
- && item.plus >= 9 && item.plus2 >= 9)
+ && item.plus >= MAX_WPN_ENCHANT && item.plus2 >= MAX_WPN_ENCHANT)
{
description += "$It is maximally enchanted.";
}
else
- description += "$It can be maximally enchanted to +9, +9.";
+ {
+ description += "$It can be maximally enchanted to +";
+ _append_value(description, MAX_WPN_ENCHANT, false);
+ description += ", +";
+ _append_value(description, MAX_WPN_ENCHANT, false);
+ description += ".";
+ }
}
return (description);
@@ -1254,10 +1260,14 @@ static std::string _describe_ammo( const item_def &item )
append_missile_info(description);
- if (item_ident( item, ISFLAG_KNOW_PLUSES ) && item.plus >= 9)
+ if (item_ident( item, ISFLAG_KNOW_PLUSES ) && item.plus >= MAX_WPN_ENCHANT)
description += "$It is maximally enchanted.";
else
- description += "$It can be maximally enchanted to +9.";
+ {
+ description += "$It can be maximally enchanted to +";
+ _append_value(description, MAX_WPN_ENCHANT, false);
+ description += ".";
+ }
return (description);
}
@@ -1435,7 +1445,7 @@ static std::string _describe_armour( const item_def &item, bool verbose )
const int max_ench = armour_max_enchant(item);
if (item.plus < max_ench || !item_ident( item, ISFLAG_KNOW_PLUSES ))
{
- description += "$It can be maximally enchanted to ";
+ description += "$It can be maximally enchanted to +";
_append_value(description, max_ench, false);
description += ".";
}
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 1ee5c195f9..9d79151650 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -1373,13 +1373,16 @@ bool is_enchantable_weapon(const item_def &wpn, bool uncurse)
// only uncursed.
if (wpn.base_type == OBJ_WEAPONS)
{
- if (is_artefact(wpn) || wpn.plus >= 9 && wpn.plus2 >= 9)
+ if (is_artefact(wpn)
+ || wpn.plus >= MAX_WPN_ENCHANT && wpn.plus2 >= MAX_WPN_ENCHANT)
+ {
return (uncurse && item_cursed(wpn));
+ }
}
// Highly enchanted missiles, which have only one stat, cannot be
// enchanted or uncursed, since missiles cannot be artefacts or
// cursed.
- else if (wpn.plus >= 9)
+ else if (wpn.plus >= MAX_WPN_ENCHANT)
return (false);
return (true);