From db37e43a07959371149a08dda64db664455b4d59 Mon Sep 17 00:00:00 2001 From: dolorous Date: Wed, 11 Mar 2009 22:16:30 +0000 Subject: Properly disallow randart versions of mundane items. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9417 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/itemprop.cc | 24 +++++++++++++++++++++--- crawl-ref/source/itemprop.h | 3 +++ crawl-ref/source/makeitem.cc | 32 ++++++-------------------------- crawl-ref/source/randart.cc | 3 +++ 4 files changed, 33 insertions(+), 29 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index cbfb90505d..19ca2226ea 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -528,9 +528,7 @@ void do_uncurse_item( item_def &item ) item.flags &= (~ISFLAG_CURSED); } -// -// Is item stationary (cannot be picked up?) -// +// Is item stationary (cannot be picked up)? void set_item_stationary( item_def &item ) { if (item.base_type == OBJ_MISSILES && item.sub_type == MI_THROWING_NET) @@ -573,6 +571,26 @@ bool item_is_critical(const item_def &item) && item.plus != RUNE_ABYSSAL); } +// Is item something that no one would bother enchanting? +bool item_is_mundane(const item_def &item) +{ + bool retval = false; + + switch (item.base_type) + { + case OBJ_WEAPONS: + retval = (item.sub_type == WPN_CLUB + || item.sub_type == WPN_GIANT_CLUB + || item.sub_type == WPN_GIANT_SPIKED_CLUB + || item.sub_type == WPN_KNIFE); + break; + default: + break; + } + + return (retval); +} + void set_ident_flags( item_def &item, unsigned long flags ) { preserve_quiver_slots p; diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h index df287a9a74..c908854657 100644 --- a/crawl-ref/source/itemprop.h +++ b/crawl-ref/source/itemprop.h @@ -613,6 +613,9 @@ void init_properties(void); // Returns true if this item should be preserved as far as possible. bool item_is_critical(const item_def &item); +// Returns true if this item should not normally be enchanted. +bool item_is_mundane(const item_def &item); + // cursed: bool item_cursed( const item_def &item ); bool item_known_cursed( const item_def &item ); diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index a25f960a9a..bf76ac12e1 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -877,7 +877,7 @@ static bool _try_make_weapon_artefact(item_def& item, int force_type, } // The other 98% are normal randarts. - make_item_randart( item ); + make_item_randart(item); item.plus = random2(7); item.plus2 = random2(7); @@ -1482,26 +1482,6 @@ static brand_type _determine_weapon_brand(const item_def& item, int item_level) return (rc); } -// Is this item something that no one would bother enchanting? -static bool _item_is_mundane(const item_def& item) -{ - bool retval = false; - - switch (item.base_type) - { - case OBJ_WEAPONS: - retval = (item.sub_type == WPN_CLUB - || item.sub_type == WPN_GIANT_CLUB - || item.sub_type == WPN_GIANT_SPIKED_CLUB - || item.sub_type == WPN_KNIFE); - break; - default: - break; - } - - return (retval); -} - static void _generate_weapon_item(item_def& item, bool allow_uniques, int force_type, int item_level, int item_race) @@ -1567,7 +1547,7 @@ static void _generate_weapon_item(item_def& item, bool allow_uniques, } else if ((force_good || is_demonic(item) || forced_ego || x_chance_in_y(51 + item_level, 200)) - && !_item_is_mundane(item)) + && !item_is_mundane(item)) { // Make a better item (possibly ego). if (!no_brand) @@ -2126,7 +2106,7 @@ static void _generate_armour_item(item_def& item, bool allow_uniques, } else if ((force_good || forced_ego || item.sub_type == ARM_WIZARD_HAT || x_chance_in_y(51 + item_level, 250)) - && !_item_is_mundane(item)) + && !item_is_mundane(item)) { // Make a good item... item.plus += random2(3); @@ -2662,7 +2642,7 @@ static void _generate_jewellery_item(item_def& item, bool allow_uniques, if (allow_uniques && item_level > 2 && x_chance_in_y(101 + item_level * 3, 4000)) { - make_item_randart( item ); + make_item_randart(item); } else if (item.sub_type == RING_HUNGER || item.sub_type == RING_TELEPORTATION || one_chance_in(50)) @@ -2931,7 +2911,7 @@ static bool _weapon_is_visibly_special(const item_def &item) const int brand = get_weapon_brand(item); const bool visibly_branded = (brand != SPWPN_NORMAL); - if (_item_is_mundane(item)) + if (item_is_mundane(item)) return (false); if (get_equip_desc(item) != ISFLAG_NO_DESC) @@ -2954,7 +2934,7 @@ 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)) + if (item_is_mundane(item)) return (false); if (get_equip_desc(item) != ISFLAG_NO_DESC) diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc index 6f22c01433..4bf9da03d8 100644 --- a/crawl-ref/source/randart.cc +++ b/crawl-ref/source/randart.cc @@ -2130,6 +2130,9 @@ bool make_item_blessed_blade( item_def &item ) bool make_item_randart( item_def &item ) { + if (item_is_mundane(item)) + return (false); + if (item.base_type != OBJ_WEAPONS && item.base_type != OBJ_ARMOUR && item.base_type != OBJ_JEWELLERY -- cgit v1.2.3-54-g00ecf