L2JMobius

Public Development => Solved/Invalid Bug Reports => Topic started by: hexash14 on April 11, 2019, 07:23:34 PM

Title: CriticalRatePositionBonus makes positional critical rate negative
Post by: hexash14 on April 11, 2019, 07:23:34 PM
Hello, as the title says, sometimes the positional critical rate turns out to be negative. This happens (if I am not mistaken) when a skill that increases positional critical rate ends.

To solve this, the method "onExit" in  "scripts / handlers / effecthandlers / CriticalRatePositionBonus.java" needs to divide the same amount that was multiplied in the onStart method. So

This:
Code: [Select]
@Override
public void onExit(L2Character effector, L2Character effected, Skill skill)
{
effected.getStat().mergePositionTypeValue(Stats.CRITICAL_RATE, _position, (-_amount / 100) - 1, MathUtil::div);
}

Should be changed to this:
Code: [Select]
@Override
public void onExit(L2Character effector, L2Character effected, Skill skill)
{
effected.getStat().mergePositionTypeValue(Stats.CRITICAL_RATE, _position, (_amount / 100) + 1, MathUtil::div);
}

I didn't check all the sources in the free repository, but from the ones I checked all of them had the bug (from ertheia to etina's fate at least).
Title: Re: CriticalRatePositionBonus makes positional critical rate negative
Post by: Mobius on April 11, 2019, 08:15:20 PM
This is fixed on the private version.