summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/artefact.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-27 09:58:49 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-27 09:58:49 +0000
commit7aa3305f41d2f073710d9a732bd29572b704bc49 (patch)
tree374aa17118ecb68bc4c237176506dbaf9aafb0b7 /crawl-ref/source/artefact.cc
parent3cc681e30ac236f7b88adece29f194cb30138ec8 (diff)
downloadcrawl-ref-7aa3305f41d2f073710d9a732bd29572b704bc49.tar.gz
crawl-ref-7aa3305f41d2f073710d9a732bd29572b704bc49.zip
* Moved most hard-coded non-standard unrandart behaviour to art-func.h,
specifically code for equipping, unequpping, an equipped unrandart doing something every time world_reacts() is called (special wield effects), melee hit effects, and evoking. Left hardcoded outside of art-func.h: * Sword of Cerebov temproarily downgrading the defender's fire resistance. * Staff of Olgreb boosting poison spells, as if it were a staff of poison. * Vampire's Tooth always getting maximal vampiric drain. * Mace of Variablity's initial pluses being chosen at creation time. * Since what used to be special wield effects is now handled very differently, noisy weapons and the lantern of shadows effects are handled with player attributes rather than SPWLD_NOISES and SPWLD_SHADOW. * Unrandarts can now have an elemental colour for their colour (currently only used for the Mace of Variability). * Unrandarts' value modification, being special, and being evil are now handled in art-data.txt rather than being hardcoded. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10055 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/artefact.cc')
-rw-r--r--crawl-ref/source/artefact.cc28
1 files changed, 20 insertions, 8 deletions
diff --git a/crawl-ref/source/artefact.cc b/crawl-ref/source/artefact.cc
index f4698f4e05..18d8343723 100644
--- a/crawl-ref/source/artefact.cc
+++ b/crawl-ref/source/artefact.cc
@@ -29,6 +29,7 @@ REVISION("$Rev$");
#include "religion.h"
#include "spl-book.h"
#include "stuff.h"
+#include "view.h" // Elemental colours for unrandarts
#define KNOWN_PROPS_KEY "artefact_known_props"
#define ARTEFACT_PROPS_KEY "artefact_props"
@@ -290,12 +291,13 @@ static std::string _replace_name_parts(const std::string name_in,
// Remember: disallow unrandart creation in Abyss/Pan.
+// Functions defined in art-func.h are referenced in art-data.h
+#include "art-func.h"
+
static unrandart_entry unranddata[] = {
#include "art-data.h"
};
-static FixedVector < bool, NO_UNRANDARTS > unrandart_exist;
-
static unrandart_entry *_seekunrandart( const item_def &item );
bool is_known_artefact( const item_def &item )
@@ -326,7 +328,7 @@ bool is_unrandom_artefact( const item_def &item )
bool is_special_unrandom_artefact( const item_def &item )
{
return (item.flags & ISFLAG_UNRANDART
- && get_unrand_specialness(item.special) == UNRANDSPEC_SPECIAL);
+ && (_seekunrandart(item)->flags & UNRAND_FLAG_SPECIAL));
}
unique_item_status_type get_unique_item_status(const item_def& item)
@@ -1609,16 +1611,20 @@ int find_okay_unrandart(unsigned char aclass, unsigned char atype,
unrand_special_type get_unrand_specialness(int unrand_index)
{
- if (unrand_index >= UNRAND_SINGING_SWORD
- && unrand_index <= UNRAND_ASMODEUS)
+ if (unrand_index < UNRAND_START || unrand_index > UNRAND_LAST)
{
- return (UNRANDSPEC_SPECIAL);
+ return (UNRANDSPEC_NORMAL);
}
+
+ if (unranddata[unrand_index].flags & UNRAND_FLAG_SPECIAL)
+ return (UNRANDSPEC_SPECIAL);
+
return (UNRANDSPEC_NORMAL);
}
unrand_special_type get_unrand_specialness(const item_def &item)
{
+ ASSERT(is_unrandom_artefact(item));
return get_unrand_specialness(item.special);
}
@@ -1970,6 +1976,12 @@ bool make_item_unrandart( item_def &item, int unrand_index )
set_unique_item_status(unrand_index, UNIQ_EXISTS);
+ if (unrand_index == UNRAND_VARIABILITY)
+ {
+ item.plus = random_range(-4, 16);
+ item.plus2 = random_range(-4, 16);
+ }
+
return (true);
}
@@ -1988,7 +2000,7 @@ const char *unrandart_descrip( int which_descrip, const item_def &item )
void artefact_set_properties( item_def &item,
artefact_properties_t &proprt )
{
- ASSERT( is_random_artefact( item ) );
+ ASSERT( is_artefact( item ) );
ASSERT( item.props.exists( ARTEFACT_PROPS_KEY ) );
CrawlVector &rap_vec = item.props[ARTEFACT_PROPS_KEY].get_vector();
@@ -2004,7 +2016,7 @@ void artefact_set_property( item_def &item,
artefact_prop_type prop,
int val )
{
- ASSERT( is_random_artefact( item ) );
+ ASSERT( is_artefact( item ) );
ASSERT( item.props.exists( ARTEFACT_PROPS_KEY ) );
CrawlVector &rap_vec = item.props[ARTEFACT_PROPS_KEY].get_vector();