From b1cf9d139a41a6db0c0047f0ca89dfb94b3e2819 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Sat, 24 Nov 2012 15:47:28 -0800 Subject: [PATCH 1/3] Fixing some issues with Arcane Forging. --- .../commands/skills/RepairCommand.java | 22 ++++++++++--------- .../gmail/nossr50/skills/repair/Repair.java | 8 +++++-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java index 3934c0eb8..84fac30eb 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java @@ -14,15 +14,15 @@ import com.gmail.nossr50.skills.repair.Repair; import com.gmail.nossr50.skills.repair.Repairable; public class RepairCommand extends SkillCommand { - AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private int arcaneForgingRank; private String repairMasteryBonus; private String superRepairChance; - private float repairMasteryChanceMax = advancedConfig.getRepairMasteryChanceMax(); - private float repairMasteryMaxBonusLevel = advancedConfig.getRepairMasteryMaxLevel(); - private float superRepairChanceMax = advancedConfig.getSuperRepairChanceMax(); - private float superRepairMaxBonusLevel = advancedConfig.getSuperRepairMaxLevel(); + private float repairMasteryChanceMax = advancedConfig.getRepairMasteryChanceMax(); + private float repairMasteryMaxBonusLevel = advancedConfig.getRepairMasteryMaxLevel(); + private float superRepairChanceMax = advancedConfig.getSuperRepairChanceMax(); + private float superRepairMaxBonusLevel = advancedConfig.getSuperRepairMaxLevel(); private boolean canSuperRepair; private boolean canMasterRepair; @@ -35,6 +35,7 @@ public class RepairCommand extends SkillCommand { private boolean canRepairString; private boolean canRepairLeather; private boolean canRepairWood; + private boolean arcaneBypass; private int salvageLevel; private int diamondLevel; @@ -48,7 +49,7 @@ public class RepairCommand extends SkillCommand { @Override protected void dataCalculations() { - DecimalFormat df = new DecimalFormat("#.0"); + DecimalFormat df = new DecimalFormat("#.0"); // We're using pickaxes here, not the best but it works Repairable diamondRepairable = mcMMO.repairManager.getRepairable(278); Repairable goldRepairable = mcMMO.repairManager.getRepairable(285); @@ -63,10 +64,10 @@ public class RepairCommand extends SkillCommand { salvageLevel = Config.getInstance().getSalvageUnlockLevel(); if(skillValue >= repairMasteryMaxBonusLevel) repairMasteryBonus = df.format(repairMasteryChanceMax); - else repairMasteryBonus = df.format((repairMasteryChanceMax / repairMasteryMaxBonusLevel) * skillValue); + else repairMasteryBonus = df.format((repairMasteryChanceMax / repairMasteryMaxBonusLevel) * skillValue); if(skillValue >= superRepairMaxBonusLevel) superRepairChance = df.format(superRepairChanceMax); - else superRepairChance = df.format((superRepairChanceMax / superRepairMaxBonusLevel) * skillValue); + else superRepairChance = df.format((superRepairChanceMax / superRepairMaxBonusLevel) * skillValue); arcaneForgingRank = Repair.getArcaneForgingRank(profile); } @@ -84,6 +85,7 @@ public class RepairCommand extends SkillCommand { canRepairString = permInstance.stringRepair(player); canRepairLeather = permInstance.leatherRepair(player); canRepairWood = permInstance.woodRepair(player); + arcaneBypass = permInstance.arcaneBypass(player); } @Override @@ -154,11 +156,11 @@ public class RepairCommand extends SkillCommand { player.sendMessage(LocaleLoader.getString("Repair.Arcane.Rank", new Object[] { arcaneForgingRank })); if (Config.getInstance().getArcaneForgingEnchantLossEnabled()) { - player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Success", new Object[] { Repair.getEnchantChance(arcaneForgingRank) })); + player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Success", new Object[] { (arcaneBypass ? 100 : Repair.getEnchantChance(arcaneForgingRank)) })); } if (Config.getInstance().getArcaneForgingDowngradeEnabled()) { - player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Downgrade", new Object[] { Repair.getDowngradeChance(arcaneForgingRank) })); + player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Downgrade", new Object[] { (arcaneBypass ? 0 : Repair.getDowngradeChance(arcaneForgingRank)) })); } } } diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Repair.java b/src/main/java/com/gmail/nossr50/skills/repair/Repair.java index 3f8c8349a..da3667f23 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/Repair.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/Repair.java @@ -91,6 +91,10 @@ public class Repair { * @param is Item being repaired */ protected static void addEnchants(Player player, ItemStack is) { + if(permInstance.arcaneBypass(player)) { + player.sendMessage(LocaleLoader.getString("Repair.Arcane.Perfect")); + return; + } Map enchants = is.getEnchantments(); if (enchants.size() == 0) { @@ -122,7 +126,7 @@ public class Repair { int enchantLevel = enchant.getValue(); if (configInstance.getArcaneForgingDowngradeEnabled() && enchantLevel > 1) { - if (random.nextInt(100) < getDowngradeChance(rank)) { + if (random.nextInt(randomChance) < getDowngradeChance(rank)) { is.addEnchantment(enchantment, --enchantLevel); downgraded = true; } @@ -209,7 +213,7 @@ public class Repair { // float bonus = (float) skillLevel / 500; float bonus; if(skillLevel >= repairMasteryMaxBonusLevel) bonus = repairMasteryChanceMax; - else bonus = (repairMasteryChanceMax / repairMasteryMaxBonusLevel) * skillLevel; + else bonus = ((float) skillLevel / (float) repairMasteryMaxBonusLevel) * (float) repairMasteryChanceMax; if (permInstance.repairMastery(player)) { bonus = (repairAmount * bonus); From 082fa2ca0d24c4fbad18989af799be99bf9a1676 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Sun, 25 Nov 2012 16:18:30 -0800 Subject: [PATCH 2/3] Dealing with type conversion issues in the skill commands. --- .../commands/skills/AcrobaticsCommand.java | 134 +++++++++--------- .../commands/skills/ArcheryCommand.java | 134 +++++++++--------- .../nossr50/commands/skills/AxesCommand.java | 36 ++--- .../commands/skills/ExcavationCommand.java | 4 +- .../commands/skills/FishingCommand.java | 4 +- .../commands/skills/HerbalismCommand.java | 36 ++--- .../commands/skills/MiningCommand.java | 32 ++--- .../commands/skills/RepairCommand.java | 4 +- .../commands/skills/SwordsCommand.java | 20 +-- .../commands/skills/TamingCommand.java | 24 ++-- .../commands/skills/UnarmedCommand.java | 14 +- .../commands/skills/WoodcuttingCommand.java | 20 +-- .../nossr50/skills/gathering/Mining.java | 2 +- 13 files changed, 232 insertions(+), 232 deletions(-) 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 81da62cab..9ab35481f 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java @@ -10,90 +10,90 @@ import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; public class AcrobaticsCommand extends SkillCommand { - AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); - private String dodgeChance; - private String rollChance; - private String gracefulRollChance; + private String dodgeChance; + private String rollChance; + private String gracefulRollChance; - 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 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; + private boolean canDodge; + private boolean canRoll; + private boolean canGracefulRoll; - public AcrobaticsCommand() { - super(SkillType.ACROBATICS); - } + public AcrobaticsCommand() { + super(SkillType.ACROBATICS); + } - @Override - protected void dataCalculations() { - DecimalFormat df = new DecimalFormat("#.0"); - // DODGE - if(skillValue >= dodgeMaxBonusLevel) dodgeChance = df.format(dodgeChanceMax); - else dodgeChance = df.format((dodgeChanceMax / dodgeMaxBonusLevel) * skillValue); - // ROLL - if(skillValue >= rollMaxBonusLevel) rollChance = df.format(rollChanceMax); - else rollChance = df.format((rollChanceMax / rollMaxBonusLevel) * skillValue); - // GRACEFULROLL - if(skillValue >= gracefulRollMaxBonusLevel) gracefulRollChance = df.format(gracefulRollChanceMax); - else gracefulRollChance = df.format((gracefulRollChanceMax / gracefulRollMaxBonusLevel) * skillValue); - } + @Override + protected void dataCalculations() { + DecimalFormat df = new DecimalFormat("#.0"); + // DODGE + if(skillValue >= dodgeMaxBonusLevel) dodgeChance = df.format(dodgeChanceMax); + else dodgeChance = df.format(((double) dodgeChanceMax / (double) dodgeMaxBonusLevel) * (double) skillValue); + // ROLL + if(skillValue >= rollMaxBonusLevel) rollChance = df.format(rollChanceMax); + else rollChance = df.format(((double) rollChanceMax / (double) rollMaxBonusLevel) * (double) skillValue); + // GRACEFULROLL + if(skillValue >= gracefulRollMaxBonusLevel) gracefulRollChance = df.format(gracefulRollChanceMax); + else gracefulRollChance = df.format(((double) gracefulRollChanceMax / (double) gracefulRollMaxBonusLevel) * (double) skillValue); + } - @Override - protected void permissionsCheck() { - canDodge = permInstance.dodge(player); - canRoll = permInstance.roll(player); - canGracefulRoll = permInstance.gracefulRoll(player); - } + @Override + protected void permissionsCheck() { + canDodge = permInstance.dodge(player); + canRoll = permInstance.roll(player); + canGracefulRoll = permInstance.gracefulRoll(player); + } - @Override - protected boolean effectsHeaderPermissions() { - return canDodge || canGracefulRoll || canRoll; - } + @Override + protected boolean effectsHeaderPermissions() { + return canDodge || canGracefulRoll || canRoll; + } - @Override - protected void effectsDisplay() { + @Override + protected void effectsDisplay() { if (player.hasPermission("mcmmo.perks.lucky.acrobatics")) { String perkPrefix = ChatColor.RED + "[mcMMO Perks] "; player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { "Acrobatics" }) })); } - if (canRoll) { - player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.0"), LocaleLoader.getString("Acrobatics.Effect.1") })); - } + if (canRoll) { + player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.0"), LocaleLoader.getString("Acrobatics.Effect.1") })); + } - if (canGracefulRoll) { - player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.2"), LocaleLoader.getString("Acrobatics.Effect.3") })); - } + if (canGracefulRoll) { + player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.2"), LocaleLoader.getString("Acrobatics.Effect.3") })); + } - if (canDodge) { - player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.4"), LocaleLoader.getString("Acrobatics.Effect.5") })); - } - } + if (canDodge) { + player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.4"), LocaleLoader.getString("Acrobatics.Effect.5") })); + } + } - @Override - protected boolean statsHeaderPermissions() { - return canDodge || canGracefulRoll || canRoll; - } + @Override + protected boolean statsHeaderPermissions() { + return canDodge || canGracefulRoll || canRoll; + } - @Override - protected void statsDisplay() { - if (canRoll) { - player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Chance", new Object[] { rollChance })); - } + @Override + protected void statsDisplay() { + if (canRoll) { + player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Chance", new Object[] { rollChance })); + } - if (canGracefulRoll) { - player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance })); - } + if (canGracefulRoll) { + player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance })); + } - if (canDodge) { - player.sendMessage(LocaleLoader.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance })); - } - } + if (canDodge) { + player.sendMessage(LocaleLoader.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance })); + } + } } \ No newline at end of file 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 bc65ebda4..b162d3f75 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java @@ -10,97 +10,97 @@ import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; public class ArcheryCommand extends SkillCommand { - AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); - private String skillShotBonus; - private String dazeChance; - private String retrieveChance; + private String skillShotBonus; + private String dazeChance; + private String retrieveChance; - private int skillShotIncreaseLevel = advancedConfig.getSkillShotIncreaseLevel(); - private double skillShotIncreasePercentage = advancedConfig.getSkillShotIncreasePercentage(); - private double skillShotBonusMax = advancedConfig.getSkillShotBonusMax(); + 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 dazeBonusMax = advancedConfig.getDazeBonusMax(); + private float dazeMaxBonusLevel = advancedConfig.getDazeMaxBonusLevel(); - private float retrieveBonusMax = advancedConfig.getRetrieveBonusMax(); - private float retrieveMaxBonusLevel = advancedConfig.getRetrieveMaxBonusLevel(); + private float retrieveBonusMax = advancedConfig.getRetrieveBonusMax(); + private float retrieveMaxBonusLevel = advancedConfig.getRetrieveMaxBonusLevel(); - private boolean canSkillShot; - private boolean canDaze; - private boolean canRetrieve; + private boolean canSkillShot; + private boolean canDaze; + private boolean canRetrieve; - public ArcheryCommand() { - super(SkillType.ARCHERY); - } + public ArcheryCommand() { + super(SkillType.ARCHERY); + } - @Override - protected void dataCalculations() { - DecimalFormat df = new DecimalFormat("#.0"); - // SkillShot - double bonus = (int)(skillValue / skillShotIncreaseLevel) * skillShotIncreasePercentage; + @Override + protected void dataCalculations() { + DecimalFormat df = new DecimalFormat("#.0"); + // SkillShot + double bonus = (int)((double) skillValue / (double) skillShotIncreaseLevel) * (double) skillShotIncreasePercentage; if (bonus > skillShotBonusMax) skillShotBonus = percent.format(skillShotBonusMax); else skillShotBonus = percent.format(bonus); - // Daze - if(skillValue >= dazeMaxBonusLevel) dazeChance = df.format(dazeBonusMax); - else dazeChance = df.format((dazeBonusMax / dazeMaxBonusLevel) * skillValue); + // Daze + if(skillValue >= dazeMaxBonusLevel) dazeChance = df.format(dazeBonusMax); + else dazeChance = df.format(((double) dazeBonusMax / (double) dazeMaxBonusLevel) * (double) skillValue); - // Retrieve - if(skillValue >= retrieveMaxBonusLevel) retrieveChance = df.format(retrieveBonusMax); - else retrieveChance = df.format((retrieveBonusMax / retrieveMaxBonusLevel) * skillValue); - } + // Retrieve + if(skillValue >= retrieveMaxBonusLevel) retrieveChance = df.format(retrieveBonusMax); + else retrieveChance = df.format(((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * (double) skillValue); + } - @Override - protected void permissionsCheck() { - canSkillShot = permInstance.archeryBonus(player); - canDaze = permInstance.daze(player); - canRetrieve = permInstance.trackArrows(player); - } + @Override + protected void permissionsCheck() { + canSkillShot = permInstance.archeryBonus(player); + canDaze = permInstance.daze(player); + canRetrieve = permInstance.trackArrows(player); + } - @Override - protected boolean effectsHeaderPermissions() { - return canSkillShot || canDaze || canRetrieve; - } + @Override + protected boolean effectsHeaderPermissions() { + return canSkillShot || canDaze || canRetrieve; + } - @Override - protected void effectsDisplay() { + @Override + protected void effectsDisplay() { if (player.hasPermission("mcmmo.perks.lucky.archery")) { String perkPrefix = ChatColor.RED + "[mcMMO Perks] "; player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { "Archery" }) })); } - if (canSkillShot) { - player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.0"), LocaleLoader.getString("Archery.Effect.1") })); - } + if (canSkillShot) { + player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.0"), LocaleLoader.getString("Archery.Effect.1") })); + } - if (canDaze) { - player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.2"), LocaleLoader.getString("Archery.Effect.3") })); - } + if (canDaze) { + player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.2"), LocaleLoader.getString("Archery.Effect.3") })); + } - if (canRetrieve) { - player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.4"), LocaleLoader.getString("Archery.Effect.5") })); - } - } + if (canRetrieve) { + player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.4"), LocaleLoader.getString("Archery.Effect.5") })); + } + } - @Override - protected boolean statsHeaderPermissions() { - return canSkillShot || canDaze || canRetrieve; - } + @Override + protected boolean statsHeaderPermissions() { + return canSkillShot || canDaze || canRetrieve; + } - @Override - protected void statsDisplay() { - if (canSkillShot) { - player.sendMessage(LocaleLoader.getString("Archery.Combat.SkillshotBonus", new Object[] { skillShotBonus })); - } + @Override + protected void statsDisplay() { + if (canSkillShot) { + player.sendMessage(LocaleLoader.getString("Archery.Combat.SkillshotBonus", new Object[] { skillShotBonus })); + } - if (canDaze) { - player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", new Object[] { dazeChance })); - } + if (canDaze) { + player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", new Object[] { dazeChance })); + } - if (canRetrieve) { - player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance })); - } - } + if (canRetrieve) { + player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance })); + } + } } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java index f88abb625..f23c38088 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java @@ -11,21 +11,21 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.Misc; public class AxesCommand extends SkillCommand { - AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); - + AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + private String critChance; private String bonusDamage; private String impactDamage; private String greaterImpactDamage; private String skullSplitterLength; - private int bonusDamageAxesBonusMax = advancedConfig.getBonusDamageAxesBonusMax(); - private int bonusDamageAxesMaxBonusLevel = advancedConfig.getBonusDamageAxesMaxBonusLevel(); - private double critMaxChance = advancedConfig.getAxesCriticalChance(); - private int critMaxBonusLevel = advancedConfig.getAxesCriticalMaxBonusLevel(); - private int greaterImpactIncreaseLevel = advancedConfig.getGreaterImpactIncreaseLevel(); -// private double greaterImpactModifier = advancedConfig.getGreaterImpactModifier(); - private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength(); + private int bonusDamageAxesBonusMax = advancedConfig.getBonusDamageAxesBonusMax(); + private int bonusDamageAxesMaxBonusLevel = advancedConfig.getBonusDamageAxesMaxBonusLevel(); + private double critMaxChance = advancedConfig.getAxesCriticalChance(); + private int critMaxBonusLevel = advancedConfig.getAxesCriticalMaxBonusLevel(); + private int greaterImpactIncreaseLevel = advancedConfig.getGreaterImpactIncreaseLevel(); +// private double greaterImpactModifier = advancedConfig.getGreaterImpactModifier(); + private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength(); private boolean canSkullSplitter; private boolean canCritical; @@ -39,17 +39,17 @@ public class AxesCommand extends SkillCommand { @Override protected void dataCalculations() { - DecimalFormat df = new DecimalFormat("#.0"); - int skillCheck = Misc.skillCheck((int)skillValue, critMaxBonusLevel); + DecimalFormat df = new DecimalFormat("#.0"); + int skillCheck = Misc.skillCheck((int)skillValue, critMaxBonusLevel); - impactDamage = String.valueOf(1 + ((int) skillValue / greaterImpactIncreaseLevel)); - skullSplitterLength = String.valueOf(2 + ((int) skillValue / abilityLengthIncreaseLevel)); - greaterImpactDamage = "2"; + impactDamage = String.valueOf(1 + ((double) skillValue / (double) greaterImpactIncreaseLevel)); + skullSplitterLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel)); + greaterImpactDamage = "2"; - if (skillValue >= critMaxBonusLevel) critChance = df.format(critMaxChance); - else critChance = String.valueOf((critMaxChance / critMaxBonusLevel) * (float)skillCheck); - if (skillValue >= bonusDamageAxesMaxBonusLevel) bonusDamage = String.valueOf(bonusDamageAxesBonusMax); - else bonusDamage = String.valueOf((int) skillValue / (bonusDamageAxesMaxBonusLevel / bonusDamageAxesBonusMax)); + if (skillValue >= critMaxBonusLevel) critChance = df.format(critMaxChance); + else critChance = String.valueOf(((double) critMaxChance / (double) critMaxBonusLevel) * (double) skillCheck); + if (skillValue >= bonusDamageAxesMaxBonusLevel) bonusDamage = String.valueOf(bonusDamageAxesBonusMax); + else bonusDamage = String.valueOf((double) skillValue / ((double) bonusDamageAxesMaxBonusLevel / (double) bonusDamageAxesBonusMax)); } @Override diff --git a/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java index 7294a3980..0a492b31d 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java @@ -8,7 +8,7 @@ import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; public class ExcavationCommand extends SkillCommand { - AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private String gigaDrillBreakerLength; private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength(); @@ -22,7 +22,7 @@ public class ExcavationCommand extends SkillCommand { @Override protected void dataCalculations() { - gigaDrillBreakerLength = String.valueOf(2 + ((int) skillValue / abilityLengthIncreaseLevel)); + gigaDrillBreakerLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel)); } @Override diff --git a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java index 7e88da248..994b7a695 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java @@ -30,10 +30,10 @@ public class FishingCommand extends SkillCommand { @Override protected void dataCalculations() { lootTier = Fishing.getFishingLootTier(profile); - magicChance = percent.format((float) lootTier / 15); + magicChance = percent.format((double) lootTier / 15D); int dropChance = Fishing.getShakeChance(lootTier); if (player.hasPermission("mcmmo.perks.lucky.fishing")) { - dropChance = (int) (dropChance * 1.25); + dropChance = (int) ((double) dropChance * 1.25D); } shakeChance = String.valueOf(dropChance); diff --git a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java index 98e4f1060..423d11e90 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java @@ -11,8 +11,8 @@ import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; public class HerbalismCommand extends SkillCommand { - AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); - + AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + private String greenTerraLength; private String greenThumbChance; private String greenThumbStage; @@ -28,7 +28,7 @@ public class HerbalismCommand extends SkillCommand { private int greenThumbMaxLevel = advancedConfig.getGreenThumbMaxLevel(); private double doubleDropsMaxBonus = advancedConfig.getHerbalismDoubleDropsChanceMax(); private int doubleDropsMaxLevel = advancedConfig.getHerbalismDoubleDropsMaxLevel(); - + private boolean canGreenTerra; private boolean canGreenThumbWheat; private boolean canGreenThumbBlocks; @@ -42,21 +42,21 @@ public class HerbalismCommand extends SkillCommand { @Override protected void dataCalculations() { - DecimalFormat df = new DecimalFormat("#.0"); - greenTerraLength = String.valueOf(2 + ((int) skillValue / abilityLengthIncreaseLevel)); - //FARMERS DIET - if(skillValue >= farmersDietMaxLevel) farmersDietRank = "5"; - else farmersDietRank = String.valueOf((int)skillValue / farmersDietRankChange); - //GREEN THUMB - if(skillValue >= greenThumbStageMaxLevel) greenThumbStage = "4"; - else greenThumbStage = String.valueOf((int)skillValue / greenThumbStageChange); - - - if(skillValue >= greenThumbMaxLevel) greenThumbChance = String.valueOf(greenThumbMaxBonus); - else greenThumbChance = String.valueOf((greenThumbMaxBonus / greenThumbMaxLevel) * skillValue); - //DOUBLE DROPS - if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus); - else doubleDropChance = df.format((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue); + DecimalFormat df = new DecimalFormat("#.0"); + greenTerraLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel)); + //FARMERS DIET + if(skillValue >= farmersDietMaxLevel) farmersDietRank = "5"; + else farmersDietRank = String.valueOf((double) skillValue / (double) farmersDietRankChange); + //GREEN THUMB + if(skillValue >= greenThumbStageMaxLevel) greenThumbStage = "4"; + else greenThumbStage = String.valueOf((double) skillValue / (double) greenThumbStageChange); + + + if(skillValue >= greenThumbMaxLevel) greenThumbChance = String.valueOf(greenThumbMaxBonus); + else greenThumbChance = String.valueOf(((double) greenThumbMaxBonus / (double) greenThumbMaxLevel) * (double) skillValue); + //DOUBLE DROPS + if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus); + else doubleDropChance = df.format(((double) doubleDropsMaxBonus / (double) doubleDropsMaxLevel) * (double) skillValue); } @Override diff --git a/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java index 255c4f093..a5aa2500a 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java @@ -12,25 +12,25 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.Misc; public class MiningCommand extends SkillCommand { - AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private String doubleDropChance; private String superBreakerLength; private String blastMiningRank; private String blastRadiusIncrease; private String blastDamageDecrease; - private int blastMiningRank1 = advancedConfig.getBlastMiningRank1(); - private int blastMiningRank2 = advancedConfig.getBlastMiningRank2(); - private int blastMiningRank3 = advancedConfig.getBlastMiningRank3(); - private int blastMiningRank4 = advancedConfig.getBlastMiningRank4(); - private int blastMiningRank5 = advancedConfig.getBlastMiningRank5(); - private int blastMiningRank6 = advancedConfig.getBlastMiningRank6(); - private int blastMiningRank7 = advancedConfig.getBlastMiningRank7(); - private int blastMiningRank8 = advancedConfig.getBlastMiningRank8(); + private int blastMiningRank1 = advancedConfig.getBlastMiningRank1(); + private int blastMiningRank2 = advancedConfig.getBlastMiningRank2(); + private int blastMiningRank3 = advancedConfig.getBlastMiningRank3(); + private int blastMiningRank4 = advancedConfig.getBlastMiningRank4(); + private int blastMiningRank5 = advancedConfig.getBlastMiningRank5(); + private int blastMiningRank6 = advancedConfig.getBlastMiningRank6(); + private int blastMiningRank7 = advancedConfig.getBlastMiningRank7(); + private int blastMiningRank8 = advancedConfig.getBlastMiningRank8(); - private double doubleDropsMaxBonus = advancedConfig.getMiningDoubleDropChance(); - private int doubleDropsMaxLevel = advancedConfig.getMiningDoubleDropMaxLevel(); - public int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength(); + private double doubleDropsMaxBonus = advancedConfig.getMiningDoubleDropChance(); + private int doubleDropsMaxLevel = advancedConfig.getMiningDoubleDropMaxLevel(); + public int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength(); private boolean canSuperBreaker; private boolean canDoubleDrop; @@ -45,10 +45,10 @@ public class MiningCommand extends SkillCommand { @Override protected void dataCalculations() { - DecimalFormat df = new DecimalFormat("#.0"); - superBreakerLength = String.valueOf(2 + ((int) skillValue / abilityLengthIncreaseLevel)); - if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus); - else doubleDropChance = df.format((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue); + DecimalFormat df = new DecimalFormat("#.0"); + superBreakerLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel)); + if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus); + else doubleDropChance = df.format(((double) doubleDropsMaxBonus / (double) doubleDropsMaxLevel) * (double) skillValue); if (skillValue >= blastMiningRank8) { blastMiningRank = "8"; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java index 84fac30eb..b005f0859 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java @@ -64,10 +64,10 @@ public class RepairCommand extends SkillCommand { salvageLevel = Config.getInstance().getSalvageUnlockLevel(); if(skillValue >= repairMasteryMaxBonusLevel) repairMasteryBonus = df.format(repairMasteryChanceMax); - else repairMasteryBonus = df.format((repairMasteryChanceMax / repairMasteryMaxBonusLevel) * skillValue); + else repairMasteryBonus = df.format(((double) repairMasteryChanceMax / (double) repairMasteryMaxBonusLevel) * (double) skillValue); if(skillValue >= superRepairMaxBonusLevel) superRepairChance = df.format(superRepairChanceMax); - else superRepairChance = df.format((superRepairChanceMax / superRepairMaxBonusLevel) * skillValue); + else superRepairChance = df.format(((double) superRepairChanceMax / (double) superRepairMaxBonusLevel) * (double) skillValue); arcaneForgingRank = Repair.getArcaneForgingRank(profile); } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java index 77ee6e78c..7568f76ee 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java @@ -10,8 +10,8 @@ import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; public class SwordsCommand extends SkillCommand { - AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); - + AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + private String counterAttackChance; private String bleedLength; private String bleedChance; @@ -36,19 +36,19 @@ public class SwordsCommand extends SkillCommand { @Override protected void dataCalculations() { - DecimalFormat df = new DecimalFormat("#.0"); - serratedStrikesLength = String.valueOf(2 + ((int) skillValue / abilityLengthIncreaseLevel)); + DecimalFormat df = new DecimalFormat("#.0"); + serratedStrikesLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel)); if (skillValue >= bleedMaxLevel) bleedLength = String.valueOf(bleedMaxTicks); else bleedLength = String.valueOf(bleedBaseTicks); - if(skillValue >= bleedMaxLevel) bleedChance = df.format(bleedChanceMax); - else bleedChance = df.format((bleedChanceMax / bleedMaxLevel) * skillValue); + if(skillValue >= bleedMaxLevel) bleedChance = df.format(bleedChanceMax); + else bleedChance = df.format(((double) bleedChanceMax / (double) bleedMaxLevel) * (double) skillValue); - if(skillValue >= counterMaxLevel) counterAttackChance = df.format(counterChanceMax); - else counterAttackChance = df.format((counterChanceMax / counterMaxLevel) * skillValue); - - serratedStrikesLength = String.valueOf(serratedBleedTicks); + if(skillValue >= counterMaxLevel) counterAttackChance = df.format(counterChanceMax); + else counterAttackChance = df.format(((double) counterChanceMax / (double) counterMaxLevel) * (double) skillValue); + + serratedStrikesLength = String.valueOf(serratedBleedTicks); } @Override diff --git a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java index bf0106562..006c7c546 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java @@ -11,17 +11,17 @@ import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; public class TamingCommand extends SkillCommand { - AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private String goreChance; - private float goreChanceMax = advancedConfig.getGoreChanceMax(); - private float goreMaxLevel = advancedConfig.getGoreMaxBonusLevel(); - private int fastFoodUnlock = advancedConfig.getFastFoodUnlock(); - private float fastFoodChance = advancedConfig.getFastFoodChance(); - private int enviromentallyAwareUnlock = advancedConfig.getEnviromentallyAwareUnlock(); - private int thickFurUnlock = advancedConfig.getThickFurUnlock(); - private int shockProofUnlock = advancedConfig.getShockProofUnlock(); - private int sharpenedClawUnlock = advancedConfig.getSharpenedClawsUnlock(); + private float goreChanceMax = advancedConfig.getGoreChanceMax(); + private float goreMaxLevel = advancedConfig.getGoreMaxBonusLevel(); + private int fastFoodUnlock = advancedConfig.getFastFoodUnlock(); + private float fastFoodChance = advancedConfig.getFastFoodChance(); + private int enviromentallyAwareUnlock = advancedConfig.getEnviromentallyAwareUnlock(); + private int thickFurUnlock = advancedConfig.getThickFurUnlock(); + private int shockProofUnlock = advancedConfig.getShockProofUnlock(); + private int sharpenedClawUnlock = advancedConfig.getSharpenedClawsUnlock(); private boolean canBeastLore; private boolean canGore; @@ -38,9 +38,9 @@ public class TamingCommand extends SkillCommand { @Override protected void dataCalculations() { - DecimalFormat df = new DecimalFormat("#.0"); - if(skillValue >= goreMaxLevel) goreChance = df.format(goreChanceMax); - else goreChance = df.format((goreChanceMax / goreMaxLevel) * skillValue); + DecimalFormat df = new DecimalFormat("#.0"); + if(skillValue >= goreMaxLevel) goreChance = df.format(goreChanceMax); + else goreChance = df.format(((double) goreChanceMax / (double) goreMaxLevel) * (double) skillValue); } @Override diff --git a/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java index 5c36507b6..e18abc185 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java @@ -10,7 +10,7 @@ import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; public class UnarmedCommand extends SkillCommand { - AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private String berserkLength; private String deflectChance; private String disarmChance; @@ -22,7 +22,7 @@ public class UnarmedCommand extends SkillCommand { private float deflectMaxLevel = advancedConfig.getDeflectMaxBonusLevel(); private float ironArmMaxBonus = advancedConfig.getIronArmBonus(); private int ironArmIncreaseLevel = advancedConfig.getIronArmIncreaseLevel(); - private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength(); + private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength(); private boolean canBerserk; private boolean canDisarm; @@ -35,17 +35,17 @@ public class UnarmedCommand extends SkillCommand { @Override protected void dataCalculations() { - DecimalFormat df = new DecimalFormat("#.0"); - berserkLength = String.valueOf(2 + ((int) skillValue / abilityLengthIncreaseLevel)); + DecimalFormat df = new DecimalFormat("#.0"); + berserkLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel)); if(skillValue >= disarmMaxLevel) disarmChance = df.format(disarmChanceMax); - else disarmChance = df.format((disarmChanceMax / disarmMaxLevel) * skillValue); + else disarmChance = df.format(((double) disarmChanceMax / (double) disarmMaxLevel) * (double) skillValue); if(skillValue >= deflectMaxLevel) deflectChance = df.format(deflectChanceMax); - else deflectChance = df.format((deflectChanceMax / deflectMaxLevel) * skillValue); + else deflectChance = df.format(((double) deflectChanceMax / (double) deflectMaxLevel) * (double) skillValue); if (skillValue >= 250) ironArmBonus = String.valueOf(ironArmMaxBonus); - else ironArmBonus = String.valueOf(3 + ((int) skillValue / ironArmIncreaseLevel)); + else ironArmBonus = String.valueOf(3 + ((double) skillValue / (double) ironArmIncreaseLevel)); } @Override diff --git a/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java index 6eb338a02..3e8362ca1 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java @@ -11,15 +11,15 @@ import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; public class WoodcuttingCommand extends SkillCommand { - AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private String treeFellerLength; private String doubleDropChance; - private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength(); - private double doubleDropsMaxBonus = advancedConfig.getWoodcuttingDoubleDropChance(); - private int doubleDropsMaxLevel = advancedConfig.getWoodcuttingDoubleDropMaxLevel(); - private int leafBlowUnlock = advancedConfig.getLeafBlowUnlockLevel(); - + private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength(); + private double doubleDropsMaxBonus = advancedConfig.getWoodcuttingDoubleDropChance(); + private int doubleDropsMaxLevel = advancedConfig.getWoodcuttingDoubleDropMaxLevel(); + private int leafBlowUnlock = advancedConfig.getLeafBlowUnlockLevel(); + private boolean canTreeFell; private boolean canLeafBlow; private boolean canDoubleDrop; @@ -31,11 +31,11 @@ public class WoodcuttingCommand extends SkillCommand { @Override protected void dataCalculations() { - DecimalFormat df = new DecimalFormat("0.0"); + DecimalFormat df = new DecimalFormat("0.0"); - treeFellerLength = String.valueOf(2 + ((int) skillValue / abilityLengthIncreaseLevel)); - if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus); - else doubleDropChance = df.format((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue); + treeFellerLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel)); + if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus); + else doubleDropChance = df.format(((double) doubleDropsMaxBonus / (double) doubleDropsMaxLevel) * (double) skillValue); } @Override diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java b/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java index 3c3cfc145..d64cef981 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java @@ -329,7 +329,7 @@ public class Mining { int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL); int randomChance = 100; - int chance = (MAX_CHANCE / MAX_BONUS_LEVEL) * skillLevel; + int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * (double) skillLevel); if (player.hasPermission("mcmmo.perks.lucky.mining")) { randomChance = (int) (randomChance * 0.75); From 0037524cfd418c4f3bedabda0b28ef4449488067 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Sun, 25 Nov 2012 16:40:42 -0800 Subject: [PATCH 3/3] Fixing more errors with typecasting. --- .../gmail/nossr50/config/AdvancedConfig.java | 162 +++++++++--------- .../nossr50/skills/acrobatics/Acrobatics.java | 2 +- .../gmail/nossr50/skills/archery/Archery.java | 2 +- .../skills/archery/ArcheryManager.java | 22 +-- .../com/gmail/nossr50/skills/combat/Axes.java | 10 +- .../nossr50/skills/gathering/BlastMining.java | 18 +- .../nossr50/skills/gathering/Mining.java | 4 +- .../nossr50/skills/gathering/WoodCutting.java | 6 +- .../gmail/nossr50/skills/repair/Repair.java | 24 +-- .../gmail/nossr50/skills/swords/Swords.java | 4 +- .../nossr50/skills/swords/SwordsManager.java | 4 +- .../gmail/nossr50/skills/taming/Taming.java | 4 +- .../nossr50/skills/taming/TamingManager.java | 2 +- .../gmail/nossr50/skills/unarmed/Unarmed.java | 4 +- .../skills/unarmed/UnarmedManager.java | 6 +- 15 files changed, 137 insertions(+), 137 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 2fd8bc870..164fb386f 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -14,56 +14,56 @@ public class AdvancedConfig extends ConfigLoader { return instance; } - @Override - protected void loadKeys() { - // TODO Do I need to use this? - } - /* GENERAL */ - public int getAbilityLength() { return config.getInt("Skills.General.Ability_IncreaseLevel", 50); } - + @Override + protected void loadKeys() { + // TODO Do I need to use this? + } + /* GENERAL */ + public int getAbilityLength() { return config.getInt("Skills.General.Ability_IncreaseLevel", 50); } + /* ACROBATICS */ - public int getDodgeChanceMax() { return config.getInt("Skills.Acrobatics.Dodge_ChanceMax", 20); } - public int getDodgeMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Dodge_MaxBonusLevel", 800); } - - public int getRollChanceMax() { return config.getInt("Skills.Acrobatics.Roll_ChanceMax", 100); } - public int getRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Roll_MaxBonusLevel", 1000); } - - public int getGracefulRollChanceMax() { return config.getInt("Skills.Acrobatics.GracefulRoll_ChanceMax", 100); } - public int getGracefulRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.GracefulRoll_MaxBonusLevel", 500); } + public int getDodgeChanceMax() { return config.getInt("Skills.Acrobatics.Dodge_ChanceMax", 20); } + public int getDodgeMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Dodge_MaxBonusLevel", 800); } + + public int getRollChanceMax() { return config.getInt("Skills.Acrobatics.Roll_ChanceMax", 100); } + public int getRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Roll_MaxBonusLevel", 1000); } + + public int getGracefulRollChanceMax() { return config.getInt("Skills.Acrobatics.GracefulRoll_ChanceMax", 100); } + public int getGracefulRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.GracefulRoll_MaxBonusLevel", 500); } - public int getDodgeXPModifier() { return config.getInt("Skills.Acrobatics.Dodge_XP_Modifier", 120); } - public int getRollXPModifier() { return config.getInt("Skills.Acrobatics.Roll_XP_Modifier", 80); } - public int getFallXPModifier() { return config.getInt("Skills.Acrobatics.Fall_XP_Modifier", 120); } - + public int getDodgeXPModifier() { return config.getInt("Skills.Acrobatics.Dodge_XP_Modifier", 120); } + public int getRollXPModifier() { return config.getInt("Skills.Acrobatics.Roll_XP_Modifier", 80); } + public int getFallXPModifier() { return config.getInt("Skills.Acrobatics.Fall_XP_Modifier", 120); } + /* ARCHERY */ - public int getSkillShotIncreaseLevel() { return config.getInt("Skills.Archery.SkillShot_IncreaseLevel", 50); } - 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 getSkillShotIncreaseLevel() { return config.getInt("Skills.Archery.SkillShot_IncreaseLevel", 50); } + 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 int getDazeMaxBonusLevel() { return config.getInt("Skills.Archery.Daze_MaxBonusLevel", 1000); } - public int getDazeModifier() { return config.getInt("Skills.Archery.Daze_BonusDamage", 4); } + public int getDazeBonusMax() { return config.getInt("Skills.Archery.Daze_MaxChance", 50); } + 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 int getRetrieveMaxBonusLevel() { return config.getInt("Skills.Archery.Retrieve_MaxBonusLevel", 1000); } - + public int getRetrieveBonusMax() { return config.getInt("Skills.Archery.Retrieve_MaxBonus", 100); } + public int getRetrieveMaxBonusLevel() { return config.getInt("Skills.Archery.Retrieve_MaxBonusLevel", 1000); } + /* AXES */ - public int getBonusDamageAxesBonusMax() { return config.getInt("Skills.Axes.DamageIncrease_MaxBonus", 4); } - public int getBonusDamageAxesMaxBonusLevel() { return config.getInt("Skills.Axes.DamageIncrease_MaxBonusLevel", 200); } + public int getBonusDamageAxesBonusMax() { return config.getInt("Skills.Axes.DamageIncrease_MaxBonus", 4); } + public int getBonusDamageAxesMaxBonusLevel() { return config.getInt("Skills.Axes.DamageIncrease_MaxBonusLevel", 200); } - public double getAxesCriticalChance() { return config.getDouble("Skills.Axes.AxesCritical_MaxChance", 37.50); } - public int getAxesCriticalMaxBonusLevel() { return config.getInt("Skills.Axes.AxesCritical_MaxBonusLevel", 750); } - public double getAxesCriticalPVPModifier() { return config.getDouble("Skills.Axes.AxesCritical_PVP_Modifier", 1.5); } - public int getAxesCriticalPVEModifier() { return config.getInt("Skills.Axes.AxesCritical_PVE_Modifier", 2); } - - public int getGreaterImpactChance() { return config.getInt("Skills.Axes.GreaterImpact_Chance", 25); } - public int getGreaterImpactIncreaseLevel() { return config.getInt("Skills.Axes.GreaterImpact_IncreaseLevel", 50); } - public double getGreaterImpactModifier() { return config.getDouble("Skills.Axes.GreaterImpact_KnockbackModifier", 1.5); } - public int getGreaterImpactBonusDamage() { return config.getInt("Skills.Axes.GreaterImpact_BonusDamage", 2); } - + public double getAxesCriticalChance() { return config.getDouble("Skills.Axes.AxesCritical_MaxChance", 37.50); } + public int getAxesCriticalMaxBonusLevel() { return config.getInt("Skills.Axes.AxesCritical_MaxBonusLevel", 750); } + public double getAxesCriticalPVPModifier() { return config.getDouble("Skills.Axes.AxesCritical_PVP_Modifier", 1.5); } + public int getAxesCriticalPVEModifier() { return config.getInt("Skills.Axes.AxesCritical_PVE_Modifier", 2); } + + public int getGreaterImpactChance() { return config.getInt("Skills.Axes.GreaterImpact_Chance", 25); } + public int getGreaterImpactIncreaseLevel() { return config.getInt("Skills.Axes.GreaterImpact_IncreaseLevel", 50); } + public double getGreaterImpactModifier() { return config.getDouble("Skills.Axes.GreaterImpact_KnockbackModifier", 1.5); } + public int getGreaterImpactBonusDamage() { return config.getInt("Skills.Axes.GreaterImpact_BonusDamage", 2); } + /* EXCAVATION */ - //Nothing to configure, everything is already configurable in config.yml - + //Nothing to configure, everything is already configurable in config.yml + /* FISHING */ public int getShakeUnlockLevel() { return config.getInt("Skills.Fishing.Shake_UnlockLevel", 150); } public int getFishingEnchantmentChance() { return config.getInt("Skills.Fishing.Enchantment_Chance", 10); } @@ -97,56 +97,56 @@ public class AdvancedConfig extends ConfigLoader { public int getSuperRepairMaxLevel() { return config.getInt("Skills.Repair.SuperRepair_MaxBonusLevel", 1000); } /* SWORDS */ - public int getBleedChanceMax() { return config.getInt("Skills.Sword.Bleed_ChanceMax", 75); } - public int getBleedMaxBonusLevel() { return config.getInt("Skills.Sword.Bleed_MaxBonusLevel", 750); } - public int getBleedMaxTicks() { return config.getInt("Skills.Sword.Bleed_MaxTicks", 3); } - public int getBleedBaseTicks() { return config.getInt("Skills.Sword.Bleed_BaseTicks", 2); } + public int getBleedChanceMax() { return config.getInt("Skills.Sword.Bleed_ChanceMax", 75); } + public int getBleedMaxBonusLevel() { return config.getInt("Skills.Sword.Bleed_MaxBonusLevel", 750); } + public int getBleedMaxTicks() { return config.getInt("Skills.Sword.Bleed_MaxTicks", 3); } + public int getBleedBaseTicks() { return config.getInt("Skills.Sword.Bleed_BaseTicks", 2); } public int getCounterChanceMax() { return config.getInt("Skills.Sword.Counter_ChanceMax", 30); } - public int getCounterMaxBonusLevel() { return config.getInt("Skills.Sword.Counter_MaxBonusLevel", 600); } - public int getCounterModifier() { return config.getInt("Skills.Sword.Counter_DamageModifier", 2); } - - public int getSerratedStrikesModifier() { return config.getInt("Skills.Sword.SerratedStrikes_DamageModifier", 4); } - public int getSerratedStrikesTicks() { return config.getInt("Skills.Sword.SerratedStrikes_BleedTicks", 5); } + public int getCounterMaxBonusLevel() { return config.getInt("Skills.Sword.Counter_MaxBonusLevel", 600); } + public int getCounterModifier() { return config.getInt("Skills.Sword.Counter_DamageModifier", 2); } + + public int getSerratedStrikesModifier() { return config.getInt("Skills.Sword.SerratedStrikes_DamageModifier", 4); } + public int getSerratedStrikesTicks() { return config.getInt("Skills.Sword.SerratedStrikes_BleedTicks", 5); } /* TAMING */ - public int getGoreChanceMax() { return config.getInt("Skills.Taming.Gore_ChanceMax", 100); } - public int getGoreMaxBonusLevel() { return config.getInt("Skills.Taming.Gore_MaxBonusLevel", 1000); } - public int getGoreBleedTicks() { return config.getInt("Skills.Taming.Gore_BleedTicks", 2); } - public int getGoreModifier() { return config.getInt("Skills.Taming.Gore_Modifier", 2); } + public int getGoreChanceMax() { return config.getInt("Skills.Taming.Gore_ChanceMax", 100); } + public int getGoreMaxBonusLevel() { return config.getInt("Skills.Taming.Gore_MaxBonusLevel", 1000); } + public int getGoreBleedTicks() { return config.getInt("Skills.Taming.Gore_BleedTicks", 2); } + public int getGoreModifier() { return config.getInt("Skills.Taming.Gore_Modifier", 2); } - public int getFastFoodUnlock() { return config.getInt("Skills.Taming.FastFood_UnlockLevel", 50); } - public int getFastFoodChance() { return config.getInt("Skills.Taming.FastFood_Chance", 50); } - - public int getEnviromentallyAwareUnlock() { return config.getInt("Skills.Taming.EnvironmentallyAware_UnlockLevel", 100); } + public int getFastFoodUnlock() { return config.getInt("Skills.Taming.FastFood_UnlockLevel", 50); } + public int getFastFoodChance() { return config.getInt("Skills.Taming.FastFood_Chance", 50); } + + public int getEnviromentallyAwareUnlock() { return config.getInt("Skills.Taming.EnvironmentallyAware_UnlockLevel", 100); } - public int getThickFurUnlock() { return config.getInt("Skills.Taming.ThickFur_UnlockLevel", 250); } - public int getThickFurModifier() { return config.getInt("Skills.Taming.ThickFur_Modifier", 2); } - - public int getShockProofUnlock() { return config.getInt("Skills.Taming.ShockProof_UnlockLevel", 500); } - public int getShockProofModifier() { return config.getInt("Skills.Taming.ShockProof_Modifier", 6); } + public int getThickFurUnlock() { return config.getInt("Skills.Taming.ThickFur_UnlockLevel", 250); } + public int getThickFurModifier() { return config.getInt("Skills.Taming.ThickFur_Modifier", 2); } + + public int getShockProofUnlock() { return config.getInt("Skills.Taming.ShockProof_UnlockLevel", 500); } + public int getShockProofModifier() { return config.getInt("Skills.Taming.ShockProof_Modifier", 6); } - public int getSharpenedClawsUnlock() { return config.getInt("Skills.Taming.SharpenedClaws_UnlockLevel", 750); } - public int getSharpenedClawsBonus() { return config.getInt("Skills.Taming.SharpenedClaws_Bonus", 2); } + public int getSharpenedClawsUnlock() { return config.getInt("Skills.Taming.SharpenedClaws_UnlockLevel", 750); } + public int getSharpenedClawsBonus() { return config.getInt("Skills.Taming.SharpenedClaws_Bonus", 2); } /* UNARMED */ - public int getDisarmChanceMax() { return config.getInt("Skills.Unarmed.Disarm_ChanceMax", 33); } - public int getDisarmMaxBonusLevel() { return config.getInt("Skills.Unarmed.Disarm_MaxBonusLevel", 1000); } - public int getDeflectChanceMax() { return config.getInt("Skills.Unarmed.Deflect_ChanceMax", 50); } - public int getDeflectMaxBonusLevel() { return config.getInt("Skills.Unarmed.Deflect_MaxBonusLevel", 1000); } - public int getIronGripChanceMax() { return config.getInt("Skills.Unarmed.IronGrip_ChanceMax", 100); } - public int getIronGripMaxBonusLevel() { return config.getInt("Skills.Unarmed.IronGrip_MaxBonusLevel", 1000); } - public int getIronArmBonus() { return config.getInt("Skills.Unarmed.IronArm_Bonus", 8); } - public int getIronArmIncreaseLevel() { return config.getInt("Skills.Unarmed.IronArm_IncreaseLevel", 50); } + public int getDisarmChanceMax() { return config.getInt("Skills.Unarmed.Disarm_ChanceMax", 33); } + public int getDisarmMaxBonusLevel() { return config.getInt("Skills.Unarmed.Disarm_MaxBonusLevel", 1000); } + public int getDeflectChanceMax() { return config.getInt("Skills.Unarmed.Deflect_ChanceMax", 50); } + public int getDeflectMaxBonusLevel() { return config.getInt("Skills.Unarmed.Deflect_MaxBonusLevel", 1000); } + public int getIronGripChanceMax() { return config.getInt("Skills.Unarmed.IronGrip_ChanceMax", 100); } + public int getIronGripMaxBonusLevel() { return config.getInt("Skills.Unarmed.IronGrip_MaxBonusLevel", 1000); } + public int getIronArmBonus() { return config.getInt("Skills.Unarmed.IronArm_Bonus", 8); } + public int getIronArmIncreaseLevel() { return config.getInt("Skills.Unarmed.IronArm_IncreaseLevel", 50); } /* WOODCUTTING */ public int getLeafBlowUnlockLevel() { return config.getInt("Skills.Woodcutting.LeafBlower_UnlockLevel", 100); } public int getWoodcuttingDoubleDropChance() { return config.getInt("Skills.Woodcutting.DoubleDrops_ChanceMax", 100); } public int getWoodcuttingDoubleDropMaxLevel() { return config.getInt("Skills.Woodcutting.DoubleDrops_MaxBonusLevel", 1000); } /* SPOUT STUFF*/ - public int getSpoutNotificationTier1() { return config.getInt("Spout.Notifications.Tier1", 200); } - public int getSpoutNotificationTier2() { return config.getInt("Spout.Notifications.Tier2", 400); } - public int getSpoutNotificationTier3() { return config.getInt("Spout.Notifications.Tier3", 600); } - public int getSpoutNotificationTier4() { return config.getInt("Spout.Notifications.Tier4", 800); } - //TODO Make the sounds configurable! :D -// public String getSpoutSoundRepair() { return config.getString("Spout.Sounds.RepairSound", "url here"); } -// public String getSpoutSoundLevelUp() { return config.getString("Spout.Sounds.LevelUp", "url here"); } + public int getSpoutNotificationTier1() { return config.getInt("Spout.Notifications.Tier1", 200); } + public int getSpoutNotificationTier2() { return config.getInt("Spout.Notifications.Tier2", 400); } + public int getSpoutNotificationTier3() { return config.getInt("Spout.Notifications.Tier3", 600); } + public int getSpoutNotificationTier4() { return config.getInt("Spout.Notifications.Tier4", 800); } + //TODO Make the sounds configurable! :D +// public String getSpoutSoundRepair() { return config.getString("Spout.Sounds.RepairSound", "url here"); } +// public String getSpoutSoundLevelUp() { return config.getString("Spout.Sounds.LevelUp", "url here"); } } 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 51dec028b..1af3cc8c5 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java @@ -5,7 +5,7 @@ import java.util.Random; import com.gmail.nossr50.config.AdvancedConfig; public class Acrobatics { - static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); public static final int DODGE_MAX_BONUS_LEVEL = advancedConfig.getDodgeMaxBonusLevel(); public static final int DODGE_XP_MODIFIER = advancedConfig.getDodgeXPModifier(); 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 bf761da47..546998f2b 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/Archery.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/Archery.java @@ -13,7 +13,7 @@ import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.util.Misc; public class Archery { - static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private static Random random = new Random(); private static List trackedEntities = new ArrayList(); 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 1df7318aa..c529888b2 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java @@ -11,18 +11,18 @@ import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Users; public class ArcheryManager { - AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); - + AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + private Player player; private PlayerProfile profile; private int skillLevel; private Permissions permissionsInstance; - private float dazeBonusMax = advancedConfig.getDazeBonusMax(); - private float dazeMaxBonusLevel = advancedConfig.getDazeMaxBonusLevel(); - private float retrieveBonusMax = advancedConfig.getRetrieveBonusMax(); - private float retrieveMaxBonusLevel = advancedConfig.getRetrieveMaxBonusLevel(); - + private float dazeBonusMax = advancedConfig.getDazeBonusMax(); + private float dazeMaxBonusLevel = advancedConfig.getDazeMaxBonusLevel(); + private float retrieveBonusMax = advancedConfig.getRetrieveBonusMax(); + private float retrieveMaxBonusLevel = advancedConfig.getRetrieveMaxBonusLevel(); + public ArcheryManager (Player player) { this.player = player; this.profile = Users.getProfile(player); @@ -57,7 +57,7 @@ public class ArcheryManager { if (player.hasPermission("mcmmo.perks.lucky.archery")) { randomChance = (int) (randomChance * 0.75); } - final float chance = (retrieveBonusMax / retrieveMaxBonusLevel) * skillLevel; + final float chance = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * (double) skillLevel); if (chance > Archery.getRandom().nextInt(randomChance)) { eventHandler.addToTracker(); } @@ -88,10 +88,10 @@ public class ArcheryManager { randomChance = (int) (randomChance * 0.75); } - final float chance = (dazeBonusMax / dazeMaxBonusLevel) * skillLevel; + final float chance = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * (double) skillLevel); if (chance > Archery.getRandom().nextInt(randomChance)) { - eventHandler.handleDazeEffect(); - eventHandler.sendAbilityMessages(); + eventHandler.handleDazeEffect(); + eventHandler.sendAbilityMessages(); } } diff --git a/src/main/java/com/gmail/nossr50/skills/combat/Axes.java b/src/main/java/com/gmail/nossr50/skills/combat/Axes.java index 25e57d400..1306f2690 100644 --- a/src/main/java/com/gmail/nossr50/skills/combat/Axes.java +++ b/src/main/java/com/gmail/nossr50/skills/combat/Axes.java @@ -21,7 +21,7 @@ import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Users; public class Axes { - static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private static Random random = new Random(); @@ -40,7 +40,7 @@ public class Axes { final int INCREASE_LEVEL = MAX_LEVEL / MAX_BONUS; /* Add 1 DMG for every 50 skill levels */ - int bonus = Users.getProfile(attacker).getSkillLevel(SkillType.AXES) / INCREASE_LEVEL; + int bonus = (int) ((double) Users.getProfile(attacker).getSkillLevel(SkillType.AXES) / (double) INCREASE_LEVEL); if (bonus > MAX_BONUS) { bonus = MAX_BONUS; @@ -87,7 +87,7 @@ public class Axes { int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL); int randomChance = 100; - double chance = (MAX_CHANCE / MAX_BONUS_LEVEL) * skillCheck; + double chance = ((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * (double) skillCheck; if (attacker.hasPermission("mcmmo.perks.lucky.axes")) { randomChance = (int) (randomChance * 0.75); @@ -130,7 +130,7 @@ public class Axes { /* Every 30 Skill Levels you gain 1 durability damage */ int impactIncreaseLevel = advancedConfig.getGreaterImpactIncreaseLevel(); - durabilityDamage += Users.getProfile(attacker).getSkillLevel(SkillType.AXES)/impactIncreaseLevel; + durabilityDamage += (int) ((double) Users.getProfile(attacker).getSkillLevel(SkillType.AXES) / (double) impactIncreaseLevel); if (!hasArmor(targetPlayer)) { applyGreaterImpact(attacker, target, event); @@ -158,7 +158,7 @@ public class Axes { private static void applyGreaterImpact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) { if(attacker == null) return; - + final int 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/skills/gathering/BlastMining.java b/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java index 9f6a8ff93..e9446f5d8 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java @@ -28,18 +28,18 @@ import com.gmail.nossr50.util.Skills; import com.gmail.nossr50.util.Users; public class BlastMining { - static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private static Random random = new Random(); - private static int blastMiningRank1 = advancedConfig.getBlastMiningRank1(); - private static int blastMiningRank2 = advancedConfig.getBlastMiningRank2(); - private static int blastMiningRank3 = advancedConfig.getBlastMiningRank3(); - private static int blastMiningRank4 = advancedConfig.getBlastMiningRank4(); - private static int blastMiningRank5 = advancedConfig.getBlastMiningRank5(); - private static int blastMiningRank6 = advancedConfig.getBlastMiningRank6(); - private static int blastMiningRank7 = advancedConfig.getBlastMiningRank7(); - private static int blastMiningRank8 = advancedConfig.getBlastMiningRank8(); + private static int blastMiningRank1 = advancedConfig.getBlastMiningRank1(); + private static int blastMiningRank2 = advancedConfig.getBlastMiningRank2(); + private static int blastMiningRank3 = advancedConfig.getBlastMiningRank3(); + private static int blastMiningRank4 = advancedConfig.getBlastMiningRank4(); + private static int blastMiningRank5 = advancedConfig.getBlastMiningRank5(); + private static int blastMiningRank6 = advancedConfig.getBlastMiningRank6(); + private static int blastMiningRank7 = advancedConfig.getBlastMiningRank7(); + private static int blastMiningRank8 = advancedConfig.getBlastMiningRank8(); /** * Handler for what blocks drop from the explosion. * diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java b/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java index d64cef981..9ebc9b1b1 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java @@ -27,7 +27,7 @@ import com.gmail.nossr50.util.Users; public class Mining { private static Random random = new Random(); - static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); /** * Handle double drops when using Silk Touch. @@ -323,7 +323,7 @@ public class Mining { miningXP(player, block); final int MAX_BONUS_LEVEL = advancedConfig.getMiningDoubleDropMaxLevel(); - int MAX_CHANCE = advancedConfig.getMiningDoubleDropChance(); + int MAX_CHANCE = advancedConfig.getMiningDoubleDropChance(); int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING); int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL); diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java index 9d61aebab..06e02ed03 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java @@ -32,7 +32,7 @@ import com.gmail.nossr50.util.Users; public class WoodCutting { - static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private static Random random = new Random(); /** @@ -330,7 +330,7 @@ public class WoodCutting { */ private static void woodCuttingProcCheck(Player player, Block block) { - final int MAX_CHANCE = advancedConfig.getMiningDoubleDropChance(); + final int MAX_CHANCE = advancedConfig.getMiningDoubleDropChance(); final int MAX_BONUS_LEVEL = advancedConfig.getMiningDoubleDropMaxLevel(); int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.WOODCUTTING); @@ -345,7 +345,7 @@ public class WoodCutting { Material mat = Material.getMaterial(block.getTypeId()); int randomChance = 100; - int chance = (MAX_CHANCE / MAX_BONUS_LEVEL) * skillLevel; + int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * (double) skillLevel); if (player.hasPermission("mcmmo.perks.lucky.woodcutting")) { randomChance = (int) (randomChance * 0.75); diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Repair.java b/src/main/java/com/gmail/nossr50/skills/repair/Repair.java index da3667f23..64d1d9062 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/Repair.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/Repair.java @@ -28,12 +28,12 @@ public class Repair { private static Config configInstance = Config.getInstance(); private static Permissions permInstance = Permissions.getInstance(); - static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); - private static int repairMasteryChanceMax = advancedConfig.getRepairMasteryChanceMax(); - private static int repairMasteryMaxBonusLevel = advancedConfig.getRepairMasteryMaxLevel(); - private static int superRepairChanceMax = advancedConfig.getSuperRepairChanceMax(); - private static int superRepairMaxBonusLevel = advancedConfig.getSuperRepairMaxLevel(); + private static int repairMasteryChanceMax = advancedConfig.getRepairMasteryChanceMax(); + private static int repairMasteryMaxBonusLevel = advancedConfig.getRepairMasteryMaxLevel(); + private static int superRepairChanceMax = advancedConfig.getSuperRepairChanceMax(); + private static int superRepairMaxBonusLevel = advancedConfig.getSuperRepairMaxLevel(); /** * Handle the XP gain for repair events. @@ -211,9 +211,9 @@ public class Repair { */ protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) { // float bonus = (float) skillLevel / 500; - float bonus; - if(skillLevel >= repairMasteryMaxBonusLevel) bonus = repairMasteryChanceMax; - else bonus = ((float) skillLevel / (float) repairMasteryMaxBonusLevel) * (float) repairMasteryChanceMax; + float bonus; + if(skillLevel >= repairMasteryMaxBonusLevel) bonus = repairMasteryChanceMax; + else bonus = ((float) skillLevel / (float) repairMasteryMaxBonusLevel) * (float) repairMasteryChanceMax; if (permInstance.repairMastery(player)) { bonus = (repairAmount * bonus); @@ -240,20 +240,20 @@ public class Repair { * @return true if bonus granted, false otherwise */ public static boolean checkPlayerProcRepair(Player player) { - final int MAX_CHANCE = superRepairChanceMax; + final int MAX_CHANCE = superRepairChanceMax; final int MAX_BONUS_LEVEL = superRepairMaxBonusLevel; int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR); int randomChance = 100; - int chance = (MAX_CHANCE / MAX_BONUS_LEVEL) * skillLevel; + int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * (double) skillLevel); if (skillLevel >= MAX_BONUS_LEVEL) chance = MAX_CHANCE; if (player.hasPermission("mcmmo.perks.lucky.repair")) randomChance = (int) (randomChance * 0.75); if (chance > random.nextInt(randomChance) && permInstance.repairBonus(player)){ - player.sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy")); - return true; + player.sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy")); + return true; } return false; } diff --git a/src/main/java/com/gmail/nossr50/skills/swords/Swords.java b/src/main/java/com/gmail/nossr50/skills/swords/Swords.java index 9807159aa..59b4630ac 100644 --- a/src/main/java/com/gmail/nossr50/skills/swords/Swords.java +++ b/src/main/java/com/gmail/nossr50/skills/swords/Swords.java @@ -5,8 +5,8 @@ import java.util.Random; import com.gmail.nossr50.config.AdvancedConfig; public class Swords { - static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); - + static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + public static final int BLEED_MAX_BONUS_LEVEL = advancedConfig.getBleedMaxBonusLevel(); public static final int MAX_BLEED_TICKS = advancedConfig.getBleedMaxTicks(); public static final int BASE_BLEED_TICKS = advancedConfig.getBleedBaseTicks(); 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 c949c2bf9..9abbaf0d5 100644 --- a/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java +++ b/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java @@ -50,7 +50,7 @@ public class SwordsManager { randomChance = (int) (randomChance * 0.75); } - final float chance = (bleedChanceMax / bleedMaxLevel) * skillLevel; + final float chance = (float) (((double) bleedChanceMax / (double) bleedMaxLevel) * (double) skillLevel); if (chance > Swords.getRandom().nextInt(randomChance)) { eventHandler.addBleedTicks(); eventHandler.sendAbilityMessages(); @@ -81,7 +81,7 @@ public class SwordsManager { randomChance = (int) (randomChance * 0.75); } - final float chance = (counterChanceMax / counterMaxLevel) * skillLevel; + final float chance = (float) (((double) counterChanceMax / (double) counterMaxLevel) * (double) skillLevel); if (chance > Swords.getRandom().nextInt(randomChance)) { eventHandler.dealDamage(); eventHandler.sendAbilityMessages(); 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 ea1f01a98..7d3afc47d 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/Taming.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/Taming.java @@ -5,8 +5,8 @@ import java.util.Random; import com.gmail.nossr50.config.AdvancedConfig; public class Taming { - static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); - + static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + public static final int ENVIRONMENTALLY_AWARE_ACTIVATION_LEVEL = advancedConfig.getEnviromentallyAwareUnlock(); public static final int FAST_FOOD_SERVICE_ACTIVATION_CHANCE = advancedConfig.getFastFoodChance(); 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 1db338b94..d954a46d8 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -111,7 +111,7 @@ public class TamingManager { randomChance = (int) (randomChance * 0.75); } - final float chance = (goreChanceMax / goreMaxLevel) * skillLevel; + final float chance = (float) (((double) goreChanceMax / (double) goreMaxLevel) * (double) skillLevel); if (chance > Taming.getRandom().nextInt(randomChance)) { eventHandler.modifyEventDamage(); eventHandler.applyBleed(); diff --git a/src/main/java/com/gmail/nossr50/skills/unarmed/Unarmed.java b/src/main/java/com/gmail/nossr50/skills/unarmed/Unarmed.java index 01512a6bd..c68521d71 100644 --- a/src/main/java/com/gmail/nossr50/skills/unarmed/Unarmed.java +++ b/src/main/java/com/gmail/nossr50/skills/unarmed/Unarmed.java @@ -5,8 +5,8 @@ import java.util.Random; import com.gmail.nossr50.config.AdvancedConfig; public class Unarmed { - static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); - + static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + public static final int BONUS_DAMAGE_MAX_BONUS_MODIFIER = advancedConfig.getIronArmBonus(); public static final int BONUS_DAMAGE_INCREASE_LEVEL = advancedConfig.getIronArmIncreaseLevel(); public static final int DEFLECT_MAX_CHANCE = advancedConfig.getDisarmChanceMax() ; 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 f940b91fa..b7a0ee6ed 100644 --- a/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java +++ b/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java @@ -51,7 +51,7 @@ public class UnarmedManager { randomChance = (int) (randomChance * 0.75); } - final float chance = (disarmChanceMax / disarmMaxLevel) * skillLevel; + final float chance = (float) (((double) disarmChanceMax / (double) disarmMaxLevel) * (double) skillLevel); if (chance > Unarmed.getRandom().nextInt(randomChance)) { if (!hasIronGrip(defender)) { eventHandler.sendAbilityMessage(); @@ -88,7 +88,7 @@ public class UnarmedManager { randomChance = (int) (randomChance * 0.75); } - final float chance = (deflectChanceMax / deflectMaxLevel) * skillLevel; + final float chance = (float) (((double) deflectChanceMax / (double) deflectMaxLevel) * (double) skillLevel); if (chance > Unarmed.getRandom().nextInt(randomChance)) { eventHandler.cancelEvent(); eventHandler.sendAbilityMessage(); @@ -144,7 +144,7 @@ public class UnarmedManager { randomChance = (int) (randomChance * 0.75); } - final float chance = (ironGripChanceMax / ironGripMaxLevel) * skillLevel; + final float chance = (float) (((double) ironGripChanceMax / (double) ironGripMaxLevel) * (double) skillLevel); if (chance > Unarmed.getRandom().nextInt(randomChance)) { eventHandler.sendAbilityMessages(); return true;