From 186ad2cd5919502cd50df621f46ff36e0db4309f Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 31 May 2019 01:45:57 -0700 Subject: [PATCH] Add MaximumProgressLevel interface and implementation --- .../gmail/nossr50/config/AdvancedConfig.java | 2 - .../config/hocon/skills/axes/ConfigAxes.java | 96 ++++++++++++++++--- .../skills/axes/ConfigAxesAxeMastery.java | 18 ++++ .../axes/ConfigAxesCriticalStrikes.java | 32 +++++++ .../skills/axes/ConfigAxesGreaterImpact.java | 7 ++ .../hocon/skills/axes/ConfigAxesImpact.java | 28 ++++++ .../skills/axes/ConfigAxesSkullSplitter.java | 18 ++++ .../AbstractMaximumProgressionLevel.java | 33 +++++++ .../properties/MaximumProgressionLevel.java | 25 +++++ .../com/gmail/nossr50/skills/axes/Axes.java | 13 --- 10 files changed, 243 insertions(+), 29 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesAxeMastery.java create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesCriticalStrikes.java create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesGreaterImpact.java create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesImpact.java create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesSkullSplitter.java create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/properties/AbstractMaximumProgressionLevel.java create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/properties/MaximumProgressionLevel.java diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 971393f70..d05439a94 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -641,8 +641,6 @@ public class AdvancedConfig extends ConfigValidated { return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, BONUS_DAMAGE); } - public double getImpactChance() { return config.getDouble("Skills.Axes.ArmorImpact.Chance", 25.0D); } - public double getImpactDurabilityDamageMultiplier() { return config.getDouble("Skills.Axes.ArmorImpact.DamagePerRank", 6.5D); } public double getArmorImpactMaxDurabilityDamage() { return getDoubleValue(SKILLS, AXES, ARMOR_IMPACT, MAX_PERCENTAGE_DURABILITY_DAMAGE); diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxes.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxes.java index 33be7d315..069d460f5 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxes.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxes.java @@ -5,28 +5,96 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; @ConfigSerializable public class ConfigAxes { - public static final double IMPACT_CHANCE_DEFAULT = 25.0D; - public static final double IMPACT_DURABILITY_MULTIPLIER_DEFAULT = 6.5D; - /* - public double getImpactChance() { return config.getDouble("Skills.Axes.ArmorImpact.Chance", 25.0D); } - public double getImpactDurabilityDamageMultiplier() { return config.getDouble("Skills.Axes.ArmorImpact.DamagePerRank", 6.5D); } + public static double getAxeMasteryRankDamageMultiplier() { + return axeMasteryRankDamageMultiplier; + } + + public double getImpactDamageMultiplier() { + return impactDamageMultiplier; + } + + public double getCriticalHitPVPModifier() { + return criticalHitPVPModifier; + } + + public double getCriticalHitPVEModifier() { + return criticalHitPVEModifier; + } + + public double getGreaterImpactBonusDamage() { + return greaterImpactBonusDamage; + } + + public double getGreaterImpactKnockbackMultiplier() { + return greaterImpactKnockbackMultiplier; + } + + + GreaterImpact: + # Chance: Chance of hitting with GreaterImpact, mobs are knocked backwards when successful + # KnockbackModifier: Velocity modifier of GreaterImpact hits, this determines how great the knockback is + # BonusDamage: Extra damage for GreaterImpact hits + Chance: 25.0 + KnockbackModifier: 1.5 + BonusDamage: 2.0 + ArmorImpact: + # Multiplied against the skill rank to determine how much damage to do + DamagePerRank: 6.5 + # IncreaseLevel: Every the durability damage goes up with 1 + # Chance: Chance of hitting with ArmorImpact + # MaxPercentageDurabilityDamage: Durability damage cap for ArmorImpact, 20% means that you can never destroy a piece of armor in less than 5 hits + Chance: 25.0 */ - @Setting(value = "Impact-Activation-Chance", comment = "Chance to activate the Impact skill, this is a static chance and does not change per rank of the skill." + - "\nDefault value: "+IMPACT_CHANCE_DEFAULT) - private double impactChance = IMPACT_CHANCE_DEFAULT; + @Setting(value = "Axe-Mastery") + private ConfigAxesAxeMastery configAxesAxeMastery = new ConfigAxesAxeMastery(); - @Setting(value = "Impact-Durability-Damage-Multiplier", comment = "The amount of durability damage done by Impact is multiplied by this number" + - "\nThe damage done by impact starts at 1 and increases by 1 every rank, this value is then multiplied by this variable to determine the durability damage done to armor." + - "\nDefault value: "+IMPACT_DURABILITY_MULTIPLIER_DEFAULT) - private double impactDurabilityDamageModifier = IMPACT_DURABILITY_MULTIPLIER_DEFAULT; + @Setting(value = "Critical-Strikes") + private ConfigAxesCriticalStrikes configAxesCriticalStrikes = new ConfigAxesCriticalStrikes(); + + @Setting(value = "Greater-Impact") + private ConfigAxesGreaterImpact configAxesGreaterImpact = new ConfigAxesGreaterImpact(); + + @Setting(value = "Impact") + private ConfigAxesImpact configAxesImpact = new ConfigAxesImpact(); + + @Setting(value = "Skull-Splitter") + private ConfigAxesSkullSplitter configAxesSkullSplitter = new ConfigAxesSkullSplitter(); + + public double getSkullSplitterDamageDivisor() { + return configAxesSkullSplitter.getSkullSplitterDamageDivisor(); + } + + public ConfigAxesAxeMastery getConfigAxesAxeMastery() { + return configAxesAxeMastery; + } + + public ConfigAxesCriticalStrikes getConfigAxesCriticalStrikes() { + return configAxesCriticalStrikes; + } + + public ConfigAxesGreaterImpact getConfigAxesGreaterImpact() { + return configAxesGreaterImpact; + } + + public ConfigAxesImpact getConfigAxesImpact() { + return configAxesImpact; + } + + public ConfigAxesSkullSplitter getConfigAxesSkullSplitter() { + return configAxesSkullSplitter; + } public double getImpactChance() { - return impactChance; + return configAxesImpact.getImpactChance(); } public double getImpactDurabilityDamageModifier() { - return impactDurabilityDamageModifier; + return configAxesImpact.getImpactDurabilityDamageModifier(); + } + + public double getAxeMasteryMultiplier() { + return configAxesAxeMastery.getAxeMasteryMultiplier(); } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesAxeMastery.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesAxeMastery.java new file mode 100644 index 000000000..c1c25add2 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesAxeMastery.java @@ -0,0 +1,18 @@ +package com.gmail.nossr50.config.hocon.skills.axes; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigAxesAxeMastery { + private static final double AXE_MASTERY_MULTIPLIER_DEFAULT = 1.0D; + + @Setting(value = "Axe-Mastery-Rank-Damage-Multiplier", comment = "This value is multiplied against the current rank of Axe Mastery to determine bonus damage." + + "\nWith the default config value of 1.0, at rank 4 a player will deal 4.0 extra damage with Axes (1.0 * 4)" + + "\nDefault Value: "+ AXE_MASTERY_MULTIPLIER_DEFAULT) + private double axeMasteryMultiplier = AXE_MASTERY_MULTIPLIER_DEFAULT; + + public double getAxeMasteryMultiplier() { + return axeMasteryMultiplier; + } +} diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesCriticalStrikes.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesCriticalStrikes.java new file mode 100644 index 000000000..becb5da73 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesCriticalStrikes.java @@ -0,0 +1,32 @@ +package com.gmail.nossr50.config.hocon.skills.axes; + +import com.gmail.nossr50.datatypes.skills.SubSkillType; +import com.gmail.nossr50.datatypes.skills.properties.AbstractMaximumProgressionLevel; +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigAxesCriticalStrikes { + + private static final double MAX_ACTIVATION_CHANCE_DEFAULT = 37.50D; + /* + CriticalStrikes: + # ChanceMax: Maximum chance of causing a critical hit when on or higher + # MaxBonusLevel: Level where of causing critical hits is reached + ChanceMax: 37.50 + MaxBonusLevel: + Standard: 100 + RetroMode: 1000 + # Damage modifier of critical hits for PVP / PVE, when causing a critical hit the damage gets multiplied by the modifier + PVP_Modifier: 1.5 + PVE_Modifier: 2.0 + */ + + @Setting(value = "Max-Activation-Chance", comment = "This is max percentage chance that is used to determine whether or not the ability is successful." + + "\nA value of 50.0 would mean at most the ability can only have a 50% chance to work at max skill level.") + double maxActivationChance = MAX_ACTIVATION_CHANCE_DEFAULT; + + @Setting(value = "Maximum-Level", comment = "This is the level at which full benefits for this skill will be reached." + + "\nProperties of this skill may or may not scale with level, but those that do will gradually increase until max level is achieved.") + AbstractMaximumProgressionLevel maximumProgressionLevel = new AbstractMaximumProgressionLevel(SubSkillType.AXES_CRITICAL_STRIKES, 100, 1000); +} diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesGreaterImpact.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesGreaterImpact.java new file mode 100644 index 000000000..056d8b5f7 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesGreaterImpact.java @@ -0,0 +1,7 @@ +package com.gmail.nossr50.config.hocon.skills.axes; + +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigAxesGreaterImpact { +} diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesImpact.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesImpact.java new file mode 100644 index 000000000..f4d46550f --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesImpact.java @@ -0,0 +1,28 @@ +package com.gmail.nossr50.config.hocon.skills.axes; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigAxesImpact { + + public static final double IMPACT_CHANCE_DEFAULT = 25.0D; + public static final double IMPACT_DURABILITY_MULTIPLIER_DEFAULT = 6.5D; + + @Setting(value = "Impact-Activation-Chance", comment = "Chance to activate the Impact skill, this is a static chance and does not change per rank of the skill." + + "\nDefault value: "+IMPACT_CHANCE_DEFAULT) + private double impactChance = IMPACT_CHANCE_DEFAULT; + + @Setting(value = "Impact-Durability-Damage-Multiplier", comment = "The amount of durability damage done by Impact is multiplied by this number" + + "\nThe damage done by impact starts at 1 and increases by 1 every rank, this value is then multiplied by this variable to determine the durability damage done to armor." + + "\nDefault value: "+IMPACT_DURABILITY_MULTIPLIER_DEFAULT) + private double impactDurabilityDamageModifier = IMPACT_DURABILITY_MULTIPLIER_DEFAULT; + + public double getImpactChance() { + return impactChance; + } + + public double getImpactDurabilityDamageModifier() { + return impactDurabilityDamageModifier; + } +} diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesSkullSplitter.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesSkullSplitter.java new file mode 100644 index 000000000..4d45b7e9f --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/axes/ConfigAxesSkullSplitter.java @@ -0,0 +1,18 @@ +package com.gmail.nossr50.config.hocon.skills.axes; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigAxesSkullSplitter { + + private static final double SKULL_SPLITTER_DAMAGE_DIVISOR_DEFAULT = 2.0D; + + @Setting(value = "Damage-Divisor", comment = "Damage dealt to targets by Skull Splitter will be divided by this number" + + "\nDefault value: "+SKULL_SPLITTER_DAMAGE_DIVISOR_DEFAULT) + private double skullSplitterDamageDivisor = SKULL_SPLITTER_DAMAGE_DIVISOR_DEFAULT; + + public double getSkullSplitterDamageDivisor() { + return skullSplitterDamageDivisor; + } +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/properties/AbstractMaximumProgressionLevel.java b/src/main/java/com/gmail/nossr50/datatypes/skills/properties/AbstractMaximumProgressionLevel.java new file mode 100644 index 000000000..97a8aef71 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/properties/AbstractMaximumProgressionLevel.java @@ -0,0 +1,33 @@ +package com.gmail.nossr50.datatypes.skills.properties; + +import com.gmail.nossr50.datatypes.skills.SubSkillType; + +public class AbstractMaximumProgressionLevel implements MaximumProgressionLevel { + + SubSkillType subSkillType; + + int standardMaxLevel; + int retroMaxLevel; + + public AbstractMaximumProgressionLevel(SubSkillType subSkillType, int standardMaxLevel, int retroMaxLevel) { + this.subSkillType = subSkillType; + this.standardMaxLevel = standardMaxLevel; + this.retroMaxLevel = retroMaxLevel; + } + + @Override + public SubSkillType getSubSkillType() { + return subSkillType; + } + + @Override + public int getRetroMaxLevel() { + return retroMaxLevel; + } + + @Override + public int getStandardMaxLevel() { + return standardMaxLevel; + } + +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/properties/MaximumProgressionLevel.java b/src/main/java/com/gmail/nossr50/datatypes/skills/properties/MaximumProgressionLevel.java new file mode 100644 index 000000000..d26553375 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/properties/MaximumProgressionLevel.java @@ -0,0 +1,25 @@ +package com.gmail.nossr50.datatypes.skills.properties; + +/** + * Represents the level at which skill properties for this skill that scale based on level will reach their maximum benefits + * If a player is this level or higher, they will have the full-power version of this skill + */ +public interface MaximumProgressionLevel extends SkillProperty { + /** + * The maximum level for this skill in Retro + * Defaults to 1000 + * @@return maximum level for this skill in Retro scaling (1-1000) + */ + default int getRetroMaxLevel() { + return 1000; + } + + /** + * The maximum level for this skill in Standard + * Defaults to 100 + * @return maximum level for this skill in Standard scaling (1-100) + */ + default int getStandardMaxLevel() { + return 100; + } +} diff --git a/src/main/java/com/gmail/nossr50/skills/axes/Axes.java b/src/main/java/com/gmail/nossr50/skills/axes/Axes.java index be031a23b..40c937263 100644 --- a/src/main/java/com/gmail/nossr50/skills/axes/Axes.java +++ b/src/main/java/com/gmail/nossr50/skills/axes/Axes.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.skills.axes; -import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.skills.RankUtils; @@ -9,18 +8,6 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; public class Axes { - public static double axeMasteryRankDamageMultiplier = AdvancedConfig.getInstance().getAxeMasteryRankDamageMultiplier(); - - public static double criticalHitPVPModifier = AdvancedConfig.getInstance().getCriticalStrikesPVPModifier(); - public static double criticalHitPVEModifier = AdvancedConfig.getInstance().getCriticalStrikesPVEModifier(); - - public static double impactChance = AdvancedConfig.getInstance().getImpactChance(); - - public static double greaterImpactBonusDamage = AdvancedConfig.getInstance().getGreaterImpactBonusDamage(); - //public static double greaterImpactChance = AdvancedConfig.getInstance().getGreaterImpactChance(); - public static double greaterImpactKnockbackMultiplier = AdvancedConfig.getInstance().getGreaterImpactModifier(); - - public static double skullSplitterModifier = AdvancedConfig.getInstance().getSkullSplitterModifier(); protected static boolean hasArmor(LivingEntity target) { for (ItemStack itemStack : target.getEquipment().getArmorContents()) {