Health and damage are now doubles, not ints.

This commit is contained in:
GJ 2013-07-11 12:43:36 -04:00
parent 4dc9c97978
commit d07b67b5bf
17 changed files with 65 additions and 65 deletions

View File

@ -7,7 +7,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
* Called when mcMMO applies damage from an entity due to special abilities. * Called when mcMMO applies damage from an entity due to special abilities.
*/ */
public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent { 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); super(damager, damagee, cause, damage);
} }
} }

View File

@ -7,7 +7,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
* Called when mcMMO applies damage due to special abilities. * Called when mcMMO applies damage due to special abilities.
*/ */
public class FakeEntityDamageEvent extends EntityDamageEvent { 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); super(damagee, cause, damage);
} }
} }

View File

@ -124,7 +124,7 @@ public class EntityListener implements Listener {
return; return;
} }
int damage = event.getDamage(); double damage = event.getDamage();
if (damage <= 0) { if (damage <= 0) {
return; return;
@ -184,7 +184,7 @@ public class EntityListener implements Listener {
return; return;
} }
int damage = event.getDamage(); double damage = event.getDamage();
if (damage <= 0) { if (damage <= 0) {
return; return;

View File

@ -11,7 +11,7 @@ public class AwardCombatXpTask extends BukkitRunnable {
private double baseXp; private double baseXp;
private SkillType skillType; private SkillType skillType;
private LivingEntity target; private LivingEntity target;
private int baseHealth; private double baseHealth;
public AwardCombatXpTask(McMMOPlayer mcMMOPlayer, SkillType skillType, double baseXp, LivingEntity target) { public AwardCombatXpTask(McMMOPlayer mcMMOPlayer, SkillType skillType, double baseXp, LivingEntity target) {
this.mcMMOPlayer = mcMMOPlayer; this.mcMMOPlayer = mcMMOPlayer;
@ -23,8 +23,8 @@ public class AwardCombatXpTask extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
int health = target.getHealth(); double health = target.getHealth();
int damage = baseHealth - health; double damage = baseHealth - health;
// May avoid negative xp, we don't know what other plugins do with the entity health // May avoid negative xp, we don't know what other plugins do with the entity health
if (damage <= 0) { if (damage <= 0) {

View File

@ -25,11 +25,11 @@ public final class Acrobatics {
private 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); 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); return Math.max(damage - damageThreshold, 0);
} }
} }

View File

@ -44,8 +44,8 @@ public class AcrobaticsManager extends SkillManager {
* @param damage The amount of damage initially dealt by the event * @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 * @return the modified event damage if the ability was successful, the original event damage otherwise
*/ */
public int dodgeCheck(int damage) { public double dodgeCheck(double damage) {
int modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage, Acrobatics.dodgeDamageModifier); double modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage, Acrobatics.dodgeDamageModifier);
Player player = getPlayer(); Player player = getPlayer();
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Acrobatics.dodgeMaxChance, Acrobatics.dodgeMaxBonusLevel)) { 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? // Why do we check respawn cooldown here?
if (System.currentTimeMillis() >= mcMMOPlayer.getRespawnATS() + Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS) { if (System.currentTimeMillis() >= mcMMOPlayer.getRespawnATS() + Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS) {
applyXpGain(damage * Acrobatics.dodgeXpModifier); applyXpGain((float) (damage * Acrobatics.dodgeXpModifier));
} }
return modifiedDamage; return modifiedDamage;
@ -72,23 +72,23 @@ public class AcrobaticsManager extends SkillManager {
* @param damage The amount of damage initially dealt by the event * @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 * @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(); Player player = getPlayer();
if (player.isSneaking() && Permissions.gracefulRoll(player)) { if (player.isSneaking() && Permissions.gracefulRoll(player)) {
return gracefulRollCheck(damage); 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)) { if (!isFatal(modifiedDamage) && isSuccessfulRoll(Acrobatics.rollMaxChance, Acrobatics.rollMaxBonusLevel)) {
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text")); player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
applyXpGain(damage * Acrobatics.rollXpModifier); applyXpGain((float) (damage * Acrobatics.rollXpModifier));
return modifiedDamage; return modifiedDamage;
} }
else if (!isFatal(damage)) { else if (!isFatal(damage)) {
applyXpGain(damage * Acrobatics.fallXpModifier); applyXpGain((float) (damage * Acrobatics.fallXpModifier));
} }
return damage; return damage;
@ -100,17 +100,17 @@ public class AcrobaticsManager extends SkillManager {
* @param damage The amount of damage initially dealt by the event * @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 * @return the modified event damage if the ability was successful, the original event damage otherwise
*/ */
private int gracefulRollCheck(int damage) { private double gracefulRollCheck(double damage) {
int modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.gracefulRollThreshold); double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.gracefulRollThreshold);
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(damage * Acrobatics.rollXpModifier); applyXpGain((float) (damage * Acrobatics.rollXpModifier));
return modifiedDamage; return modifiedDamage;
} }
else if (!isFatal(damage)) { else if (!isFatal(damage)) {
applyXpGain(damage * Acrobatics.fallXpModifier); applyXpGain((float) (damage * Acrobatics.fallXpModifier));
} }
return damage; return damage;
@ -120,7 +120,7 @@ public class AcrobaticsManager extends SkillManager {
return (maxChance / maxLevel) * Math.min(getSkillLevel(), maxLevel) > Misc.getRandom().nextInt(activationChance); 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; return getPlayer().getHealth() - damage < 1;
} }
} }

View File

@ -68,7 +68,7 @@ public class ArcheryManager extends SkillManager {
* @param damage The amount of damage initially dealt by the event * @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 * @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)) { if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Archery.dazeMaxBonus, Archery.dazeMaxBonusLevel)) {
Location dazedLocation = defender.getLocation(); Location dazedLocation = defender.getLocation();
dazedLocation.setPitch(90 - Misc.getRandom().nextInt(181)); 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 * @param damage The amount of damage initially dealt by the event
* @return the modified event damage * @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); double damageBonusPercent = Math.min(((getSkillLevel() / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage), Archery.skillShotMaxBonusPercentage);
int archeryBonus = (int) (damage * damageBonusPercent); double archeryBonus = damage * damageBonusPercent;
return damage + archeryBonus; return damage + archeryBonus;
} }

View File

@ -55,8 +55,8 @@ public class AxesManager extends SkillManager {
* @param damage The amount of damage initially dealt by the event * @param damage The amount of damage initially dealt by the event
* @return the modified event damage * @return the modified event damage
*/ */
public int axeMasteryCheck(int damage) { public double axeMasteryCheck(double damage) {
int axeBonus = Math.min(getSkillLevel() / (Axes.bonusDamageMaxBonusLevel / Axes.bonusDamageMaxBonus), Axes.bonusDamageMaxBonus); double axeBonus = Math.min(getSkillLevel() / (Axes.bonusDamageMaxBonusLevel / Axes.bonusDamageMaxBonus), Axes.bonusDamageMaxBonus);
return damage + axeBonus; return damage + axeBonus;
} }
@ -68,17 +68,17 @@ public class AxesManager extends SkillManager {
* @param damage The amount of damage initially dealt by the event * @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 * @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)) { if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Axes.criticalHitMaxChance, Axes.criticalHitMaxBonusLevel)) {
getPlayer().sendMessage(LocaleLoader.getString("Axes.Combat.CriticalHit")); getPlayer().sendMessage(LocaleLoader.getString("Axes.Combat.CriticalHit"));
if (target instanceof Player) { if (target instanceof Player) {
((Player) target).sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck")); ((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; return damage;
@ -111,7 +111,7 @@ public class AxesManager extends SkillManager {
* @param damage The amount of damage initially dealt by the event * @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 * @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())) { if (Axes.greaterImpactChance > Misc.getRandom().nextInt(getActivationChance())) {
Player player = getPlayer(); Player player = getPlayer();
@ -142,7 +142,7 @@ public class AxesManager extends SkillManager {
* @param target The {@link LivingEntity} being affected by the ability * @param target The {@link LivingEntity} being affected by the ability
* @param damage The amount of damage initially dealt by the event * @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); CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Axes.skullSplitterModifier, skill);
} }
} }

View File

@ -175,8 +175,8 @@ public class MiningManager extends SkillManager {
return (float) (radius + getBlastRadiusModifier()); return (float) (radius + getBlastRadiusModifier());
} }
public int processDemolitionsExpertise(int damage) { public double processDemolitionsExpertise(double damage) {
return (int) (damage * ((100.0D - getBlastDamageModifier()) / 100.0D)); return damage * ((100.0D - getBlastDamageModifier()) / 100.0D);
} }
/** /**

View File

@ -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)) { if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Swords.counterAttackMaxChance, Swords.counterAttackMaxBonusLevel)) {
CombatUtils.dealDamage(attacker, damage / Swords.counterAttackModifier); 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); CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Swords.serratedStrikesModifier, skill);
BleedTimerTask.add(target, Swords.serratedStrikesBleedTicks); BleedTimerTask.add(target, Swords.serratedStrikesBleedTicks);
} }

View File

@ -39,7 +39,7 @@ public class Taming {
return pet.isTamed() && owner instanceof Player && pet instanceof Wolf; 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); wolf.playEffect(EntityEffect.WOLF_SHAKE);
return damage / thickFurModifier; return damage / thickFurModifier;
} }
@ -49,7 +49,7 @@ public class Taming {
wolf.setFireTicks(0); wolf.setFireTicks(0);
} }
public static int processShockProof(Wolf wolf, int damage) { public static double processShockProof(Wolf wolf, double damage) {
wolf.playEffect(EntityEffect.WOLF_SHAKE); wolf.playEffect(EntityEffect.WOLF_SHAKE);
return damage / shockProofModifier; return damage / shockProofModifier;
} }
@ -59,12 +59,12 @@ public class Taming {
* *
* @param event The event to modify * @param event The event to modify
*/ */
public static int sharpenedClaws(int damage) { public static double sharpenedClaws(double damage) {
return damage + Taming.sharpenedClawsBonusDamage; return damage + Taming.sharpenedClawsBonusDamage;
} }
public static void processHolyHound(Wolf wolf, int damage) { public static void processHolyHound(Wolf wolf, double damage) {
int modifiedHealth = Math.min(wolf.getHealth() + damage, wolf.getMaxHealth()); double modifiedHealth = Math.min(wolf.getHealth() + damage, wolf.getMaxHealth());
wolf.setHealth(modifiedHealth); wolf.setHealth(modifiedHealth);
wolf.playEffect(EntityEffect.WOLF_HEARTS); wolf.playEffect(EntityEffect.WOLF_HEARTS);

View File

@ -84,14 +84,14 @@ public class TamingManager extends SkillManager {
* @param wolf The wolf using the ability * @param wolf The wolf using the ability
* @param damage The damage being absorbed by the wolf * @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())) { if (Taming.fastFoodServiceActivationChance > Misc.getRandom().nextInt(getActivationChance())) {
int health = wolf.getHealth(); double health = wolf.getHealth();
int maxHealth = wolf.getMaxHealth(); double maxHealth = wolf.getMaxHealth();
if (health < maxHealth) { if (health < maxHealth) {
int newHealth = health + damage; double newHealth = health + damage;
wolf.setHealth(Math.min(newHealth, maxHealth)); wolf.setHealth(Math.min(newHealth, maxHealth));
} }
} }
@ -102,7 +102,7 @@ public class TamingManager extends SkillManager {
* *
* @param event The event to modify * @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)) { if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Taming.goreMaxChance, Taming.goreMaxBonusLevel)) {
BleedTimerTask.add(target, Taming.goreBleedTicks); BleedTimerTask.add(target, Taming.goreBleedTicks);
@ -150,7 +150,7 @@ public class TamingManager extends SkillManager {
player.sendMessage(message); player.sendMessage(message);
} }
public void processEnvironmentallyAware(Wolf wolf, int damage) { public void processEnvironmentallyAware(Wolf wolf, double damage) {
if (damage > wolf.getHealth()) { if (damage > wolf.getHealth()) {
return; return;
} }

View File

@ -95,8 +95,8 @@ public class UnarmedManager extends SkillManager {
return false; return false;
} }
public int berserkDamage(int damage) { public double berserkDamage(double damage) {
return (int) (damage * Unarmed.berserkDamageModifier); return damage * Unarmed.berserkDamageModifier;
} }
/** /**
@ -105,7 +105,7 @@ public class UnarmedManager extends SkillManager {
* @param damage The amount of damage initially dealt by the event * @param damage The amount of damage initially dealt by the event
* @return the modified event damage * @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); int unarmedBonus = Math.min(3 + (getSkillLevel() / Unarmed.ironArmIncreaseLevel), Unarmed.ironArmMaxBonusDamage);
return damage + unarmedBonus; return damage + unarmedBonus;

View File

@ -103,10 +103,10 @@ public class WoodcuttingManager extends SkillManager {
if (!Woodcutting.handleDurabilityLoss(treeFellerBlocks, player.getItemInHand())) { if (!Woodcutting.handleDurabilityLoss(treeFellerBlocks, player.getItemInHand())) {
player.sendMessage(LocaleLoader.getString("Woodcutting.Skills.TreeFeller.Splinter")); player.sendMessage(LocaleLoader.getString("Woodcutting.Skills.TreeFeller.Splinter"));
int health = player.getHealth(); double health = player.getHealth();
if (health > 1) { if (health > 1) {
CombatUtils.dealDamage(player, Misc.getRandom().nextInt(health - 1)); CombatUtils.dealDamage(player, Misc.getRandom().nextInt((int) (health - 1)));
} }
return; return;

View File

@ -95,7 +95,7 @@ public final class ChimaeraWing {
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail")); player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail"));
player.updateInventory(); player.updateInventory();
player.setVelocity(new Vector(0, 0.5D, 0)); 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(); mcMMOPlayer.actualizeLastTeleport();
return; return;
} }

View File

@ -39,7 +39,7 @@ public final class MobHealthbarUtils {
* @param target the targetted entity * @param target the targetted entity
* @param damage damage done by the attack triggering this * @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)) { if (!Permissions.mobHealthDisplay(player)) {
return; return;
} }
@ -91,10 +91,10 @@ public final class MobHealthbarUtils {
} }
} }
private static String createHealthDisplay(PlayerProfile profile, LivingEntity entity, int damage) { private static String createHealthDisplay(PlayerProfile profile, LivingEntity entity, double damage) {
int maxHealth = entity.getMaxHealth(); double maxHealth = entity.getMaxHealth();
int currentHealth = Math.max(entity.getHealth() - damage, 0); double currentHealth = Math.max(entity.getHealth() - damage, 0);
double healthPercentage = (currentHealth / (double) maxHealth) * 100.0D; double healthPercentage = (currentHealth / maxHealth) * 100.0D;
int fullDisplay = 0; int fullDisplay = 0;
ChatColor color = ChatColor.BLACK; ChatColor color = ChatColor.BLACK;
@ -102,7 +102,7 @@ public final class MobHealthbarUtils {
switch (profile.getMobHealthbarType()) { switch (profile.getMobHealthbarType()) {
case HEARTS: case HEARTS:
fullDisplay = Math.min(maxHealth / 2, 10); fullDisplay = Math.min((int) (maxHealth / 2), 10);
color = ChatColor.DARK_RED; color = ChatColor.DARK_RED;
symbol = ""; symbol = "";
break; break;

View File

@ -46,7 +46,7 @@ import com.gmail.nossr50.util.player.UserManager;
public final class CombatUtils { public final class CombatUtils {
private 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); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager(); SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
@ -317,7 +317,7 @@ public final class CombatUtils {
* @param target LivingEntity which to attempt to damage * @param target LivingEntity which to attempt to damage
* @param dmg Amount of damage to attempt to do * @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); dealDamage(target, dmg, EntityDamageEvent.DamageCause.CUSTOM);
} }
@ -328,7 +328,7 @@ public final class CombatUtils {
* @param dmg Amount of damage to attempt to do * @param dmg Amount of damage to attempt to do
* @param cause DamageCause to pass to damage event * @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()) { if (Config.getInstance().getEventCallbackEnabled()) {
EntityDamageEvent ede = new FakeEntityDamageEvent(target, cause, dmg); EntityDamageEvent ede = new FakeEntityDamageEvent(target, cause, dmg);
mcMMO.p.getServer().getPluginManager().callEvent(ede); mcMMO.p.getServer().getPluginManager().callEvent(ede);
@ -351,7 +351,7 @@ public final class CombatUtils {
* @param dmg Amount of damage to attempt to do * @param dmg Amount of damage to attempt to do
* @param attacker Player to pass to event as damager * @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()) { if (Config.getInstance().getEventCallbackEnabled()) {
EntityDamageEvent ede = new FakeEntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg); EntityDamageEvent ede = new FakeEntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg);
mcMMO.p.getServer().getPluginManager().callEvent(ede); mcMMO.p.getServer().getPluginManager().callEvent(ede);
@ -375,9 +375,9 @@ public final class CombatUtils {
* @param damage The initial damage amount * @param damage The initial damage amount
* @param type The type of skill being used * @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 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)) { for (Entity entity : target.getNearbyEntities(2.5, 2.5, 2.5)) {
if (numberOfTargets <= 0) { if (numberOfTargets <= 0) {
@ -565,7 +565,7 @@ public final class CombatUtils {
* @param eventDamage The damage from the event the entity is involved in * @param eventDamage The damage from the event the entity is involved in
* @return true if the entity is invincible, false otherwise * @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 apparently if you do more damage to a LivingEntity than its last damage int you bypass the invincibility.
* So yeah, this is for that. * So yeah, this is for that.