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:
@ -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
|
||||
|
Reference in New Issue
Block a user