1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Support hota quest gates

This commit is contained in:
nordsoft
2023-10-11 23:15:24 +02:00
parent 7ccd4cdcb2
commit 14b030d2eb
2 changed files with 17 additions and 1 deletions

View File

@@ -710,10 +710,23 @@ void CGQuestGuard::init(CRandomGenerator & rand)
configuration.info.push_back({}); configuration.info.push_back({});
configuration.info.back().visitType = Rewardable::EEventType::EVENT_FIRST_VISIT; configuration.info.back().visitType = Rewardable::EEventType::EVENT_FIRST_VISIT;
configuration.info.back().reward.removeObject = true; configuration.info.back().reward.removeObject = subID == 0 ? true : false;
configuration.canRefuse = true; configuration.canRefuse = true;
} }
void CGQuestGuard::onHeroVisit(const CGHeroInstance * h) const
{
if(!quest->isCompleted)
CGSeerHut::onHeroVisit(h);
else
cb->setObjProperty(id, CGSeerHut::SEERHUT_COMPLETE, false);
}
bool CGQuestGuard::passableFor(PlayerColor color) const
{
return quest->isCompleted;
}
void CGQuestGuard::serializeJsonOptions(JsonSerializeFormat & handler) void CGQuestGuard::serializeJsonOptions(JsonSerializeFormat & handler)
{ {
//quest only, do not call base class //quest only, do not call base class

View File

@@ -151,6 +151,9 @@ class DLL_LINKAGE CGQuestGuard : public CGSeerHut
{ {
public: public:
void init(CRandomGenerator & rand) override; void init(CRandomGenerator & rand) override;
void onHeroVisit(const CGHeroInstance * h) const override;
bool passableFor(PlayerColor color) const override;
template <typename Handler> void serialize(Handler &h, const int version) template <typename Handler> void serialize(Handler &h, const int version)
{ {