Magic resistance is applied to effects without a magnitude
Continuation of #8539, taking #2321 (comment 2536610826) into consideration.
MWMechanics::getEffectResistance appears to match the research https://wiki.openmw.org/index.php?title=Research:Magic#Magic_resistance but yields non-vanilla effects.
If x <= 0 so x is set to 0, the final value of x can still be non-zero due to resistance being factored in. This means that resistance is applied twice, but the second application is unlikely to be meaningful. It also means that a character with 10% magicka resistance will be silenced for 0.9 points, making GetSilence return 0. This is not the case in Morrowind.exe where the saved stat is an int and GetSilence will return 1 even if the player has 50% magicka resistance.
The research notes that the resistance value is stored separately in what we'd probably call ESM::ActiveEffect. It seems likely to me that that value is discarded or disregarded for NoMagnitude effects.
We should probably change the code to
float roll = Misc::Rng::rollClosedProbability(prng) * 100;
if (magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude)
{
roll -= resistance;
if (x <= roll)
return 0;
return 100;
}
if (x <= roll)
x = 0;
else
x = roll / std::min(x, 100.f);
x = std::min(x + resistance, 100.f);
return x;