1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

- Updated TODOs, removed unused method declaration, updated comments

- Fixed hero strength calculation (power, knowledge should be included as well)
This commit is contained in:
beegee1 2013-12-30 20:04:24 +00:00
parent 9d0387140f
commit a03d01bd3f
5 changed files with 5 additions and 8 deletions

View File

@ -1212,7 +1212,7 @@ const CCampaignScenario * CGameState::getCampaignScenarioForCrossoverHeroes() co
std::vector<CGHeroInstance *> 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<std::pair<CGHeroInstance*, ObjectInstanceID> > CGameState::generateC
nh->initHeroDefInfo();
campaignHeroReplacements.push_back(std::make_pair(nh, gid));
}
//TODO delete hero placeholder
}
}
}

View File

@ -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

View File

@ -378,7 +378,6 @@ public:
}
} skillsInfo;
//BonusList bonuses;
//////////////////////////////////////////////////////////////////////////

View File

@ -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;
}

View File

@ -108,11 +108,10 @@ public:
SScenarioPrologEpilog prolog, epilog;
CScenarioTravel travelOptions;
std::vector<CGHeroInstance *> crossoverHeroes; // contains all heroes with the same state when the camapign scenario was finished
std::vector<CGHeroInstance *> 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<CGHeroInstance *> heroes);
bool isNotVoid() const;
template <typename Handler> void serialize(Handler &h, const int formatVersion)