00001 #ifndef MON_RESIST_DEF_H 00002 #define MON_RESIST_DEF_H 00003 00004 #include "mon-enum.h" 00005 00006 struct mon_resist_def 00007 { 00008 // All values are actually saved as single-bytes, so practical 00009 // range is -128 - 127, and the game only distinguishes values in 00010 // the range -1 to 3. 00011 00012 short elec; 00013 short poison; 00014 short fire; 00015 short steam; 00016 short cold; 00017 short hellfire; 00018 short acid; 00019 00020 bool asphyx; 00021 bool sticky_flame; 00022 bool rotting; 00023 00024 // Physical damage resists (currently unused) 00025 short pierce; 00026 short slice; 00027 short bludgeon; 00028 00029 mon_resist_def(); 00030 mon_resist_def(int flags, short level = -100); 00031 00032 mon_resist_def operator | (const mon_resist_def &other) const; 00033 const mon_resist_def &operator |= (const mon_resist_def &other); 00034 00035 short get_resist_level(mon_resist_flags res_type) const; 00036 00037 private: 00038 short get_default_res_level(int resist, short level) const; 00039 }; 00040 00041 inline mon_resist_def operator | (int a, const mon_resist_def &b) 00042 { 00043 return (mon_resist_def(a) | b); 00044 } 00045 00046 typedef mon_resist_def mrd; 00047 00048 #endif