00001
00002
00003
00004
00005
00006
00007
00008 #ifndef RANDART_H
00009 #define RANDART_H
00010
00011 #include "externs.h"
00012
00013 struct bolt;
00014
00015 #include "art-enum.h"
00016
00017 #define ART_PROPERTIES ARTP_NUM_PROPERTIES
00018
00019
00020 #define RANDART_SEED_MASK 0x00ffffff
00021
00022 #define KNOWN_PROPS_KEY "artefact_known_props"
00023 #define ARTEFACT_PROPS_KEY "artefact_props"
00024 #define ARTEFACT_NAME_KEY "artefact_name"
00025 #define ARTEFACT_APPEAR_KEY "artefact_appearance"
00026
00027 enum unrand_flag_type
00028 {
00029 UNRAND_FLAG_NONE = 0x00,
00030 UNRAND_FLAG_SPECIAL = 0x01,
00031 UNRAND_FLAG_HOLY = 0x02,
00032 UNRAND_FLAG_UNHOLY = 0x04,
00033 UNRAND_FLAG_EVIL = 0x08,
00034 UNRAND_FLAG_UNCLEAN = 0x10,
00035 UNRAND_FLAG_CHAOTIC = 0x20,
00036 UNRAND_FLAG_CORPSE_VIOLATING = 0x40,
00037 UNRAND_FLAG_NOGEN = 0x80,
00038
00039
00040 };
00041
00042 enum setup_missile_type
00043 {
00044 SM_CONTINUE,
00045 SM_FINISHED,
00046 SM_CANCEL,
00047 };
00048
00049
00050
00051 struct unrandart_entry
00052 {
00053 const char *name;
00054 const char *unid_name;
00055
00056 object_class_type base_type;
00057 uint8_t sub_type;
00058 short plus;
00059 short plus2;
00060 uint8_t colour;
00061
00062 short value;
00063 uint8_t flags;
00064
00065 short prpty[ART_PROPERTIES];
00066
00067
00068 const char *desc;
00069 const char *desc_id;
00070 const char *desc_end;
00071
00072 void (*equip_func)(item_def* item, bool* show_msgs, bool unmeld);
00073 void (*unequip_func)(const item_def* item, bool* show_msgs);
00074 void (*world_reacts_func)(item_def* item);
00075
00076
00077 union
00078 {
00079 void (*melee_effects)(item_def* item, actor* attacker,
00080 actor* defender, bool mondied);
00081 setup_missile_type (*launch)(item_def* item, bolt* beam,
00082 std::string* ammo_name, bool* returning);
00083 } fight_func;
00084 bool (*evoke_func)(item_def *item, int* pract, bool* did_work,
00085 bool* unevokable);
00086 };
00087
00088 bool is_known_artefact(const item_def &item);
00089 bool is_artefact(const item_def &item);
00090 bool is_random_artefact(const item_def &item);
00091 bool is_unrandom_artefact(const item_def &item);
00092 bool is_special_unrandom_artefact(const item_def &item);
00093
00094 void artefact_fixup_props(item_def &item);
00095
00096 unique_item_status_type get_unique_item_status(const item_def& item);
00097 unique_item_status_type get_unique_item_status(int unrand_index);
00098 void set_unique_item_status(const item_def& item,
00099 unique_item_status_type status);
00100 void set_unique_item_status(int unrand_index,
00101 unique_item_status_type status);
00102
00103 std::string get_artefact_name(const item_def &item, bool force_known = false);
00104
00105 void set_artefact_name(item_def &item, const std::string &name);
00106
00107 std::string artefact_name(const item_def &item, bool appearance = false);
00108
00109 const char *unrandart_descrip(int which_descrip, const item_def &item);
00110
00111 int find_okay_unrandart(uint8_t aclass, uint8_t atype = OBJ_RANDOM,
00112 bool in_abyss = false);
00113
00114 typedef FixedVector< int, ART_PROPERTIES > artefact_properties_t;
00115 typedef FixedVector< bool, ART_PROPERTIES > artefact_known_props_t;
00116
00117 void artefact_desc_properties(const item_def &item,
00118 artefact_properties_t &proprt,
00119 artefact_known_props_t &known,
00120 bool force_fake_props = false);
00121
00122 void artefact_wpn_properties(const item_def &item,
00123 artefact_properties_t &proprt,
00124 artefact_known_props_t &known);
00125
00126 void artefact_wpn_properties(const item_def &item,
00127 artefact_properties_t &proprt);
00128
00129 int artefact_wpn_property(const item_def &item, artefact_prop_type prop,
00130 bool &known);
00131
00132 int artefact_wpn_property(const item_def &item, artefact_prop_type prop);
00133
00134 int artefact_known_wpn_property(const item_def &item,
00135 artefact_prop_type prop);
00136
00137 void artefact_wpn_learn_prop(item_def &item, artefact_prop_type prop);
00138
00139 bool make_item_randart(item_def &item, bool force_mundane = false);
00140 bool make_item_unrandart(item_def &item, int unrand_index);
00141
00142 bool randart_is_bad(const item_def &item);
00143 bool randart_is_bad(const item_def &item, artefact_properties_t &proprt);
00144
00145 int find_unrandart_index(const item_def& artefact);
00146
00147 unrandart_entry* get_unrand_entry(int unrand_index);
00148
00149 void artefact_set_property(item_def &item,
00150 artefact_prop_type prop,
00151 int val);
00152
00153 int get_unrandart_num(const char *name);
00154
00155 void cheibriados_make_item_ponderous(item_def &item);
00156
00157 #endif