diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-06-25 02:29:14 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-06-25 02:29:14 +0000 |
commit | 2fad05374f70f21d4af3d147325581bf1047b5be (patch) | |
tree | 40a46254f044837f658e4dbabb07ce3c52b72804 /crawl-ref/source/itemprop.cc | |
parent | ab0e3274d569d1cdea4010f4ed1d4b24cd3804e9 (diff) | |
download | crawl-ref-2fad05374f70f21d4af3d147325581bf1047b5be.tar.gz crawl-ref-2fad05374f70f21d4af3d147325581bf1047b5be.zip |
First part of the merger of fixed artefacts into unrandom artefacts
(further changes will be much smaller). Breaks savefile compatibility,
and bumps the major savefile version up to 6.
Some changes made to some tiles files, but it hasn't been tested with a tiles
build.
Overview of changes:
* Unrand artefacts are now defined in art-data.txt and is turned into
C code via util/art-data.pl. This has the dual advantage of being
more readable by humans, and that if the unrand data structure
changes then you can just change util/art-data.pl and regenerate
the C code rather than having to change some 70 different C structs
by hand.
* util/art-data.pl automatically updates NO_UNRANDARTS, and also
automatically generates an enumeration of all the unrands which are
equal to their item.special field.
* randart.cc and randart.h have been renamed to artefact.cc and artefact.h,
since the files covers all types of artefacts, and the differences
between randarts, unrandarts and (former) fixed arts have been
minimized since the terms were introduced. Also renamed unrand.h to
art-data.h
* The brands and resistances of former fixed arts are now handled via
artefact properties, but the rest of their special behaviours are still
hardcoded.
* Unrandarts are now distinguished between normal and "special",
with the special ones currently just being identical to the list of
the formed fixed arts. Special unrandarts are randomly generated less
often than normal unrandarts, can be generated in the Abyss if they've
been lost, can't be picked up by monsters, and can't be affected by
Tukima's Dance.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10035 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/itemprop.cc')
-rw-r--r-- | crawl-ref/source/itemprop.cc | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 7c54b7fd4c..6694a063f5 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -22,6 +22,7 @@ REVISION("$Rev$"); #include "externs.h" +#include "artefact.h" #include "decks.h" #include "food.h" #include "invent.h" @@ -34,7 +35,6 @@ REVISION("$Rev$"); #include "notes.h" #include "player.h" #include "quiver.h" -#include "randart.h" #include "skills2.h" #include "stuff.h" #include "transfor.h" @@ -880,9 +880,7 @@ void set_helmet_random_desc( item_def &item ) // bool set_item_ego_type( item_def &item, int item_type, int ego_type ) { - if (item.base_type == item_type - && !is_random_artefact( item ) - && !is_fixed_artefact( item )) + if (item.base_type == item_type && !is_artefact(item)) { item.special = ego_type; return (true); @@ -899,27 +897,8 @@ int get_weapon_brand( const item_def &item ) if (item.base_type != OBJ_WEAPONS) return (SPWPN_NORMAL); - if (is_fixed_artefact( item )) - { - switch (item.special) - { - case SPWPN_SWORD_OF_CEREBOV: - return (SPWPN_FLAMING); - - case SPWPN_STAFF_OF_OLGREB: - return (SPWPN_VENOM); - - case SPWPN_VAMPIRES_TOOTH: - return (SPWPN_VAMPIRICISM); - - default: - return (SPWPN_NORMAL); - } - } - else if (is_random_artefact( item )) - { + if (is_artefact( item )) return (artefact_wpn_property( item, ARTP_BRAND )); - } return (item.special); } @@ -1115,6 +1094,11 @@ bool jewellery_is_amulet( const item_def &item ) return (item.sub_type >= AMU_RAGE); } +bool jewellery_is_amulet( int sub_type ) +{ + return (sub_type >= AMU_RAGE); +} + bool check_jewellery_size( const item_def &item, size_type size ) { ASSERT( item.base_type == OBJ_JEWELLERY ); @@ -2468,11 +2452,8 @@ bool gives_ability(const item_def &item) // Check for evokable randart properties. for (int rap = ARTP_INVISIBLE; rap <= ARTP_MAPPING; rap++) - if (artefact_wpn_property( item, - static_cast<artefact_prop_type>(rap) )) - { + if (artefact_wpn_property( item, static_cast<artefact_prop_type>(rap) )) return (true); - } return (false); } @@ -2539,11 +2520,8 @@ bool gives_resistance(const item_def &item) if (rap == ARTP_MAGIC || rap >= ARTP_INVISIBLE && rap != ARTP_CAN_TELEPORT) continue; - if (artefact_wpn_property( item, - static_cast<artefact_prop_type>(rap) )) - { + if (artefact_wpn_property( item, static_cast<artefact_prop_type>(rap) )) return (true); - } } return (false); @@ -2728,6 +2706,28 @@ size_type item_size(const item_def &item) return (static_cast<size_type>(size)); } +equipment_type get_item_slot(object_class_type type, int sub_type) +{ + switch(type) + { + case OBJ_WEAPONS: + case OBJ_STAVES: + case OBJ_MISCELLANY: + return (EQ_WEAPON); + + case OBJ_ARMOUR: + return get_armour_slot(static_cast<armour_type>(sub_type)); + + case OBJ_JEWELLERY: + return (jewellery_is_amulet(sub_type) ? EQ_AMULET : EQ_RINGS); + + default: + break; + } + + return (EQ_NONE); +} + // Returns true if we might be interested in dumping the colour. bool is_colourful_item(const item_def &item) { |