summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/makeitem.cc
diff options
context:
space:
mode:
authorNicholas Feinberg <pleasingfung@gmail.com>2014-06-26 17:37:57 -0700
committerNicholas Feinberg <pleasingfung@gmail.com>2014-06-26 17:41:58 -0700
commitc30505934977749b94a2bd70a928a1d700c92459 (patch)
treeca457901e3661aa90ec89eb7bed53082a80b01f4 /crawl-ref/source/makeitem.cc
parent108b6996ad89fe69889406d91ff1635e1ec3263c (diff)
downloadcrawl-ref-c30505934977749b94a2bd70a928a1d700c92459.tar.gz
crawl-ref-c30505934977749b94a2bd70a928a1d700c92459.zip
Illuminate weapon/armour glow code
Simplified it to a simple plus threshold per armour class (body, shield, etc), rather than a weird mix of random chance and poorly- specified thresholds. Likewise set a threshold for weapons.
Diffstat (limited to 'crawl-ref/source/makeitem.cc')
-rw-r--r--crawl-ref/source/makeitem.cc35
1 files changed, 26 insertions, 9 deletions
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 0322f8e5a2..c2b65ee900 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -2947,7 +2947,7 @@ static bool _weapon_is_visibly_special(const item_def &item)
if (visibly_branded || is_artefact(item))
return true;
- if (x_chance_in_y(item.plus - 2, 3))
+ if (item.plus >= 3)
return true;
if (item.flags & ISFLAG_CURSED && one_chance_in(3))
@@ -2956,6 +2956,30 @@ static bool _weapon_is_visibly_special(const item_def &item)
return false;
}
+/**
+ * Return the number of plusses required for a type of armour to glow.
+ * (From plus alone.)
+ *
+ * @param armour_type The type of armour being considered.
+ * @return The armour plus value required to be interesting.
+ */
+static int _armour_plus_threshold(equipment_type armour_type)
+{
+ switch (armour_type)
+ {
+ // body armour is very common; squelch most of it
+ case EQ_BODY_ARMOUR:
+ return 3;
+ // cloaks & shields are fairly common
+ case EQ_CLOAK:
+ case EQ_SHIELD:
+ return 2;
+ // aux armour is relatively uncommon
+ default:
+ return 1;
+ }
+}
+
static bool _armour_is_visibly_special(const item_def &item)
{
const int brand = get_armour_ego_type(item);
@@ -2970,15 +2994,8 @@ static bool _armour_is_visibly_special(const item_def &item)
if (item.is_mundane())
return false;
- // body armour with +3 or more can be interesting; any aux armour with any
- // plus is interesting, except for cloaks, because zot. (they need +2.)
- if (x_chance_in_y(item.plus - 2, 3)
- || item.plus > 0 && get_armour_slot(item) != EQ_BODY_ARMOUR
- && (get_armour_slot(item) != EQ_CLOAK
- || item.plus > 1))
- {
+ if (item.plus >= _armour_plus_threshold(get_armour_slot(item)))
return true;
- }
if (item.flags & ISFLAG_CURSED && one_chance_in(3))
return true;