Info.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Info.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 "../JsonNode.h"
  12. #include "../mapObjects/CObjectClassesHandler.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. class CRandomGenerator;
  15. namespace Rewardable
  16. {
  17. struct Limiter;
  18. using LimitersList = std::vector<std::shared_ptr<Rewardable::Limiter>>;
  19. struct Reward;
  20. struct Configuration;
  21. struct ResetInfo;
  22. enum class EEventType;
  23. class DLL_LINKAGE Info : public IObjectInfo
  24. {
  25. JsonNode parameters;
  26. void configureRewards(Rewardable::Configuration & object, CRandomGenerator & rng, const JsonNode & source, std::map<si32, si32> & thrownDice, Rewardable::EEventType mode) const;
  27. void configureLimiter(Rewardable::Configuration & object, CRandomGenerator & rng, Rewardable::Limiter & limiter, const JsonNode & source) const;
  28. Rewardable::LimitersList configureSublimiters(Rewardable::Configuration & object, CRandomGenerator & rng, const JsonNode & source) const;
  29. void configureReward(Rewardable::Configuration & object, CRandomGenerator & rng, Rewardable::Reward & info, const JsonNode & source) const;
  30. void configureResetInfo(Rewardable::Configuration & object, CRandomGenerator & rng, Rewardable::ResetInfo & info, const JsonNode & source) const;
  31. public:
  32. const JsonNode & getParameters() const;
  33. bool givesResources() const override;
  34. bool givesExperience() const override;
  35. bool givesMana() const override;
  36. bool givesMovement() const override;
  37. bool givesPrimarySkills() const override;
  38. bool givesSecondarySkills() const override;
  39. bool givesArtifacts() const override;
  40. bool givesCreatures() const override;
  41. bool givesSpells() const override;
  42. bool givesBonuses() const override;
  43. void configureObject(Rewardable::Configuration & object, CRandomGenerator & rng) const;
  44. void init(const JsonNode & objectConfig);
  45. template <typename Handler> void serialize(Handler &h, const int version)
  46. {
  47. h & parameters;
  48. }
  49. };
  50. }
  51. VCMI_LIB_NAMESPACE_END