Added XP boost to Acrobatics when wearing Boots of Feather Falling.

Adds #1098
This commit is contained in:
GJ 2013-10-07 09:53:32 -04:00
parent d8f3a54f9b
commit fb4777e7f0
5 changed files with 25 additions and 4 deletions

View File

@ -8,6 +8,7 @@ Key:
- Removal - Removal
Version 1.4.07-dev 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 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 Carrot on a Stick and Flint & Steel to repair.vanilla.yml
+ Added horses to the "Shake" ability + Added horses to the "Shake" ability

View File

@ -803,6 +803,8 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
public int getRollXPModifier() { return config.getInt("Skills.Acrobatics.Roll_XP_Modifier", 80); } 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 int getFallXPModifier() { return config.getInt("Skills.Acrobatics.Fall_XP_Modifier", 120); }
public double getFeatherFallXPModifier() { return config.getDouble("Skills.Acrobatics.FeatherFall_Multiplier", 2.0); }
/* ARCHERY */ /* ARCHERY */
public int getSkillShotIncreaseLevel() { return config.getInt("Skills.Archery.SkillShot_IncreaseLevel", 50); } public int getSkillShotIncreaseLevel() { return config.getInt("Skills.Archery.SkillShot_IncreaseLevel", 50); }
public double getSkillShotIncreasePercentage() { return config.getDouble("Skills.Archery.SkillShot_IncreasePercentage", 0.1D); } public double getSkillShotIncreasePercentage() { return config.getDouble("Skills.Archery.SkillShot_IncreasePercentage", 0.1D); }

View File

@ -20,6 +20,8 @@ public final class Acrobatics {
public static int rollXpModifier = AdvancedConfig.getInstance().getRollXPModifier(); public static int rollXpModifier = AdvancedConfig.getInstance().getRollXPModifier();
public static int fallXpModifier = AdvancedConfig.getInstance().getFallXPModifier(); public static int fallXpModifier = AdvancedConfig.getInstance().getFallXPModifier();
public static double featherFallXPModifier = AdvancedConfig.getInstance().getFeatherFallXPModifier();
public static boolean afkLevelingDisabled = Config.getInstance().getAcrobaticsAFKDisabled(); public static boolean afkLevelingDisabled = Config.getInstance().getAcrobaticsAFKDisabled();
public static boolean dodgeLightningDisabled = Config.getInstance().getDodgeLightningDisabled(); public static boolean dodgeLightningDisabled = Config.getInstance().getDodgeLightningDisabled();

View File

@ -1,9 +1,11 @@
package com.gmail.nossr50.skills.acrobatics; package com.gmail.nossr50.skills.acrobatics;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LightningStrike; import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
@ -83,12 +85,12 @@ public class AcrobaticsManager extends SkillManager {
if (!isFatal(modifiedDamage) && isSuccessfulRoll(Acrobatics.rollMaxChance, Acrobatics.rollMaxBonusLevel)) { if (!isFatal(modifiedDamage) && isSuccessfulRoll(Acrobatics.rollMaxChance, Acrobatics.rollMaxBonusLevel)) {
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text")); player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
applyXpGain((float) (damage * Acrobatics.rollXpModifier)); applyXpGain(calculateRollXP(damage, true));
return modifiedDamage; return modifiedDamage;
} }
else if (!isFatal(damage)) { else if (!isFatal(damage)) {
applyXpGain((float) (damage * Acrobatics.fallXpModifier)); applyXpGain(calculateRollXP(damage, false));
} }
return damage; return damage;
@ -105,12 +107,12 @@ public class AcrobaticsManager extends SkillManager {
if (!isFatal(modifiedDamage) && isSuccessfulRoll(Acrobatics.gracefulRollMaxChance, Acrobatics.gracefulRollMaxBonusLevel)) { if (!isFatal(modifiedDamage) && isSuccessfulRoll(Acrobatics.gracefulRollMaxChance, Acrobatics.gracefulRollMaxBonusLevel)) {
getPlayer().sendMessage(LocaleLoader.getString("Acrobatics.Ability.Proc")); getPlayer().sendMessage(LocaleLoader.getString("Acrobatics.Ability.Proc"));
applyXpGain((float) (damage * Acrobatics.rollXpModifier)); applyXpGain(calculateRollXP(damage, true));
return modifiedDamage; return modifiedDamage;
} }
else if (!isFatal(damage)) { else if (!isFatal(damage)) {
applyXpGain((float) (damage * Acrobatics.fallXpModifier)); applyXpGain(calculateRollXP(damage, false));
} }
return damage; return damage;
@ -123,4 +125,15 @@ public class AcrobaticsManager extends SkillManager {
private boolean isFatal(double damage) { private boolean isFatal(double damage) {
return getPlayer().getHealth() - damage < 1; 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;
}
} }

View File

@ -49,6 +49,9 @@ Skills:
Dodge_XP_Modifier: 120 Dodge_XP_Modifier: 120
Roll_XP_Modifier: 80 Roll_XP_Modifier: 80
Fall_XP_Modifier: 120 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 # Settings for Archery
### ###