diff --git a/hch/CObjectHandler.cpp b/hch/CObjectHandler.cpp index 1f4dae5e8..3e6facda3 100644 --- a/hch/CObjectHandler.cpp +++ b/hch/CObjectHandler.cpp @@ -846,8 +846,8 @@ void CGHeroInstance::initHero() boost::algorithm::replace_first(hoverName,"%s",name); boost::algorithm::replace_first(hoverName,"%s", type->heroClass->name); - if(mana < 0) - mana = manaLimit(); //after all bonuses are taken into account + if (mana < 0) + mana = manaLimit(); } void CGHeroInstance::initArmy(CCreatureSet *dst /*= NULL*/) @@ -1135,14 +1135,6 @@ void CGHeroInstance::initObj() bonus.subtype = PrimarySkill::DEFENSE; break; } -// for (std::vector::iterator i = VLC->creh->creatures.begin(); i != VLC->creh->creatures.end(); i++) -// { //TODO: what if creature changes type during the game (Dragon Eye Ring?) -// if ((*i)->hasBonusOfType(Bonus::DRAGON_NATURE)) //TODO: implement it! -// { -// bonus.limiter = new CCreatureTypeLimiter (**i, false); -// speciality.bonuses.push_back (bonus); -// } -// } bonus.limiter = new HasAnotherBonusLimiter(Bonus::DRAGON_NATURE); speciality.bonuses.push_back (bonus); break; @@ -1154,6 +1146,8 @@ void CGHeroInstance::initObj() for (std::vector >::iterator it = secSkills.begin(); it != secSkills.end(); it++) updateSkill(it->first, it->second); UpdateSpeciality(); + + mana = manaLimit(); //after all bonuses are taken into account, make sure this line is the last one } void CGHeroInstance::UpdateSpeciality() { @@ -4828,7 +4822,7 @@ void CGPandoraBox::giveContents( const CGHeroInstance *h, bool afterBattle ) con if(gainedExp || changesPrimSkill || abilities.size()) { - int expVal = gainedExp*(100+h->getSecSkillLevel(21)*5)/100.0f; + expType expVal = gainedExp*(100+h->getSecSkillLevel(21)*5)/100.0f; getText(iw,afterBattle,175,h); if(expVal) diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index c5a36dac0..8ade9e7b8 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -1960,12 +1960,12 @@ UpgradeInfo CGameState::getUpgradeInfo(const CStackInstance &stack) if(stack.armyObj->ID == TOWNI_TYPE) t = static_cast(stack.armyObj); else if(h) - { //TODO: check if hero specialty makes some upgrades possible + { //hero speciality BonusList lista = h->speciality.getBonuses(Selector::typeSybtype(Bonus::SPECIAL_UPGRADE, base->idNumber)); for (BonusList::iterator it = lista.begin(); it != lista.end(); it++) { ui16 nid = it->additionalInfo; - if (nid != base->idNumber) //sharpshooter appears to be default upgrade of minor creatures (?) + if (nid != base->idNumber) //in very specific case the upgrade is avaliable by default (?) { ret.newID.push_back(nid); ret.cost.push_back(costDiff(VLC->creh->creatures[nid]->cost, base->cost));