mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Visions spell in case of monsters
This commit is contained in:
parent
36cdb2968b
commit
2156204306
@ -101,7 +101,33 @@ std::string CGCreature::getHoverText(PlayerColor player) const
|
||||
|
||||
std::string CGCreature::getHoverText(const CGHeroInstance * hero) const
|
||||
{
|
||||
std::string hoverName = getHoverText(hero->tempOwner);
|
||||
//VISIONS spell support
|
||||
|
||||
static const std::string cached = boost::to_string((boost::format("type_%d__subtype_0") % Bonus::VISIONS));
|
||||
|
||||
std::string hoverName;
|
||||
|
||||
const int visionsMultiplier = hero->valOfBonuses(Selector::typeSubtype(Bonus::VISIONS,0), cached);
|
||||
|
||||
int visionsRadius = visionsMultiplier * hero->getPrimSkillLevel(PrimarySkill::SPELL_POWER);
|
||||
|
||||
if (visionsMultiplier > 0)
|
||||
vstd::amin(visionsRadius, 3); //minimum range is 3 tiles, but only if VISIONS bonus present
|
||||
|
||||
const bool inVisionsRange = (pos.dist2d(hero->pos) < visionsRadius) && (pos.z == hero->pos.z);
|
||||
|
||||
if(inVisionsRange)
|
||||
{
|
||||
MetaString ms;
|
||||
ms << stacks.begin()->second->count;
|
||||
ms << " " ;
|
||||
ms.addTxt(MetaString::CRE_PL_NAMES,subID);
|
||||
ms.toString(hoverName);
|
||||
}
|
||||
else
|
||||
{
|
||||
hoverName = getHoverText(hero->tempOwner);
|
||||
}
|
||||
|
||||
const JsonNode & texts = VLC->generaltexth->localizedTexts["adventureMap"]["monsterThreat"];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user