Add MaximumProgressLevel interface and implementation

This commit is contained in:
nossr50 2019-05-31 01:45:57 -07:00
parent 19acf47f1e
commit 186ad2cd59
10 changed files with 243 additions and 29 deletions

View File

@ -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);

View File

@ -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 <IncreaseLevel> 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();
}
}

View File

@ -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;
}
}

View File

@ -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 <MaxBonusLevel> or higher
# MaxBonusLevel: Level where <ChanceMax> 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);
}

View File

@ -0,0 +1,7 @@
package com.gmail.nossr50.config.hocon.skills.axes;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigAxesGreaterImpact {
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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()) {