mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-24 01:27:41 +01:00
Wire up Acrobatics XP config + PVP XP
This commit is contained in:
parent
8ddbb3aa91
commit
fb6e5e41ad
@ -148,7 +148,7 @@ Version 2.2.0
|
||||
Update_Check, Prefer_Beta, Ability_Activation_Level_Gate, Max_Tries_At_Same_Location, Prevent_AFK_Leveling, Items_Pickup_Disabled_Full_Inventory
|
||||
|
||||
Removed the following config settings for being unwanted
|
||||
Config_Update_Overwrite, Tool_Mods_Enabled, Armor_Mods_Enabled, Block_Mods_Enabled, Entity_Mods_Enabled
|
||||
Config_Update_Overwrite, Tool_Mods_Enabled, Armor_Mods_Enabled, Block_Mods_Enabled, Entity_Mods_Enabled,
|
||||
|
||||
API Changes
|
||||
SimpleRepairable/SimpleSalvageable renamed to just Repairable/Salvageable, and their unnecessary interface classes were removed
|
||||
|
@ -178,18 +178,6 @@ public class ExperienceConfig extends ConfigValidated {
|
||||
reason.add(EXPERIENCE + "." + COMBAT + "." + MULTIPLIER + "." + ANIMALS + " should be at least 0!");
|
||||
}
|
||||
|
||||
if (getDodgeXPModifier() < 0) {
|
||||
reason.add("Skills." + ACROBATICS + "." + DODGE + "_XP_" + MODIFIER + " should be at least 0!");
|
||||
}
|
||||
|
||||
if (getRollXPModifier() < 0) {
|
||||
reason.add("Skills." + ACROBATICS + "." + ROLL + "_XP_" + MODIFIER + " should be at least 0!");
|
||||
}
|
||||
|
||||
if (getFallXPModifier() < 0) {
|
||||
reason.add("Skills." + ACROBATICS + "." + FALL + "_XP_" + MODIFIER + " should be at least 0!");
|
||||
}
|
||||
|
||||
/* Fishing */
|
||||
// TODO: Add validation for each fish type once enum is available.
|
||||
|
||||
@ -315,11 +303,6 @@ public class ExperienceConfig extends ConfigValidated {
|
||||
* XP SETTINGS
|
||||
*/
|
||||
|
||||
/* General Settings */
|
||||
public boolean getExperienceGainsPlayerVersusPlayerEnabled() {
|
||||
return getBooleanValue(EXPERIENCE, PVP, REWARDS);
|
||||
}
|
||||
|
||||
/* Combat XP Multipliers */
|
||||
public double getCombatXP(EntityType entity) {
|
||||
return getDoubleValue(EXPERIENCE, COMBAT, MULTIPLIER, StringUtils.getEntityConfigName(entity));
|
||||
@ -404,23 +387,6 @@ public class ExperienceConfig extends ConfigValidated {
|
||||
return BarStyle.SOLID;
|
||||
}
|
||||
|
||||
/* Acrobatics */
|
||||
public int getDodgeXPModifier() {
|
||||
return getIntValue(EXPERIENCE, ACROBATICS, DODGE);
|
||||
}
|
||||
|
||||
public int getRollXPModifier() {
|
||||
return getIntValue(EXPERIENCE, ACROBATICS, ROLL);
|
||||
}
|
||||
|
||||
public int getFallXPModifier() {
|
||||
return getIntValue(EXPERIENCE, ACROBATICS, FALL);
|
||||
}
|
||||
|
||||
public double getFeatherFallXPModifier() {
|
||||
return getDoubleValue(EXPERIENCE, ACROBATICS, FEATHER_FALL_MULTIPLIER);
|
||||
}
|
||||
|
||||
/* Alchemy */
|
||||
public double getPotionXP(PotionStage stage) {
|
||||
return getDoubleValue(EXPERIENCE, ALCHEMY, POTION_STAGE + stage.toNumerical());
|
||||
|
@ -119,4 +119,28 @@ public class ConfigExperience {
|
||||
public int getFallXP() {
|
||||
return experienceAcrobatics.getFallXP();
|
||||
}
|
||||
|
||||
public int getStageOnePotionXP() {
|
||||
return experienceAlchemy.getStageOnePotionXP();
|
||||
}
|
||||
|
||||
public int getStageTwoPotionXP() {
|
||||
return experienceAlchemy.getStageTwoPotionXP();
|
||||
}
|
||||
|
||||
public int getStageThreePotionXP() {
|
||||
return experienceAlchemy.getStageThreePotionXP();
|
||||
}
|
||||
|
||||
public int getStageFourPotionXP() {
|
||||
return experienceAlchemy.getStageFourPotionXP();
|
||||
}
|
||||
|
||||
public int getStageFivePotionXP() {
|
||||
return experienceAlchemy.getStageFivePotionXP();
|
||||
}
|
||||
|
||||
public boolean isPvpXPEnabled() {
|
||||
return experienceCombat.isPvpXPEnabled();
|
||||
}
|
||||
}
|
@ -5,4 +5,6 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||
@ConfigSerializable
|
||||
public class ConfigExperienceArchery {
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,8 +1,20 @@
|
||||
package com.gmail.nossr50.config.hocon.experience;
|
||||
|
||||
import ninja.leaping.configurate.objectmapping.Setting;
|
||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||
|
||||
@ConfigSerializable
|
||||
public class ConfigExperienceCombat {
|
||||
|
||||
private static final boolean PVP_XP_ENABLED_DEFAULT = false;
|
||||
|
||||
@Setting(value = "PVP-XP", comment = "If true, players will gain XP from PVP interactions." +
|
||||
"\nBe careful turning this on as this can potentially allow for unwanted behaviour from players." +
|
||||
"\nDefault value: "+PVP_XP_ENABLED_DEFAULT)
|
||||
private boolean pvpXPEnabled = PVP_XP_ENABLED_DEFAULT;
|
||||
|
||||
public boolean isPvpXPEnabled() {
|
||||
return pvpXPEnabled;
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.config.hocon.skills.acrobatics;
|
||||
|
||||
import com.gmail.nossr50.config.hocon.skills.ConfigSubSkillScalingRNG;
|
||||
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;
|
||||
@ -24,4 +25,11 @@ public class ConfigAcrobatics {
|
||||
return dodge;
|
||||
}
|
||||
|
||||
public ConfigSubSkillScalingRNG getRNGSettings() {
|
||||
return dodge.getRNGSettings();
|
||||
}
|
||||
|
||||
public double getDamageReductionDivisor() {
|
||||
return dodge.getDamageReductionDivisor();
|
||||
}
|
||||
}
|
@ -301,10 +301,10 @@ public class Roll extends AcrobaticsSubSkill {
|
||||
|
||||
private float calculateRollXP(Player player, double damage, boolean isRoll) {
|
||||
ItemStack boots = player.getInventory().getBoots();
|
||||
float xp = (float) (damage * (isRoll ? ExperienceConfig.getInstance().getRollXPModifier() : ExperienceConfig.getInstance().getFallXPModifier()));
|
||||
float xp = (float) (damage * (isRoll ? mcMMO.getConfigManager().getConfigExperience().getRollXP() : mcMMO.getConfigManager().getConfigExperience().getFallXP()));
|
||||
|
||||
if (boots != null && boots.containsEnchantment(Enchantment.PROTECTION_FALL)) {
|
||||
xp *= ExperienceConfig.getInstance().getFeatherFallXPModifier();
|
||||
xp *= mcMMO.getConfigManager().getConfigExperience().getFeatherFallMultiplier();
|
||||
}
|
||||
|
||||
return xp;
|
||||
|
@ -3,13 +3,18 @@ package com.gmail.nossr50.skills.acrobatics;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.MainConfig;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
public final class Acrobatics {
|
||||
public static double dodgeDamageModifier = AdvancedConfig.getInstance().getDodgeDamageModifier();
|
||||
public static int dodgeXpModifier = ExperienceConfig.getInstance().getDodgeXPModifier();
|
||||
public static boolean dodgeLightningDisabled = MainConfig.getInstance().getDodgeLightningDisabled();
|
||||
public static double dodgeDamageModifier;
|
||||
public static int dodgeXpModifier;
|
||||
// public static boolean dodgeLightningDisabled;
|
||||
|
||||
private Acrobatics() {}
|
||||
private Acrobatics() {
|
||||
dodgeDamageModifier = mcMMO.getConfigManager().getConfigAcrobatics().getDamageReductionDivisor();
|
||||
dodgeXpModifier = mcMMO.getConfigManager().getExperienceConfig().getDodgeXPModifier();
|
||||
// dodgeLightningDisabled = MainConfig.getInstance().getDodgeLightningDisabled();
|
||||
}
|
||||
|
||||
protected static double calculateModifiedDodgeDamage(double damage, double damageModifier) {
|
||||
return Math.max(damage / damageModifier, 1.0);
|
||||
|
@ -52,9 +52,9 @@ public class AcrobaticsManager extends SkillManager {
|
||||
return false;
|
||||
|
||||
if (Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ACROBATICS_DODGE)) {
|
||||
if (damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) {
|
||||
/*if (damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) {
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
return skill.shouldProcess(damager);
|
||||
}
|
||||
|
@ -551,7 +551,7 @@ public final class CombatUtils {
|
||||
XPGainReason xpGainReason;
|
||||
|
||||
if (target instanceof Player) {
|
||||
if (!ExperienceConfig.getInstance().getExperienceGainsPlayerVersusPlayerEnabled() || PartyManager.inSameParty(mcMMOPlayer.getPlayer(), (Player) target)) {
|
||||
if (!mcMMO.getConfigManager().getConfigExperience().isPvpXPEnabled() || PartyManager.inSameParty(mcMMOPlayer.getPlayer(), (Player) target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user