1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

General tweaking of specialities for general consistency.

Values now grow with level. Warning: they affect entire hero himself, not the specific type of creature.
This commit is contained in:
DjWarmonger
2010-07-08 19:10:26 +00:00
parent 94f7ee41e2
commit 24b47ce006
6 changed files with 208 additions and 149 deletions

View File

@@ -700,7 +700,45 @@ DLL_EXPORT void SetHoverName::applyGs( CGameState *gs )
DLL_EXPORT void HeroLevelUp::applyGs( CGameState *gs )
{
gs->getHero(heroid)->level = level;
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;
}
}
}
}
DLL_EXPORT void BattleStart::applyGs( CGameState *gs )