Most the functionality of SkillPropertiesManager is in place, but not

yet complete
This commit is contained in:
nossr50 2019-06-07 04:07:43 -07:00
parent 3c3bc338f2
commit c58a36e604
21 changed files with 394 additions and 276 deletions

View File

@ -198,6 +198,11 @@
<artifactId>configurate-hocon</artifactId>
<version>3.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.spongepowered</groupId>
<artifactId>configurate-core</artifactId>
<version>3.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>

View File

@ -25,7 +25,11 @@ public class ConfigConstants {
private final static String[] EXAMPLE_BLACKLIST_WORLDS = {"Example_15434453", "Example_2324423", "Example_323423465"};
/* Field Names & Comments */
public static final String SUB_SKILL_NODE = "Sub-Skill";
public final static String MAX_CHANCE_FIELD_NAME = "Max-Chance";
public final static String STATIC_ACTIVATION_FIELD_NAME = "Activation-Chance";
public final static String MAX_BONUS_LEVEL_FIELD_NAME = "Max-Bonus-Level";
public final static String MAX_BONUS_PERCENTAGE_FIELD_NAME = "Max-Bonus-Percentage";
public final static String MAX_CHANCE_FIELD_DESCRIPTION = "The maximum probability for this skill to succeed.";
//Add the worlds to the list

View File

@ -517,4 +517,8 @@ public final class ConfigManager {
public ConfigExperience getConfigExperience() {
return configExperience.getConfig();
}
public SerializedConfigLoader<?> getSkillConfigLoader(PrimarySkillType primarySkillType) {
return skillConfigLoaders.get(primarySkillType);
}
}

View File

@ -0,0 +1,25 @@
package com.gmail.nossr50.config.hocon.skills;
import com.gmail.nossr50.config.ConfigConstants;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigMaxChance {
public static final String FIFTY_PERCENT_EXAMPLE = "50";
public static final String MAX_BONUS_LEVEL_EXAMPLE = "100";
public static final String ODDS_PERCENTAGE_EXAMPLE = "25%";
public static final double CHANCE_AT_MAX_SKILL_DEFAULT = 100.0D;
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = "The maximum success chance for this Sub-Skill." +
"\nA value of 100.0 would be equivalent to 100% chance of success." +
"\nPlayers only have Max-Success-Chance when their skill level has reached the maximum bonus level." +
"\nMax skill chance is dynamically adjusted based on the players level difference from the \"Max-Bonus-Level\", you can think of it as a curve where reaching \"Max-Bonus-Level\" is the peak." +
"\nAs an example, imagine \""+ConfigConstants.MAX_CHANCE_FIELD_NAME+"\" was set to " + FIFTY_PERCENT_EXAMPLE + " and the \""+ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME+"\" was " + MAX_BONUS_LEVEL_EXAMPLE + "," +
"\n and the player was level " + FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + ODDS_PERCENTAGE_EXAMPLE + " odds to succeed with this skill.")
private double chanceAtMaxSkill = CHANCE_AT_MAX_SKILL_DEFAULT;
public double getChanceAtMaxSkill() {
return chanceAtMaxSkill;
}
}

View File

@ -0,0 +1,19 @@
package com.gmail.nossr50.config.hocon.skills;
import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.datatypes.skills.properties.AbstractMaxBonusLevel;
import com.gmail.nossr50.datatypes.skills.properties.MaxBonusLevel;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigMaxLevel {
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME, comment = "Max bonus level is the level a player needs to reach in this skill to receive maximum benefits, such as better RNG odds or otherwise." +
"\nSkills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " +
"\n a player should have based on how far they are from the max bonus level value, and the other parameters used for the scaling of the sub-skill.")
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
public MaxBonusLevel getMaxBonusLevel() {
return maxBonusLevel;
}
}

View File

@ -1,26 +0,0 @@
package com.gmail.nossr50.config.hocon.skills;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigScalingSubSkillPercentage {
@Setting(value = "Standard-Mode-Scaling-Settings", comment = "Standard mode is the new default level scaling for mcMMO" +
"\nMost skills in standard mode scale from 1-100, maxing out at 100." +
"\nStandard scaling is fairly new, and it replaced the previous scaling method which is now known as RetroMode scaling." +
"\nYou are either using Standard or Retro mode on your server, which one you are using is setup in the leveling config file." +
"\nSettings from here are only applied when using Standard mode scaling.")
private ConfigScalingSubSkillStandard standardSettings;
@Setting(value = "Retro-Mode-Scaling-Settings", comment = "Retro mode is the optional level scaling for mcMMO, which was replaced by Standard scaling." +
"\nMost skills in retro mode scale from 1-1000, maxing out at 1000." +
"\nRetro scaling was the main method of scaling in mcMMO for almost 8 years," +
"\n and it was replaced in 2.1 with the new 1-100 scaling method which is known as Standard mode scaling." +
"\nYou can still use Retro Mode scaling, it will never be removed from mcMMO so do not worry about using it!" +
"\nYou are either using Standard or Retro mode on your server, which one you are using is setup in the leveling config file." +
"\nSettings from here are only applied when using Retro mode scaling.")
private ConfigScalingSubSkillRetro retroSettings;
}

View File

@ -1,40 +0,0 @@
package com.gmail.nossr50.config.hocon.skills;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigScalingSubSkillRetro {
public static final String FIFTY_PERCENT_EXAMPLE = "500";
public static final String MAX_BONUS_LEVEL_EXAMPLE = "1000";
public static final String ODDS_PERCENTAGE_EXAMPLE = "25%";
public static final int MAX_BONUS_LEVEL_DEFAULT = 1000;
public static final double CHANCE_AT_MAX_SKILL_DEFAULT = 100.0D;
@Setting(value = "Max-Bonus-Level", comment = "Max bonus level is the level a player needs to reach in this skill to receive maximum benefits, such as better RNG odds or otherwise." +
"\nSkills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " +
"\n a player should have based on how far they are from the max bonus level value, and the other parameters used for the scaling of the sub-skill." +
"\n\n-- NOTE: This setting is only valid for retro level scaling. --" +
"\nDefault value: " + MAX_BONUS_LEVEL_DEFAULT)
private int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT;
@Setting(value = "Max-Success-Chance", comment = "The maximum success chance for this Sub-Skill." +
"\nA value of 100.0 would be equivalent to 100% chance of success." +
"\nPlayers only have Max-Success-Chance when their skill level has reached the maximum bonus level." +
"\nMax skill chance is dynamically adjusted based on the players level difference from the \"Max-Bonus-Level\", you can think of it as a curve where reaching \"Max-Bonus-Level\" is the peak." +
"\nAs an example, imagine \"Max-Success-Chance\" was set to " + FIFTY_PERCENT_EXAMPLE + " and the \"Max-Bonus-Level\" was " + MAX_BONUS_LEVEL_EXAMPLE + "," +
"\n and the player was level " + FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + ODDS_PERCENTAGE_EXAMPLE + " odds to succeed with this skill." +
"\n\n-- NOTE: This setting is only valid for retro level scaling. --" +
"\nDefault value: " + CHANCE_AT_MAX_SKILL_DEFAULT)
private double chanceAtMaxSkill = CHANCE_AT_MAX_SKILL_DEFAULT;
public int getMaxBonusLevel() {
return maxBonusLevel;
}
public double getChanceAtMaxSkill() {
return chanceAtMaxSkill;
}
}

View File

@ -1,39 +0,0 @@
package com.gmail.nossr50.config.hocon.skills;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigScalingSubSkillStandard {
public static final String FIFTY_PERCENT_EXAMPLE = "50";
public static final String MAX_BONUS_LEVEL_EXAMPLE = "100";
public static final String ODDS_PERCENTAGE_EXAMPLE = "25%";
public static final int MAX_BONUS_LEVEL_DEFAULT = 100;
public static final double CHANCE_AT_MAX_SKILL_DEFAULT = 100.0D;
@Setting(value = "Max-Bonus-Level", comment = "Max bonus level is the level a player needs to reach in this skill to receive maximum benefits, such as better RNG odds or otherwise." +
"\nSkills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " +
"\n a player should have based on how far they are from the max bonus level value, and the other parameters used for the scaling of the sub-skill." +
"\n\n-- NOTE: This setting is only valid for standard level scaling. --" +
"\nDefault value: " + MAX_BONUS_LEVEL_DEFAULT)
private int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT;
@Setting(value = "Max-Success-Chance", comment = "The maximum success chance for this Sub-Skill." +
"\nA value of 100.0 would be equivalent to 100% chance of success." +
"\nPlayers only have Max-Success-Chance when their skill level has reached the maximum bonus level." +
"\nMax skill chance is dynamically adjusted based on the players level difference from the \"Max-Bonus-Level\", you can think of it as a curve where reaching \"Max-Bonus-Level\" is the peak." +
"\nAs an example, imagine \"Max-Success-Chance\" was set to " + FIFTY_PERCENT_EXAMPLE + " and the \"Max-Bonus-Level\" was " + MAX_BONUS_LEVEL_EXAMPLE + "," +
"\n and the player was level " + FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + ODDS_PERCENTAGE_EXAMPLE + " odds to succeed with this skill." +
"\n\n-- NOTE: This setting is only valid for standard level scaling. --" +
"\nDefault value: " + CHANCE_AT_MAX_SKILL_DEFAULT)
private double chanceAtMaxSkill = CHANCE_AT_MAX_SKILL_DEFAULT;
public int getMaxBonusLevel() {
return maxBonusLevel;
}
public double getChanceAtMaxSkill() {
return chanceAtMaxSkill;
}
}

View File

@ -1,53 +0,0 @@
package com.gmail.nossr50.config.hocon.skills;
import com.gmail.nossr50.mcMMO;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSubSkillScalingRNG {
@Setting(value = "Standard-Mode-Scaling-Settings", comment = "Standard mode is the new default level scaling for mcMMO" +
"\nMost skills in standard mode scale from 1-100, maxing out at 100." +
"\nStandard scaling is fairly new, and it replaced the previous scaling method which is now known as RetroMode scaling." +
"\n\nYou are either using Standard or Retro mode on your server, which one you are using is setup in the leveling config file." +
"\nSettings from here are only applied when using Standard mode scaling.")
private ConfigScalingSubSkillStandard standardSettings = new ConfigScalingSubSkillStandard();
@Setting(value = "Retro-Mode-Scaling-Settings", comment = "Retro mode is the optional level scaling for mcMMO, which was replaced by Standard scaling." +
"\nMost skills in retro mode scale from 1-1000, maxing out at 1000." +
"\nRetro scaling was the main method of scaling in mcMMO for almost 8 years," +
"\n and it was replaced in 2.1 with the new 1-100 scaling method which is known as Standard mode scaling." +
"\nYou can still use Retro Mode scaling, it will never be removed from mcMMO so do not worry about using it!" +
"\n\nYou are either using Standard or Retro mode on your server, which one you are using is setup in the leveling config file." +
"\nSettings from here are only applied when using Retro mode scaling.")
private ConfigScalingSubSkillRetro retroSettings = new ConfigScalingSubSkillRetro();
public ConfigScalingSubSkillStandard getStandardSettings() {
return standardSettings;
}
public ConfigScalingSubSkillRetro getRetroSettings() {
return retroSettings;
}
/**
* The max chance for the RNG component of a subskill from the user config
*
* @return the max chance for the RNG component of a subskill
*/
public double getMaxChance() {
if (mcMMO.getConfigManager().getConfigLeveling().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().isRetroModeEnabled())
return getRetroSettings().getChanceAtMaxSkill();
else
return getStandardSettings().getChanceAtMaxSkill();
}
public double getMaxBonusLevel() {
if (mcMMO.getConfigManager().getConfigLeveling().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().isRetroModeEnabled())
return getRetroSettings().getMaxBonusLevel();
else
return getStandardSettings().getMaxBonusLevel();
}
}

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.config.hocon.skills.acrobatics;
import com.gmail.nossr50.config.hocon.skills.ConfigSubSkillScalingRNG;
import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.config.hocon.skills.acrobatics.dodge.ConfigDodge;
import com.gmail.nossr50.config.hocon.skills.acrobatics.roll.ConfigRoll;
import ninja.leaping.configurate.objectmapping.Setting;
@ -9,27 +9,26 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigAcrobatics {
@Setting(value = "Roll", comment = "Settings related to the Roll Sub-Skill." +
"\nSettings related to preventing abuse of this skill can be found in the anti_exploit config file.")
private ConfigRoll roll = new ConfigRoll();
@Setting(value = ConfigConstants.SUB_SKILL_NODE, comment = "Sub-Skill settings for Acrobatics")
private ConfigAcrobaticsSubSkills subSkills = new ConfigAcrobaticsSubSkills();
@Setting(value = "Dodge", comment = "Settings related to the Dodge Sub-Skill." +
"\nSettings related to preventing abuse of this skill can be found in the anti_exploit config file.")
private ConfigDodge dodge = new ConfigDodge();
public ConfigAcrobaticsSubSkills getSubSkills() {
return subSkills;
}
public ConfigRoll getRoll() {
return roll;
return subSkills.getRoll();
}
public ConfigDodge getDodge() {
return dodge;
return subSkills.getDodge();
}
public ConfigSubSkillScalingRNG getRNGSettings() {
return dodge.getRNGSettings();
public double getDamageTheshold() {
return getRoll().getDamageTheshold();
}
public double getDamageReductionDivisor() {
return dodge.getDamageReductionDivisor();
return getDodge().getDamageReductionDivisor();
}
}

View File

@ -0,0 +1,27 @@
package com.gmail.nossr50.config.hocon.skills.acrobatics;
import com.gmail.nossr50.config.hocon.skills.acrobatics.dodge.ConfigDodge;
import com.gmail.nossr50.config.hocon.skills.acrobatics.roll.ConfigRoll;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigAcrobaticsSubSkills {
@Setting(value = "Roll", comment = "Settings related to the Roll Sub-Skill." +
"\nSettings related to preventing abuse of this skill can be found in the anti_exploit config file.")
private ConfigRoll roll = new ConfigRoll();
@Setting(value = "Dodge", comment = "Settings related to the Dodge Sub-Skill." +
"\nSettings related to preventing abuse of this skill can be found in the anti_exploit config file.")
private ConfigDodge dodge = new ConfigDodge();
public ConfigRoll getRoll() {
return roll;
}
public ConfigDodge getDodge() {
return dodge;
}
}

View File

@ -1,6 +1,8 @@
package com.gmail.nossr50.config.hocon.skills.acrobatics.dodge;
import com.gmail.nossr50.config.hocon.skills.ConfigSubSkillScalingRNG;
import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.datatypes.skills.properties.AbstractMaxBonusLevel;
import com.gmail.nossr50.datatypes.skills.properties.MaxBonusLevel;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -8,6 +10,10 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
public class ConfigDodge {
public static final double DAMAGE_REDUCTION_DIVISOR_DEFAULT = 2.0D;
public static final String FIFTY_PERCENT_EXAMPLE = "50";
public static final String MAX_BONUS_LEVEL_EXAMPLE = "100";
public static final String ODDS_PERCENTAGE_EXAMPLE = "25%";
public static final double CHANCE_AT_MAX_SKILL_DEFAULT = 100.0D;
@Setting(value = "Damage-Reduction-Divisor", comment = "If a player successfully dodges the incoming damage will be divided by this value." +
"\nPlayers can dodge almost all types of damage from other entities, such as player damage, monster damage, etc." +
@ -16,11 +22,25 @@ public class ConfigDodge {
"\nDefault value: " + DAMAGE_REDUCTION_DIVISOR_DEFAULT)
private double damageReductionDivisor = DAMAGE_REDUCTION_DIVISOR_DEFAULT;
@Setting(value = "RNG-Settings", comment = "Settings related to random chance elements for this Sub-Skill.")
private ConfigSubSkillScalingRNG rng = new ConfigSubSkillScalingRNG();
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME, comment = "Max bonus level is the level a player needs to reach in this skill to receive maximum benefits, such as better RNG odds or otherwise." +
"\nSkills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " +
"\n a player should have based on how far they are from the max bonus level value, and the other parameters used for the scaling of the sub-skill.")
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
public ConfigSubSkillScalingRNG getRNGSettings() {
return rng;
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = "The maximum success chance for this Sub-Skill." +
"\nA value of 100.0 would be equivalent to 100% chance of success." +
"\nPlayers only have Max-Success-Chance when their skill level has reached the maximum bonus level." +
"\nMax skill chance is dynamically adjusted based on the players level difference from the \"Max-Bonus-Level\", you can think of it as a curve where reaching \"Max-Bonus-Level\" is the peak." +
"\nAs an example, imagine \""+ConfigConstants.MAX_CHANCE_FIELD_NAME+"\" was set to " + FIFTY_PERCENT_EXAMPLE + " and the \""+ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME+"\" was " + MAX_BONUS_LEVEL_EXAMPLE + "," +
"\n and the player was level " + FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + ODDS_PERCENTAGE_EXAMPLE + " odds to succeed with this skill.")
private double chanceAtMaxSkill = CHANCE_AT_MAX_SKILL_DEFAULT;
public MaxBonusLevel getMaxBonusLevel() {
return maxBonusLevel;
}
public double getChanceAtMaxSkill() {
return chanceAtMaxSkill;
}
public double getDamageReductionDivisor() {

View File

@ -1,6 +1,8 @@
package com.gmail.nossr50.config.hocon.skills.acrobatics.roll;
import com.gmail.nossr50.config.hocon.skills.ConfigSubSkillScalingRNG;
import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.datatypes.skills.properties.AbstractMaxBonusLevel;
import com.gmail.nossr50.datatypes.skills.properties.MaxBonusLevel;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -8,20 +10,38 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
public class ConfigRoll {
public static final double ROLL_DAMAGE_THRESHOLD_DEFAULT = 7.0D;
public static final String FIFTY_PERCENT_EXAMPLE = "50";
public static final String MAX_BONUS_LEVEL_EXAMPLE = "100";
public static final String ODDS_PERCENTAGE_EXAMPLE = "25%";
public static final double CHANCE_AT_MAX_SKILL_DEFAULT = 100.0D;
@Setting(value = "Damage-Threshold", comment = "Rolling will reduce up to this much damage." +
"\nGraceful Rolls will reduce twice this value." +
"\nDefault value: " + ROLL_DAMAGE_THRESHOLD_DEFAULT)
private double damageTheshold = ROLL_DAMAGE_THRESHOLD_DEFAULT;
@Setting(value = "RNG-Settings", comment = "Settings related to random chance elements for this Sub-Skill.")
private ConfigSubSkillScalingRNG rng = new ConfigSubSkillScalingRNG();
public ConfigSubSkillScalingRNG getRNGSettings() {
return rng;
}
public double getDamageTheshold() {
return damageTheshold;
}
}
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME, comment = "Max bonus level is the level a player needs to reach in this skill to receive maximum benefits, such as better RNG odds or otherwise." +
"\nSkills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " +
"\n a player should have based on how far they are from the max bonus level value, and the other parameters used for the scaling of the sub-skill.")
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = "The maximum success chance for this Sub-Skill." +
"\nA value of 100.0 would be equivalent to 100% chance of success." +
"\nPlayers only have Max-Success-Chance when their skill level has reached the maximum bonus level." +
"\nMax skill chance is dynamically adjusted based on the players level difference from the \"Max-Bonus-Level\", you can think of it as a curve where reaching \"Max-Bonus-Level\" is the peak." +
"\nAs an example, imagine \""+ConfigConstants.MAX_CHANCE_FIELD_NAME+"\" was set to " + FIFTY_PERCENT_EXAMPLE + " and the \""+ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME+"\" was " + MAX_BONUS_LEVEL_EXAMPLE + "," +
"\n and the player was level " + FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + ODDS_PERCENTAGE_EXAMPLE + " odds to succeed with this skill.")
private double chanceAtMaxSkill = CHANCE_AT_MAX_SKILL_DEFAULT;
public MaxBonusLevel getMaxBonusLevel() {
return maxBonusLevel;
}
public double getChanceAtMaxSkill() {
return chanceAtMaxSkill;
}
}

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.config.hocon.skills.axes;
import com.gmail.nossr50.datatypes.skills.properties.AbstractSkillCeiling;
import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.datatypes.skills.properties.DamageProperty;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -8,79 +8,54 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigAxes {
@Setting(value = ConfigConstants.SUB_SKILL_NODE, comment = "Settings for Axes Sub-Skills.")
private ConfigAxesSubSkills subSkills = new ConfigAxesSubSkills();
@Setting(value = "Axe-Mastery")
private ConfigAxesAxeMastery configAxesAxeMastery = new ConfigAxesAxeMastery();
@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 getCriticalStrikesMaxActivationChance() {
return configAxesCriticalStrikes.getMaxActivationChance();
}
public AbstractSkillCeiling getCriticalStrikesMaximumProgressionLevel() {
return configAxesCriticalStrikes.getMaximumProgressionLevel();
}
public double getGreaterImpactActivationChance() {
return configAxesGreaterImpact.getActivationChance();
}
public double getGreaterImpactKnockBackModifier() {
return configAxesGreaterImpact.getKnockBackModifier();
}
public double getGreaterImpactBonusDamage() {
return configAxesGreaterImpact.getBonusDamage();
}
public DamageProperty getCriticalStrikesDamageProperty() {
return configAxesCriticalStrikes.getDamageProperty();
}
public double getSkullSplitterDamageDivisor() {
return configAxesSkullSplitter.getSkullSplitterDamageDivisor();
public ConfigAxesSubSkills getSubSkills() {
return subSkills;
}
public ConfigAxesAxeMastery getConfigAxesAxeMastery() {
return configAxesAxeMastery;
return subSkills.getConfigAxesAxeMastery();
}
public double getGreaterImpactKnockBackModifier() {
return subSkills.getGreaterImpactKnockBackModifier();
}
public double getGreaterImpactBonusDamage() {
return subSkills.getGreaterImpactBonusDamage();
}
public DamageProperty getCriticalStrikesDamageProperty() {
return subSkills.getCriticalStrikesDamageProperty();
}
public double getSkullSplitterDamageDivisor() {
return subSkills.getSkullSplitterDamageDivisor();
}
public ConfigAxesCriticalStrikes getConfigAxesCriticalStrikes() {
return configAxesCriticalStrikes;
return subSkills.getConfigAxesCriticalStrikes();
}
public ConfigAxesGreaterImpact getConfigAxesGreaterImpact() {
return configAxesGreaterImpact;
return subSkills.getConfigAxesGreaterImpact();
}
public ConfigAxesImpact getConfigAxesImpact() {
return configAxesImpact;
return subSkills.getConfigAxesImpact();
}
public ConfigAxesSkullSplitter getConfigAxesSkullSplitter() {
return configAxesSkullSplitter;
}
public double getImpactChance() {
return configAxesImpact.getImpactChance();
return subSkills.getConfigAxesSkullSplitter();
}
public double getImpactDurabilityDamageModifier() {
return configAxesImpact.getImpactDurabilityDamageModifier();
return subSkills.getImpactDurabilityDamageModifier();
}
public double getAxeMasteryMultiplier() {
return configAxesAxeMastery.getAxeMasteryMultiplier();
return subSkills.getAxeMasteryMultiplier();
}
}

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.config.hocon.skills.axes;
import com.gmail.nossr50.config.ConfigConstants;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -10,7 +11,7 @@ public class ConfigAxesGreaterImpact {
public static final double KNOCKBACK_MODIFIER_DEFAULT = 1.5D;
public static final double BONUS_DAMAGE_DEFAULT = 2.0D;
@Setting(value = "Activation-Chance", comment = "Chance for this skill to activate, this does not change." +
@Setting(value = ConfigConstants.STATIC_ACTIVATION_FIELD_NAME, comment = "Chance for this skill to activate, this does not change." +
"\nDefault value: "+ACTIVATION_CHANCE_DEFAULT)
private double activationChance = ACTIVATION_CHANCE_DEFAULT;
@ -23,10 +24,6 @@ public class ConfigAxesGreaterImpact {
"\nDefault value: "+ BONUS_DAMAGE_DEFAULT)
private double bonusDamage = BONUS_DAMAGE_DEFAULT;
public double getActivationChance() {
return activationChance;
}
public double getKnockBackModifier() {
return knockBackModifier;
}

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.config.hocon.skills.axes;
import com.gmail.nossr50.config.ConfigConstants;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -9,7 +10,7 @@ public class ConfigAxesImpact {
private static final double IMPACT_CHANCE_DEFAULT = 25.0D;
private 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." +
@Setting(value = ConfigConstants.STATIC_ACTIVATION_FIELD_NAME, 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;
@ -18,10 +19,6 @@ public class ConfigAxesImpact {
"\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,76 @@
package com.gmail.nossr50.config.hocon.skills.axes;
import com.gmail.nossr50.datatypes.skills.properties.AbstractSkillCeiling;
import com.gmail.nossr50.datatypes.skills.properties.DamageProperty;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigAxesSubSkills {
@Setting(value = "Axe-Mastery")
private ConfigAxesAxeMastery configAxesAxeMastery = new ConfigAxesAxeMastery();
@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 getCriticalStrikesMaxActivationChance() {
return configAxesCriticalStrikes.getMaxActivationChance();
}
public AbstractSkillCeiling getCriticalStrikesMaximumProgressionLevel() {
return configAxesCriticalStrikes.getMaximumProgressionLevel();
}
public double getGreaterImpactKnockBackModifier() {
return configAxesGreaterImpact.getKnockBackModifier();
}
public double getGreaterImpactBonusDamage() {
return configAxesGreaterImpact.getBonusDamage();
}
public DamageProperty getCriticalStrikesDamageProperty() {
return configAxesCriticalStrikes.getDamageProperty();
}
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 getImpactDurabilityDamageModifier() {
return configAxesImpact.getImpactDurabilityDamageModifier();
}
public double getAxeMasteryMultiplier() {
return configAxesAxeMastery.getAxeMasteryMultiplier();
}
}

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.config.hocon.skills.repair;
import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.config.hocon.skills.repair.general.ConfigRepairGeneral;
import com.gmail.nossr50.config.hocon.skills.repair.repairmastery.ConfigRepairMastery;
import com.gmail.nossr50.config.hocon.skills.repair.subskills.ConfigRepairSubSkills;
@ -74,7 +75,7 @@ public class ConfigRepair {
@Setting(value = "General")
private ConfigRepairGeneral repairGeneral = new ConfigRepairGeneral();
@Setting(value = "SubSkills", comment = "Settings for subskills stemming from Repair")
@Setting(value = ConfigConstants.SUB_SKILL_NODE, comment = "Settings for subskills stemming from Repair")
private ConfigRepairSubSkills repairSubSkills = new ConfigRepairSubSkills();
@Setting(value = "Z-Repairables", comment = "This is the list of what can be repaired in mcMMO by Anvils and their properties." +

View File

@ -1,16 +1,30 @@
package com.gmail.nossr50.config.hocon.skills.repair;
import com.gmail.nossr50.config.hocon.skills.ConfigSubSkillScalingRNG;
import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.datatypes.skills.properties.AbstractMaxBonusLevel;
import com.gmail.nossr50.datatypes.skills.properties.MaxBonusLevel;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigRepairSuperRepair {
@Setting(value = "Settings")
private ConfigSubSkillScalingRNG superRepair = new ConfigSubSkillScalingRNG();
private static final String FIFTY_PERCENT_EXAMPLE = "50";
private static final String MAX_BONUS_LEVEL_EXAMPLE = "100";
private static final String ODDS_PERCENTAGE_EXAMPLE = "25%";
private static final double CHANCE_AT_MAX_SKILL_DEFAULT = 100.0D;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME, comment = "Max bonus level is the level a player needs to reach in this skill to receive maximum benefits, such as better RNG odds or otherwise." +
"\nSkills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " +
"\n a player should have based on how far they are from the max bonus level value, and the other parameters used for the scaling of the sub-skill.")
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = "The maximum success chance for this Sub-Skill." +
"\nA value of 100.0 would be equivalent to 100% chance of success." +
"\nPlayers only have Max-Success-Chance when their skill level has reached the maximum bonus level." +
"\nMax skill chance is dynamically adjusted based on the players level difference from the \"Max-Bonus-Level\", you can think of it as a curve where reaching \"Max-Bonus-Level\" is the peak." +
"\nAs an example, imagine \""+ConfigConstants.MAX_CHANCE_FIELD_NAME+"\" was set to " + FIFTY_PERCENT_EXAMPLE + " and the \""+ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME+"\" was " + MAX_BONUS_LEVEL_EXAMPLE + "," +
"\n and the player was level " + FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + ODDS_PERCENTAGE_EXAMPLE + " odds to succeed with this skill.")
private double chanceAtMaxSkill = CHANCE_AT_MAX_SKILL_DEFAULT;
public ConfigSubSkillScalingRNG getSuperRepair() {
return superRepair;
}
}

View File

@ -1,28 +1,42 @@
package com.gmail.nossr50.core;
import com.gmail.nossr50.config.hocon.skills.ConfigSubSkillScalingRNG;
import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.config.hocon.HOCONUtil;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.properties.MaxBonusLevel;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.random.InvalidStaticChance;
import com.google.common.reflect.TypeToken;
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
import java.util.HashMap;
import java.util.Iterator;
/**
* Hacky way to do this until I rewrite the skill system fully
*/
public class SkillPropertiesManager {
private HashMap<SubSkillType, Double> maxChanceMap;
private HashMap<SubSkillType, Double> maxBonusLevelMap;
private HashMap<SubSkillType, Double> staticActivationChanceMap;
private HashMap<SubSkillType, Integer> maxBonusLevelMap;
private HashMap<SubSkillType, Double> maxBonusPercentage;
public SkillPropertiesManager() {
maxChanceMap = new HashMap<>();
maxBonusLevelMap = new HashMap<>();
maxBonusPercentage = new HashMap<>();
staticActivationChanceMap = new HashMap<>();
}
public void registerRNG(SubSkillType subSkillType, ConfigSubSkillScalingRNG config) {
maxChanceMap.put(subSkillType, config.getMaxChance());
maxBonusLevelMap.put(subSkillType, config.getMaxBonusLevel());
public void registerMaxBonusLevel(SubSkillType subSkillType, MaxBonusLevel maxBonusLevel) {
maxBonusLevelMap.put(subSkillType, mcMMO.isRetroModeEnabled() ? maxBonusLevel.getRetroScaleValue() : maxBonusLevel.getStandardScaleValue());
}
public void registerMaxChance(SubSkillType subSkillType, double maxChance) {
maxChanceMap.put(subSkillType, maxChance);
}
public double getMaxChance(SubSkillType subSkillType) {
@ -34,17 +48,106 @@ public class SkillPropertiesManager {
}
public void fillRegisters() {
fillRNGRegisters();
}
/**
* Goes over each of our skill configs and grabs any properties it can find
*/
private void fillRNGRegisters() {
//Acrobatics
registerRNG(SubSkillType.ACROBATICS_DODGE, mcMMO.getConfigManager().getConfigAcrobatics().getDodge().getRNGSettings());
registerRNG(SubSkillType.ACROBATICS_DODGE, mcMMO.getConfigManager().getConfigAcrobatics().getRoll().getRNGSettings());
//Repair
registerRNG(SubSkillType.REPAIR_SUPER_REPAIR, mcMMO.getConfigManager().getConfigRepair().getSuperRepair().getSuperRepair());
//The path to a subskill's properties will always be like this
//Skill Config Root Node -> Sub-Skill -> Hocon-Friendly-Name (of the subskill) -> PropertyFieldName (camelCase of the interface type)
for(PrimarySkillType primarySkillType : PrimarySkillType.values()) {
CommentedConfigurationNode rootNode = mcMMO.getConfigManager().getSkillConfigLoader(primarySkillType).getRootNode();
//Attempt to grab node
CommentedConfigurationNode subSkillCategoryNode = getNodeIfReal(rootNode, ConfigConstants.SUB_SKILL_NODE);
//Check if the root node has a node matching the name "Sub-Skill"
if(subSkillCategoryNode != null) {
//Check all the "children" of this skill, this will need to be rewritten in the future
for (SubSkillType subSkillType : primarySkillType.getSkillAbilities()) {
//HOCON friendly subskill name
String hoconFriendlySubskillName = subSkillType.getHoconFriendlyConfigName();
//Attempt to grab node
CommentedConfigurationNode subSkillNode = getNodeIfReal(subSkillCategoryNode, hoconFriendlySubskillName);
//Check if the Sub-Skill node has a child matching this subskill name
if (subSkillNode != null) {
//Check for all the various mcMMO skill properties
for(Iterator<? extends CommentedConfigurationNode> it = subSkillNode.getChildrenList().iterator(); it.hasNext();) {
CommentedConfigurationNode childNode = it.next();
Object lastObjectInPath = childNode.getPath()[childNode.getPath().length + 1];
String nodeName = lastObjectInPath.toString();
if(nodeName.equalsIgnoreCase(ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME)) {
attemptRegisterMaxBonusLevel(subSkillType, childNode);
} else if(nodeName.equalsIgnoreCase(ConfigConstants.MAX_CHANCE_FIELD_NAME)) {
attemptRegisterMaxChance(subSkillType, childNode);
} else if(nodeName.equalsIgnoreCase(ConfigConstants.STATIC_ACTIVATION_FIELD_NAME)) {
attemptRegisterStaticChance(subSkillType, childNode);
} else if(nodeName.equalsIgnoreCase(ConfigConstants.MAX_BONUS_PERCENTAGE_FIELD_NAME)) {
attemptRegisterMaxBonusPercentage(subSkillType, childNode);
}
}
}
}
}
}
}
private CommentedConfigurationNode getNodeIfReal(CommentedConfigurationNode configurationNode, String path) {
if(doesNodeExist(configurationNode.getNode(path)))
return configurationNode.getNode(path);
else
return null;
}
private boolean doesNodeExist(CommentedConfigurationNode configurationNode) {
return configurationNode.getValue() != null;
}
private void attemptRegisterMaxBonusLevel(SubSkillType subSkillType, CommentedConfigurationNode childNode) {
try {
MaxBonusLevel maxBonusLevel = childNode.getValue(TypeToken.of(MaxBonusLevel.class));
registerMaxBonusLevel(subSkillType, maxBonusLevel);
mcMMO.p.getLogger().info("Registered MaxBonusLevel for "+subSkillType.toString());
} catch (ObjectMappingException e) {
//This time a silent exception is fine
}
}
private void attemptRegisterMaxChance(SubSkillType subSkillType, CommentedConfigurationNode childNode) {
try {
Double maxChance = childNode.getValue(TypeToken.of(Double.class));
registerMaxChance(subSkillType, maxChance);
mcMMO.p.getLogger().info("Registered MaxChance for "+subSkillType.toString());
} catch (ObjectMappingException e) {
//This time a silent exception is fine
}
}
private void attemptRegisterStaticChance(SubSkillType subSkillType, CommentedConfigurationNode childNode) {
}
private void attemptRegisterMaxBonusPercentage(SubSkillType subSkillType, CommentedConfigurationNode childNode) {
}
public double getStaticChanceProperty(SubSkillType subSkillType) throws InvalidStaticChance {
if(staticActivationChanceMap.get(subSkillType) == null)
throw new InvalidStaticChance();
return staticActivationChanceMap.get(subSkillType);
}
}

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.util.random;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
@ -226,16 +225,7 @@ public class RandomChanceUtil {
* @throws InvalidStaticChance if the skill has no defined static chance this exception will be thrown and you should know you're a naughty boy
*/
public static double getStaticRandomChance(SubSkillType subSkillType) throws InvalidStaticChance {
switch (subSkillType) {
case AXES_ARMOR_IMPACT:
return mcMMO.getConfigManager().getConfigAxes().getImpactChance();
case AXES_GREATER_IMPACT:
return mcMMO.getConfigManager().getConfigAxes().getGreaterImpactActivationChance();
case TAMING_FAST_FOOD_SERVICE:
return AdvancedConfig.getInstance().getFastFoodChance();
default:
throw new InvalidStaticChance();
}
return mcMMO.getDynamicSettingsManager().getSkillPropertiesManager().getStaticChanceProperty(subSkillType);
}
public static boolean sendSkillEvent(Player player, SubSkillType subSkillType, double activationChance) {