CRewardableConstructor.h 1.4 KB

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