Info.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 "../mapObjectConstructors/IObjectInfo.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. std::string objectTextID;
  27. void configureRewards(Rewardable::Configuration & object, CRandomGenerator & rng, const JsonNode & source, std::map<si32, si32> & thrownDice, Rewardable::EEventType mode, const std::string & textPrefix) const;
  28. void configureLimiter(Rewardable::Configuration & object, CRandomGenerator & rng, Rewardable::Limiter & limiter, const JsonNode & source) const;
  29. Rewardable::LimitersList configureSublimiters(Rewardable::Configuration & object, CRandomGenerator & rng, const JsonNode & source) const;
  30. void configureReward(Rewardable::Configuration & object, CRandomGenerator & rng, Rewardable::Reward & info, const JsonNode & source) const;
  31. void configureResetInfo(Rewardable::Configuration & object, CRandomGenerator & rng, Rewardable::ResetInfo & info, const JsonNode & source) const;
  32. public:
  33. const JsonNode & getParameters() const;
  34. bool givesResources() const override;
  35. bool givesExperience() const override;
  36. bool givesMana() const override;
  37. bool givesMovement() const override;
  38. bool givesPrimarySkills() const override;
  39. bool givesSecondarySkills() const override;
  40. bool givesArtifacts() const override;
  41. bool givesCreatures() const override;
  42. bool givesSpells() const override;
  43. bool givesBonuses() const override;
  44. void configureObject(Rewardable::Configuration & object, CRandomGenerator & rng) const;
  45. void init(const JsonNode & objectConfig, const std::string & objectTextID);
  46. template <typename Handler> void serialize(Handler &h, const int version)
  47. {
  48. h & parameters;
  49. }
  50. };
  51. }
  52. VCMI_LIB_NAMESPACE_END