mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
Starting work on converting skills to use the new 100-scale system
This commit is contained in:
@ -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