mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 02:04:44 +02:00
Starting work on converting skills to use the new 100-scale system
This commit is contained in:
@ -438,6 +438,7 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
public boolean getAbilityMessagesEnabled() { return config.getBoolean("Abilities.Messages", true); }
|
||||
public boolean getAbilitiesEnabled() { return config.getBoolean("Abilities.Enabled", true); }
|
||||
public boolean getAbilitiesOnlyActivateWhenSneaking() { return config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false); }
|
||||
public boolean getAbilitiesGateEnabled() { return config.getBoolean("Abilities.Activation.Level_Gate_Abilities"); }
|
||||
|
||||
public int getCooldown(AbilityType ability) { return config.getInt("Abilities.Cooldowns." + ability.toString()); }
|
||||
public int getMaxLength(AbilityType ability) { return config.getInt("Abilities.Max_Seconds." + ability.toString()); }
|
||||
@ -471,6 +472,9 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
return disabled;
|
||||
}
|
||||
|
||||
/* Axes */
|
||||
public int getAxesGate() { return config.getInt("Skills.Axes.Ability_Activation_Level_Gate", 10); }
|
||||
|
||||
/* Acrobatics */
|
||||
public boolean getDodgeLightningDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_Dodge_Lightning", false); }
|
||||
public int getXPAfterTeleportCooldown() { return config.getInt("Skills.Acrobatics.XP_After_Teleport_Cooldown", 5); }
|
||||
@ -488,6 +492,10 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
|
||||
/* Mining */
|
||||
public Material getDetonatorItem() { return Material.matchMaterial(config.getString("Skills.Mining.Detonator_Name", "FLINT_AND_STEEL")); }
|
||||
public int getMiningGate() { return config.getInt("Skills.Mining.Ability_Activation_Level_Gate", 10); }
|
||||
|
||||
/* Excavation */
|
||||
public int getExcavationGate() { return config.getInt("Skills.Excavation.Ability_Activation_Level_Gate", 10); }
|
||||
|
||||
/* Repair */
|
||||
public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); }
|
||||
@ -507,6 +515,10 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
|
||||
public boolean getUnarmedItemPickupDisabled() { return config.getBoolean("Skills.Unarmed.Item_Pickup_Disabled_Full_Inventory", true); }
|
||||
public boolean getUnarmedItemsAsUnarmed() { return config.getBoolean("Skills.Unarmed.Items_As_Unarmed", false); }
|
||||
public int getUnarmedGate() { return config.getInt("Skills.Unarmed.Ability_Activation_Level_Gate", 10); }
|
||||
|
||||
/* Swords */
|
||||
public int getSwordsGate() { return config.getInt("Skills.Swords.Ability_Activation_Level_Gate", 10); }
|
||||
|
||||
/* Taming */
|
||||
public Material getTamingCOTWMaterial(EntityType type) { return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material")); }
|
||||
@ -519,6 +531,7 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
/* Woodcutting */
|
||||
public boolean getWoodcuttingDoubleDropsEnabled(BlockData material) { return config.getBoolean("Double_Drops.Woodcutting." + StringUtils.getFriendlyConfigBlockDataString(material)); }
|
||||
public boolean getTreeFellerSoundsEnabled() { return config.getBoolean("Skills.Woodcutting.Tree_Feller_Sounds", true); }
|
||||
public int getWoodcuttingGate() { return config.getInt("Skills.Woodcutting.Ability_Activation_Level_Gate", 10); }
|
||||
|
||||
/* AFK Leveling */
|
||||
public boolean getAcrobaticsPreventAFK() { return config.getBoolean("Skills.Acrobatics.Prevent_AFK_Leveling", true); }
|
||||
@ -536,6 +549,10 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
return (cap <= 0) ? Integer.MAX_VALUE : cap;
|
||||
}
|
||||
|
||||
public int getSkillAbilityGate(SkillType skill) {
|
||||
return config.getInt("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Ability_Activation_Level_Gate");
|
||||
}
|
||||
|
||||
public boolean getTruncateSkills() { return config.getBoolean("General.TruncateSkills", false); }
|
||||
|
||||
/* PVP & PVE Settings */
|
||||
|
@ -726,6 +726,19 @@ public class McMMOPlayer {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the player has passed the gate requirement
|
||||
*/
|
||||
if(Config.getInstance().getAbilitiesGateEnabled())
|
||||
{
|
||||
if(getSkillLevel(skill) < skill.getSkillAbilityGate())
|
||||
{
|
||||
//Inform the player they are not yet skilled enough
|
||||
player.sendMessage(LocaleLoader.getString("Skills.AbilityGateRequirementFail"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int timeRemaining = calculateTimeRemaining(ability);
|
||||
|
||||
if (timeRemaining > 0) {
|
||||
|
@ -119,6 +119,8 @@ public enum SkillType {
|
||||
return Config.getInstance().getLevelCap(this);
|
||||
}
|
||||
|
||||
public int getSkillAbilityGate() { return Config.getInstance().getSkillAbilityGate(this); }
|
||||
|
||||
public boolean getPVPEnabled() {
|
||||
return Config.getInstance().getPVPEnabled(this);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -21,6 +21,7 @@ public final class Woodcutting {
|
||||
public static int leafBlowerUnlockLevel = AdvancedConfig.getInstance().getLeafBlowUnlockLevel();
|
||||
public static int treeFellerThreshold = Config.getInstance().getTreeFellerThreshold();
|
||||
|
||||
|
||||
protected static boolean treeFellerReachedThreshold = false;
|
||||
|
||||
protected enum ExperienceGainMethod {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.skills.woodcutting;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
@ -23,6 +24,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class WoodcuttingManager extends SkillManager {
|
||||
|
||||
public WoodcuttingManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.WOODCUTTING);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class FormulaManager {
|
||||
switch (formulaType) {
|
||||
case LINEAR:
|
||||
if (!experienceNeededLinear.containsKey(level)) {
|
||||
experience = (int) Math.floor(base + level * multiplier);
|
||||
experience = (int) Math.floor( 10 * (base + level * multiplier));
|
||||
experienceNeededLinear.put(level, experience);
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ public class FormulaManager {
|
||||
|
||||
case EXPONENTIAL:
|
||||
if (!experienceNeededExponential.containsKey(level)) {
|
||||
experience = (int) Math.floor(multiplier * Math.pow(level, exponent) + base);
|
||||
experience = (int) Math.floor( 10 * multiplier * Math.pow(level, exponent) + base);
|
||||
experienceNeededExponential.put(level, experience);
|
||||
}
|
||||
|
||||
|
@ -208,6 +208,18 @@ public class SkillUtils {
|
||||
|
||||
public static boolean activationSuccessful(SecondaryAbility skillAbility, Player player, int skillLevel, int activationChance, double maxChance, int maxLevel) {
|
||||
double chance = (maxChance / maxLevel) * Math.min(skillLevel, maxLevel) / activationChance;
|
||||
return propagateSecondaryAbilityEvent(skillAbility, player, activationChance, chance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an event out regarding activation of RNG based sub-skills
|
||||
* @param skillAbility The random-chance ability
|
||||
* @param player The player that the skill belong to
|
||||
* @param activationChance parameter used in activation calculations
|
||||
* @param chance parameter used in activation calculations
|
||||
* @return returns true if successful
|
||||
*/
|
||||
private static boolean propagateSecondaryAbilityEvent(SecondaryAbility skillAbility, Player player, int activationChance, double chance) {
|
||||
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(player, skillAbility, chance);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
return (event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance) && !event.isCancelled();
|
||||
@ -215,9 +227,7 @@ public class SkillUtils {
|
||||
|
||||
public static boolean activationSuccessful(SecondaryAbility skillAbility, Player player, double staticChance, int activationChance) {
|
||||
double chance = staticChance / activationChance;
|
||||
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(player, skillAbility, chance);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
return (event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance) && !event.isCancelled();
|
||||
return propagateSecondaryAbilityEvent(skillAbility, player, activationChance, chance);
|
||||
}
|
||||
|
||||
public static boolean activationSuccessful(SecondaryAbility skillAbility, Player player) {
|
||||
|
Reference in New Issue
Block a user