DjWarmonger 15 tahun lalu
induk
melakukan
2ec775cb46
2 mengubah file dengan 7 tambahan dan 13 penghapusan
  1. 5 11
      hch/CObjectHandler.cpp
  2. 2 2
      lib/CGameState.cpp

+ 5 - 11
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<CCreature*>::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<std::pair<ui8,ui8> >::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)

+ 2 - 2
lib/CGameState.cpp

@@ -1960,12 +1960,12 @@ UpgradeInfo CGameState::getUpgradeInfo(const CStackInstance &stack)
 	if(stack.armyObj->ID == TOWNI_TYPE)
 		t = static_cast<const CGTownInstance *>(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));