mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Fixed a bug where Retro mode made you 10x luckier
This commit is contained in:
parent
e962f645b6
commit
87f84a5f66
@ -216,7 +216,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
protected String[] calculateAbilityDisplayValues(float skillValue, SubSkillType subSkill, boolean isLucky) {
|
||||
int maxBonusLevel = AdvancedConfig.getInstance().getMaxBonusLevel(subSkill);
|
||||
int maxBonusLevel = Config.getInstance().getIsRetroMode() ? AdvancedConfig.getInstance().getMaxBonusLevel(subSkill) * 10 : AdvancedConfig.getInstance().getMaxBonusLevel(subSkill);
|
||||
|
||||
return calculateAbilityDisplayValues((AdvancedConfig.getInstance().getMaxChance(subSkill) / maxBonusLevel) * Math.min(skillValue, maxBonusLevel), isLucky);
|
||||
}
|
||||
|
@ -246,7 +246,6 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
*/
|
||||
|
||||
/* General Settings */
|
||||
|
||||
public boolean getIsMetricsEnabled() { return config.getBoolean("Metrics.bstats", true); }
|
||||
|
||||
//Retro mode will default the value to true if the config file doesn't contain the entry (server is from a previous mcMMO install)
|
||||
|
@ -62,10 +62,16 @@ public class SkillUtils {
|
||||
public static String[] calculateAbilityDisplayValues(float skillValue, SubSkillType subSkillType, boolean isLucky) {
|
||||
int maxBonusLevel = AdvancedConfig.getInstance().getMaxBonusLevel(subSkillType);
|
||||
|
||||
if(Config.getInstance().getIsRetroMode())
|
||||
maxBonusLevel = maxBonusLevel * 10;
|
||||
|
||||
return calculateAbilityDisplayValues((AdvancedConfig.getInstance().getMaxChance(subSkillType) / maxBonusLevel) * Math.min(skillValue, maxBonusLevel), isLucky);
|
||||
}
|
||||
|
||||
public static String[] calculateAbilityDisplayValuesCustom(float skillValue, SubSkillType subSkillType, boolean isLucky, int maxBonusLevel, double maxChance) {
|
||||
if(Config.getInstance().getIsRetroMode())
|
||||
maxBonusLevel = maxBonusLevel * 10;
|
||||
|
||||
return calculateAbilityDisplayValues((maxChance / maxBonusLevel) * Math.min(skillValue, maxBonusLevel), isLucky);
|
||||
}
|
||||
|
||||
@ -259,12 +265,18 @@ public class SkillUtils {
|
||||
* @return true if random chance succeeds and the event isn't cancelled
|
||||
*/
|
||||
private static boolean performRandomSkillCheck(SubSkillType subSkillType, Player player, int skillLevel, int activationChance, double maxChance, int maxLevel) {
|
||||
if(Config.getInstance().getIsRetroMode())
|
||||
maxLevel = maxLevel * 10;
|
||||
|
||||
double chance = (maxChance / maxLevel) * Math.min(skillLevel, maxLevel) / activationChance;
|
||||
return performRandomSkillCheckStatic(subSkillType, player, activationChance, chance);
|
||||
}
|
||||
|
||||
/* NEW VERSION */
|
||||
private static boolean performRandomSkillCheck(AbstractSubSkill abstractSubSkill, Player player, int skillLevel, int activationChance, double maxChance, int maxLevel) {
|
||||
if(Config.getInstance().getIsRetroMode())
|
||||
maxLevel = maxLevel * 10;
|
||||
|
||||
double chance = (maxChance / maxLevel) * Math.min(skillLevel, maxLevel) / activationChance;
|
||||
return performRandomSkillCheckStatic(abstractSubSkill, player, activationChance, chance);
|
||||
}
|
||||
@ -326,10 +338,8 @@ public class SkillUtils {
|
||||
*/
|
||||
public static boolean isActivationSuccessfulCustom(Player player, AbstractSubSkill abstractSubSkill, double maxChance, int maxBonusLevel)
|
||||
{
|
||||
|
||||
int skillLevel = UserManager.getPlayer(player).getSkillLevel(abstractSubSkill.getPrimarySkill());
|
||||
|
||||
|
||||
return performRandomSkillCheck(abstractSubSkill, player, skillLevel, PerksUtils.handleLuckyPerks(player, abstractSubSkill.getPrimarySkill()), maxChance, maxBonusLevel);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user