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:
parent
9d0387140f
commit
a03d01bd3f
@ -1212,7 +1212,7 @@ const CCampaignScenario * CGameState::getCampaignScenarioForCrossoverHeroes() co
|
|||||||
|
|
||||||
std::vector<CGHeroInstance *> CGameState::prepareCrossoverHeroes(const CCampaignScenario * campaignScenario)
|
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;
|
const auto & travelOptions = campaignScenario->travelOptions;
|
||||||
|
|
||||||
if (!(travelOptions.whatHeroKeeps & 1))
|
if (!(travelOptions.whatHeroKeeps & 1))
|
||||||
@ -2767,8 +2767,6 @@ std::vector<std::pair<CGHeroInstance*, ObjectInstanceID> > CGameState::generateC
|
|||||||
nh->initHeroDefInfo();
|
nh->initHeroDefInfo();
|
||||||
campaignHeroReplacements.push_back(std::make_pair(nh, gid));
|
campaignHeroReplacements.push_back(std::make_pair(nh, gid));
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO delete hero placeholder
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1364,7 +1364,8 @@ void CGHeroInstance::setPropertyDer( ui8 what, ui32 val )
|
|||||||
|
|
||||||
double CGHeroInstance::getHeroStrength() const
|
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
|
ui64 CGHeroInstance::getTotalStrength() const
|
||||||
|
@ -378,7 +378,6 @@ public:
|
|||||||
}
|
}
|
||||||
} skillsInfo;
|
} skillsInfo;
|
||||||
|
|
||||||
//BonusList bonuses;
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ const CGHeroInstance * CCampaignScenario::strongestHero( PlayerColor owner ) con
|
|||||||
auto ownedHeroes = crossoverHeroes | filtered(isOwned);
|
auto ownedHeroes = crossoverHeroes | filtered(isOwned);
|
||||||
|
|
||||||
auto i = vstd::maxElementByFun(ownedHeroes,
|
auto i = vstd::maxElementByFun(ownedHeroes,
|
||||||
[](const CGHeroInstance * h) {return h->getTotalStrength();});
|
[](const CGHeroInstance * h) {return h->getHeroStrength();});
|
||||||
return i == ownedHeroes.end() ? nullptr : *i;
|
return i == ownedHeroes.end() ? nullptr : *i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,11 +108,10 @@ public:
|
|||||||
SScenarioPrologEpilog prolog, epilog;
|
SScenarioPrologEpilog prolog, epilog;
|
||||||
|
|
||||||
CScenarioTravel travelOptions;
|
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;
|
const CGHeroInstance * strongestHero(PlayerColor owner) const;
|
||||||
void loadPreconditionRegions(ui32 regions);
|
void loadPreconditionRegions(ui32 regions);
|
||||||
void prepareCrossoverHeroes(std::vector<CGHeroInstance *> heroes);
|
|
||||||
bool isNotVoid() const;
|
bool isNotVoid() const;
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int formatVersion)
|
template <typename Handler> void serialize(Handler &h, const int formatVersion)
|
||||||
|
Loading…
Reference in New Issue
Block a user