From d07b67b5bfc4a5178a4de53f443bb4c24321c4e2 Mon Sep 17 00:00:00 2001 From: GJ Date: Thu, 11 Jul 2013 12:43:36 -0400 Subject: [PATCH] Health and damage are now doubles, not ints. --- .../fake/FakeEntityDamageByEntityEvent.java | 2 +- .../events/fake/FakeEntityDamageEvent.java | 2 +- .../nossr50/listeners/EntityListener.java | 4 ++-- .../runnables/skills/AwardCombatXpTask.java | 6 ++--- .../nossr50/skills/acrobatics/Acrobatics.java | 4 ++-- .../skills/acrobatics/AcrobaticsManager.java | 24 +++++++++---------- .../skills/archery/ArcheryManager.java | 6 ++--- .../nossr50/skills/axes/AxesManager.java | 14 +++++------ .../nossr50/skills/mining/MiningManager.java | 4 ++-- .../nossr50/skills/swords/SwordsManager.java | 4 ++-- .../gmail/nossr50/skills/taming/Taming.java | 10 ++++---- .../nossr50/skills/taming/TamingManager.java | 12 +++++----- .../skills/unarmed/UnarmedManager.java | 6 ++--- .../woodcutting/WoodcuttingManager.java | 4 ++-- .../com/gmail/nossr50/util/ChimaeraWing.java | 2 +- .../gmail/nossr50/util/MobHealthbarUtils.java | 12 +++++----- .../nossr50/util/skills/CombatUtils.java | 14 +++++------ 17 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/events/fake/FakeEntityDamageByEntityEvent.java b/src/main/java/com/gmail/nossr50/events/fake/FakeEntityDamageByEntityEvent.java index a2ad48842..2dfcbd138 100644 --- a/src/main/java/com/gmail/nossr50/events/fake/FakeEntityDamageByEntityEvent.java +++ b/src/main/java/com/gmail/nossr50/events/fake/FakeEntityDamageByEntityEvent.java @@ -7,7 +7,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; * Called when mcMMO applies damage from an entity due to special abilities. */ public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent { - public FakeEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, int damage) { + public FakeEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, double damage) { super(damager, damagee, cause, damage); } } diff --git a/src/main/java/com/gmail/nossr50/events/fake/FakeEntityDamageEvent.java b/src/main/java/com/gmail/nossr50/events/fake/FakeEntityDamageEvent.java index 3ae6b1aed..20a2dd0d8 100644 --- a/src/main/java/com/gmail/nossr50/events/fake/FakeEntityDamageEvent.java +++ b/src/main/java/com/gmail/nossr50/events/fake/FakeEntityDamageEvent.java @@ -7,7 +7,7 @@ import org.bukkit.event.entity.EntityDamageEvent; * Called when mcMMO applies damage due to special abilities. */ public class FakeEntityDamageEvent extends EntityDamageEvent { - public FakeEntityDamageEvent(Entity damagee, DamageCause cause, int damage) { + public FakeEntityDamageEvent(Entity damagee, DamageCause cause, double damage) { super(damagee, cause, damage); } } diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 45cd523f8..e74f3fe80 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -124,7 +124,7 @@ public class EntityListener implements Listener { return; } - int damage = event.getDamage(); + double damage = event.getDamage(); if (damage <= 0) { return; @@ -184,7 +184,7 @@ public class EntityListener implements Listener { return; } - int damage = event.getDamage(); + double damage = event.getDamage(); if (damage <= 0) { return; diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AwardCombatXpTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AwardCombatXpTask.java index 883f1e890..efb98f9c3 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AwardCombatXpTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AwardCombatXpTask.java @@ -11,7 +11,7 @@ public class AwardCombatXpTask extends BukkitRunnable { private double baseXp; private SkillType skillType; private LivingEntity target; - private int baseHealth; + private double baseHealth; public AwardCombatXpTask(McMMOPlayer mcMMOPlayer, SkillType skillType, double baseXp, LivingEntity target) { this.mcMMOPlayer = mcMMOPlayer; @@ -23,8 +23,8 @@ public class AwardCombatXpTask extends BukkitRunnable { @Override public void run() { - int health = target.getHealth(); - int damage = baseHealth - health; + double health = target.getHealth(); + double damage = baseHealth - health; // May avoid negative xp, we don't know what other plugins do with the entity health if (damage <= 0) { diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java index 448455b1a..e703a3d83 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java @@ -25,11 +25,11 @@ public final class Acrobatics { private Acrobatics() {}; - protected static int calculateModifiedDodgeDamage(int damage, int damageModifier) { + protected static double calculateModifiedDodgeDamage(double damage, int damageModifier) { return Math.max(damage / damageModifier, 1); } - protected static int calculateModifiedRollDamage(int damage, int damageThreshold) { + protected static double calculateModifiedRollDamage(double damage, int damageThreshold) { return Math.max(damage - damageThreshold, 0); } } 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 a72ce3816..49f51195c 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java @@ -44,8 +44,8 @@ public class AcrobaticsManager extends SkillManager { * @param damage The amount of damage initially dealt by the event * @return the modified event damage if the ability was successful, the original event damage otherwise */ - public int dodgeCheck(int damage) { - int modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage, Acrobatics.dodgeDamageModifier); + public double dodgeCheck(double damage) { + double modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage, Acrobatics.dodgeDamageModifier); Player player = getPlayer(); if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Acrobatics.dodgeMaxChance, Acrobatics.dodgeMaxBonusLevel)) { @@ -57,7 +57,7 @@ public class AcrobaticsManager extends SkillManager { // Why do we check respawn cooldown here? if (System.currentTimeMillis() >= mcMMOPlayer.getRespawnATS() + Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS) { - applyXpGain(damage * Acrobatics.dodgeXpModifier); + applyXpGain((float) (damage * Acrobatics.dodgeXpModifier)); } return modifiedDamage; @@ -72,23 +72,23 @@ public class AcrobaticsManager extends SkillManager { * @param damage The amount of damage initially dealt by the event * @return the modified event damage if the ability was successful, the original event damage otherwise */ - public int rollCheck(int damage) { + public double rollCheck(double damage) { Player player = getPlayer(); if (player.isSneaking() && Permissions.gracefulRoll(player)) { return gracefulRollCheck(damage); } - int modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.rollThreshold); + double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.rollThreshold); if (!isFatal(modifiedDamage) && isSuccessfulRoll(Acrobatics.rollMaxChance, Acrobatics.rollMaxBonusLevel)) { player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text")); - applyXpGain(damage * Acrobatics.rollXpModifier); + applyXpGain((float) (damage * Acrobatics.rollXpModifier)); return modifiedDamage; } else if (!isFatal(damage)) { - applyXpGain(damage * Acrobatics.fallXpModifier); + applyXpGain((float) (damage * Acrobatics.fallXpModifier)); } return damage; @@ -100,17 +100,17 @@ public class AcrobaticsManager extends SkillManager { * @param damage The amount of damage initially dealt by the event * @return the modified event damage if the ability was successful, the original event damage otherwise */ - private int gracefulRollCheck(int damage) { - int modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.gracefulRollThreshold); + private double gracefulRollCheck(double damage) { + double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.gracefulRollThreshold); if (!isFatal(modifiedDamage) && isSuccessfulRoll(Acrobatics.gracefulRollMaxChance, Acrobatics.gracefulRollMaxBonusLevel)) { getPlayer().sendMessage(LocaleLoader.getString("Acrobatics.Ability.Proc")); - applyXpGain(damage * Acrobatics.rollXpModifier); + applyXpGain((float) (damage * Acrobatics.rollXpModifier)); return modifiedDamage; } else if (!isFatal(damage)) { - applyXpGain(damage * Acrobatics.fallXpModifier); + applyXpGain((float) (damage * Acrobatics.fallXpModifier)); } return damage; @@ -120,7 +120,7 @@ public class AcrobaticsManager extends SkillManager { return (maxChance / maxLevel) * Math.min(getSkillLevel(), maxLevel) > Misc.getRandom().nextInt(activationChance); } - private boolean isFatal(int damage) { + private boolean isFatal(double damage) { return getPlayer().getHealth() - damage < 1; } } diff --git a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java index 033da4f44..96ad08026 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java @@ -68,7 +68,7 @@ public class ArcheryManager extends SkillManager { * @param damage The amount of damage initially dealt by the event * @return the modified event damage if the ability was successful, the original event damage otherwise */ - public int dazeCheck(Player defender, int damage) { + public double dazeCheck(Player defender, double damage) { if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Archery.dazeMaxBonus, Archery.dazeMaxBonusLevel)) { Location dazedLocation = defender.getLocation(); dazedLocation.setPitch(90 - Misc.getRandom().nextInt(181)); @@ -96,9 +96,9 @@ public class ArcheryManager extends SkillManager { * @param damage The amount of damage initially dealt by the event * @return the modified event damage */ - public int skillShotCheck(int damage) { + public double skillShotCheck(double damage) { double damageBonusPercent = Math.min(((getSkillLevel() / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage), Archery.skillShotMaxBonusPercentage); - int archeryBonus = (int) (damage * damageBonusPercent); + double archeryBonus = damage * damageBonusPercent; return damage + archeryBonus; } diff --git a/src/main/java/com/gmail/nossr50/skills/axes/AxesManager.java b/src/main/java/com/gmail/nossr50/skills/axes/AxesManager.java index 3306e8752..77de304b5 100644 --- a/src/main/java/com/gmail/nossr50/skills/axes/AxesManager.java +++ b/src/main/java/com/gmail/nossr50/skills/axes/AxesManager.java @@ -55,8 +55,8 @@ public class AxesManager extends SkillManager { * @param damage The amount of damage initially dealt by the event * @return the modified event damage */ - public int axeMasteryCheck(int damage) { - int axeBonus = Math.min(getSkillLevel() / (Axes.bonusDamageMaxBonusLevel / Axes.bonusDamageMaxBonus), Axes.bonusDamageMaxBonus); + public double axeMasteryCheck(double damage) { + double axeBonus = Math.min(getSkillLevel() / (Axes.bonusDamageMaxBonusLevel / Axes.bonusDamageMaxBonus), Axes.bonusDamageMaxBonus); return damage + axeBonus; } @@ -68,17 +68,17 @@ public class AxesManager extends SkillManager { * @param damage The amount of damage initially dealt by the event * @return the modified event damage if the ability was successful, the original event damage otherwise */ - public int criticalHitCheck(LivingEntity target, int damage) { + public double criticalHitCheck(LivingEntity target, double damage) { if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Axes.criticalHitMaxChance, Axes.criticalHitMaxBonusLevel)) { getPlayer().sendMessage(LocaleLoader.getString("Axes.Combat.CriticalHit")); if (target instanceof Player) { ((Player) target).sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck")); - return (int) (damage * Axes.criticalHitPVPModifier); + return damage * Axes.criticalHitPVPModifier; } - return (int) (damage * Axes.criticalHitPVEModifier); + return damage * Axes.criticalHitPVEModifier; } return damage; @@ -111,7 +111,7 @@ public class AxesManager extends SkillManager { * @param damage The amount of damage initially dealt by the event * @return the modified event damage if the ability was successful, the original event damage otherwise */ - public int greaterImpactCheck(LivingEntity target, int damage) { + public double greaterImpactCheck(LivingEntity target, double damage) { if (Axes.greaterImpactChance > Misc.getRandom().nextInt(getActivationChance())) { Player player = getPlayer(); @@ -142,7 +142,7 @@ public class AxesManager extends SkillManager { * @param target The {@link LivingEntity} being affected by the ability * @param damage The amount of damage initially dealt by the event */ - public void skullSplitterCheck(LivingEntity target, int damage) { + public void skullSplitterCheck(LivingEntity target, double damage) { CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Axes.skullSplitterModifier, skill); } } diff --git a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java index ac792f616..c0d45172f 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java @@ -175,8 +175,8 @@ public class MiningManager extends SkillManager { return (float) (radius + getBlastRadiusModifier()); } - public int processDemolitionsExpertise(int damage) { - return (int) (damage * ((100.0D - getBlastDamageModifier()) / 100.0D)); + public double processDemolitionsExpertise(double damage) { + return damage * ((100.0D - getBlastDamageModifier()) / 100.0D); } /** diff --git a/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java b/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java index 962bf4970..80991e271 100644 --- a/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java +++ b/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java @@ -66,7 +66,7 @@ public class SwordsManager extends SkillManager { } } - public void counterAttackChecks(LivingEntity attacker, int damage) { + public void counterAttackChecks(LivingEntity attacker, double damage) { if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Swords.counterAttackMaxChance, Swords.counterAttackMaxBonusLevel)) { CombatUtils.dealDamage(attacker, damage / Swords.counterAttackModifier); @@ -78,7 +78,7 @@ public class SwordsManager extends SkillManager { } } - public void serratedStrikes(LivingEntity target, int damage) { + public void serratedStrikes(LivingEntity target, double damage) { CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Swords.serratedStrikesModifier, skill); BleedTimerTask.add(target, Swords.serratedStrikesBleedTicks); } diff --git a/src/main/java/com/gmail/nossr50/skills/taming/Taming.java b/src/main/java/com/gmail/nossr50/skills/taming/Taming.java index a6e312680..c3af04142 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/Taming.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/Taming.java @@ -39,7 +39,7 @@ public class Taming { return pet.isTamed() && owner instanceof Player && pet instanceof Wolf; } - public static int processThickFur(Wolf wolf, int damage) { + public static double processThickFur(Wolf wolf, double damage) { wolf.playEffect(EntityEffect.WOLF_SHAKE); return damage / thickFurModifier; } @@ -49,7 +49,7 @@ public class Taming { wolf.setFireTicks(0); } - public static int processShockProof(Wolf wolf, int damage) { + public static double processShockProof(Wolf wolf, double damage) { wolf.playEffect(EntityEffect.WOLF_SHAKE); return damage / shockProofModifier; } @@ -59,12 +59,12 @@ public class Taming { * * @param event The event to modify */ - public static int sharpenedClaws(int damage) { + public static double sharpenedClaws(double damage) { return damage + Taming.sharpenedClawsBonusDamage; } - public static void processHolyHound(Wolf wolf, int damage) { - int modifiedHealth = Math.min(wolf.getHealth() + damage, wolf.getMaxHealth()); + public static void processHolyHound(Wolf wolf, double damage) { + double modifiedHealth = Math.min(wolf.getHealth() + damage, wolf.getMaxHealth()); wolf.setHealth(modifiedHealth); wolf.playEffect(EntityEffect.WOLF_HEARTS); diff --git a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java index 22787f939..528f8d7ed 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -84,14 +84,14 @@ public class TamingManager extends SkillManager { * @param wolf The wolf using the ability * @param damage The damage being absorbed by the wolf */ - public void fastFoodService(Wolf wolf, int damage) { + public void fastFoodService(Wolf wolf, double damage) { if (Taming.fastFoodServiceActivationChance > Misc.getRandom().nextInt(getActivationChance())) { - int health = wolf.getHealth(); - int maxHealth = wolf.getMaxHealth(); + double health = wolf.getHealth(); + double maxHealth = wolf.getMaxHealth(); if (health < maxHealth) { - int newHealth = health + damage; + double newHealth = health + damage; wolf.setHealth(Math.min(newHealth, maxHealth)); } } @@ -102,7 +102,7 @@ public class TamingManager extends SkillManager { * * @param event The event to modify */ - public int gore(LivingEntity target, int damage) { + public double gore(LivingEntity target, double damage) { if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Taming.goreMaxChance, Taming.goreMaxBonusLevel)) { BleedTimerTask.add(target, Taming.goreBleedTicks); @@ -150,7 +150,7 @@ public class TamingManager extends SkillManager { player.sendMessage(message); } - public void processEnvironmentallyAware(Wolf wolf, int damage) { + public void processEnvironmentallyAware(Wolf wolf, double damage) { if (damage > wolf.getHealth()) { return; } diff --git a/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java b/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java index 631092193..4fa75a624 100644 --- a/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java +++ b/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java @@ -95,8 +95,8 @@ public class UnarmedManager extends SkillManager { return false; } - public int berserkDamage(int damage) { - return (int) (damage * Unarmed.berserkDamageModifier); + public double berserkDamage(double damage) { + return damage * Unarmed.berserkDamageModifier; } /** @@ -105,7 +105,7 @@ public class UnarmedManager extends SkillManager { * @param damage The amount of damage initially dealt by the event * @return the modified event damage */ - public int ironArmCheck(int damage) { + public double ironArmCheck(double damage) { int unarmedBonus = Math.min(3 + (getSkillLevel() / Unarmed.ironArmIncreaseLevel), Unarmed.ironArmMaxBonusDamage); return damage + unarmedBonus; diff --git a/src/main/java/com/gmail/nossr50/skills/woodcutting/WoodcuttingManager.java b/src/main/java/com/gmail/nossr50/skills/woodcutting/WoodcuttingManager.java index 1905a76f8..acd438082 100644 --- a/src/main/java/com/gmail/nossr50/skills/woodcutting/WoodcuttingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/woodcutting/WoodcuttingManager.java @@ -103,10 +103,10 @@ public class WoodcuttingManager extends SkillManager { if (!Woodcutting.handleDurabilityLoss(treeFellerBlocks, player.getItemInHand())) { player.sendMessage(LocaleLoader.getString("Woodcutting.Skills.TreeFeller.Splinter")); - int health = player.getHealth(); + double health = player.getHealth(); if (health > 1) { - CombatUtils.dealDamage(player, Misc.getRandom().nextInt(health - 1)); + CombatUtils.dealDamage(player, Misc.getRandom().nextInt((int) (health - 1))); } return; diff --git a/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java b/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java index 71c405891..5aa485dde 100644 --- a/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java +++ b/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java @@ -95,7 +95,7 @@ public final class ChimaeraWing { player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail")); player.updateInventory(); player.setVelocity(new Vector(0, 0.5D, 0)); - CombatUtils.dealDamage(player, Misc.getRandom().nextInt(player.getHealth() - 10)); + CombatUtils.dealDamage(player, Misc.getRandom().nextInt((int) (player.getHealth() - 10))); mcMMOPlayer.actualizeLastTeleport(); return; } diff --git a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java index 580d3ad9a..1adc1c547 100644 --- a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java +++ b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java @@ -39,7 +39,7 @@ public final class MobHealthbarUtils { * @param target the targetted entity * @param damage damage done by the attack triggering this */ - public static void handleMobHealthbars(Player player, LivingEntity target, int damage) { + public static void handleMobHealthbars(Player player, LivingEntity target, double damage) { if (!Permissions.mobHealthDisplay(player)) { return; } @@ -91,10 +91,10 @@ public final class MobHealthbarUtils { } } - private static String createHealthDisplay(PlayerProfile profile, LivingEntity entity, int damage) { - int maxHealth = entity.getMaxHealth(); - int currentHealth = Math.max(entity.getHealth() - damage, 0); - double healthPercentage = (currentHealth / (double) maxHealth) * 100.0D; + private static String createHealthDisplay(PlayerProfile profile, LivingEntity entity, double damage) { + double maxHealth = entity.getMaxHealth(); + double currentHealth = Math.max(entity.getHealth() - damage, 0); + double healthPercentage = (currentHealth / maxHealth) * 100.0D; int fullDisplay = 0; ChatColor color = ChatColor.BLACK; @@ -102,7 +102,7 @@ public final class MobHealthbarUtils { switch (profile.getMobHealthbarType()) { case HEARTS: - fullDisplay = Math.min(maxHealth / 2, 10); + fullDisplay = Math.min((int) (maxHealth / 2), 10); color = ChatColor.DARK_RED; symbol = "❤"; break; diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index 56e4c62d9..e187a25a9 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -46,7 +46,7 @@ import com.gmail.nossr50.util.player.UserManager; public final class CombatUtils { private CombatUtils() {} - private static void processSwordCombat(LivingEntity target, Player player, int damage) { + private static void processSwordCombat(LivingEntity target, Player player, double damage) { McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); SwordsManager swordsManager = mcMMOPlayer.getSwordsManager(); @@ -317,7 +317,7 @@ public final class CombatUtils { * @param target LivingEntity which to attempt to damage * @param dmg Amount of damage to attempt to do */ - public static void dealDamage(LivingEntity target, int dmg) { + public static void dealDamage(LivingEntity target, double dmg) { dealDamage(target, dmg, EntityDamageEvent.DamageCause.CUSTOM); } @@ -328,7 +328,7 @@ public final class CombatUtils { * @param dmg Amount of damage to attempt to do * @param cause DamageCause to pass to damage event */ - private static void dealDamage(LivingEntity target, int dmg, DamageCause cause) { + private static void dealDamage(LivingEntity target, double dmg, DamageCause cause) { if (Config.getInstance().getEventCallbackEnabled()) { EntityDamageEvent ede = new FakeEntityDamageEvent(target, cause, dmg); mcMMO.p.getServer().getPluginManager().callEvent(ede); @@ -351,7 +351,7 @@ public final class CombatUtils { * @param dmg Amount of damage to attempt to do * @param attacker Player to pass to event as damager */ - private static void dealDamage(LivingEntity target, int dmg, Player attacker) { + private static void dealDamage(LivingEntity target, double dmg, Player attacker) { if (Config.getInstance().getEventCallbackEnabled()) { EntityDamageEvent ede = new FakeEntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg); mcMMO.p.getServer().getPluginManager().callEvent(ede); @@ -375,9 +375,9 @@ public final class CombatUtils { * @param damage The initial damage amount * @param type The type of skill being used */ - public static void applyAbilityAoE(Player attacker, LivingEntity target, int damage, SkillType type) { + public static void applyAbilityAoE(Player attacker, LivingEntity target, double damage, SkillType type) { int numberOfTargets = Misc.getTier(attacker.getItemInHand()); // The higher the weapon tier, the more targets you hit - int damageAmount = Math.max(damage, 1); + double damageAmount = Math.max(damage, 1); for (Entity entity : target.getNearbyEntities(2.5, 2.5, 2.5)) { if (numberOfTargets <= 0) { @@ -565,7 +565,7 @@ public final class CombatUtils { * @param eventDamage The damage from the event the entity is involved in * @return true if the entity is invincible, false otherwise */ - public static boolean isInvincible(LivingEntity entity, int eventDamage) { + public static boolean isInvincible(LivingEntity entity, double eventDamage) { /* * So apparently if you do more damage to a LivingEntity than its last damage int you bypass the invincibility. * So yeah, this is for that.