1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

vcmi: skill-agnostic resistance

Uses exiting bonus and new PERCENT_TO_TARGET_TYPE value type
This commit is contained in:
Konstantin
2023-02-17 01:19:43 +03:00
parent 6e4372176a
commit 34a26580a7
10 changed files with 15 additions and 55 deletions

View File

@ -745,11 +745,6 @@ int CStackInstance::getLevel() const
si32 CStackInstance::magicResistance() const
{
si32 val = valOfBonuses(Selector::type()(Bonus::MAGIC_RESISTANCE));
if (const CGHeroInstance * hero = dynamic_cast<const CGHeroInstance *>(_armyObj))
{
//resistance skill
val += hero->valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::RESISTANCE);
}
vstd::amin (val, 100);
return val;
}
@ -792,15 +787,7 @@ void CStackInstance::setType(const CCreature *c)
}
std::string CStackInstance::bonusToString(const std::shared_ptr<Bonus>& bonus, bool description) const
{
if(Bonus::MAGIC_RESISTANCE == bonus->type)
{
return "";
}
else
{
return VLC->getBth()->bonusToString(bonus, this, description);
}
return VLC->getBth()->bonusToString(bonus, this, description);
}
std::string CStackInstance::bonusToGraphics(const std::shared_ptr<Bonus>& bonus) const