1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Hero speciality in creatures (growing with level) is now ready.

Fixed Tree of Knowledge giving only 2^31 XP.
This commit is contained in:
DjWarmonger
2010-07-13 19:55:13 +00:00
parent 88e1636250
commit ab8e24c490
6 changed files with 55 additions and 68 deletions

View File

@ -707,42 +707,7 @@ DLL_EXPORT void HeroLevelUp::applyGs( CGameState *gs )
CGHeroInstance* h = gs->getHero(heroid);
h->level = level;
//speciality
if (h->speciality.growthsWithLevel)
{
std::vector<CCreature*>* creatures = &VLC->creh->creatures;
for (std::list<Bonus>::iterator it = h->speciality.bonuses.begin(); it != h->speciality.bonuses.end(); it++)
{
switch (it->type)
{
case Bonus::SECONDARY_SKILL_PREMY:
it->val = (h->speciality.valOfBonuses(Bonus::SPECIAL_SECONDARY_SKILL, it->subtype) *
h->valOfBonuses(Bonus::SECONDARY_SKILL_PREMY,it->subtype) * h->level)/100;
break;
case Bonus::PRIMARY_SKILL:
int creLevel = (*creatures)[it->additionalInfo]->level;
if(!creLevel)
{
if(it->additionalInfo == 146)
creLevel = 5; //treat ballista as 5-level
else
{
tlog2 << "Warning: unknown level of " << (*creatures)[it->val]->namePl << std::endl;
continue;
}
}
switch (it->subtype)
{
case 1:
it->val = (level * (*creatures)[it->additionalInfo]->attack)/creLevel /20;
break;
case 2:
it->val = (level * (*creatures)[it->additionalInfo]->defence)/creLevel /20;
break;
}
break;
}
}
}
h->UpdateSpeciality();
}
DLL_EXPORT void BattleStart::applyGs( CGameState *gs )