CArmedInstance.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * CArmedInstance.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 "CObjectHandler.h"
  12. #include "../CCreatureSet.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. class BattleInfo;
  15. class CGameState;
  16. class DLL_LINKAGE CArmedInstance: public CGObjectInstance, public CBonusSystemNode, public CCreatureSet, public IConstBonusProvider
  17. {
  18. private:
  19. CCheckProxy nonEvilAlignmentMix;
  20. static CSelector nonEvilAlignmentMixSelector;
  21. public:
  22. BattleInfo *battle; //set to the current battle, if engaged
  23. void randomizeArmy(int type);
  24. virtual void updateMoraleBonusFromArmy();
  25. void armyChanged() override;
  26. //////////////////////////////////////////////////////////////////////////
  27. //IConstBonusProvider
  28. const IBonusBearer* getBonusBearer() const override;
  29. // int valOfGlobalBonuses(CSelector selector) const; //used only for castle interface ???
  30. virtual CBonusSystemNode & whereShouldBeAttached(CGameState * gs);
  31. virtual CBonusSystemNode & whatShouldBeAttached();
  32. //////////////////////////////////////////////////////////////////////////
  33. CArmedInstance();
  34. CArmedInstance(bool isHypotetic);
  35. PlayerColor getOwner() const override
  36. {
  37. return this->tempOwner;
  38. }
  39. template <typename Handler> void serialize(Handler &h, const int version)
  40. {
  41. h & static_cast<CGObjectInstance&>(*this);
  42. h & static_cast<CBonusSystemNode&>(*this);
  43. h & static_cast<CCreatureSet&>(*this);
  44. }
  45. };
  46. VCMI_LIB_NAMESPACE_END