1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Seer Huts with exp / gold rewards.

This commit is contained in:
DjWarmonger
2015-03-01 09:46:09 +01:00
parent dd887eb929
commit 67ab90616d
2 changed files with 84 additions and 32 deletions

View File

@@ -389,10 +389,10 @@ void CQuest::getCompletionText (MetaString &iwText, std::vector<Component> &comp
CGSeerHut::CGSeerHut() : IQuestObject() CGSeerHut::CGSeerHut() : IQuestObject()
{ {
obj->quest->lastDay = -1; quest->lastDay = -1;
obj->quest->isCustomFirst = false; quest->isCustomFirst = false;
obj->quest->isCustomNext = false; quest->isCustomNext = false;
obj->quest->isCustomComplete = false; quest->isCustomComplete = false;
} }
void CGSeerHut::setObjToKill() void CGSeerHut::setObjToKill()

View File

@@ -2283,11 +2283,10 @@ void CRmgTemplateZone::addAllPossibleObjects(CMapGenerator* gen)
{ {
seerHutsPerType = 1; seerHutsPerType = 1;
} }
oi.maxPerZone = seerHutsPerType;
RandomGeneratorUtil::randomShuffle(creatures, gen->rand); RandomGeneratorUtil::randomShuffle(creatures, gen->rand);
for (int loops = 0; loops < seerHutsPerType; loops++) //in case there are many arties available
{
for (int i = 0; i < std::min<int>(creatures.size(), questArtsRemaining - genericSeerHuts); i++) for (int i = 0; i < std::min<int>(creatures.size(), questArtsRemaining - genericSeerHuts); i++)
{ {
auto creature = creatures[i]; auto creature = creatures[i];
@@ -2321,6 +2320,59 @@ void CRmgTemplateZone::addAllPossibleObjects(CMapGenerator* gen)
oi.probability = 3; oi.probability = 3;
possibleObjects.push_back(oi); possibleObjects.push_back(oi);
} }
static int seerExpGold[] = { 5000, 10000, 15000, 20000 };
static int seerValues[] = { 2000, 5333, 8666, 12000};
for (int i = 0; i < 4; i++) //seems that code for exp and gold reward is similiar
{
int randomAppearance = *RandomGeneratorUtil::nextItem(VLC->objtypeh->knownSubObjects(Obj::SEER_HUT), gen->rand);
oi.setTemplate(Obj::SEER_HUT, randomAppearance, terrainType);
oi.value = seerValues[i];
oi.probability = 10;
oi.generateObject = [i, randomAppearance, gen]() -> CGObjectInstance *
{
auto obj = new CGSeerHut();
obj->ID = Obj::SEER_HUT;
obj->subID = randomAppearance;
obj->rewardType = CGSeerHut::EXPERIENCE;
obj->rID = 0; //unitialized?
obj->rVal = seerExpGold[i];
obj->quest->missionType = CQuest::MISSION_ART;
ArtifactID artid = *RandomGeneratorUtil::nextItem(gen->getQuestArtsRemaning(), gen->rand);
obj->quest->m5arts.push_back(artid);
gen->banQuestArt(artid);
gen->map->addQuest(obj);
return obj;
//TODO: place required artifact in next zone
};
possibleObjects.push_back(oi);
oi.generateObject = [i, randomAppearance, gen]() -> CGObjectInstance *
{
auto obj = new CGSeerHut();
obj->ID = Obj::SEER_HUT;
obj->subID = randomAppearance;
obj->rewardType = CGSeerHut::RESOURCES;
obj->rID = Res::GOLD;
obj->rVal = seerExpGold[i];
obj->quest->missionType = CQuest::MISSION_ART;
ArtifactID artid = *RandomGeneratorUtil::nextItem(gen->getQuestArtsRemaning(), gen->rand);
obj->quest->m5arts.push_back(artid);
gen->banQuestArt(artid);
gen->map->addQuest(obj);
return obj;
//TODO: place required artifact in next zone
};
possibleObjects.push_back(oi);
} }
} }