No more Standard or Retro, use cosmetic scale modifier setting instead

This commit is contained in:
nossr50 2020-01-27 20:13:36 -08:00
parent 2e5a12a72b
commit aaffafb88b
35 changed files with 76 additions and 444 deletions

View File

@ -51,7 +51,6 @@ import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.properties.DamageProperty; import com.gmail.nossr50.datatypes.skills.properties.DamageProperty;
import com.gmail.nossr50.datatypes.skills.properties.MaxBonusLevel;
import com.gmail.nossr50.datatypes.skills.subskills.taming.CallOfTheWildType; import com.gmail.nossr50.datatypes.skills.subskills.taming.CallOfTheWildType;
import com.gmail.nossr50.datatypes.skills.subskills.taming.TamingSummon; import com.gmail.nossr50.datatypes.skills.subskills.taming.TamingSummon;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
@ -266,7 +265,6 @@ public final class ConfigManager {
customSerializers.registerType(TypeToken.of(CustomXPPerk.class), new CustomXPPerkSerializer()); customSerializers.registerType(TypeToken.of(CustomXPPerk.class), new CustomXPPerkSerializer());
customSerializers.registerType(TypeToken.of(DamageProperty.class), new DamagePropertySerializer()); customSerializers.registerType(TypeToken.of(DamageProperty.class), new DamagePropertySerializer());
customSerializers.registerType(TypeToken.of(SkillRankProperty.class), new SkillRankPropertySerializer()); customSerializers.registerType(TypeToken.of(SkillRankProperty.class), new SkillRankPropertySerializer());
customSerializers.registerType(TypeToken.of(MaxBonusLevel.class), new MaxBonusLevelSerializer());
customSerializers.registerType(TypeToken.of(PlayerNotificationSettings.class), new PlayerNotificationSerializer()); customSerializers.registerType(TypeToken.of(PlayerNotificationSettings.class), new PlayerNotificationSerializer());
customSerializers.registerType(TypeToken.of(SoundSetting.class), new SoundSettingSerializer()); customSerializers.registerType(TypeToken.of(SoundSetting.class), new SoundSettingSerializer());
// customSerializers.registerType(TypeToken.of(ItemWildcards.class), new ItemWildcardSerializer()); // customSerializers.registerType(TypeToken.of(ItemWildcards.class), new ItemWildcardSerializer());
@ -483,17 +481,6 @@ public final class ConfigManager {
return configRanks.getRootNode(); return configRanks.getRootNode();
} }
/**
* Checks if this plugin is using retro mode
* Retro mode is a 0-1000 skill system
* Standard mode is scaled for 1-100
*
* @return true if retro mode is enabled
*/
public boolean isRetroMode() {
return getConfigLeveling().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().isRetroModeEnabled();
}
public ConfigExperience getConfigExperience() { public ConfigExperience getConfigExperience() {
return configExperience.getConfig(); return configExperience.getConfig();
} }

View File

@ -1,33 +0,0 @@
package com.gmail.nossr50.config.serializers;
import com.gmail.nossr50.datatypes.skills.properties.AbstractMaxBonusLevel;
import com.gmail.nossr50.datatypes.skills.properties.MaxBonusLevel;
import com.google.common.reflect.TypeToken;
import ninja.leaping.configurate.ConfigurationNode;
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
import ninja.leaping.configurate.objectmapping.serialize.TypeSerializer;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
public class MaxBonusLevelSerializer implements TypeSerializer<MaxBonusLevel> {
public static final String STANDARD_NODE = "Standard-Max-Bonus-Level";
public static final String RETRO_NODE = "Retro-Max-Bonus-Level";
@Nullable
@Override
public MaxBonusLevel deserialize(@NonNull TypeToken<?> type, @NonNull ConfigurationNode value) throws ObjectMappingException {
int standard = value.getNode(STANDARD_NODE).getValue(TypeToken.of(Integer.class));
int retro = value.getNode(RETRO_NODE).getValue(TypeToken.of(Integer.class));
AbstractMaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(standard, retro);
return maxBonusLevel;
}
@Override
public void serialize(@NonNull TypeToken<?> type, @Nullable MaxBonusLevel obj, @NonNull ConfigurationNode value) throws ObjectMappingException {
value.getNode(STANDARD_NODE).setValue(obj.getStandardScaleValue());
value.getNode(RETRO_NODE).setValue(obj.getRetroScaleValue());
}
}

View File

@ -13,21 +13,17 @@ import java.util.Map;
public class SkillRankPropertySerializer implements TypeSerializer<SkillRankProperty> { public class SkillRankPropertySerializer implements TypeSerializer<SkillRankProperty> {
private static final String STANDARD_RANK_UNLOCK_LEVEL_REQUIREMENTS = "Standard-Rank-Unlock-Level-Requirements"; private static final String RANK_UNLOCK_LEVEL_REQUIREMENTS = "Standard-Rank-Unlock-Level-Requirements";
private static final String RETRO_RANK_UNLOCK_LEVEL_REQUIREMENTS = "Retro-Rank-Unlock-Level-Requirements";
@Nullable @Nullable
@Override @Override
public SkillRankProperty deserialize(@NonNull TypeToken<?> type, @NonNull ConfigurationNode value) throws ObjectMappingException { public SkillRankProperty deserialize(@NonNull TypeToken<?> type, @NonNull ConfigurationNode value) throws ObjectMappingException {
HashMap<Integer, Integer> standardHashMap; HashMap<Integer, Integer> standardHashMap;
HashMap<Integer, Integer> retroHashMap;
try { try {
Map<? extends Integer, ? extends Integer> standardMap = value.getNode(STANDARD_RANK_UNLOCK_LEVEL_REQUIREMENTS).getValue(new TypeToken<Map<? extends Integer, ? extends Integer>>() {}); Map<? extends Integer, ? extends Integer> standardMap = value.getNode(RANK_UNLOCK_LEVEL_REQUIREMENTS).getValue(new TypeToken<Map<? extends Integer, ? extends Integer>>() {});
Map<? extends Integer, ? extends Integer> retroMap = value.getNode(RETRO_RANK_UNLOCK_LEVEL_REQUIREMENTS).getValue(new TypeToken<Map<? extends Integer, ? extends Integer>>() {});
standardHashMap = new HashMap<>(standardMap); standardHashMap = new HashMap<>(standardMap);
retroHashMap = new HashMap<>(retroMap);
} catch (ObjectMappingException e) { } catch (ObjectMappingException e) {
System.out.println("[mcMMO Deserializer Debug] Unable to deserialize rank property information from the config, make sure the ranks are correctly set in the config. You can delete the rank config to generate a new one if problems persist."); System.out.println("[mcMMO Deserializer Debug] Unable to deserialize rank property information from the config, make sure the ranks are correctly set in the config. You can delete the rank config to generate a new one if problems persist.");
@ -35,15 +31,13 @@ public class SkillRankPropertySerializer implements TypeSerializer<SkillRankProp
} }
SkillRankProperty skillRankProperty = new SkillRankProperty(); SkillRankProperty skillRankProperty = new SkillRankProperty();
skillRankProperty.setStandardRanks(standardHashMap); skillRankProperty.setRanks(standardHashMap);
skillRankProperty.setRetroRanks(retroHashMap);
return skillRankProperty; return skillRankProperty;
} }
@Override @Override
public void serialize(@NonNull TypeToken<?> type, @Nullable SkillRankProperty obj, @NonNull ConfigurationNode value) throws ObjectMappingException { public void serialize(@NonNull TypeToken<?> type, @Nullable SkillRankProperty obj, @NonNull ConfigurationNode value) throws ObjectMappingException {
value.getNode(STANDARD_RANK_UNLOCK_LEVEL_REQUIREMENTS).setValue(obj.getStandardRanks()); value.getNode(RANK_UNLOCK_LEVEL_REQUIREMENTS).setValue(obj.getRanks());
value.getNode(RETRO_RANK_UNLOCK_LEVEL_REQUIREMENTS).setValue(obj.getRetroRanks());
} }
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills; package com.gmail.nossr50.config.skills;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -11,9 +9,9 @@ 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." + @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 " + "\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 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); private int maxBonusLevel = 1000;
public MaxBonusLevel getMaxBonusLevel() { public int getMaxBonusLevel() {
return maxBonusLevel; return maxBonusLevel;
} }
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.acrobatics.dodge; package com.gmail.nossr50.config.skills.acrobatics.dodge;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -22,25 +20,11 @@ public class ConfigDodge {
"\nDefault value: " + DAMAGE_REDUCTION_DIVISOR_DEFAULT) "\nDefault value: " + DAMAGE_REDUCTION_DIVISOR_DEFAULT)
private double damageReductionDivisor = DAMAGE_REDUCTION_DIVISOR_DEFAULT; private double damageReductionDivisor = DAMAGE_REDUCTION_DIVISOR_DEFAULT;
@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." + @Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION)
"\nSkills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " + private double maxChance = 100.0;
"\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() { public double getChanceAtMaxSkill() {
return chanceAtMaxSkill; return maxChance;
} }
public double getDamageReductionDivisor() { public double getDamageReductionDivisor() {

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.acrobatics.roll; package com.gmail.nossr50.config.skills.acrobatics.roll;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -10,9 +8,6 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
public class ConfigRoll { public class ConfigRoll {
public static final double ROLL_DAMAGE_THRESHOLD_DEFAULT = 7.0D; 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; public static final double CHANCE_AT_MAX_SKILL_DEFAULT = 100.0D;
@Setting(value = "Damage-Threshold", comment = "Rolling will reduce up to this much damage." + @Setting(value = "Damage-Threshold", comment = "Rolling will reduce up to this much damage." +
@ -24,24 +19,10 @@ public class ConfigRoll {
return damageTheshold; 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." + @Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION)
"\nSkills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " + private double maxChance = 100.0D;
"\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() { public double getChanceAtMaxSkill() {
return chanceAtMaxSkill; return maxChance;
} }
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.archery; package com.gmail.nossr50.config.skills.archery;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -12,14 +10,7 @@ public class ConfigArcheryArrowRetrieval {
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION) @Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION)
private double maxChance = 100.0D; private double maxChance = 100.0D;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME)
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
public double getMaxChance() { public double getMaxChance() {
return maxChance; return maxChance;
} }
public MaxBonusLevel getMaxBonusLevel() {
return maxBonusLevel;
}
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.archery; package com.gmail.nossr50.config.skills.archery;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -15,9 +13,6 @@ public class ConfigArcheryDaze {
+ "\nDefault value: "+DAZE_MAX_CHANCE_DEFAULT) + "\nDefault value: "+DAZE_MAX_CHANCE_DEFAULT)
private double maxChance = DAZE_MAX_CHANCE_DEFAULT; private double maxChance = DAZE_MAX_CHANCE_DEFAULT;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME)
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
@Setting(value = "Bonus-Damage", comment = "How much bonus damage is applied when daze is applied to a target." + @Setting(value = "Bonus-Damage", comment = "How much bonus damage is applied when daze is applied to a target." +
"\nDefault value: "+DAZE_BONUS_DMG_DEFAULT) "\nDefault value: "+DAZE_BONUS_DMG_DEFAULT)
private double bonusDamage = DAZE_BONUS_DMG_DEFAULT; private double bonusDamage = DAZE_BONUS_DMG_DEFAULT;
@ -26,10 +21,6 @@ public class ConfigArcheryDaze {
return maxChance; return maxChance;
} }
public MaxBonusLevel getMaxBonusLevel() {
return maxBonusLevel;
}
public double getDazeBonusDamage() { public double getDazeBonusDamage() {
return bonusDamage; return bonusDamage;
} }

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.config.skills.axes;
import com.gmail.nossr50.config.ConfigConstants; import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.datatypes.skills.properties.AbstractDamageProperty; import com.gmail.nossr50.datatypes.skills.properties.AbstractDamageProperty;
import com.gmail.nossr50.datatypes.skills.properties.AbstractMaxBonusLevel;
import com.gmail.nossr50.datatypes.skills.properties.DamageProperty; import com.gmail.nossr50.datatypes.skills.properties.DamageProperty;
import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -12,18 +11,14 @@ public class ConfigAxesCriticalStrikes {
private static final double MAX_ACTIVATION_CHANCE_DEFAULT = 37.50D; private static final double MAX_ACTIVATION_CHANCE_DEFAULT = 37.50D;
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = "This is max percentage chance that is used to determine whether or not the ability is successful." + @Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION)
"\nA value of 50.0 would mean at most the ability can only have a 50% chance to work at max skill level.") private double maxChance = MAX_ACTIVATION_CHANCE_DEFAULT;
private double maxActivationChance = MAX_ACTIVATION_CHANCE_DEFAULT;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME, comment = ConfigConstants.MAX_BONUS_LEVEL_DESCRIPTION)
private AbstractMaxBonusLevel maximumProgressionLevel = new AbstractMaxBonusLevel(100);
@Setting(value = "Damage-Modifiers", comment = "Damage dealt is multiplied by these values when this skill is successfully activated.") @Setting(value = "Damage-Modifiers", comment = "Damage dealt is multiplied by these values when this skill is successfully activated.")
private DamageProperty damageProperty = new AbstractDamageProperty(1.5, 2.0); private DamageProperty damageProperty = new AbstractDamageProperty(1.5, 2.0);
public double getMaxActivationChance() { public double getMaxActivationChance() {
return maxActivationChance; return maxChance;
} }
public DamageProperty getDamageProperty() { public DamageProperty getDamageProperty() {

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.herbalism; package com.gmail.nossr50.config.skills.herbalism;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -11,8 +9,4 @@ public class ConfigHerbalismDoubleDrops {
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION) @Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION)
private double maxChance = 100.0; private double maxChance = 100.0;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME)
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.herbalism; package com.gmail.nossr50.config.skills.herbalism;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -11,8 +9,4 @@ public class ConfigHerbalismGreenThumb {
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION) @Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION)
private double maxChance = 100.0; private double maxChance = 100.0;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME)
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.herbalism; package com.gmail.nossr50.config.skills.herbalism;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -11,8 +9,4 @@ public class ConfigHerbalismHylianLuck {
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION) @Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION)
private double maxChance = 10.0; private double maxChance = 10.0;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME)
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.herbalism; package com.gmail.nossr50.config.skills.herbalism;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -12,7 +10,4 @@ public class ConfigHerbalismShroomThumb {
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION) @Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION)
private double maxChance = 50.0; private double maxChance = 50.0;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME)
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.mining; package com.gmail.nossr50.config.skills.mining;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -11,9 +9,6 @@ public class ConfigMiningDoubleDrops {
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION) @Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION)
private double maxChance = 100.0; private double maxChance = 100.0;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME)
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
@Setting(value = "Silk-Touch-Double-Drops", comment = "Allow silk touch to benefit from double drops.") @Setting(value = "Silk-Touch-Double-Drops", comment = "Allow silk touch to benefit from double drops.")
private boolean allowSilkTouchDoubleDrops = true; private boolean allowSilkTouchDoubleDrops = true;

View File

@ -2,13 +2,14 @@ package com.gmail.nossr50.config.skills.ranks;
import com.gmail.nossr50.api.exceptions.MissingSkillPropertyDefinition; import com.gmail.nossr50.api.exceptions.MissingSkillPropertyDefinition;
import com.gmail.nossr50.datatypes.skills.properties.SkillProperty; import com.gmail.nossr50.datatypes.skills.properties.SkillProperty;
import com.gmail.nossr50.mcMMO;
import org.apache.logging.log4j.Level;
import java.util.HashMap; import java.util.HashMap;
public class SkillRankProperty implements SkillProperty { public class SkillRankProperty implements SkillProperty {
private HashMap<Integer, Integer> standardRanks; private HashMap<Integer, Integer> ranks;
private HashMap<Integer, Integer> retroRanks;
public SkillRankProperty(Integer... rankDefinitions) { public SkillRankProperty(Integer... rankDefinitions) {
initRankMaps(); initRankMaps();
@ -16,88 +17,59 @@ public class SkillRankProperty implements SkillProperty {
for(int x = 0; x < rankDefinitions.length; x++) { for(int x = 0; x < rankDefinitions.length; x++) {
int curRank = x+1; int curRank = x+1;
addStandardAndRetroRank(curRank, rankDefinitions[x]); addRank(curRank, rankDefinitions[x]);
} }
} }
public SkillRankProperty(HashMap<Integer, Integer> standardRanks, HashMap<Integer, Integer> retroRanks) { public SkillRankProperty(HashMap<Integer, Integer> ranks) {
this.standardRanks = standardRanks; this.ranks = ranks;
this.retroRanks = retroRanks;
} }
/** /**
* Convenience method to add Standard and Retro at the same time for default initialization of values * Fill in the rank map and mutate it by the cosmetic modifier
* Only requires standard values be passed
* @param curRank the rank to fill in the value for * @param curRank the rank to fill in the value for
* @param standardValue the value of the rank in Standard * @param rankValue the value of the rank in Standard
*/ */
private void addStandardAndRetroRank(int curRank, int standardValue) { private void addRank(int curRank, int rankValue) {
//Retro will be equal to standards rank requirement multiplied by 10 unless that value is 1, in which case it will also be 1
int retroValue = standardValue == 1 ? 1 : standardValue * 10;
//Avoid negative numbers //Avoid negative numbers
if(standardValue < 0) { rankValue = Math.max(0, rankValue);
standardRanks.put(curRank, 0);
retroRanks.put(curRank, 0);
} else {
standardRanks.put(curRank, standardValue);
retroRanks.put(curRank, retroValue);
}
}
/** ranks.put(curRank, rankValue);
* Convenience method to add Standard and Retro at the same time
* @param curRank the rank to fill in the value for
* @param standardValue the value of the rank in Standard
* @param retroValue the value of the rank in Retro
*/
private void addStandardAndRetroRank(int curRank, int standardValue, int retroValue) {
//Avoid negative numbers
standardValue = Math.max(0, standardValue);
retroValue = Math.max(0, retroValue);
standardRanks.put(curRank, standardValue);
retroRanks.put(curRank, retroValue);
} }
private void initRankMaps() { private void initRankMaps() {
standardRanks = new HashMap<>(); ranks = new HashMap<>();
retroRanks = new HashMap<>();
} }
/** /**
* Gets the unlock level for this skill as defined by this SkillRankProperty * Gets the unlock level for this skill as defined by this SkillRankProperty
* @param retroMode whether or not mcMMO is using RetroMode, true for if it is
* @param targetRank the rank to get the unlock level for * @param targetRank the rank to get the unlock level for
* @return the unlock level for target rank * @return the unlock level for target rank
*/ */
public int getUnlockLevel(boolean retroMode, int targetRank) throws MissingSkillPropertyDefinition { public int getUnlockLevel(mcMMO pluginRef, int targetRank) throws MissingSkillPropertyDefinition {
if(retroMode) { if(ranks.get(targetRank) == null) {
if(retroRanks.get(targetRank) == null) {
throw new MissingSkillPropertyDefinition("No definition found for rank:"+targetRank+" using Retro scaling");
}
return retroRanks.get(targetRank);
} else {
if(standardRanks.get(targetRank) == null) {
throw new MissingSkillPropertyDefinition("No definition found for rank:"+targetRank+" using Standard scaling"); throw new MissingSkillPropertyDefinition("No definition found for rank:"+targetRank+" using Standard scaling");
} }
return standardRanks.get(targetRank);
} //Avoid zero or lower
int cosmeticModifier = Math.max(1, pluginRef.getPlayerLevelingSettings().getCosmeticLevelScaleModifier());
if(cosmeticModifier == 1)
return ranks.get(targetRank);
//Mutate rank
int rankValue = ranks.get(targetRank);
rankValue = rankValue / cosmeticModifier;
return rankValue;
} }
public void setStandardRanks(HashMap<Integer, Integer> standardRanks) { public void setRanks(HashMap<Integer, Integer> ranks) {
this.standardRanks = standardRanks; this.ranks = ranks;
} }
public void setRetroRanks(HashMap<Integer, Integer> retroRanks) { public HashMap<Integer, Integer> getRanks() {
this.retroRanks = retroRanks; return ranks;
} }
public HashMap<Integer, Integer> getStandardRanks() {
return standardRanks;
}
public HashMap<Integer, Integer> getRetroRanks() {
return retroRanks;
}
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.repair; package com.gmail.nossr50.config.skills.repair;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -14,17 +12,7 @@ public class ConfigRepairSuperRepair {
private static final String ODDS_PERCENTAGE_EXAMPLE = "25%"; private static final String ODDS_PERCENTAGE_EXAMPLE = "25%";
private static final double CHANCE_AT_MAX_SKILL_DEFAULT = 100.0D; 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." + @Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION)
"\nSkills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " + private double maxChance = 100.0;
"\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;
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.repair.repairmastery; package com.gmail.nossr50.config.skills.repair.repairmastery;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -12,14 +10,7 @@ public class ConfigRepairRepairMastery {
@Setting(value = ConfigConstants.MAX_BONUS_PERCENTAGE_FIELD_NAME) @Setting(value = ConfigConstants.MAX_BONUS_PERCENTAGE_FIELD_NAME)
private double maxBonusPercentage = 200.0D; private double maxBonusPercentage = 200.0D;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME, comment = ConfigConstants.MAX_BONUS_LEVEL_DESCRIPTION)
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
public double getMaxBonusPercentage() { public double getMaxBonusPercentage() {
return maxBonusPercentage; return maxBonusPercentage;
} }
public MaxBonusLevel getMaxBonusLevel() {
return maxBonusLevel;
}
} }

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.config.skills.smelting; package com.gmail.nossr50.config.skills.smelting;
import com.gmail.nossr50.config.ConfigConstants; import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.datatypes.skills.properties.MaxBonusLevel;
import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -13,7 +12,7 @@ public class ConfigSmelting {
@Setting(value = ConfigConstants.SUB_SKILL_NODE) @Setting(value = ConfigConstants.SUB_SKILL_NODE)
private ConfigSmeltingSubSkills subskills = new ConfigSmeltingSubSkills(); private ConfigSmeltingSubSkills subskills = new ConfigSmeltingSubSkills();
public ConfigSmeltingSubSkills getSubskills() { public ConfigSmeltingSubSkills getSubSkills() {
return subskills; return subskills;
} }
@ -26,10 +25,6 @@ public class ConfigSmelting {
return subskills.getMaxChance(); return subskills.getMaxChance();
} }
public MaxBonusLevel getMaxBonusLevel() {
return subskills.getMaxBonusLevel();
}
public HashMap<Integer, Integer> getXpMultiplierTable() { public HashMap<Integer, Integer> getXpMultiplierTable() {
return subskills.getXpMultiplierTable(); return subskills.getXpMultiplierTable();
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.smelting; package com.gmail.nossr50.config.skills.smelting;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -28,17 +26,10 @@ public class ConfigSmeltingSecondSmelt {
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION) @Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION)
private double maxChance = 50.0; private double maxChance = 50.0;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME, comment = ConfigConstants.MAX_BONUS_LEVEL_DESCRIPTION)
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
public double getMaxChance() { public double getMaxChance() {
return maxChance; return maxChance;
} }
public MaxBonusLevel getMaxBonusLevel() {
return maxBonusLevel;
}
@Setting(value = "XP-Multiplier-Per-Rank") @Setting(value = "XP-Multiplier-Per-Rank")
private HashMap<Integer, Integer> xpMultiplierTable = XP_MULT_MAP_DEFAULT; private HashMap<Integer, Integer> xpMultiplierTable = XP_MULT_MAP_DEFAULT;

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.config.skills.smelting; package com.gmail.nossr50.config.skills.smelting;
import com.gmail.nossr50.datatypes.skills.properties.MaxBonusLevel;
import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -20,10 +19,6 @@ public class ConfigSmeltingSubSkills {
return smeltingSecondSmelt.getMaxChance(); return smeltingSecondSmelt.getMaxChance();
} }
public MaxBonusLevel getMaxBonusLevel() {
return smeltingSecondSmelt.getMaxBonusLevel();
}
public HashMap<Integer, Integer> getXpMultiplierTable() { public HashMap<Integer, Integer> getXpMultiplierTable() {
return smeltingSecondSmelt.getXpMultiplierTable(); return smeltingSecondSmelt.getXpMultiplierTable();
} }

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.config.skills.swords; package com.gmail.nossr50.config.skills.swords;
import com.gmail.nossr50.config.ConfigConstants; import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.datatypes.skills.properties.MaxBonusLevel;
import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -31,10 +30,6 @@ public class ConfigSwords {
return subSkills.getCounterAttackMaxChance(); return subSkills.getCounterAttackMaxChance();
} }
public MaxBonusLevel getCounterAttackMaxBonusLevel() {
return subSkills.getCounterAttackMaxBonusLevel();
}
public double getCounterAttackDamageModifier() { public double getCounterAttackDamageModifier() {
return subSkills.getCounterAttackDamageModifier(); return subSkills.getCounterAttackDamageModifier();
} }
@ -47,10 +42,6 @@ public class ConfigSwords {
return subSkills.getRuptureMaxChance(); return subSkills.getRuptureMaxChance();
} }
public MaxBonusLevel getRuptureMaxBonusLevel() {
return subSkills.getRuptureMaxBonusLevel();
}
public double getRuptureDamagePlayer() { public double getRuptureDamagePlayer() {
return subSkills.getRuptureDamagePlayer(); return subSkills.getRuptureDamagePlayer();
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.swords; package com.gmail.nossr50.config.skills.swords;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -14,9 +12,6 @@ public class ConfigSwordsCounterAttack {
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION) @Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION)
private double maxChance = 30.0; private double maxChance = 30.0;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME, comment = ConfigConstants.MAX_BONUS_LEVEL_DESCRIPTION)
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
@Setting(value = "Damage-Modifier", comment = "The damage returned from Counter-Attack will be equal to the damage dealt divided by this number." + @Setting(value = "Damage-Modifier", comment = "The damage returned from Counter-Attack will be equal to the damage dealt divided by this number." +
"\nDefault value: "+DAMAGE_MODIFIER_DEFAULT) "\nDefault value: "+DAMAGE_MODIFIER_DEFAULT)
private double damageModifier = DAMAGE_MODIFIER_DEFAULT; private double damageModifier = DAMAGE_MODIFIER_DEFAULT;
@ -25,10 +20,6 @@ public class ConfigSwordsCounterAttack {
return maxChance; return maxChance;
} }
public MaxBonusLevel getCounterAttackMaxBonusLevel() {
return maxBonusLevel;
}
public double getCounterAttackDamageModifier() { public double getCounterAttackDamageModifier() {
return damageModifier; return damageModifier;
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.swords; package com.gmail.nossr50.config.skills.swords;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -17,9 +15,6 @@ public class ConfigSwordsRupture {
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION) @Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION)
private double maxChance = MAX_CHANCE_DEFAULT; private double maxChance = MAX_CHANCE_DEFAULT;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME)
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
@Setting(value = "Damage-Per-Tick-PVP") @Setting(value = "Damage-Per-Tick-PVP")
private double damagePlayer = DAMAGE_PVP_DEFAULT; private double damagePlayer = DAMAGE_PVP_DEFAULT;
@ -35,10 +30,6 @@ public class ConfigSwordsRupture {
return maxChance; return maxChance;
} }
public MaxBonusLevel getRuptureMaxBonusLevel() {
return maxBonusLevel;
}
public double getRuptureDamagePlayer() { public double getRuptureDamagePlayer() {
return damagePlayer; return damagePlayer;
} }

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.config.skills.swords; package com.gmail.nossr50.config.skills.swords;
import com.gmail.nossr50.datatypes.skills.properties.MaxBonusLevel;
import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -35,10 +34,6 @@ public class ConfigSwordsSubSkills {
return counterAttack.getCounterAttackMaxChance(); return counterAttack.getCounterAttackMaxChance();
} }
public MaxBonusLevel getCounterAttackMaxBonusLevel() {
return counterAttack.getCounterAttackMaxBonusLevel();
}
public double getCounterAttackDamageModifier() { public double getCounterAttackDamageModifier() {
return counterAttack.getCounterAttackDamageModifier(); return counterAttack.getCounterAttackDamageModifier();
} }
@ -51,10 +46,6 @@ public class ConfigSwordsSubSkills {
return rupture.getRuptureMaxChance(); return rupture.getRuptureMaxChance();
} }
public MaxBonusLevel getRuptureMaxBonusLevel() {
return rupture.getRuptureMaxBonusLevel();
}
public double getRuptureDamagePlayer() { public double getRuptureDamagePlayer() {
return rupture.getRuptureDamagePlayer(); return rupture.getRuptureDamagePlayer();
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.taming; package com.gmail.nossr50.config.skills.taming;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -15,9 +13,6 @@ public class ConfigTamingGore {
@Setting(value = "Gore-Bleed-Tick-Length", comment = "How many times to apply the bleed DOT from gore before it wears off.") @Setting(value = "Gore-Bleed-Tick-Length", comment = "How many times to apply the bleed DOT from gore before it wears off.")
private int goreBleedTicks = 2; private int goreBleedTicks = 2;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME, comment = ConfigConstants.MAX_BONUS_LEVEL_DESCRIPTION)
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
@Setting(value = "Gore-Damage-Modifier") @Setting(value = "Gore-Damage-Modifier")
private double goreMofifier = 2.0; private double goreMofifier = 2.0;
@ -25,10 +20,6 @@ public class ConfigTamingGore {
return maxChance; return maxChance;
} }
public MaxBonusLevel getMaxBonusLevel() {
return maxBonusLevel;
}
public double getGoreMofifier() { public double getGoreMofifier() {
return goreMofifier; return goreMofifier;
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config.skills.woodcutting; package com.gmail.nossr50.config.skills.woodcutting;
import com.gmail.nossr50.config.ConfigConstants; 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.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -14,15 +12,8 @@ public class ConfigWoodcuttingHarvest {
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION) @Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION)
private double maxChance = MAX_CHANCE_DEFAULT; private double maxChance = MAX_CHANCE_DEFAULT;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME)
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
public double getMaxChance() { public double getMaxChance() {
return maxChance; return maxChance;
} }
public MaxBonusLevel getMaxBonusLevel() {
return maxBonusLevel;
}
} }

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.core;
import com.gmail.nossr50.config.ConfigConstants; import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.properties.MaxBonusLevel;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.random.InvalidStaticChance; import com.gmail.nossr50.util.random.InvalidStaticChance;
import com.google.common.reflect.TypeToken; import com.google.common.reflect.TypeToken;
@ -31,8 +30,8 @@ public class SkillPropertiesManager {
staticActivationChanceMap = new HashMap<>(); staticActivationChanceMap = new HashMap<>();
} }
public void registerMaxBonusLevel(SubSkillType subSkillType, MaxBonusLevel maxBonusLevel) { public void registerMaxBonusLevel(SubSkillType subSkillType, int maxBonusLevel) {
maxBonusLevelMap.put(subSkillType, pluginRef.isRetroModeEnabled() ? maxBonusLevel.getRetroScaleValue() : maxBonusLevel.getStandardScaleValue()); maxBonusLevelMap.put(subSkillType, maxBonusLevel);
} }
public void registerMaxBonus(SubSkillType subSkillType, double maxBonus) { public void registerMaxBonus(SubSkillType subSkillType, double maxBonus) {
@ -133,13 +132,9 @@ public class SkillPropertiesManager {
} }
private void attemptRegisterMaxBonusLevel(SubSkillType subSkillType, CommentedConfigurationNode childNode) { private void attemptRegisterMaxBonusLevel(SubSkillType subSkillType, CommentedConfigurationNode childNode) {
try {
pluginRef.getLogger().info("Registering MaxBonusLevel for "+subSkillType.toString()); pluginRef.getLogger().info("Registering MaxBonusLevel for "+subSkillType.toString());
MaxBonusLevel maxBonusLevel = childNode.getValue(TypeToken.of(MaxBonusLevel.class)); int maxBonusLevel = childNode.getInt();
registerMaxBonusLevel(subSkillType, maxBonusLevel); registerMaxBonusLevel(subSkillType, maxBonusLevel);
} catch (ObjectMappingException e) {
//This time a silent exception is fine
}
} }
private void attemptRegisterMaxChance(SubSkillType subSkillType, CommentedConfigurationNode childNode) { private void attemptRegisterMaxChance(SubSkillType subSkillType, CommentedConfigurationNode childNode) {

View File

@ -1,35 +0,0 @@
package com.gmail.nossr50.datatypes.skills.properties;
public class AbstractMaxBonusLevel implements MaxBonusLevel {
private int retro;
private int standard;
public AbstractMaxBonusLevel(int standard, int retro) {
this.standard = standard;
this.retro = retro;
}
public AbstractMaxBonusLevel(int standard) {
this.standard = standard;
this.retro = standard * 10;
}
@Override
public int getRetroScaleValue() {
return retro;
}
@Override
public int getStandardScaleValue() {
return standard;
}
public void setRetro(int retro) {
this.retro = retro;
}
public void setStandard(int standard) {
this.standard = standard;
}
}

View File

@ -1,19 +0,0 @@
package com.gmail.nossr50.datatypes.skills.properties;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
public abstract class AbstractScalingProperty implements ScalingProperty {
public SubSkillType subSkillType;
public AbstractScalingProperty(SubSkillType subSkillType) {
super();
this.subSkillType = subSkillType;
}
@Override
public String toString() {
return "AbstractScalingProperty{" +
"subSkillType=" + subSkillType +
'}';
}
}

View File

@ -1,17 +0,0 @@
package com.gmail.nossr50.datatypes.skills.properties;
public interface MaxBonusLevel {
/**
* Get the max level for this skill for Retro scaling
* @return Retro Mode max bonus level
*/
int getRetroScaleValue();
/**
* Get the max level for this skill for Standard scaling
* @return Standard Mode max bonus level
*/
int getStandardScaleValue();
}

View File

@ -1,10 +0,0 @@
package com.gmail.nossr50.datatypes.skills.properties;
public interface ScalingProperty extends SkillProperty {
/**
* Returns the appropriate value for this scaling property whether it is Standard or Retro
*
* @return the value used in scaling calculations for this ScalingProperty
*/
double getValue();
}

View File

@ -372,7 +372,7 @@ public class Roll extends AcrobaticsSubSkill {
//Chance to roll at half max skill //Chance to roll at half max skill
RandomChanceSkill rollHalfMaxSkill = new RandomChanceSkill(pluginRef, null, subSkillType); RandomChanceSkill rollHalfMaxSkill = new RandomChanceSkill(pluginRef, null, subSkillType);
int halfMaxSkillValue = pluginRef.isRetroModeEnabled() ? 500 : 50; int halfMaxSkillValue = (int) pluginRef.getDynamicSettingsManager().getSkillMaxBonusLevel(subSkillType) / 2;
rollHalfMaxSkill.setSkillLevel(halfMaxSkillValue); rollHalfMaxSkill.setSkillLevel(halfMaxSkillValue);
//Chance to graceful roll at full skill //Chance to graceful roll at full skill

View File

@ -236,10 +236,14 @@ public class mcMMO extends JavaPlugin {
metrics = new Metrics(this); metrics = new Metrics(this);
metrics.addCustomChart(new Metrics.SimplePie("version", () -> getDescription().getVersion())); metrics.addCustomChart(new Metrics.SimplePie("version", () -> getDescription().getVersion()));
if (!configManager.getConfigLeveling().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().isRetroModeEnabled()) int levelScaleModifier = configManager.getConfigLeveling().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().getCosmeticLevelScaleModifier();
if (levelScaleModifier == 10)
metrics.addCustomChart(new Metrics.SimplePie("scaling", () -> "Standard")); metrics.addCustomChart(new Metrics.SimplePie("scaling", () -> "Standard"));
else else if (levelScaleModifier == 1)
metrics.addCustomChart(new Metrics.SimplePie("scaling", () -> "Retro")); metrics.addCustomChart(new Metrics.SimplePie("scaling", () -> "Retro"));
else
metrics.addCustomChart(new Metrics.SimplePie("scaling", () -> "Custom"));
} }
} catch (Throwable t) { } catch (Throwable t) {
getLogger().severe("There was an error while enabling mcMMO!"); getLogger().severe("There was an error while enabling mcMMO!");
@ -510,17 +514,6 @@ public class mcMMO extends JavaPlugin {
return healthBarPluginEnabled; return healthBarPluginEnabled;
} }
/**
* Checks if this plugin is using retro mode
* Retro mode is a 0-1000 skill system
* Standard mode is scaled for 1-100
*
* @return true if retro mode is enabled
*/
public boolean isRetroModeEnabled() {
return configManager.isRetroMode();
}
public ConfigManager getConfigManager() { public ConfigManager getConfigManager() {
return configManager; return configManager;
} }

View File

@ -9,10 +9,10 @@ import java.util.Map;
public class FormulaManager { public class FormulaManager {
// Experience needed to reach a level, cached values for speed // Experience needed to reach a level, cached values for speed
private Map<Integer, Integer> experienceNeededRetroLinear; private Map<Integer, Integer> experienceNeededCosmeticLinear;
private Map<Integer, Integer> experienceNeededStandardLinear; private Map<Integer, Integer> experienceNeededLinear;
private Map<Integer, Integer> experienceNeededRetroExponential; private Map<Integer, Integer> experienceNeededCosmeticExponential;
private Map<Integer, Integer> experienceNeededStandardExponential; private Map<Integer, Integer> experienceNeededExponential;
private FormulaType currentFormula; private FormulaType currentFormula;
private final mcMMO pluginRef; private final mcMMO pluginRef;
@ -27,10 +27,10 @@ public class FormulaManager {
* Initialize maps used for XP to next level * Initialize maps used for XP to next level
*/ */
private void initExperienceNeededMaps() { private void initExperienceNeededMaps() {
experienceNeededRetroLinear = new HashMap<>(); experienceNeededCosmeticLinear = new HashMap<>();
experienceNeededRetroExponential = new HashMap<>(); experienceNeededCosmeticExponential = new HashMap<>();
experienceNeededStandardLinear = new HashMap<>(); experienceNeededLinear = new HashMap<>();
experienceNeededStandardExponential = new HashMap<>(); experienceNeededExponential = new HashMap<>();
} }
/** /**
@ -120,34 +120,21 @@ public class FormulaManager {
return processXPToNextLevel(level, currentFormula); return processXPToNextLevel(level, currentFormula);
} }
/**
* Gets the value of XP needed for the next level based on the level Scaling, the level, and the formula type
* @param level target level
* @param formulaType target formulaType
*/
private int processXPToNextLevel(int level, FormulaType formulaType) {
if(pluginRef.isRetroModeEnabled())
{
return processXPRetroToNextLevel(level, formulaType);
} else {
return processStandardXPToNextLevel(level, formulaType);
}
}
/** /**
* Calculate the XP needed for the next level for the linear formula for Standard scaling (1-100) * Calculate the XP needed for the next level for the linear formula for Standard scaling (1-100)
* @param level target level * @param level target level
* @return raw xp needed to reach the next level * @return raw xp needed to reach the next level
*/ */
private int processStandardXPToNextLevel(int level, FormulaType formulaType) { private int processXPToNextLevel(int level, FormulaType formulaType) {
Map<Integer, Integer> experienceMapRef = formulaType == FormulaType.LINEAR ? experienceNeededStandardLinear : experienceNeededStandardExponential; Map<Integer, Integer> experienceMapRef = formulaType == FormulaType.LINEAR ? experienceNeededLinear : experienceNeededExponential;
if(!experienceMapRef.containsKey(level)) { if(!experienceMapRef.containsKey(level)) {
int cosmeticScaleMod = pluginRef.getPlayerLevelingSettings().getCosmeticLevelScaleModifier();
int experienceSum = 0; int experienceSum = 0;
int retroIndex = (level * 10) + 1; int cosmeticIndex = (level * cosmeticScaleMod) + 1;
//Sum the range of levels in Retro that this Standard level would represent //Sum the range of levels in Retro that this Standard level would represent
for(int x = retroIndex; x < (retroIndex + 10); x++) { for(int x = cosmeticIndex; x < (cosmeticIndex + cosmeticScaleMod); x++) {
//calculateXPNeeded doesn't cache results so we use that instead of invoking the Retro XP methods to avoid memory bloat //calculateXPNeeded doesn't cache results so we use that instead of invoking the Retro XP methods to avoid memory bloat
experienceSum += calculateXPNeeded(x, formulaType); experienceSum += calculateXPNeeded(x, formulaType);
} }
@ -166,7 +153,7 @@ public class FormulaManager {
* @return raw xp needed to reach the next level based on formula type * @return raw xp needed to reach the next level based on formula type
*/ */
private int processXPRetroToNextLevel(int level, FormulaType formulaType) { private int processXPRetroToNextLevel(int level, FormulaType formulaType) {
Map<Integer, Integer> experienceMapRef = formulaType == FormulaType.LINEAR ? experienceNeededRetroLinear : experienceNeededRetroExponential; Map<Integer, Integer> experienceMapRef = formulaType == FormulaType.LINEAR ? experienceNeededCosmeticLinear : experienceNeededCosmeticExponential;
if (!experienceMapRef.containsKey(level)) { if (!experienceMapRef.containsKey(level)) {
int experience = calculateXPNeeded(level, formulaType); int experience = calculateXPNeeded(level, formulaType);

View File

@ -392,7 +392,7 @@ public class RankTools {
.getNode(subSkillType.getHoconFriendlyConfigName()) .getNode(subSkillType.getHoconFriendlyConfigName())
.getValue(TypeToken.of(SkillRankProperty.class)); .getValue(TypeToken.of(SkillRankProperty.class));
int unlockLevel = skillRankProperty.getUnlockLevel(pluginRef.isRetroModeEnabled(), rank); int unlockLevel = skillRankProperty.getUnlockLevel(pluginRef, rank);
return unlockLevel; return unlockLevel;
} catch (ObjectMappingException | MissingSkillPropertyDefinition | NullPointerException e) { } catch (ObjectMappingException | MissingSkillPropertyDefinition | NullPointerException e) {