CArmedInstance.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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/CBonusSystemNode.h"
  14. #include "../bonuses/BonusCache.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. BonusValueCache nonEvilAlignmentMix;
  23. public:
  24. BattleInfo *battle; //set to the current battle, if engaged
  25. void randomizeArmy(FactionID 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(IGameCallback *cb);
  36. CArmedInstance(IGameCallback *cb, bool isHypothetic);
  37. PlayerColor getOwner() const override
  38. {
  39. return this->tempOwner;
  40. }
  41. void serializeJsonOptions(JsonSerializeFormat & handler) override;
  42. template <typename Handler> void serialize(Handler &h)
  43. {
  44. h & static_cast<CGObjectInstance&>(*this);
  45. h & static_cast<CBonusSystemNode&>(*this);
  46. h & static_cast<CCreatureSet&>(*this);
  47. }
  48. };
  49. VCMI_LIB_NAMESPACE_END