Fixed probability bug Fixes #5055 Fixes #5054

This commit is contained in:
nossr50
2024-07-27 15:01:28 -07:00
parent 248116df21
commit e886a16388
5 changed files with 125 additions and 44 deletions

View File

@@ -41,7 +41,7 @@ public class ProbabilityUtil {
public static double chanceOfSuccessPercentage(@Nullable McMMOPlayer mmoPlayer,
@NotNull SubSkillType subSkillType,
boolean isLucky) {
Probability probability = getSubSkillProbability(subSkillType, mmoPlayer);
final Probability probability = getSubSkillProbability(subSkillType, mmoPlayer);
//Probability values are on a 0-1 scale and need to be "transformed" into a 1-100 scale
double percentageValue = probability.getValue(); //Doesn't need to be scaled
@@ -437,7 +437,7 @@ public class ProbabilityUtil {
return Probability.ofPercent(ceiling);
}
double odds = (skillLevel / maxBonusLevel) * 100D;
double odds = ((skillLevel / maxBonusLevel) * ceiling);
// make sure the odds aren't lower or higher than the floor or ceiling
return Probability.ofPercent(Math.min(Math.max(floor, odds), ceiling));