From 348887f7996c81506ef4f1884bbad47371c9b097 Mon Sep 17 00:00:00 2001 From: GJ Date: Mon, 14 Jan 2013 12:41:39 -0500 Subject: [PATCH] Refactoring, removing useless variables, changing ints to doubles, etc. --- .../commands/skills/AcrobaticsCommand.java | 20 ++++++---------- .../commands/skills/ArcheryCommand.java | 23 ++++++------------- .../gmail/nossr50/config/AdvancedConfig.java | 14 +++++------ .../nossr50/skills/acrobatics/Acrobatics.java | 12 +++++----- .../skills/acrobatics/AcrobaticsManager.java | 8 +++---- .../skills/acrobatics/DodgeEventHandler.java | 2 +- .../skills/acrobatics/RollEventHandler.java | 2 +- .../gmail/nossr50/skills/archery/Archery.java | 6 ++--- .../skills/archery/ArcheryManager.java | 8 +++---- .../archery/ArrowTrackingEventHandler.java | 2 +- ...andler.java => SkillShotEventHandler.java} | 4 ++-- .../com/gmail/nossr50/skills/axes/Axes.java | 4 ++-- .../java/com/gmail/nossr50/util/Combat.java | 2 +- src/main/resources/advanced.yml | 16 ++++++------- 14 files changed, 54 insertions(+), 69 deletions(-) rename src/main/java/com/gmail/nossr50/skills/archery/{ArcheryBonusDamageEventHandler.java => SkillShotEventHandler.java} (82%) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java index 0b52957b5..a22797307 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java @@ -6,6 +6,7 @@ import com.gmail.nossr50.commands.SkillCommand; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.skills.acrobatics.Acrobatics; import com.gmail.nossr50.util.Permissions; public class AcrobaticsCommand extends SkillCommand { @@ -18,13 +19,6 @@ public class AcrobaticsCommand extends SkillCommand { private String gracefulRollChance; private String gracefulRollChanceLucky; - private float dodgeChanceMax = advancedConfig.getDodgeChanceMax(); - private float dodgeMaxBonusLevel = advancedConfig.getDodgeMaxBonusLevel(); - private float rollChanceMax = advancedConfig.getRollChanceMax(); - private float rollMaxBonusLevel = advancedConfig.getRollMaxBonusLevel(); - private float gracefulRollChanceMax = advancedConfig.getGracefulRollChanceMax(); - private float gracefulRollMaxBonusLevel = advancedConfig.getGracefulRollMaxBonusLevel(); - private boolean canDodge; private boolean canRoll; private boolean canGracefulRoll; @@ -41,22 +35,22 @@ public class AcrobaticsCommand extends SkillCommand { float gracefulRollChanceF; // DODGE - if (skillValue >= dodgeMaxBonusLevel) dodgeChanceF = dodgeChanceMax; - else dodgeChanceF = (float) (((double) dodgeChanceMax / (double) dodgeMaxBonusLevel) * skillValue); + if (skillValue >= Acrobatics.dodgeMaxBonusLevel) dodgeChanceF = (float) Acrobatics.dodgeMaxChance; + else dodgeChanceF = (float) ((Acrobatics.dodgeMaxChance / Acrobatics.dodgeMaxBonusLevel) * skillValue); dodgeChance = percent.format(dodgeChanceF / 100D); if (dodgeChanceF * 1.3333D >= 100D) dodgeChanceLucky = percent.format(1D); else dodgeChanceLucky = percent.format(dodgeChanceF * 1.3333D / 100D); // ROLL - if (skillValue >= rollMaxBonusLevel) rollChanceF = rollChanceMax; - else rollChanceF = (float) (((double) rollChanceMax / (double) rollMaxBonusLevel) * skillValue); + if (skillValue >= Acrobatics.rollMaxBonusLevel) rollChanceF = (float) Acrobatics.rollMaxChance; + else rollChanceF = (float) ((Acrobatics.rollMaxChance / Acrobatics.rollMaxBonusLevel) * skillValue); rollChance = percent.format(rollChanceF / 100D); if (rollChanceF * 1.3333D >= 100D) rollChanceLucky = percent.format(1D); else rollChanceLucky = percent.format(rollChanceF * 1.3333D / 100D); // GRACEFULROLL - if (skillValue >= gracefulRollMaxBonusLevel) gracefulRollChanceF = gracefulRollChanceMax; - else gracefulRollChanceF = (float) (((double) gracefulRollChanceMax / (double) gracefulRollMaxBonusLevel) * skillValue); + if (skillValue >= Acrobatics.gracefulRollMaxBonusLevel) gracefulRollChanceF = (float) Acrobatics.gracefulRollMaxChance; + else gracefulRollChanceF = (float) ((Acrobatics.gracefulRollMaxChance / Acrobatics.gracefulRollMaxBonusLevel) * skillValue); gracefulRollChance = percent.format(gracefulRollChanceF / 100D); if (gracefulRollChanceF * 1.3333D >= 100D) gracefulRollChanceLucky = percent.format(1D); else gracefulRollChanceLucky = percent.format(gracefulRollChanceF * 1.3333D / 100D); diff --git a/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java index d29e274f7..8b465b29d 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java @@ -6,6 +6,7 @@ import com.gmail.nossr50.commands.SkillCommand; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.skills.archery.Archery; import com.gmail.nossr50.util.Permissions; public class ArcheryCommand extends SkillCommand { @@ -17,16 +18,6 @@ public class ArcheryCommand extends SkillCommand { private String retrieveChance; private String retrieveChanceLucky; - private int skillShotIncreaseLevel = advancedConfig.getSkillShotIncreaseLevel(); - private double skillShotIncreasePercentage = advancedConfig.getSkillShotIncreasePercentage(); - private double skillShotBonusMax = advancedConfig.getSkillShotBonusMax(); - - private float dazeBonusMax = advancedConfig.getDazeBonusMax(); - private float dazeMaxBonusLevel = advancedConfig.getDazeMaxBonusLevel(); - - private float retrieveBonusMax = advancedConfig.getRetrieveBonusMax(); - private float retrieveMaxBonusLevel = advancedConfig.getRetrieveMaxBonusLevel(); - private boolean canSkillShot; private boolean canDaze; private boolean canRetrieve; @@ -42,20 +33,20 @@ public class ArcheryCommand extends SkillCommand { float retrieveChanceF; // SkillShot - double bonus = (int)((double) skillValue / (double) skillShotIncreaseLevel) * skillShotIncreasePercentage; - if (bonus > skillShotBonusMax) skillShotBonus = percent.format(skillShotBonusMax); + double bonus = (int)((double) skillValue / (double) Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage; + if (bonus > Archery.skillShotMaxBonusPercentage) skillShotBonus = percent.format(Archery.skillShotMaxBonusPercentage); else skillShotBonus = percent.format(bonus); // Daze - if (skillValue >= dazeMaxBonusLevel) dazeChanceF = dazeBonusMax; - else dazeChanceF = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * skillValue); + if (skillValue >= Archery.dazeMaxBonusLevel) dazeChanceF = (float) Archery.dazeMaxBonus; + else dazeChanceF = (float) (( Archery.dazeMaxBonus / Archery.dazeMaxBonusLevel) * skillValue); dazeChance = percent.format(dazeChanceF / 100D); if (dazeChanceF * 1.3333D >= 100D) dazeChanceLucky = percent.format(1D); else dazeChanceLucky = percent.format(dazeChanceF * 1.3333D / 100D); // Retrieve - if (skillValue >= retrieveMaxBonusLevel) retrieveChanceF = retrieveBonusMax; - else retrieveChanceF = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * skillValue); + if (skillValue >= Archery.retrieveMaxBonusLevel) retrieveChanceF = (float) Archery.retrieveMaxChance; + else retrieveChanceF = (float) ((Archery.retrieveMaxChance / Archery.retrieveMaxBonusLevel) * skillValue); retrieveChance = percent.format(retrieveChanceF / 100D); if (retrieveChanceF * 1.3333D >= 100D) retrieveChanceLucky = percent.format(1D); else retrieveChanceLucky = percent.format(retrieveChanceF * 1.3333D / 100D); diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index af8a45916..3ffbb37cc 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -22,13 +22,13 @@ public class AdvancedConfig extends ConfigLoader { public int getAbilityLength() { return config.getInt("Skills.General.Ability_IncreaseLevel", 50); } /* ACROBATICS */ - public int getDodgeChanceMax() { return config.getInt("Skills.Acrobatics.Dodge_ChanceMax", 20); } + public double getDodgeChanceMax() { return config.getDouble("Skills.Acrobatics.Dodge_ChanceMax", 20.0D); } public int getDodgeMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Dodge_MaxBonusLevel", 800); } - public int getRollChanceMax() { return config.getInt("Skills.Acrobatics.Roll_ChanceMax", 100); } + public double getRollChanceMax() { return config.getDouble("Skills.Acrobatics.Roll_ChanceMax", 100.0D); } public int getRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Roll_MaxBonusLevel", 1000); } - public int getGracefulRollChanceMax() { return config.getInt("Skills.Acrobatics.GracefulRoll_ChanceMax", 100); } + public double getGracefulRollChanceMax() { return config.getDouble("Skills.Acrobatics.GracefulRoll_ChanceMax", 100.0D); } public int getGracefulRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.GracefulRoll_MaxBonusLevel", 500); } public int getDodgeXPModifier() { return config.getInt("Skills.Acrobatics.Dodge_XP_Modifier", 120); } @@ -40,11 +40,11 @@ public class AdvancedConfig extends ConfigLoader { public double getSkillShotIncreasePercentage() { return config.getDouble("Skills.Archery.SkillShot_IncreasePercentage", 0.1D); } public double getSkillShotBonusMax() { return config.getDouble("Skills.Archery.SkillShot_MaxBonus", 2.0D); } - public int getDazeBonusMax() { return config.getInt("Skills.Archery.Daze_MaxChance", 50); } + public double getDazeBonusMax() { return config.getDouble("Skills.Archery.Daze_MaxChance", 50.0D); } public int getDazeMaxBonusLevel() { return config.getInt("Skills.Archery.Daze_MaxBonusLevel", 1000); } public int getDazeModifier() { return config.getInt("Skills.Archery.Daze_BonusDamage", 4); } - public int getRetrieveBonusMax() { return config.getInt("Skills.Archery.Retrieve_MaxBonus", 100); } + public double getRetrieveChanceMax() { return config.getDouble("Skills.Archery.Retrieve_MaxBonus", 100.0D); } public int getRetrieveMaxBonusLevel() { return config.getInt("Skills.Archery.Retrieve_MaxBonusLevel", 1000); } /* AXES */ @@ -56,12 +56,12 @@ public class AdvancedConfig extends ConfigLoader { public double getAxesCriticalPVPModifier() { return config.getDouble("Skills.Axes.AxesCritical_PVP_Modifier", 1.5D); } public double getAxesCriticalPVEModifier() { return config.getDouble("Skills.Axes.AxesCritical_PVE_Modifier", 2.0D); } - public int getGreaterImpactChance() { return config.getInt("Skills.Axes.GreaterImpact_Chance", 25); } + public double getGreaterImpactChance() { return config.getDouble("Skills.Axes.GreaterImpact_Chance", 25.0D); } public double getGreaterImpactModifier() { return config.getDouble("Skills.Axes.GreaterImpact_KnockbackModifier", 1.5); } public int getGreaterImpactBonusDamage() { return config.getInt("Skills.Axes.GreaterImpact_BonusDamage", 2); } public int getArmorImpactIncreaseLevel() { return config.getInt("Skills.Axes.ArmorImpact_IncreaseLevel", 50); } - public int getArmorImpactMaxDurabilityDamage() { return config.getInt("Skills.Axes.ArmorImpact_MaxPercentageDurabilityDamage", 20); } + public double getArmorImpactMaxDurabilityDamage() { return config.getDouble("Skills.Axes.ArmorImpact_MaxPercentageDurabilityDamage", 20.0D); } /* EXCAVATION */ //Nothing to configure, everything is already configurable in config.yml 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 0f1f72efc..c61485b79 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java @@ -3,14 +3,14 @@ package com.gmail.nossr50.skills.acrobatics; import com.gmail.nossr50.config.AdvancedConfig; public class Acrobatics { - public static int maxDodgeChance = AdvancedConfig.getInstance().getDodgeChanceMax(); - public static int maxDodgeBonusLevel = AdvancedConfig.getInstance().getDodgeMaxBonusLevel(); + public static double dodgeMaxChance = AdvancedConfig.getInstance().getDodgeChanceMax(); + public static int dodgeMaxBonusLevel = AdvancedConfig.getInstance().getDodgeMaxBonusLevel(); public static int dodgeXpModifier = AdvancedConfig.getInstance().getDodgeXPModifier(); - public static int maxRollChance = AdvancedConfig.getInstance().getRollChanceMax(); - public static int maxRollBonusLevel = AdvancedConfig.getInstance().getRollMaxBonusLevel(); - public static int maxGracefulRollChance = AdvancedConfig.getInstance().getGracefulRollChanceMax(); - public static int maxGracefulRollBonusLevel = AdvancedConfig.getInstance().getGracefulRollMaxBonusLevel(); + public static double rollMaxChance = AdvancedConfig.getInstance().getRollChanceMax(); + public static int rollMaxBonusLevel = AdvancedConfig.getInstance().getRollMaxBonusLevel(); + public static double gracefulRollMaxChance = AdvancedConfig.getInstance().getGracefulRollChanceMax(); + public static int gracefulRollMaxBonusLevel = AdvancedConfig.getInstance().getGracefulRollMaxBonusLevel(); public static int rollXpModifier = AdvancedConfig.getInstance().getRollXPModifier(); public static int fallXpModifier = AdvancedConfig.getInstance().getFallXPModifier(); 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 24113b890..ffaf682a0 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java @@ -35,13 +35,13 @@ public class AcrobaticsManager extends SkillManager { randomChance = (int) (randomChance * 0.75); } - float chance; + double chance; if (eventHandler.isGraceful) { - chance = ((float) Acrobatics.maxGracefulRollChance / Acrobatics.maxGracefulRollBonusLevel) * eventHandler.skillModifier; + chance = (Acrobatics.gracefulRollMaxChance / Acrobatics.gracefulRollMaxBonusLevel) * eventHandler.skillModifier; } else { - chance = ((float) Acrobatics.maxRollChance / Acrobatics.maxRollBonusLevel) * eventHandler.skillModifier; + chance = (Acrobatics.rollMaxChance / Acrobatics.rollMaxBonusLevel) * eventHandler.skillModifier; } if (chance > Misc.getRandom().nextInt(randomChance) && !eventHandler.isFatal(eventHandler.modifiedDamage)) { @@ -71,7 +71,7 @@ public class AcrobaticsManager extends SkillManager { randomChance = (int) (randomChance * 0.75); } - float chance = ((float) Acrobatics.maxDodgeChance / Acrobatics.maxDodgeBonusLevel) * eventHandler.skillModifier; + double chance = (Acrobatics.dodgeMaxChance / Acrobatics.dodgeMaxBonusLevel) * eventHandler.skillModifier; if (chance > Misc.getRandom().nextInt(randomChance) && !eventHandler.isFatal(eventHandler.modifiedDamage)) { eventHandler.modifyEventDamage(); diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/DodgeEventHandler.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/DodgeEventHandler.java index fb7af69e6..05d741e67 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/DodgeEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/DodgeEventHandler.java @@ -18,7 +18,7 @@ public class DodgeEventHandler extends AcrobaticsEventHandler { @Override protected void calculateSkillModifier() { - this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Acrobatics.maxDodgeBonusLevel); + this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Acrobatics.dodgeMaxBonusLevel); } @Override diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java index c0f2c33d8..09d371737 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java @@ -29,7 +29,7 @@ public class RollEventHandler extends AcrobaticsEventHandler { skillModifer = skillModifer * 2; } - skillModifer = Misc.skillCheck(skillModifer, Acrobatics.maxRollBonusLevel); + skillModifer = Misc.skillCheck(skillModifer, Acrobatics.rollMaxBonusLevel); this.skillModifier = skillModifer; } diff --git a/src/main/java/com/gmail/nossr50/skills/archery/Archery.java b/src/main/java/com/gmail/nossr50/skills/archery/Archery.java index 738144085..ddd59f3ae 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/Archery.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/Archery.java @@ -14,15 +14,15 @@ import com.gmail.nossr50.util.Misc; public class Archery { private static List trackedEntities = new ArrayList(); - public static int arrowTrackingMaxBonusLevel = AdvancedConfig.getInstance().getRetrieveMaxBonusLevel(); - public static int arrowTrackingMaxBonus = AdvancedConfig.getInstance().getRetrieveBonusMax(); + public static int retrieveMaxBonusLevel = AdvancedConfig.getInstance().getRetrieveMaxBonusLevel(); + public static double retrieveMaxChance = AdvancedConfig.getInstance().getRetrieveChanceMax(); public static int skillShotIncreaseLevel = AdvancedConfig.getInstance().getSkillShotIncreaseLevel(); public static double skillShotIncreasePercentage = AdvancedConfig.getInstance().getSkillShotIncreasePercentage(); public static double skillShotMaxBonusPercentage = AdvancedConfig.getInstance().getSkillShotBonusMax(); public static int dazeMaxBonusLevel = AdvancedConfig.getInstance().getDazeMaxBonusLevel(); - public static int dazeMaxBonus = AdvancedConfig.getInstance().getDazeBonusMax(); + public static double dazeMaxBonus = AdvancedConfig.getInstance().getDazeBonusMax(); public static int dazeModifier = AdvancedConfig.getInstance().getDazeModifier(); protected static void incrementTrackerValue(LivingEntity livingEntity) { 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 61cae2d42..76652a605 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java @@ -31,7 +31,7 @@ public class ArcheryManager extends SkillManager { randomChance = (int) (randomChance * 0.75); } - float chance = ((float) Archery.arrowTrackingMaxBonus / Archery.arrowTrackingMaxBonusLevel) * eventHandler.skillModifier; + double chance = (Archery.retrieveMaxChance / Archery.retrieveMaxBonusLevel) * eventHandler.skillModifier; if (chance > Misc.getRandom().nextInt(randomChance)) { eventHandler.addToTracker(); @@ -56,7 +56,7 @@ public class ArcheryManager extends SkillManager { randomChance = (int) (randomChance * 0.75); } - float chance = ((float) Archery.dazeMaxBonus / Archery.dazeMaxBonusLevel) * eventHandler.skillModifier; + double chance = (Archery.dazeMaxBonus / Archery.dazeMaxBonusLevel) * eventHandler.skillModifier; if (chance > Misc.getRandom().nextInt(randomChance)) { eventHandler.handleDazeEffect(); @@ -69,13 +69,13 @@ public class ArcheryManager extends SkillManager { * * @param event The event to modify. */ - public void bonusDamage(EntityDamageEvent event) { + public void skillShot(EntityDamageEvent event) { if (Misc.isNPC(player) || !Permissions.archeryBonus(player)) { return; } if (skillLevel >= Archery.skillShotIncreaseLevel) { - ArcheryBonusDamageEventHandler eventHandler = new ArcheryBonusDamageEventHandler(this, event); + SkillShotEventHandler eventHandler = new SkillShotEventHandler(this, event); eventHandler.calculateDamageBonus(); eventHandler.modifyEventDamage(); diff --git a/src/main/java/com/gmail/nossr50/skills/archery/ArrowTrackingEventHandler.java b/src/main/java/com/gmail/nossr50/skills/archery/ArrowTrackingEventHandler.java index 2d6839b96..311f1a422 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/ArrowTrackingEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/ArrowTrackingEventHandler.java @@ -18,7 +18,7 @@ public class ArrowTrackingEventHandler { } protected void calculateSkillModifier() { - this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Archery.arrowTrackingMaxBonusLevel); + this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Archery.retrieveMaxBonusLevel); } protected void addToTracker() { diff --git a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryBonusDamageEventHandler.java b/src/main/java/com/gmail/nossr50/skills/archery/SkillShotEventHandler.java similarity index 82% rename from src/main/java/com/gmail/nossr50/skills/archery/ArcheryBonusDamageEventHandler.java rename to src/main/java/com/gmail/nossr50/skills/archery/SkillShotEventHandler.java index 2d9d47449..8be742915 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryBonusDamageEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/SkillShotEventHandler.java @@ -2,13 +2,13 @@ package com.gmail.nossr50.skills.archery; import org.bukkit.event.entity.EntityDamageEvent; -public class ArcheryBonusDamageEventHandler { +public class SkillShotEventHandler { private ArcheryManager manager; private EntityDamageEvent event; protected double damageBonusPercent; - protected ArcheryBonusDamageEventHandler(ArcheryManager manager, EntityDamageEvent event) { + protected SkillShotEventHandler(ArcheryManager manager, EntityDamageEvent event) { this.manager = manager; this.event = event; } diff --git a/src/main/java/com/gmail/nossr50/skills/axes/Axes.java b/src/main/java/com/gmail/nossr50/skills/axes/Axes.java index 1e4c75ee0..d77f16874 100644 --- a/src/main/java/com/gmail/nossr50/skills/axes/Axes.java +++ b/src/main/java/com/gmail/nossr50/skills/axes/Axes.java @@ -46,7 +46,7 @@ public class Axes { /* Every 50 Skill Levels you gain 1 durability damage (default values) */ int impactIncreaseLevel = advancedConfig.getArmorImpactIncreaseLevel(); - float impactMaxDamage = advancedConfig.getArmorImpactMaxDurabilityDamage() / 100F; + double impactMaxDamage = advancedConfig.getArmorImpactMaxDurabilityDamage() / 100F; short maxDurability; durabilityDamage += (int) ((double) Users.getProfile(attacker).getSkillLevel(SkillType.AXES) / (double) impactIncreaseLevel); @@ -90,7 +90,7 @@ public class Axes { if (attacker == null) return; - final int GREATER_IMPACT_CHANCE = advancedConfig.getGreaterImpactChance(); + final double GREATER_IMPACT_CHANCE = advancedConfig.getGreaterImpactChance(); final double GREATER_IMPACT_MULTIPLIER = advancedConfig.getGreaterImpactModifier(); final int GREATER_IMPACT_DAMAGE = advancedConfig.getGreaterImpactBonusDamage(); diff --git a/src/main/java/com/gmail/nossr50/util/Combat.java b/src/main/java/com/gmail/nossr50/util/Combat.java index 156b98607..7f83c488a 100644 --- a/src/main/java/com/gmail/nossr50/util/Combat.java +++ b/src/main/java/com/gmail/nossr50/util/Combat.java @@ -247,7 +247,7 @@ public class Combat { ArcheryManager archeryManager = new ArcheryManager(shooter); - archeryManager.bonusDamage(event); + archeryManager.skillShot(event); if (target instanceof Player) { archeryManager.dazeCheck((Player) target, event); diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index b2a17f25c..debb78c66 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -22,17 +22,17 @@ Skills: Acrobatics: # Dodge_ChanceMax: Maximum chance of dodging when on Dodge_MaxBonusLevel or higher # Dodge_MaxBonusLevel: On this level or higher, the dodge chance will not go higher than Dodge_ChanceMax - Dodge_ChanceMax: 20 + Dodge_ChanceMax: 20.0 Dodge_MaxBonusLevel: 800 # Roll_ChanceMax: Maximum chance of rolling when on Roll_MaxBonusLevel or higher # Roll_MaxBonusLevel: On this level or higher, the roll chance will not go higher than Roll_ChanceMax - Roll_ChanceMax: 100 + Roll_ChanceMax: 100.0 Roll_MaxBonusLevel: 1000 # GracefulRoll_ChanceMax: Maximum chance of graceful rolling when on GracefulRoll_MaxBonusLevel or higher # GracefulRoll_MaxBonusLevel: On this level or higher, the graceful roll chance will not go higher than GracefulRoll_ChanceMax - GracefulRoll_ChanceMax: 100 + GracefulRoll_ChanceMax: 100.0 GracefulRoll_MaxBonusLevel: 500 # Amount of experience for performing a dodge, roll or fall @@ -53,13 +53,13 @@ Skills: # Daze_MaxChance: Maximum chance of causing daze to opponents # Daze_MaxBonusLevel: Maximum bonus level of Daze, when a player reaches this level his chance of causing a daze will be "Daze_MaxChance" # Daze_Modifier: Extra damage for arrows that cause a daze (2 damage = 1 heart) - Daze_MaxChance: 50 + Daze_MaxChance: 50.0 Daze_MaxBonusLevel: 1000 Daze_Modifier: 4 - # Retrieve_MaxBonus: Maximum chance or retrieving arrows + # Retrieve_MaxChance: Maximum chance or retrieving arrows # Retrieve_MaxBonusLevel: Maximum bonus level for Arrow retrieval, at this level the chance of retrieving arrows from mobs is Retrieve_MaxBonus - Retrieve_MaxBonus: 100 + Retrieve_MaxChance: 100.0 Retrieve_MaxBonusLevel: 1000 # # Settings for Axes @@ -82,14 +82,14 @@ Skills: # GreaterImpact_Chance: Chance of hitting with GreaterImpact, knocksbacks mobs # GreaterImpact_KnockbackModifier: Velocity modifier of GreaterImpact hits, this determines how great the knockback is # GreaterImpact_BonusDamage: Extra damage for GreaterImpact hits - GreaterImpact_Chance: 25 + GreaterImpact_Chance: 25.0 GreaterImpact_KnockbackModifier: 1.5 GreaterImpact_BonusDamage: 2 # ArmorImpact_IncreaseLevel: Every "IncreaseLevel" the durability damage goes up with 1 # ArmorImpact_MaxPercentageDurabilityDamage: Durability damage cap for ArmorImpact, 20% means that you can never destroy a piece of armor in less than 5 hits ArmorImpact_IncreaseLevel: 50 - ArmorImpact_MaxPercentageDurabilityDamage: 20 + ArmorImpact_MaxPercentageDurabilityDamage: 20.0 # # Settings for Fishing ###