CRewardableConstructor.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #pragma once
  2. #include "CRewardableObject.h"
  3. #include "CObjectClassesHandler.h"
  4. #include "../JsonNode.h"
  5. /*
  6. * CRewardableConstructor.h, part of VCMI engine
  7. *
  8. * Authors: listed in file AUTHORS in main folder
  9. *
  10. * License: GNU General Public License v2.0 or later
  11. * Full text of license available in license.txt file, in main folder
  12. *
  13. */
  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(ObjectTemplate tmpl) const override;
  40. void configureObject(CGObjectInstance * object, CRandomGenerator & rng) const override;
  41. std::unique_ptr<IObjectInfo> getObjectInfo(ObjectTemplate tmpl) const override;
  42. };