From bb64221c6b36cdb59a9a1c0c35506b21f3996c8d Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 23 Jan 2019 16:44:51 -0800 Subject: [PATCH] Fixing some issues with the new skill system and retro mode --- .../commands/skills/AcrobaticsCommand.java | 17 ++++++++++------- .../gmail/nossr50/config/AdvancedConfig.java | 7 ++++++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java index fac1f0415..9e90bbbbb 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java @@ -57,19 +57,22 @@ public class AcrobaticsCommand extends SkillCommand { if(abstractSubSkill != null) { - double maxBonusLevel = Config.getInstance().getIsRetroMode() ? AdvancedConfig.getInstance().getMaxBonusLevel(abstractSubSkill) * 10 : AdvancedConfig.getInstance().getMaxBonusLevel(abstractSubSkill); + double maxBonusLevel = AdvancedConfig.getInstance().getMaxBonusLevel(abstractSubSkill); double maxChance = AdvancedConfig.getInstance().getMaxChance(abstractSubSkill); double rollChance = SkillUtils.getChanceOfSuccess(skillValue, maxBonusLevel, maxChance); double graceChance = SkillUtils.getChanceOfSuccess(skillValue, maxBonusLevel, maxChance / 2); - String rollChanceLucky = isLucky ? percent.format(Math.min(rollChance * 1.3333D, 100.0D) / 100.0D) : null; - String graceChanceLucky = isLucky ? percent.format(Math.min(rollChance * 1.3333D, 100.0D) / 100.0D) : null; + rollChance = Math.min(100.0D, rollChance); + graceChance = Math.min(100.0D, graceChance); + String rollChanceLucky = isLucky ? percent.format(Math.min(100.0D, (rollChance * 1.3333D) / 100.0D)) : null; + String graceChanceLucky = isLucky ? percent.format(Math.min(100.0D, (graceChance * 1.3333D) / 100.0D)) : null; - messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, percent.format(rollChance)) - + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", rollChanceLucky) : "")); - messages.add(getStatMessage(true, false, SubSkillType.ACROBATICS_ROLL, percent.format(graceChance)) - + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", graceChanceLucky) : "")); + messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, percent.format(rollChance) + + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", rollChanceLucky) : ""))); + + messages.add(getStatMessage(true, false, SubSkillType.ACROBATICS_ROLL, percent.format(graceChance) + + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", graceChanceLucky) : ""))); } } diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index ad6a14c31..72c8f99e8 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -711,7 +711,12 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public double getMaxChance(SubSkillType subSkillType) { return config.getDouble(subSkillType.getAdvConfigAddress() + ".ChanceMax", 100.0D);} public int getMaxBonusLevel(AbstractSubSkill abstractSubSkill) { - return config.getInt("Skills."+abstractSubSkill.getPrimaryKeyName()+"."+abstractSubSkill.getConfigKeyName()+".MaxBonusLevel"); + int maxBonusLevel = config.getInt("Skills."+abstractSubSkill.getPrimaryKeyName()+"."+abstractSubSkill.getConfigKeyName()+".MaxBonusLevel"); + + if(mcMMO.isRetroModeEnabled()) + maxBonusLevel *= 10; + + return maxBonusLevel; } public double getMaxChance(AbstractSubSkill abstractSubSkill)