diff --git a/Changelog.txt b/Changelog.txt index cdbf883b5..ee8d35dcf 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -42,7 +42,7 @@ Version 2.1.0 ! (Skills) Sword's Rupture now has a max chance to proc of 33% instead of 70% ! (Skills) Sword's Rupture now deals 50% more damage at above Rank 3 and can last much longer! The base damage for Bleed has been increased as well (update your advanced.yml admins) ! (Skills) Sword's Rupture no longer triggers invincibility frames when damaging your opponent - + (Skills) Ability Lengths now have a default skill cap at which they stop increasing in length, configurable in advanced.yml + + (Skills) Ability Lengths now have a default skill cap at which they stop increasing in length, configurable in advanced.yml (endurance perks extend this limit) + (Skills) Added a new subskill to some skills 'Understanding The Art' this adds nothing new, but tracks benefits that increase together that seemed unrelated, which was previously a bit obfuscated. + (Skills) Tool alerts now are sent to the Action Bar + (Skills) Super Ability activation alerts are now sent to the Action Bar diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java index 104eda7f4..430adb4ca 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java @@ -64,7 +64,7 @@ public abstract class SkillCommand implements TabExecutor { float skillValue = mcMMOPlayer.getSkillLevel(skill); //Send the players a few blank lines to make finding the top of the skill command easier - for(int i = 0; i < 20; i++) + for(int i = 0; i < 19; i++) { player.sendMessage(""); } @@ -227,16 +227,26 @@ public abstract class SkillCommand implements TabExecutor { } protected String[] calculateAbilityDisplayValues(float skillValue, SubSkillType subSkill, boolean isLucky) { - int maxBonusLevel = Config.getInstance().getIsRetroMode() ? AdvancedConfig.getInstance().getMaxBonusLevel(subSkill) * 10 : AdvancedConfig.getInstance().getMaxBonusLevel(subSkill); + int maxBonusLevel = AdvancedConfig.getInstance().getMaxBonusLevel(subSkill); return calculateAbilityDisplayValues((AdvancedConfig.getInstance().getMaxChance(subSkill) / maxBonusLevel) * Math.min(skillValue, maxBonusLevel), isLucky); } protected String[] calculateLengthDisplayValues(Player player, float skillValue) { int maxLength = skill.getAbility().getMaxLength(); - int abilityLengthVar = Config.getInstance().getIsRetroMode() ? AdvancedConfig.getInstance().getAbilityLengthRetro() : AdvancedConfig.getInstance().getAbilityLengthStandard(); - int abilityLengthCap = Config.getInstance().getIsRetroMode() ? AdvancedConfig.getInstance().getAbilityLengthCapRetro() : AdvancedConfig.getInstance().getAbilityLengthCapStandard(); - int length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar); + int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength(); + int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap(); + + int length; + + if(abilityLengthCap < 0) + { + length = 2 + (int) (skillValue / abilityLengthVar); + } + else { + length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar); + } + int enduranceLength = PerksUtils.handleActivationPerks(player, length, maxLength); if (maxLength != 0) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java index 45b4d3b6f..7a775baa2 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java @@ -43,7 +43,7 @@ public class SwordsCommand extends SkillCommand { // SWORDS_RUPTURE if (canBleed) { - bleedLength = (skillValue >= AdvancedConfig.getInstance().getMaxBonusLevel(SubSkillType.SWORDS_RUPTURE)) ? Swords.bleedMaxTicks : Swords.bleedBaseTicks; + bleedLength = UserManager.getPlayer(player).getSwordsManager().getBleedTicks(); String[] bleedStrings = calculateAbilityDisplayValues(skillValue, SubSkillType.SWORDS_RUPTURE, isLucky); bleedChance = bleedStrings[0]; diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 866d87eb5..cf499ab27 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -3,6 +3,7 @@ package com.gmail.nossr50.config; import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; +import com.gmail.nossr50.mcMMO; import net.md_5.bungee.api.ChatColor; import java.util.ArrayList; @@ -30,12 +31,8 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { List reason = new ArrayList(); /* GENERAL */ - if (getAbilityLengthRetro() < 1) { - reason.add("Skills.General.Ability.Length.RetroMode.IncreaseLevel should be at least 1!"); - } - - if (getAbilityLengthStandard() < 1) { - reason.add("Skills.General.Ability.Length.Standard.IncreaseLevel should be at least 1!"); + if (getAbilityLength() < 1) { + reason.add("Skills.General.Ability.Length..IncreaseLevel should be at least 1!"); } if (getEnchantBuff() < 1) { @@ -668,13 +665,49 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { /* GENERAL */ public int getStartingLevel() { return config.getInt("Skills.General.StartingLevel", 1); } - public int getAbilityLengthCapStandard() { return config.getInt("Skills.General.Ability.Length.Standard.Cap", 50); } - public int getAbilityLengthCapRetro() { return config.getInt("Skills.General.Ability.Length.RetroMode.Cap", 500); } - public int getAbilityLengthStandard() { return config.getInt("Skills.General.Ability.Length.Standard.IncreaseLevel", 5); } - public int getAbilityLengthRetro() { return config.getInt("Skills.General.Ability.Length.RetroMode.IncreaseLevel", 50); } + + /** + * This returns the maximum level at which superabilities will stop lengthening from scaling alongside skill level. + * It returns a different value depending on whether or not the server is in retro mode + * @return the level at which abilities stop increasing in length + */ + public int getAbilityLengthCap() { + if(!mcMMO.isRetroModeEnabled()) + return config.getInt("Skills.General.Ability.Length.Standard.Cap", 50); + else + return config.getInt("Skills.General.Ability.Length.RetroMode.Cap", 500); + } + + /** + * This returns the frequency at which abilities will increase in length + * It returns a different value depending on whether or not the server is in retro mode + * @return the number of levels required per ability length increase + */ + public int getAbilityLength() { + if(!mcMMO.isRetroModeEnabled()) + return config.getInt("Skills.General.Ability.Length.Standard.IncreaseLevel", 5); + else + return config.getInt("Skills.General.Ability.Length.RetroMode.IncreaseLevel", 50); + } + public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); } - public int getMaxBonusLevel(SubSkillType subSkillType) { return config.getInt(subSkillType.getAdvConfigAddress() + ".MaxBonusLevel"); } + /** + * Grabs the max bonus level for a skill used in RNG calculations + * All max level values in the config are multiplied by 10 if the server is in retro mode as the values in the config are based around the new 1-100 skill system scaling + * A value of 10 in the file will be returned as 100 for retro mode servers to accommodate the change in scaling + * @param subSkillType target subskill + * @return the level at which this skills max benefits will be reached on the curve + */ + public int getMaxBonusLevel(SubSkillType subSkillType) { + int maxBonusLevel = config.getInt(subSkillType.getAdvConfigAddress() + ".MaxBonusLevel"); + + if(mcMMO.isRetroModeEnabled()) + maxBonusLevel *= 10; + + return maxBonusLevel; + } + public double getMaxChance(SubSkillType subSkillType) { return config.getDouble(subSkillType.getAdvConfigAddress() + ".ChanceMax", 100.0D);} public int getMaxBonusLevel(AbstractSubSkill abstractSubSkill) { @@ -886,7 +919,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { /* REPAIR */ public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D); } - public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 1000); } + public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 100); } /* Arcane Forging */ public int getArcaneForgingRankLevel(int rank) { return config.getInt("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + rank); } @@ -911,7 +944,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public double getArcaneSalvageExtractPartialEnchantsChance(int rank) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank); } /* SMELTING */ - public int getBurnModifierMaxLevel() { return config.getInt("Skills.Smelting.FuelEfficiency.MaxBonusLevel", 1000); } + public int getBurnModifierMaxLevel() { return config.getInt("Skills.Smelting.FuelEfficiency.MaxBonusLevel", 100); } public double getBurnTimeMultiplier() { return config.getDouble("Skills.Smelting.FuelEfficiency.Multiplier", 3.0D); } /*public int getFluxMiningUnlockLevel() { return config.getInt("Skills.Smelting.FluxMining.UnlockLevel", 250); }*/ @@ -925,7 +958,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public double getRuptureDamagePlayer() { return config.getDouble("Skills.Swords.Rupture.DamagePlayer", 1.0); } public double getRuptureDamageMobs() { return config.getDouble("Skills.Swords.Rupture.DamageMobs", 2.0); } - public int getRuptureMaxTicks() { return config.getInt("Skills.Swords.Rupture.MaxTicks", 3); } + public int getRuptureMaxTicks() { return config.getInt("Skills.Swords.Rupture.MaxTicks", 8); } public int getRuptureBaseTicks() { return config.getInt("Skills.Swords.Rupture.BaseTicks", 2); } public double getCounterModifier() { return config.getDouble("Skills.Swords.CounterAttack.DamageModifier", 2.0D); } diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index dc1f87976..c5adea085 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -818,9 +818,19 @@ public class McMMOPlayer { return; } - int abilityLengthVar = Config.getInstance().getIsRetroMode() ? AdvancedConfig.getInstance().getAbilityLengthRetro() : AdvancedConfig.getInstance().getAbilityLengthStandard(); - int abilityLengthCap = Config.getInstance().getIsRetroMode() ? AdvancedConfig.getInstance().getAbilityLengthCapRetro() : AdvancedConfig.getInstance().getAbilityLengthCapStandard(); - int ticks = PerksUtils.handleActivationPerks(player, 2 + (Math.min(abilityLengthCap, getSkillLevel(skill)) / abilityLengthVar), ability.getMaxLength()); + //These values change depending on whether or not the server is in retro mode + int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength(); + int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap(); + + int ticks; + + //Ability cap of 0 or below means no cap + if(abilityLengthCap > 0) + { + ticks = PerksUtils.handleActivationPerks(player, 2 + (Math.min(abilityLengthCap, getSkillLevel(skill)) / abilityLengthVar), ability.getMaxLength()); + } else { + ticks = PerksUtils.handleActivationPerks(player, 2 + (getSkillLevel(skill) / abilityLengthVar), ability.getMaxLength()); + } // Notify people that ability has been activated ParticleEffectUtils.playAbilityEnabledEffect(player); diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java index 88ca18ea6..11f015339 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java @@ -135,7 +135,6 @@ public class Roll extends AcrobaticsSubSkill implements RandomChance { * Graceful is double the odds of a normal roll */ String[] gracefulRollStrings = SkillUtils.calculateAbilityDisplayValuesCustom(skillValue, - SubSkillType.ACROBATICS_ROLL, isLucky, AdvancedConfig.getInstance().getMaxBonusLevel(this) / 2, AdvancedConfig.getInstance().getMaxChance(this)); diff --git a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java index 8fd4e1ba8..5c05fad9e 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java @@ -62,23 +62,27 @@ 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; - + public static String[] calculateAbilityDisplayValuesCustom(float skillValue, boolean isLucky, int maxBonusLevel, double maxChance) { return calculateAbilityDisplayValues((maxChance / maxBonusLevel) * Math.min(skillValue, maxBonusLevel), isLucky); } public static String[] calculateLengthDisplayValues(Player player, float skillValue, PrimarySkillType skill) { int maxLength = skill.getAbility().getMaxLength(); - int abilityLengthVar = Config.getInstance().getIsRetroMode() ? AdvancedConfig.getInstance().getAbilityLengthRetro() : AdvancedConfig.getInstance().getAbilityLengthStandard(); - int length = 2 + (int) (skillValue / abilityLengthVar); + int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength(); + int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap(); + + int length; + + if(abilityLengthCap > 0) + { + length = (int) Math.min(abilityLengthCap, 2 + (skillValue / abilityLengthVar)); + } else { + length = 2 + (int) (skillValue / abilityLengthVar); + } + int enduranceLength = PerksUtils.handleActivationPerks(player, length, maxLength); if (maxLength != 0) { @@ -187,9 +191,20 @@ public class SkillUtils { McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); PrimarySkillType skill = mcMMOPlayer.getAbilityMode(SuperAbilityType.SUPER_BREAKER) ? PrimarySkillType.MINING : PrimarySkillType.EXCAVATION; - int abilityLengthVar = Config.getInstance().getIsRetroMode() ? AdvancedConfig.getInstance().getAbilityLengthRetro() : AdvancedConfig.getInstance().getAbilityLengthStandard(); - int abilityLengthCap = Config.getInstance().getIsRetroMode() ? AdvancedConfig.getInstance().getAbilityLengthCapRetro() : AdvancedConfig.getInstance().getAbilityLengthCapStandard(); - int ticks = PerksUtils.handleActivationPerks(player, 2 + (Math.min(abilityLengthCap, mcMMOPlayer.getSkillLevel(skill)) / abilityLengthVar), skill.getAbility().getMaxLength()) * Misc.TICK_CONVERSION_FACTOR; + + int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength(); + int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap(); + + int ticks; + + if(abilityLengthCap > 0) + { + ticks = PerksUtils.handleActivationPerks(player, Math.min(abilityLengthCap, 2 + (mcMMOPlayer.getSkillLevel(skill) / abilityLengthVar)), + skill.getAbility().getMaxLength()) * Misc.TICK_CONVERSION_FACTOR; + } else { + ticks = PerksUtils.handleActivationPerks(player, 2 + ((mcMMOPlayer.getSkillLevel(skill)) / abilityLengthVar), + skill.getAbility().getMaxLength()) * Misc.TICK_CONVERSION_FACTOR; + } PotionEffect abilityBuff = new PotionEffect(PotionEffectType.FAST_DIGGING, duration + ticks, amplifier + 10); player.addPotionEffect(abilityBuff, true);