From 8c10f48fbd9541e49c0bb3754640847e45ccfc4a Mon Sep 17 00:00:00 2001 From: Konstantin Date: Mon, 20 Mar 2023 22:26:55 +0300 Subject: [PATCH] CStack: make unicorns ability multiplicative --- lib/CStack.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/CStack.cpp b/lib/CStack.cpp index bf3283703..44439c615 100644 --- a/lib/CStack.cpp +++ b/lib/CStack.cpp @@ -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(100 - castChance); } BattleHex::EDir CStack::destShiftDir() const