CRewardableConstructor.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * CRewardableConstructor.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 "CRewardableObject.h"
  12. #include "CObjectClassesHandler.h"
  13. #include "../JsonNode.h"
  14. VCMI_LIB_NAMESPACE_BEGIN
  15. class DLL_LINKAGE CRandomRewardObjectInfo : public IObjectInfo
  16. {
  17. JsonNode parameters;
  18. public:
  19. bool givesResources() const override;
  20. bool givesExperience() const override;
  21. bool givesMana() const override;
  22. bool givesMovement() const override;
  23. bool givesPrimarySkills() const override;
  24. bool givesSecondarySkills() const override;
  25. bool givesArtifacts() const override;
  26. bool givesCreatures() const override;
  27. bool givesSpells() const override;
  28. bool givesBonuses() const override;
  29. void configureObject(CRewardableObject * object, CRandomGenerator & rng) const;
  30. CRandomRewardObjectInfo()
  31. {}
  32. void init(const JsonNode & objectConfig);
  33. };
  34. class DLL_LINKAGE CRewardableConstructor : public AObjectTypeHandler
  35. {
  36. CRandomRewardObjectInfo objectInfo;
  37. void initTypeData(const JsonNode & config) override;
  38. public:
  39. CRewardableConstructor();
  40. CGObjectInstance * create(std::shared_ptr<const ObjectTemplate> tmpl = nullptr) const override;
  41. void configureObject(CGObjectInstance * object, CRandomGenerator & rng) const override;
  42. std::unique_ptr<IObjectInfo> getObjectInfo(std::shared_ptr<const ObjectTemplate> tmpl) const override;
  43. };
  44. VCMI_LIB_NAMESPACE_END