SideInBattle.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 CArmedInstance;
  16. struct DLL_LINKAGE SideInBattle : public GameCallbackHolder
  17. {
  18. using GameCallbackHolder::GameCallbackHolder;
  19. PlayerColor color = PlayerColor::CANNOT_DETERMINE;
  20. ObjectInstanceID heroID; //may be empty if army is not commanded by hero
  21. ObjectInstanceID armyObjectID; //adv. map object with army that participates in battle; may be same as hero
  22. uint32_t castSpellsCount = 0; //how many spells each side has been cast this turn
  23. std::vector<SpellID> usedSpellsHistory; //every time hero casts spell, it's inserted here -> eagle eye skill
  24. int32_t enchanterCounter = 0; //tends to pass through 0, so sign is needed
  25. int32_t initialMana = 0;
  26. int32_t additionalMana = 0;
  27. void init(const CGHeroInstance * Hero, const CArmedInstance * Army);
  28. const CArmedInstance * getArmy() const;
  29. const CGHeroInstance * getHero() const;
  30. template <typename Handler> void serialize(Handler &h)
  31. {
  32. h & color;
  33. h & heroID;
  34. h & armyObjectID;
  35. h & castSpellsCount;
  36. h & usedSpellsHistory;
  37. h & enchanterCounter;
  38. h & initialMana;
  39. h & additionalMana;
  40. }
  41. };
  42. VCMI_LIB_NAMESPACE_END