Browse Source

Secondary skill bonuses will now be correctly updated on level-up.

DjWarmonger 15 years ago
parent
commit
a8bb13cbcd
2 changed files with 3 additions and 3 deletions
  1. 1 2
      hch/CObjectHandler.cpp
  2. 2 1
      lib/NetPacksLib.cpp

+ 1 - 2
hch/CObjectHandler.cpp

@@ -615,8 +615,7 @@ int3 CGHeroInstance::getPosition(bool h3m) const //h3m=true - returns position o
 
 si32 CGHeroInstance::manaLimit() const
 {
-	double modifier = (100.0f + valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, 24)) / 100.0f;
-	return si32(10*getPrimSkillLevel(3)*modifier);
+	return si32(getPrimSkillLevel(3) * (100.0f + valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, 24)) / 10.0f);
 }
 //void CGHeroInstance::setPosition(int3 Pos, bool h3m) //as above, but sets position
 //{

+ 2 - 1
lib/NetPacksLib.cpp

@@ -80,6 +80,7 @@ DLL_EXPORT void SetSecSkill::applyGs( CGameState *gs )
 	if(hero->getSecSkillLevel(which) == 0)
 	{
 		hero->secSkills.push_back(std::pair<int,int>(which, val));
+		hero->updateSkill(which, val);
 	}
 	else
 	{
@@ -97,10 +98,10 @@ DLL_EXPORT void SetSecSkill::applyGs( CGameState *gs )
 					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->updateSkill(which, val);
 }
 
 DLL_EXPORT void HeroVisitCastle::applyGs( CGameState *gs )