diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index a8872e567..4d829ab5a 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -1212,7 +1212,7 @@ const CCampaignScenario * CGameState::getCampaignScenarioForCrossoverHeroes() co std::vector CGameState::prepareCrossoverHeroes(const CCampaignScenario * campaignScenario) { - auto crossoverHeroes = campaignScenario->crossoverHeroes; //TODO check if hero instances need to be copied + auto crossoverHeroes = campaignScenario->crossoverHeroes; //TODO hero instances need to be copied, warning not trivial const auto & travelOptions = campaignScenario->travelOptions; if (!(travelOptions.whatHeroKeeps & 1)) @@ -2767,8 +2767,6 @@ std::vector > CGameState::generateC nh->initHeroDefInfo(); campaignHeroReplacements.push_back(std::make_pair(nh, gid)); } - - //TODO delete hero placeholder } } } diff --git a/lib/CObjectHandler.cpp b/lib/CObjectHandler.cpp index 155c20be4..33fb40943 100644 --- a/lib/CObjectHandler.cpp +++ b/lib/CObjectHandler.cpp @@ -1364,7 +1364,8 @@ void CGHeroInstance::setPropertyDer( ui8 what, ui32 val ) double CGHeroInstance::getHeroStrength() const { - return sqrt((1.0 + 0.05*getPrimSkillLevel(PrimarySkill::ATTACK)) * (1.0 + 0.05*getPrimSkillLevel(PrimarySkill::DEFENSE))); + return sqrt((1.0 + 0.05*getPrimSkillLevel(PrimarySkill::ATTACK)) * (1.0 + 0.05*getPrimSkillLevel(PrimarySkill::DEFENSE)) * + (1.0 + 0.05*getPrimSkillLevel(PrimarySkill::KNOWLEDGE)) * (1.0 + 0.05*getPrimSkillLevel(PrimarySkill::SPELL_POWER))); } ui64 CGHeroInstance::getTotalStrength() const diff --git a/lib/CObjectHandler.h b/lib/CObjectHandler.h index 470b6594d..7d896c900 100644 --- a/lib/CObjectHandler.h +++ b/lib/CObjectHandler.h @@ -378,7 +378,6 @@ public: } } skillsInfo; - //BonusList bonuses; ////////////////////////////////////////////////////////////////////////// diff --git a/lib/mapping/CCampaignHandler.cpp b/lib/mapping/CCampaignHandler.cpp index 752a215af..cd6d840f8 100644 --- a/lib/mapping/CCampaignHandler.cpp +++ b/lib/mapping/CCampaignHandler.cpp @@ -329,7 +329,7 @@ const CGHeroInstance * CCampaignScenario::strongestHero( PlayerColor owner ) con auto ownedHeroes = crossoverHeroes | filtered(isOwned); auto i = vstd::maxElementByFun(ownedHeroes, - [](const CGHeroInstance * h) {return h->getTotalStrength();}); + [](const CGHeroInstance * h) {return h->getHeroStrength();}); return i == ownedHeroes.end() ? nullptr : *i; } diff --git a/lib/mapping/CCampaignHandler.h b/lib/mapping/CCampaignHandler.h index 05ce83469..945096769 100644 --- a/lib/mapping/CCampaignHandler.h +++ b/lib/mapping/CCampaignHandler.h @@ -108,11 +108,10 @@ public: SScenarioPrologEpilog prolog, epilog; CScenarioTravel travelOptions; - std::vector crossoverHeroes; // contains all heroes with the same state when the camapign scenario was finished + std::vector crossoverHeroes; // contains all heroes with the same state when the campaign scenario was finished const CGHeroInstance * strongestHero(PlayerColor owner) const; void loadPreconditionRegions(ui32 regions); - void prepareCrossoverHeroes(std::vector heroes); bool isNotVoid() const; template void serialize(Handler &h, const int formatVersion)