1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

CStack: make unicorns ability multiplicative

This commit is contained in:
Konstantin 2023-03-20 22:26:55 +03:00
parent f24ca6fbcf
commit 8c10f48fbd

View File

@ -93,7 +93,7 @@ ui32 CStack::level() const
si32 CStack::magicResistance() const
{
si32 magicResistance = IBonusBearer::magicResistance();
auto magicResistance = IBonusBearer::magicResistance();
si32 auraBonus = 0;
@ -102,10 +102,11 @@ si32 CStack::magicResistance() const
if(one->unitOwner() == owner)
vstd::amax(auraBonus, one->valOfBonuses(Bonus::SPELL_RESISTANCE_AURA)); //max value
}
magicResistance += auraBonus;
vstd::amin(magicResistance, 100);
vstd::abetween(auraBonus, 0, 100);
vstd::abetween(magicResistance, 0, 100);
float castChance = (100 - magicResistance) * (100 - auraBonus)/100.0;
return magicResistance;
return static_cast<si32>(100 - castChance);
}
BattleHex::EDir CStack::destShiftDir() const