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

* improved campaign handling - bonus selection screen is mostly functional

* preliminary support for giving campaign bonuses (resources and spells, artifacts, skills for generated hero are given)
* differing the amount of resources given to AI and human players
* minor changes
This commit is contained in:
mateuszb
2010-07-31 13:55:05 +00:00
parent 1338340027
commit c06de1f1ce
15 changed files with 232 additions and 87 deletions

View File

@ -77,31 +77,7 @@ DLL_EXPORT void SetPrimSkill::applyGs( CGameState *gs )
DLL_EXPORT void SetSecSkill::applyGs( CGameState *gs )
{
CGHeroInstance *hero = gs->getHero(id);
if(hero->getSecSkillLevel(which) == 0)
{
hero->secSkills.push_back(std::pair<int,int>(which, val));
hero->updateSkill(which, val);
}
else
{
for (unsigned i=0; i<hero->secSkills.size(); i++)
{
if(hero->secSkills[i].first == which)
{
if(abs)
hero->secSkills[i].second = val;
else
hero->secSkills[i].second += val;
if(hero->secSkills[i].second > 3) //workaround to avoid crashes when same sec skill is given more than once
{
tlog1 << "Warning: Skill " << which << " increased over limit! Decreasing to Expert.\n";
hero->secSkills[i].second = 3;
}
hero->updateSkill(which, hero->secSkills[i].second); //when we know final value
}
}
}
hero->setSecSkillLevel(which, val, abs);
}
DLL_EXPORT void HeroVisitCastle::applyGs( CGameState *gs )