SideInBattle.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * SideInBattle.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../GameConstants.h"
  12. #include "../callback/GameCallbackHolder.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. class CGHeroInstance;
  15. class CGTownInstance;
  16. class CArmedInstance;
  17. struct DLL_LINKAGE SideInBattle : public GameCallbackHolder
  18. {
  19. using GameCallbackHolder::GameCallbackHolder;
  20. PlayerColor color = PlayerColor::CANNOT_DETERMINE;
  21. ObjectInstanceID heroID; //may be empty if army is not commanded by hero
  22. ObjectInstanceID armyObjectID; //adv. map object with army that participates in battle; may be same as hero
  23. uint32_t castSpellsCount = 0; //how many spells each side has been cast this turn
  24. std::vector<SpellID> usedSpellsHistory; //every time hero casts spell, it's inserted here -> eagle eye skill
  25. int32_t enchanterCounter = 0; //tends to pass through 0, so sign is needed
  26. int32_t initialMana = 0;
  27. int32_t additionalMana = 0;
  28. void init(const CGHeroInstance * Hero, const CArmedInstance * Army, const CGTownInstance * town);
  29. const CArmedInstance * getArmy() const;
  30. const CGHeroInstance * getHero() const;
  31. template <typename Handler> void serialize(Handler &h)
  32. {
  33. h & color;
  34. h & heroID;
  35. h & armyObjectID;
  36. h & castSpellsCount;
  37. h & usedSpellsHistory;
  38. h & enchanterCounter;
  39. h & initialMana;
  40. h & additionalMana;
  41. }
  42. };
  43. VCMI_LIB_NAMESPACE_END