mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Added XP boost to Acrobatics when wearing Boots of Feather Falling.
Adds #1098
This commit is contained in:
parent
d8f3a54f9b
commit
fb4777e7f0
@ -8,6 +8,7 @@ Key:
|
||||
- Removal
|
||||
|
||||
Version 1.4.07-dev
|
||||
+ Added XP boost to Acrobatics when wearing Boots of Feather Falling
|
||||
+ Added SQL Database can now recover from a dropped connection without losing data. (Thanks Riking!)
|
||||
+ Added Carrot on a Stick and Flint & Steel to repair.vanilla.yml
|
||||
+ Added horses to the "Shake" ability
|
||||
|
@ -803,6 +803,8 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
public int getRollXPModifier() { return config.getInt("Skills.Acrobatics.Roll_XP_Modifier", 80); }
|
||||
public int getFallXPModifier() { return config.getInt("Skills.Acrobatics.Fall_XP_Modifier", 120); }
|
||||
|
||||
public double getFeatherFallXPModifier() { return config.getDouble("Skills.Acrobatics.FeatherFall_Multiplier", 2.0); }
|
||||
|
||||
/* ARCHERY */
|
||||
public int getSkillShotIncreaseLevel() { return config.getInt("Skills.Archery.SkillShot_IncreaseLevel", 50); }
|
||||
public double getSkillShotIncreasePercentage() { return config.getDouble("Skills.Archery.SkillShot_IncreasePercentage", 0.1D); }
|
||||
|
@ -20,6 +20,8 @@ public final class Acrobatics {
|
||||
public static int rollXpModifier = AdvancedConfig.getInstance().getRollXPModifier();
|
||||
public static int fallXpModifier = AdvancedConfig.getInstance().getFallXPModifier();
|
||||
|
||||
public static double featherFallXPModifier = AdvancedConfig.getInstance().getFeatherFallXPModifier();
|
||||
|
||||
public static boolean afkLevelingDisabled = Config.getInstance().getAcrobaticsAFKDisabled();
|
||||
public static boolean dodgeLightningDisabled = Config.getInstance().getDodgeLightningDisabled();
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
package com.gmail.nossr50.skills.acrobatics;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LightningStrike;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
@ -83,12 +85,12 @@ public class AcrobaticsManager extends SkillManager {
|
||||
|
||||
if (!isFatal(modifiedDamage) && isSuccessfulRoll(Acrobatics.rollMaxChance, Acrobatics.rollMaxBonusLevel)) {
|
||||
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
|
||||
applyXpGain((float) (damage * Acrobatics.rollXpModifier));
|
||||
applyXpGain(calculateRollXP(damage, true));
|
||||
|
||||
return modifiedDamage;
|
||||
}
|
||||
else if (!isFatal(damage)) {
|
||||
applyXpGain((float) (damage * Acrobatics.fallXpModifier));
|
||||
applyXpGain(calculateRollXP(damage, false));
|
||||
}
|
||||
|
||||
return damage;
|
||||
@ -105,12 +107,12 @@ public class AcrobaticsManager extends SkillManager {
|
||||
|
||||
if (!isFatal(modifiedDamage) && isSuccessfulRoll(Acrobatics.gracefulRollMaxChance, Acrobatics.gracefulRollMaxBonusLevel)) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Acrobatics.Ability.Proc"));
|
||||
applyXpGain((float) (damage * Acrobatics.rollXpModifier));
|
||||
applyXpGain(calculateRollXP(damage, true));
|
||||
|
||||
return modifiedDamage;
|
||||
}
|
||||
else if (!isFatal(damage)) {
|
||||
applyXpGain((float) (damage * Acrobatics.fallXpModifier));
|
||||
applyXpGain(calculateRollXP(damage, false));
|
||||
}
|
||||
|
||||
return damage;
|
||||
@ -123,4 +125,15 @@ public class AcrobaticsManager extends SkillManager {
|
||||
private boolean isFatal(double damage) {
|
||||
return getPlayer().getHealth() - damage < 1;
|
||||
}
|
||||
|
||||
private float calculateRollXP(double damage, boolean isRoll) {
|
||||
ItemStack boots = getPlayer().getInventory().getBoots();
|
||||
float xp = (float) (damage * (isRoll ? Acrobatics.rollXpModifier : Acrobatics.fallXpModifier));
|
||||
|
||||
if (boots != null && boots.containsEnchantment(Enchantment.PROTECTION_FALL)) {
|
||||
xp *= Acrobatics.featherFallXPModifier;
|
||||
}
|
||||
|
||||
return xp;
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,9 @@ Skills:
|
||||
Dodge_XP_Modifier: 120
|
||||
Roll_XP_Modifier: 80
|
||||
Fall_XP_Modifier: 120
|
||||
|
||||
# FeatherFall_Multiplier: Multiply Acrobatics XP by this value when wearing boots with the Feather Fall enchant
|
||||
FeatherFall_Multiplier: 2.0
|
||||
#
|
||||
# Settings for Archery
|
||||
###
|
||||
|
Loading…
Reference in New Issue
Block a user