diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-14 19:06:49 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-14 19:06:49 +0000 |
commit | cec7644b28db5dbdef9adffaaa78e15617294d3a (patch) | |
tree | 3a07cefbbe63668530f3acbcce52f89c044a782f /crawl-ref/source/makeitem.cc | |
parent | 6ffb3b2ebe74f125265abce7cf0bffd851996729 (diff) | |
download | crawl-ref-cec7644b28db5dbdef9adffaaa78e15617294d3a.tar.gz crawl-ref-cec7644b28db5dbdef9adffaaa78e15617294d3a.zip |
Move checks for visibly special armour into their own function, a la
_weapon_is_visibly_special().
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9074 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/makeitem.cc')
-rw-r--r-- | crawl-ref/source/makeitem.cc | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index 5e85d5c141..e13b9d77ca 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -2932,7 +2932,6 @@ static bool _weapon_is_visibly_special(const item_def &item) if (get_equip_desc(item) != ISFLAG_NO_DESC) return (false); - if (visibly_branded || is_random_artefact(item)) return (true); @@ -2945,6 +2944,29 @@ static bool _weapon_is_visibly_special(const item_def &item) return (false); } +static bool _armour_is_visibly_special(const item_def &item) +{ + const int brand = get_armour_ego_type(item); + const bool visibly_branded = (brand != SPARM_NORMAL); + + if (_item_is_mundane(item)) + return (false); + + if (get_equip_desc(item) != ISFLAG_NO_DESC) + return (false); + + if (visibly_branded || is_random_artefact(item)) + return (true); + + if (item.plus + && (one_chance_in(3) || get_equip_race(item) && one_chance_in(7))) + { + return (true); + } + + return (false); +} + static void _give_monster_item(monsters *mon, int thing, bool force_item = false, bool (monsters::*pickupfn)(item_def&, int) = NULL) @@ -4495,9 +4517,7 @@ void item_set_appearance(item_def &item) break; case OBJ_ARMOUR: - // If not given a racial type, and special, make shiny/runed/etc. - if (get_armour_ego_type(item) != SPARM_NORMAL - || item.plus != 0 && !one_chance_in(3)) + if (_armour_is_visibly_special(item)) { const item_status_flag_type descs[] = { ISFLAG_GLOWING, ISFLAG_RUNED, |