summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-25 22:50:05 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-25 22:50:05 +0000
commitb791456793c967f1c484f0e3b726aadde102fc8a (patch)
tree8ebbf1eff3334decd91a238c11cf6a268ea3249b
parent048093d6df17f7a9d57c3de999f8d2b71289bc19 (diff)
downloadcrawl-ref-b791456793c967f1c484f0e3b726aadde102fc8a.tar.gz
crawl-ref-b791456793c967f1c484f0e3b726aadde102fc8a.zip
Replace "is_random_artefact()" with "is_artefact()" in a few places where
this was missed, and add checks for unrandart and special unrandarts where applicable. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10044 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/debug.cc9
-rw-r--r--crawl-ref/source/describe.cc14
-rw-r--r--crawl-ref/source/fight.cc6
-rw-r--r--crawl-ref/source/it_use2.cc6
-rw-r--r--crawl-ref/source/item_use.cc17
-rw-r--r--crawl-ref/source/itemname.cc6
-rw-r--r--crawl-ref/source/itemprop.cc11
7 files changed, 37 insertions, 32 deletions
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index c6fefc1da4..a5586fcea7 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -1820,8 +1820,7 @@ void wizard_tweak_object(void)
if (item == you.equip[EQ_WEAPON])
you.wield_change = true;
- const bool is_art = is_artefact(you.inv[item])
- && !is_unrandom_artefact(you.inv[item]);
+ const bool is_art = is_artefact(you.inv[item]);
while (true)
{
@@ -2002,6 +2001,12 @@ void wizard_make_object_randart()
item_def &item(you.inv[i]);
+ if (is_unrandom_artefact(item))
+ {
+ mpr("That item is already an unrandom artefact.");
+ return;
+ }
+
if (!_item_type_can_be_artefact(item.base_type))
{
mpr("That item cannot be turned into an artefact.");
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index be626b3c53..5c1853e2e5 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -735,7 +735,7 @@ static std::string _describe_weapon(const item_def &item, bool verbose)
int spec_ench = get_weapon_brand( item );
- if (!is_random_artefact( item ) && !verbose)
+ if (!is_artefact( item ) && !verbose)
spec_ench = SPWPN_NORMAL;
// special weapon descrip
@@ -1272,7 +1272,7 @@ static std::string _describe_armour( const item_def &item, bool verbose )
}
}
- if (is_random_artefact( item ))
+ if (is_artefact( item ))
{
std::string rand_desc = _randart_descrip( item );
if (!rand_desc.empty())
@@ -1351,7 +1351,7 @@ static std::string _describe_jewellery( const item_def &item, bool verbose)
description.reserve(200);
- if ((verbose || is_random_artefact( item ))
+ if ((verbose || is_artefact( item ))
&& item_ident( item, ISFLAG_KNOW_PLUSES ))
{
// Explicit description of ring power (useful for randarts)
@@ -1359,7 +1359,7 @@ static std::string _describe_jewellery( const item_def &item, bool verbose)
// in the case that its zero, just to avoid confusion. -- bwr
if (item.plus != 0
|| item.sub_type == RING_SLAYING && item.plus2 != 0
- || is_random_artefact( item ))
+ || is_artefact( item ))
{
switch (item.sub_type)
{
@@ -1422,8 +1422,8 @@ static std::string _describe_jewellery( const item_def &item, bool verbose)
}
}
- // Randart properties.
- if (is_random_artefact( item ))
+ // Artefact properties.
+ if (is_artefact( item ))
{
std::string rand_desc = _randart_descrip( item );
if (!rand_desc.empty())
@@ -2243,7 +2243,7 @@ void inscribe_item(item_def &item, bool proper_prompt)
// Only allow autoinscription if we don't have all the text
// already.
bool need_autoinscribe = false;
- if (is_random_artefact(item))
+ if (is_artefact(item))
{
ainscrip = artefact_auto_inscription(item);
if (!ainscrip.empty()
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 9657d2e40e..5b74a77724 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -375,7 +375,7 @@ void melee_attack::init_attack()
damage_brand = attacker->damage_brand(attack_number);
if (weapon && weapon->base_type == OBJ_WEAPONS
- && is_random_artefact( *weapon ))
+ && is_artefact( *weapon ))
{
artefact_wpn_properties( *weapon, art_props );
}
@@ -2251,7 +2251,7 @@ bool melee_attack::distortion_affects_defender()
// with a distortion weapon, then we have to ID it before
// the player goes to Abyss, while the weapon object is
// still in memory.
- if (is_random_artefact(*weapon))
+ if (is_artefact(*weapon))
artefact_wpn_learn_prop(*weapon, ARTP_BRAND);
else
set_ident_flags(*weapon, ISFLAG_KNOW_TYPE);
@@ -3007,7 +3007,7 @@ bool melee_attack::apply_damage_brand()
if (weapon)
{
- if (is_random_artefact(*weapon))
+ if (is_artefact(*weapon))
brand_was_known = artefact_known_wpn_property(*weapon, ARTP_BRAND);
else
brand_was_known = item_type_known(*weapon);
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc
index 57290d22a0..3685469082 100644
--- a/crawl-ref/source/it_use2.cc
+++ b/crawl-ref/source/it_use2.cc
@@ -450,7 +450,7 @@ bool unwield_item(bool showMsgs)
const int brand = get_weapon_brand( item );
- if (is_random_artefact( item ))
+ if (is_artefact( item ))
unuse_artefact(item);
if (brand != SPWPN_NORMAL)
@@ -618,13 +618,13 @@ void unwear_armour(int slot)
break;
}
- if (is_random_artefact(item))
+ if (is_artefact(item))
unuse_artefact(item);
}
void unuse_artefact(const item_def &item)
{
- ASSERT( is_random_artefact( item ) );
+ ASSERT( is_artefact( item ) );
artefact_properties_t proprt;
artefact_known_props_t known;
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 866dd8ac09..e9de2ca5b7 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -444,7 +444,9 @@ int item_special_wield_effect(const item_def &item)
return (SPWLD_NONE);
int i_eff = SPWPN_NORMAL;
- if (is_random_artefact( item ))
+ if (is_special_unrandom_artefact( item ))
+ i_eff = item.special;
+ else if (is_artefact( item ))
i_eff = artefact_wpn_property(item, ARTP_BRAND);
else
i_eff = item.special;
@@ -491,7 +493,7 @@ void wield_effects(int item_wield_2, bool showMsgs)
unsigned char special = 0;
item_def &item = you.inv[item_wield_2];
- const bool artefact = is_random_artefact(item);
+ const bool artefact = is_artefact(item);
const bool known_cursed = item_known_cursed(item);
// And here we finally get to the special effects of wielding. {dlb}
@@ -553,7 +555,8 @@ void wield_effects(int item_wield_2, bool showMsgs)
if (artefact)
{
- special = artefact_wpn_property(item, ARTP_BRAND);
+ if (!is_special_unrandom_artefact(item))
+ special = artefact_wpn_property(item, ARTP_BRAND);
use_artefact(item_wield_2);
if (!was_known)
{
@@ -3138,7 +3141,7 @@ void jewellery_wear_effects(item_def &item)
// Randart jewellery shouldn't auto-ID just because the base type
// is known. Somehow the player should still be told, preferably
// by message. (jpeg)
- const bool artefact = is_random_artefact(item);
+ const bool artefact = is_artefact(item);
const bool known_pluses = item_ident(item, ISFLAG_KNOW_PLUSES);
const bool known_cursed = item_known_cursed(item);
const bool known_bad = (item_type_known(item)
@@ -3429,7 +3432,7 @@ bool safe_to_remove_or_wear(const item_def &item, bool remove,
}
}
- if (is_random_artefact(item))
+ if (is_artefact(item))
{
prop_str += artefact_known_wpn_property(item, ARTP_STRENGTH);
prop_int += artefact_known_wpn_property(item, ARTP_INTELLIGENCE);
@@ -3731,7 +3734,7 @@ void jewellery_remove_effects(item_def &item, bool mesg)
break;
}
- if (is_random_artefact(item))
+ if (is_artefact(item))
unuse_artefact(item);
// Must occur after ring is removed. -- bwr
@@ -5262,7 +5265,7 @@ void use_artefact(item_def &item, bool unmeld)
{
#define unknown_proprt(prop) (proprt[(prop)] && !known[(prop)])
- ASSERT( is_random_artefact( item ) );
+ ASSERT( is_artefact( item ) );
const bool alreadyknown = item_type_known(item);
const bool dangerous = player_in_a_dangerous_place();
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index e7015ed3ba..c6e1171672 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -1195,7 +1195,7 @@ std::string item_def::name_aux(description_level_type desc,
buff << "pair of ";
// When asking for the base item name, randartism is ignored.
- if (is_random_artefact(*this) && !basename && !dbname)
+ if (is_artefact(*this) && !basename && !dbname)
{
buff << get_artefact_name(*this);
break;
@@ -1429,7 +1429,7 @@ std::string item_def::name_aux(description_level_type desc,
break;
}
- const bool is_randart = is_random_artefact(*this);
+ const bool is_randart = is_artefact(*this);
if (know_curse)
{
@@ -1647,7 +1647,7 @@ std::string item_def::name_aux(description_level_type desc,
// Disambiguation.
if (!terse && !basename && !dbname && know_type
- && !is_random_artefact(*this))
+ && !is_artefact(*this))
{
switch (this->base_type)
{
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 6694a063f5..265d4053e8 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -906,7 +906,7 @@ int get_weapon_brand( const item_def &item )
int get_ammo_brand( const item_def &item )
{
// No artefact arrows yet. -- bwr
- if (item.base_type != OBJ_MISSILES || is_random_artefact( item ))
+ if (item.base_type != OBJ_MISSILES || is_artefact( item ))
return (SPMSL_NORMAL);
return (item.special);
@@ -915,11 +915,8 @@ int get_ammo_brand( const item_def &item )
special_armour_type get_armour_ego_type( const item_def &item )
{
// Artefact armours have no ego type, must look up powers separately.
- if (item.base_type != OBJ_ARMOUR
- || (is_random_artefact( item ) && !is_unrandom_artefact( item )))
- {
+ if (item.base_type != OBJ_ARMOUR || is_artefact( item ))
return (SPARM_NORMAL);
- }
return (static_cast<special_armour_type>(item.special));
}
@@ -2447,7 +2444,7 @@ bool gives_ability(const item_def &item)
return (false);
}
- if (!is_random_artefact(item))
+ if (!is_artefact(item))
return (false);
// Check for evokable randart properties.
@@ -2511,7 +2508,7 @@ bool gives_resistance(const item_def &item)
return (false);
}
- if (!is_random_artefact(item))
+ if (!is_artefact(item))
return (false);
// Check for randart resistances.