2014-04-27 15:19:23 +03:00
|
|
|
/*
|
2014-06-05 20:26:50 +03:00
|
|
|
* CRewardableConstructor.h, part of VCMI engine
|
2014-04-27 15:19:23 +03:00
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
2017-07-13 10:26:03 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "CRewardableObject.h"
|
|
|
|
#include "CObjectClassesHandler.h"
|
|
|
|
|
|
|
|
#include "../JsonNode.h"
|
2014-04-27 15:19:23 +03:00
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2014-06-26 21:12:37 +03:00
|
|
|
class DLL_LINKAGE CRandomRewardObjectInfo : public IObjectInfo
|
2014-04-27 15:19:23 +03:00
|
|
|
{
|
2014-04-27 20:37:53 +03:00
|
|
|
JsonNode parameters;
|
2023-01-23 23:54:54 +02:00
|
|
|
|
2023-01-24 23:31:07 +02:00
|
|
|
void configureRewards(CRewardableObject * object, CRandomGenerator & rng, const JsonNode & source, std::map<si32, si32> & thrownDice, CRewardVisitInfo::ERewardEventType mode) const;
|
|
|
|
|
2023-01-23 23:54:54 +02:00
|
|
|
void configureLimiter(CRewardableObject * object, CRandomGenerator & rng, CRewardLimiter & limiter, const JsonNode & source) const;
|
|
|
|
TRewardLimitersList configureSublimiters(CRewardableObject * object, CRandomGenerator & rng, const JsonNode & source) const;
|
|
|
|
|
|
|
|
void configureReward(CRewardableObject * object, CRandomGenerator & rng, CRewardInfo & info, const JsonNode & source) const;
|
2023-01-24 13:54:03 +02:00
|
|
|
void configureResetInfo(CRewardableObject * object, CRandomGenerator & rng, CRewardResetInfo & info, const JsonNode & source) const;
|
2014-04-27 15:19:23 +03:00
|
|
|
public:
|
|
|
|
bool givesResources() const override;
|
|
|
|
|
|
|
|
bool givesExperience() const override;
|
|
|
|
bool givesMana() const override;
|
|
|
|
bool givesMovement() const override;
|
|
|
|
|
|
|
|
bool givesPrimarySkills() const override;
|
|
|
|
bool givesSecondarySkills() const override;
|
|
|
|
|
|
|
|
bool givesArtifacts() const override;
|
|
|
|
bool givesCreatures() const override;
|
|
|
|
bool givesSpells() const override;
|
|
|
|
|
|
|
|
bool givesBonuses() const override;
|
|
|
|
|
2014-06-05 14:19:47 +03:00
|
|
|
void configureObject(CRewardableObject * object, CRandomGenerator & rng) const;
|
2014-04-27 15:19:23 +03:00
|
|
|
|
|
|
|
CRandomRewardObjectInfo()
|
|
|
|
{}
|
|
|
|
|
2014-04-27 20:37:53 +03:00
|
|
|
void init(const JsonNode & objectConfig);
|
2014-04-27 15:19:23 +03:00
|
|
|
};
|
|
|
|
|
2014-06-26 21:12:37 +03:00
|
|
|
class DLL_LINKAGE CRewardableConstructor : public AObjectTypeHandler
|
2014-04-27 15:19:23 +03:00
|
|
|
{
|
2014-05-16 23:50:02 +03:00
|
|
|
CRandomRewardObjectInfo objectInfo;
|
2014-04-27 15:19:23 +03:00
|
|
|
|
2014-06-14 18:42:13 +03:00
|
|
|
void initTypeData(const JsonNode & config) override;
|
2014-04-27 15:19:23 +03:00
|
|
|
public:
|
2014-06-05 14:19:47 +03:00
|
|
|
CRewardableConstructor();
|
2014-04-27 20:37:53 +03:00
|
|
|
|
2022-09-11 15:12:35 +02:00
|
|
|
CGObjectInstance * create(std::shared_ptr<const ObjectTemplate> tmpl = nullptr) const override;
|
2014-04-27 15:19:23 +03:00
|
|
|
|
2014-05-17 17:50:11 +03:00
|
|
|
void configureObject(CGObjectInstance * object, CRandomGenerator & rng) const override;
|
2014-04-27 15:19:23 +03:00
|
|
|
|
2022-09-11 15:12:35 +02:00
|
|
|
std::unique_ptr<IObjectInfo> getObjectInfo(std::shared_ptr<const ObjectTemplate> tmpl) const override;
|
2014-04-27 15:19:23 +03:00
|
|
|
};
|
2022-07-26 15:07:42 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|