1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Properly calculate experience on altar

This commit is contained in:
Piotr Wójcik 2017-10-14 22:10:59 +02:00
parent f145b4be91
commit f9ed952869
2 changed files with 4 additions and 2 deletions

View File

@ -1450,7 +1450,7 @@ void CAltarWindow::updateRight(CTradeableItem *toUpdate)
{
int val = sacrificedUnits[toUpdate->serial];
toUpdate->setType(val ? CREATURE : CREATURE_PLACEHOLDER);
toUpdate->subtitle = val ? boost::str(boost::format(CGI->generaltexth->allTexts[122]) % boost::lexical_cast<std::string>(val * expPerUnit[toUpdate->serial])) : ""; //%s exp
toUpdate->subtitle = val ? boost::str(boost::format(CGI->generaltexth->allTexts[122]) % boost::lexical_cast<std::string>(hero->calculateXp(val * expPerUnit[toUpdate->serial]))) : ""; //%s exp
}
int CAltarWindow::firstFreeSlot()
@ -1495,6 +1495,7 @@ void CAltarWindow::showAll(SDL_Surface * to)
int dmp, val;
market->getOffer(arts->commonInfo->src.art->artType->id, 0, dmp, val, EMarketMode::ARTIFACT_EXP);
val = hero->calculateXp(val);
printAtMiddleLoc(boost::lexical_cast<std::string>(val), 304, 498, FONT_SMALL, Colors::WHITE, to);
}
}
@ -1520,6 +1521,7 @@ bool CAltarWindow::putOnAltar(CTradeableItem* altarSlot, const CArtifactInstance
int dmp, val;
market->getOffer(art->artType->id, 0, dmp, val, EMarketMode::ARTIFACT_EXP);
val = hero->calculateXp(val);
arts->artifactsOnAltar.insert(art);
altarSlot->setArtInstance(art);

View File

@ -5467,7 +5467,7 @@ bool CGameHandler::sacrificeArtifact(const IMarket * m, const CGHeroInstance * h
int expSum = 0;
auto finish = [this, &hero, &expSum]()
{
changePrimSkill(hero, PrimarySkill::EXPERIENCE, expSum);
changePrimSkill(hero, PrimarySkill::EXPERIENCE, hero->calculateXp(expSum));
};
for (int i = 0; i < slot.size(); ++i)