Code: Select all
float grossCastProbability = converter.getChancePercentSum(ef);
grossCastProbability = (float) Math.pow(grossCastProbability, numberOfTargetsAffecting);
probability = grossCastProbability * (1 - targets.resistance);
if (targets.resistance >= 1)
probability = 0;
and after:
Code: Select all
if (rndNum <= probability)
successful = true;
grossCastProbability: this contains the caster and effect probability sum
probability = grossCastProbability * (1 - targets.resistance); -> this means if target resistances are negative than probability CAN be more than 1.
for example:
1:
grossProbability = 50% (eg. conversion probability)
targets.resistance = 10%
probability = 0.5 * ( 1 - 0.1) = 0.45 -> 45% (NOT sure success!)
2:
grossProbability = 50% (eg. conversion probability)
targets.resistance = -30%
probability = 0.5 * ( 1 - (-0.3)) = 0.65 -> 65% (still NOT yet sure success!)
3:
grossProbability = 50% (eg. conversion probability)
targets.resistance = -120%
probability = 0.5 * ( 1 - (-1.2)) = 1.1 -> 110% (sure success!)