1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Take resources on quest completion instead of giving them

This commit is contained in:
Ivan Savenko 2024-06-17 20:18:34 +00:00
parent c68f2da977
commit 4e7809d934

View File

@ -141,6 +141,8 @@ bool CQuest::checkQuest(const CGHeroInstance * h) const
void CQuest::completeQuest(IGameCallback * cb, const CGHeroInstance *h) const void CQuest::completeQuest(IGameCallback * cb, const CGHeroInstance *h) const
{ {
// FIXME: this should be part of 'reward', and not hacking into limiter state that should only limit access to such reward
for(auto & elem : mission.artifacts) for(auto & elem : mission.artifacts)
{ {
if(h->hasArt(elem)) if(h->hasArt(elem))
@ -164,9 +166,9 @@ void CQuest::completeQuest(IGameCallback * cb, const CGHeroInstance *h) const
} }
} }
} }
cb->takeCreatures(h->id, mission.creatures); cb->takeCreatures(h->id, mission.creatures);
cb->giveResources(h->getOwner(), mission.resources); cb->giveResources(h->getOwner(), -mission.resources);
} }
void CQuest::addTextReplacements(IGameCallback * cb, MetaString & text, std::vector<Component> & components) const void CQuest::addTextReplacements(IGameCallback * cb, MetaString & text, std::vector<Component> & components) const