|
@@ -17,6 +17,7 @@
|
|
#include "../texts/CGeneralTextHandler.h"
|
|
#include "../texts/CGeneralTextHandler.h"
|
|
#include "CGCreature.h"
|
|
#include "CGCreature.h"
|
|
#include "../IGameCallback.h"
|
|
#include "../IGameCallback.h"
|
|
|
|
+#include "../IGameSettings.h"
|
|
#include "../entities/artifact/CArtifact.h"
|
|
#include "../entities/artifact/CArtifact.h"
|
|
#include "../entities/hero/CHeroHandler.h"
|
|
#include "../entities/hero/CHeroHandler.h"
|
|
#include "../mapObjectConstructors/CObjectClassesHandler.h"
|
|
#include "../mapObjectConstructors/CObjectClassesHandler.h"
|
|
@@ -118,7 +119,7 @@ bool CQuest::checkQuest(const CGHeroInstance * h) const
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
-void CQuest::completeQuest(IGameCallback * cb, const CGHeroInstance *h) const
|
|
|
|
|
|
+void CQuest::completeQuest(IGameCallback * cb, const CGHeroInstance *h, bool allowFullArmyRemoval) const
|
|
{
|
|
{
|
|
// FIXME: this should be part of 'reward', and not hacking into limiter state that should only limit access to such reward
|
|
// FIXME: this should be part of 'reward', and not hacking into limiter state that should only limit access to such reward
|
|
|
|
|
|
@@ -152,7 +153,7 @@ void CQuest::completeQuest(IGameCallback * cb, const CGHeroInstance *h) const
|
|
logGlobal->error("Failed to find artifact %s in inventory of hero %s", elem.toEntity(LIBRARY)->getJsonKey(), h->getHeroTypeID());
|
|
logGlobal->error("Failed to find artifact %s in inventory of hero %s", elem.toEntity(LIBRARY)->getJsonKey(), h->getHeroTypeID());
|
|
}
|
|
}
|
|
|
|
|
|
- cb->takeCreatures(h->id, mission.creatures);
|
|
|
|
|
|
+ cb->takeCreatures(h->id, mission.creatures, allowFullArmyRemoval);
|
|
cb->giveResources(h->getOwner(), -mission.resources);
|
|
cb->giveResources(h->getOwner(), -mission.resources);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -435,7 +436,8 @@ void CGSeerHut::init(vstd::RNG & rand)
|
|
seerName = LIBRARY->generaltexth->translate(seerNameID);
|
|
seerName = LIBRARY->generaltexth->translate(seerNameID);
|
|
getQuest().textOption = rand.nextInt(2);
|
|
getQuest().textOption = rand.nextInt(2);
|
|
getQuest().completedOption = rand.nextInt(1, 3);
|
|
getQuest().completedOption = rand.nextInt(1, 3);
|
|
-
|
|
|
|
|
|
+ getQuest().mission.hasExtraCreatures = !allowsFullArmyRemoval();
|
|
|
|
+
|
|
configuration.canRefuse = true;
|
|
configuration.canRefuse = true;
|
|
configuration.visitMode = Rewardable::EVisitMode::VISIT_ONCE;
|
|
configuration.visitMode = Rewardable::EVisitMode::VISIT_ONCE;
|
|
configuration.selectMode = Rewardable::ESelectMode::SELECT_PLAYER;
|
|
configuration.selectMode = Rewardable::ESelectMode::SELECT_PLAYER;
|
|
@@ -645,14 +647,21 @@ const CGCreature * CGSeerHut::getCreatureToKill(bool allowNull) const
|
|
return dynamic_cast<const CGCreature *>(o);
|
|
return dynamic_cast<const CGCreature *>(o);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+bool CGSeerHut::allowsFullArmyRemoval() const
|
|
|
|
+{
|
|
|
|
+ bool seerGivesUnits = !configuration.info.empty() && !configuration.info.back().reward.creatures.empty();
|
|
|
|
+ bool h3BugSettingEnabled = cb->getSettings().getBoolean(EGameSettings::MAP_OBJECTS_H3_BUG_QUEST_TAKES_ENTIRE_ARMY);
|
|
|
|
+ return seerGivesUnits || h3BugSettingEnabled;
|
|
|
|
+}
|
|
|
|
+
|
|
void CGSeerHut::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
|
|
void CGSeerHut::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
|
|
{
|
|
{
|
|
- CRewardableObject::blockingDialogAnswered(hero, answer);
|
|
|
|
if(answer)
|
|
if(answer)
|
|
{
|
|
{
|
|
- getQuest().completeQuest(cb, hero);
|
|
|
|
|
|
+ getQuest().completeQuest(cb, hero, allowsFullArmyRemoval());
|
|
cb->setObjPropertyValue(id, ObjProperty::SEERHUT_COMPLETE, !getQuest().repeatedQuest); //mission complete
|
|
cb->setObjPropertyValue(id, ObjProperty::SEERHUT_COMPLETE, !getQuest().repeatedQuest); //mission complete
|
|
}
|
|
}
|
|
|
|
+ CRewardableObject::blockingDialogAnswered(hero, answer);
|
|
}
|
|
}
|
|
|
|
|
|
void CGSeerHut::serializeJsonOptions(JsonSerializeFormat & handler)
|
|
void CGSeerHut::serializeJsonOptions(JsonSerializeFormat & handler)
|
|
@@ -736,6 +745,7 @@ void CGQuestGuard::init(vstd::RNG & rand)
|
|
blockVisit = true;
|
|
blockVisit = true;
|
|
getQuest().textOption = rand.nextInt(3, 5);
|
|
getQuest().textOption = rand.nextInt(3, 5);
|
|
getQuest().completedOption = rand.nextInt(4, 5);
|
|
getQuest().completedOption = rand.nextInt(4, 5);
|
|
|
|
+ getQuest().mission.hasExtraCreatures = !allowsFullArmyRemoval();
|
|
|
|
|
|
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;
|