00001 #ifndef MON_INFO_H
00002 #define MON_INFO_H
00003
00004 #include "mon-stuff.h"
00005 #include "mon-enum.h"
00006 #include "mon-util.h"
00007
00008 enum monster_info_flags
00009 {
00010 MB_STABBABLE,
00011 MB_DISTRACTED,
00012 MB_BERSERK,
00013 MB_DORMANT,
00014 MB_SLEEPING,
00015 MB_UNAWARE,
00016 MB_WANDERING,
00017 MB_HASTED,
00018 MB_STRONG,
00019 MB_SLOWED,
00020 MB_FLEEING,
00021 MB_CONFUSED,
00022 MB_INVISIBLE,
00023 MB_POISONED,
00024 MB_ROTTING,
00025 MB_SUMMONED,
00026 MB_HALOED,
00027 MB_GLOWING,
00028 MB_CHARMED,
00029 MB_BURNING,
00030 MB_PARALYSED,
00031 MB_SICK,
00032 MB_CAUGHT,
00033 MB_FRENZIED,
00034 MB_PETRIFYING,
00035 MB_PETRIFIED,
00036 MB_VULN_MAGIC,
00037 MB_POSSESSABLE,
00038 MB_ENSLAVED,
00039 MB_SWIFT,
00040 MB_INSANE,
00041 MB_SILENCING,
00042 MB_MESMERIZING,
00043 MB_EVIL_ATTACK,
00044 MB_SHAPESHIFTER,
00045 MB_CHAOTIC,
00046 MB_SUBMERGED,
00047 MB_BLEEDING,
00048 MB_DEFLECT_MSL,
00049 MB_PREP_RESURRECT,
00050 MB_REGENERATION,
00051 MB_RAISED_MR,
00052 MB_MIRROR_DAMAGE,
00053 MB_SAFE,
00054 MB_UNSAFE,
00055 MB_NAME_SUFFIX,
00056 MB_NAME_ADJECTIVE,
00057 MB_NAME_REPLACE,
00058 MB_NAME_UNQUALIFIED,
00059 MB_NAME_THE,
00060 MB_FADING_AWAY,
00061 MB_MOSTLY_FADED,
00062 MB_FEAR_INSPIRING,
00063 MB_WITHDRAWN,
00064 MB_ATTACHED,
00065 MB_HELPLESS,
00066 };
00067
00068 struct monster_info_base
00069 {
00070 coord_def pos;
00071 uint64_t mb;
00072 std::string mname;
00073 monster_type type;
00074 monster_type base_type;
00075 monster_type draco_type;
00076 dungeon_feature_type mimic_feature;
00077 unsigned number;
00078 unsigned colour;
00079 mon_attitude_type attitude;
00080 mon_dam_level_type dam;
00081
00082 dungeon_feature_type fire_blocker;
00083 std::string description;
00084 std::string quote;
00085 mon_holy_type holi;
00086 mon_intel_type mintel;
00087 mon_resist_def mresists;
00088 mon_itemuse_type mitemuse;
00089 int mbase_speed;
00090 flight_type fly;
00091 bool two_weapons;
00092 bool no_regen;
00093 };
00094
00095
00096
00097 struct monster_info : public monster_info_base
00098 {
00099 static bool less_than(const monster_info& m1,
00100 const monster_info& m2, bool zombified = true,
00101 bool fullname = true);
00102
00103 static bool less_than_wrapper(const monster_info& m1,
00104 const monster_info& m2);
00105
00106 #define MILEV_ALL 0
00107 #define MILEV_SKIP_SAFE -1
00108 #define MILEV_NAME -2
00109 monster_info() {}
00110 monster_info(const monster* m, int level = MILEV_ALL);
00111 monster_info(monster_type p_type,
00112 monster_type p_base_type = MONS_NO_MONSTER);
00113
00114 monster_info(const monster_info& mi)
00115 : monster_info_base(mi)
00116 {
00117 u = mi.u;
00118 for (unsigned i = 0; i < 6; ++i)
00119 {
00120 if (mi.inv[i].get())
00121 inv[i].reset(new item_def(*mi.inv[i]));
00122 }
00123 }
00124
00125 monster_info& operator=(const monster_info& p)
00126 {
00127 this->~monster_info();
00128 new (this) monster_info(p);
00129 return *this;
00130 }
00131
00132 void to_string(int count, std::string& desc, int& desc_color, bool fullname = true) const;
00133
00134
00135 monster* mon() const;
00136
00137
00138 std::auto_ptr<item_def> inv[6];
00139
00140 union
00141 {
00142 struct
00143 {
00144 species_type species;
00145 job_type job;
00146 god_type religion;
00147 skill_type best_skill;
00148 short best_skill_rank;
00149 short xl_rank;
00150 } ghost;
00151 } u;
00152
00153 inline bool is(unsigned mbflag) const
00154 {
00155 return !!(mb & (((uint64_t)1) << mbflag));
00156 }
00157
00158 inline std::string damage_desc() const
00159 {
00160 return get_damage_level_string(holi, dam);
00161 }
00162
00163 inline bool neutral() const
00164 {
00165 return attitude == ATT_NEUTRAL || attitude == ATT_GOOD_NEUTRAL || attitude == ATT_STRICT_NEUTRAL;
00166 }
00167
00168 std::string db_name() const;
00169 bool has_proper_name() const;
00170 std::string common_name(description_level_type desc = DESC_PLAIN) const;
00171 std::string proper_name(description_level_type desc = DESC_PLAIN) const;
00172 std::string full_name(description_level_type desc = DESC_PLAIN, bool use_comma = false) const;
00173
00174 std::vector<std::string> attributes() const;
00175
00176 const char *pronoun(pronoun_type variant) const
00177 {
00178 return (mons_pronoun(static_cast<monster_type>(type), variant, true));
00179 }
00180
00181 std::string wounds_description_sentence() const;
00182 std::string wounds_description(bool colour = false) const;
00183
00184 monster_type draco_subspecies() const
00185 {
00186 return (draco_type);
00187 }
00188
00189 mon_intel_type intel() const
00190 {
00191 return (mintel);
00192 }
00193
00194 mon_resist_def resists() const
00195 {
00196 return (mresists);
00197 }
00198
00199 mon_itemuse_type itemuse() const
00200 {
00201 return (mitemuse);
00202 }
00203
00204 int randarts(artefact_prop_type ra_prop) const;
00205 int res_magic() const;
00206
00207 int base_speed() const
00208 {
00209 return (mbase_speed);
00210 }
00211
00212 bool can_regenerate() const
00213 {
00214 return (!no_regen);
00215 }
00216
00217 size_type body_size() const;
00218
00219 protected:
00220 std::string _core_name() const;
00221 std::string _apply_adjusted_description(description_level_type desc, const std::string& s) const;
00222 };
00223
00224 void get_monster_info(std::vector<monster_info>& mons);
00225
00226 #endif