CArmedInstance.h 1.6 KB

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