00001
00007 #ifndef INCL_MONSTINF
00008 #define INCL_MONSTINF 1
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ALPHA_LINUX_CXX
00029 # include <iosfwd>
00030 #endif
00031
00032 #include <cassert>
00033
00034
00035
00036
00037 class Equip_element
00038 {
00039 unsigned short shapenum;
00040 unsigned char probability;
00041 unsigned char quantity;
00042 public:
00043 friend class Monster_info;
00044 friend class Monster_actor;
00045 Equip_element()
00046 { }
00047 void set(int shnum, int prob, int quant)
00048 {
00049 shapenum = shnum;
00050 probability = prob;
00051 quantity = quant;
00052 }
00053 int get_shapenum() const
00054 { return shapenum; }
00055 int get_probability() const
00056 { return probability; }
00057 int get_quantity() const
00058 { return quantity; }
00059 };
00060
00061
00062
00063
00064 class Equip_record
00065 {
00066 Equip_element elements[10];
00067 public:
00068 friend class Monster_info;
00069 friend class Monster_actor;
00070 Equip_record()
00071 { }
00072
00073 void set(int i, int shnum, int prob, int quant)
00074 { elements[i].set(shnum, prob, quant); }
00075 Equip_element& get(int i)
00076 { assert(i >= 0 && i < 10); return elements[i]; }
00077 };
00078
00079
00080
00081
00082 class Monster_info
00083 {
00084 static Equip_record *equip;
00085 static int equip_cnt;
00086 static Monster_info default_info;
00087 unsigned char strength;
00088 unsigned char dexterity;
00089 unsigned char intelligence;
00090 unsigned char alignment;
00091 unsigned char combat;
00092 unsigned char armor;
00093 unsigned char weapon;
00094 unsigned char reach;
00095 unsigned char flags;
00096
00097
00098 unsigned char vulnerable, immune;
00099 unsigned char equip_offset;
00100
00101 bool m_splits;
00102 bool m_cant_die;
00103 bool m_cant_yell;
00104 bool m_cant_bleed;
00105 bool m_poison_safe;
00106 public:
00107 friend class Monster_actor;
00108 Monster_info() { }
00109 int read(std::istream& mfile);
00110
00111 void write(int shapenum, std::ostream& mfile);
00112 static const Monster_info *get_default();
00113
00114 static void set_equip(Equip_record *eq, int cnt)
00115 {
00116 equip = eq;
00117 equip_cnt = cnt;
00118 }
00119 static int get_equip_cnt()
00120 { return equip_cnt; }
00121 static Equip_record& get_equip(int i)
00122 { assert(i >= 0 && i < equip_cnt); return equip[i]; }
00123 bool splits() const
00124 { return m_splits; }
00125 void set_splits(bool tf)
00126 { m_splits = tf; }
00127 bool cant_die() const
00128 { return m_cant_die; }
00129 void set_cant_die(bool tf)
00130 { m_cant_die = tf; }
00131 bool cant_yell() const
00132 { return m_cant_yell; }
00133 void set_cant_yell(bool tf)
00134 { m_cant_yell = tf; }
00135 bool cant_bleed() const
00136 { return m_cant_bleed; }
00137 void set_cant_bleed(bool tf)
00138 { m_cant_bleed = tf; }
00139 bool poison_safe() const
00140 { return m_poison_safe; }
00141 void set_poison_safe(bool tf)
00142 { m_poison_safe = tf; }
00143
00144
00145 unsigned char get_vulnerable() const
00146 { return vulnerable; }
00147 void set_vulnerable(unsigned char v)
00148 { vulnerable = v; }
00149 unsigned char get_immune() const
00150 { return immune; }
00151 void set_immune(unsigned char v)
00152 { immune = v; }
00153 enum Flags {
00154 fly = 0,
00155 swim = 1,
00156 walk = 2,
00157 ethereal = 3,
00158 no_body = 4
00159
00160
00161
00162
00163
00164 };
00165 unsigned char get_flags() const
00166 { return flags; }
00167 void set_flags(unsigned char f)
00168 { flags = f; }
00169 bool has_no_body() const
00170 { return (flags>>no_body)&1; }
00171 int get_strength() const
00172 { return strength; }
00173 int get_dexterity() const
00174 { return dexterity; }
00175 int get_intelligence() const
00176 { return intelligence; }
00177 int get_alignment() const
00178 { return alignment; }
00179 void set_alignment(int a)
00180 { alignment = a; }
00181 int get_combat() const
00182 { return combat; }
00183 int get_armor() const
00184 { return armor; }
00185 int get_weapon() const
00186 { return weapon; }
00187 int get_reach() const
00188 { return reach; }
00189 void set_stats(int str, int dex, int intel, int cmb, int armour,
00190 int wpn, int rch);
00191 int get_equip_offset() const
00192 { return equip_offset; }
00193 void set_equip_offset(int o)
00194 { equip_offset = o; }
00195 };
00196
00197
00198
00199 #endif