CArmedInstance.h 1.7 KB

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