CSpellHandler.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef __CSPELLHANDLER_H__
  2. #define __CSPELLHANDLER_H__
  3. #include <string>
  4. #include <vector>
  5. #include <set>
  6. #include "CSoundBase.h"
  7. //#include "map.h"
  8. /*
  9. * CSpellHandler.h, part of VCMI engine
  10. *
  11. * Authors: listed in file AUTHORS in main folder
  12. *
  13. * License: GNU General Public License v2.0 or later
  14. * Full text of license available in license.txt file, in main folder
  15. *
  16. */
  17. class DLL_EXPORT CSpell
  18. {
  19. public:
  20. ui32 id;
  21. std::string name;
  22. std::string abbName; //abbreviated name
  23. std::vector<std::string> descriptions; //descriptions of spell for skill levels: 0 - none, 1 - basic, etc
  24. si32 level;
  25. bool earth;
  26. bool water;
  27. bool fire;
  28. bool air;
  29. si32 power; //spell's power
  30. std::vector<si32> costs; //per skill level: 0 - none, 1 - basic, etc
  31. std::vector<si32> powers; //[er skill level: 0 - none, 1 - basic, etc
  32. std::vector<si32> probabilities; //% chance to gain for castles
  33. std::vector<si32> AIVals; //AI values: per skill level: 0 - none, 1 - basic, etc
  34. std::string attributes; //reference only attributes
  35. bool combatSpell; //is this spell combat (true) or adventure (false)
  36. bool creatureAbility; //if true, only creatures can use this spell
  37. si8 positiveness; //1 if spell is positive for influenced stacks, 0 if it is indifferent, -1 if it's negative
  38. std::vector<std::string> range; //description of spell's range in SRSL by magic school level
  39. std::set<ui16> rangeInHexes(unsigned int centralHex, ui8 schoolLvl ) const; //convert range to specific hexes
  40. si16 mainEffectAnim; //main spell effect animation, in AC format (or -1 when none)
  41. soundBase::soundID soundID; // spell sound id
  42. template <typename Handler> void serialize(Handler &h, const int version)
  43. {
  44. h & id & name & abbName & descriptions & level & earth & water & fire & air & power & costs
  45. & powers & probabilities & AIVals & attributes & combatSpell & creatureAbility & positiveness & range & mainEffectAnim;
  46. }
  47. };
  48. class DLL_EXPORT CSpellHandler
  49. {
  50. public:
  51. CSpellHandler::CSpellHandler();
  52. std::vector<CSpell> spells;
  53. void loadSpells();
  54. template <typename Handler> void serialize(Handler &h, const int version)
  55. {
  56. h & spells;
  57. }
  58. };
  59. #endif // __CSPELLHANDLER_H__