From d6b3010b533c83fe151c1215e3716d1d1d8adff5 Mon Sep 17 00:00:00 2001 From: Vincentyification Date: Thu, 2 Jan 2014 13:21:20 +0800 Subject: [PATCH] Update AcrobaticsManager.java Fixes a bug that prevents the player from receiving XP while having Resistance from a beacon. --- .../skills/acrobatics/AcrobaticsManager.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java index 8bce08230..407c105d3 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java @@ -151,7 +151,21 @@ public class AcrobaticsManager extends SkillManager { } private boolean isFatal(double damage) { - return getPlayer().getHealth() - damage <= 0; + Player player = getPlayer(); + int discount=1; + // If the player has resistance active, carry resistance checking + if(player.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)){ + Iterator potions=t.getActivePotionEffects().iterator(); + while(potions.hasNext()){ + PotionEffect potion=(PotionEffect)potions.next(); + if(potion.getType()==PotionEffectType.DAMAGE_RESISANCE) + {//Having resistance allows you to recieve less damage + int coupon=potion.getAmplifier(); + discount=Math.min(0,1-(coupon*0.2)); + } + } + }//...Which is accounted here + return getPlayer().getHealth() - damage*discount <= 0; } private float calculateRollXP(double damage, boolean isRoll) {