1 /* 2 This file is part of "Avanor, the Land of Mystery" roguelike game 3 Home page: http://www.avanor.com/ 4 Copyright (C) 2000-2003 Vadim Gaidukevich 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 */ 20 21 #ifndef __RESIST_H 22 #define __RESIST_H 23 24 #include "strproc.h" 25 #include "dice.h" 26 27 enum RESISTANCE {R_NONE = -1, 28 R_WHITE, R_BLACK, R_FIRE, R_WATER, R_AIR, R_EARTH, 29 R_ACID, R_COLD, R_POISON, R_DISEASE, R_PARALYSE, 30 R_STUN, R_CONFUSE, R_BLIND, 31 R_LIGHT, R_DARKNESS, R_INVISIBLE, R_SEEINVISIBLE, 32 R_EOF}; 33 34 enum FLUENCE {FLU_NONE = 0, FLU_CREATURE = 1, FLU_ITEM = 2, FLU_ALL = 3}; 35 36 struct RESIST_REC 37 { 38 char * name; //life, fire, death etc. 39 FLUENCE flag; 40 }; 41 42 class XResistance 43 { 44 public: 45 XResistance(XResistance * xr); 46 XResistance(); 47 XResistance(const char * str1); //format fire:3d6+N water:2d2+3 48 // ~XResistance() {} GetResistance(RESISTANCE r)49 int GetResistance(RESISTANCE r){return resistances[r];} SetResistance(RESISTANCE r,int val)50 void SetResistance(RESISTANCE r, int val){resistances[r] = val;} ChangeResistance(RESISTANCE r,int val)51 void ChangeResistance(RESISTANCE r, int val){resistances[r] += val;} 52 void Add(XResistance * r); 53 void Sub(XResistance * r); 54 void Set(XResistance * r); 55 char * GetResistanceName(RESISTANCE r); 56 char * GetResistanceLevel(RESISTANCE r); 57 bool isEqual(XResistance * xr); 58 59 void Store(XFile * f); 60 void Restore(XFile * f); 61 protected: 62 int resistances[R_EOF]; 63 }; 64 65 #endif 66