mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
Health and damage are now doubles, not ints.
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user