Merge pull request #326 from Glitchfinder/fixes

More fixes and patches.
This commit is contained in:
Grant 2012-11-26 11:11:51 -08:00
commit fd5de7b218
27 changed files with 384 additions and 378 deletions

View File

@ -36,13 +36,13 @@ public class AcrobaticsCommand extends SkillCommand {
DecimalFormat df = new DecimalFormat("#.0"); DecimalFormat df = new DecimalFormat("#.0");
// DODGE // DODGE
if(skillValue >= dodgeMaxBonusLevel) dodgeChance = df.format(dodgeChanceMax); if(skillValue >= dodgeMaxBonusLevel) dodgeChance = df.format(dodgeChanceMax);
else dodgeChance = df.format((dodgeChanceMax / dodgeMaxBonusLevel) * skillValue); else dodgeChance = df.format(((double) dodgeChanceMax / (double) dodgeMaxBonusLevel) * (double) skillValue);
// ROLL // ROLL
if(skillValue >= rollMaxBonusLevel) rollChance = df.format(rollChanceMax); if(skillValue >= rollMaxBonusLevel) rollChance = df.format(rollChanceMax);
else rollChance = df.format((rollChanceMax / rollMaxBonusLevel) * skillValue); else rollChance = df.format(((double) rollChanceMax / (double) rollMaxBonusLevel) * (double) skillValue);
// GRACEFULROLL // GRACEFULROLL
if(skillValue >= gracefulRollMaxBonusLevel) gracefulRollChance = df.format(gracefulRollChanceMax); if(skillValue >= gracefulRollMaxBonusLevel) gracefulRollChance = df.format(gracefulRollChanceMax);
else gracefulRollChance = df.format((gracefulRollChanceMax / gracefulRollMaxBonusLevel) * skillValue); else gracefulRollChance = df.format(((double) gracefulRollChanceMax / (double) gracefulRollMaxBonusLevel) * (double) skillValue);
} }
@Override @Override

View File

@ -39,17 +39,17 @@ public class ArcheryCommand extends SkillCommand {
protected void dataCalculations() { protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("#.0"); DecimalFormat df = new DecimalFormat("#.0");
// SkillShot // SkillShot
double bonus = (int)(skillValue / skillShotIncreaseLevel) * skillShotIncreasePercentage; double bonus = (int)((double) skillValue / (double) skillShotIncreaseLevel) * (double) skillShotIncreasePercentage;
if (bonus > skillShotBonusMax) skillShotBonus = percent.format(skillShotBonusMax); if (bonus > skillShotBonusMax) skillShotBonus = percent.format(skillShotBonusMax);
else skillShotBonus = percent.format(bonus); else skillShotBonus = percent.format(bonus);
// Daze // Daze
if(skillValue >= dazeMaxBonusLevel) dazeChance = df.format(dazeBonusMax); if(skillValue >= dazeMaxBonusLevel) dazeChance = df.format(dazeBonusMax);
else dazeChance = df.format((dazeBonusMax / dazeMaxBonusLevel) * skillValue); else dazeChance = df.format(((double) dazeBonusMax / (double) dazeMaxBonusLevel) * (double) skillValue);
// Retrieve // Retrieve
if(skillValue >= retrieveMaxBonusLevel) retrieveChance = df.format(retrieveBonusMax); if(skillValue >= retrieveMaxBonusLevel) retrieveChance = df.format(retrieveBonusMax);
else retrieveChance = df.format((retrieveBonusMax / retrieveMaxBonusLevel) * skillValue); else retrieveChance = df.format(((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * (double) skillValue);
} }
@Override @Override

View File

@ -42,14 +42,14 @@ public class AxesCommand extends SkillCommand {
DecimalFormat df = new DecimalFormat("#.0"); DecimalFormat df = new DecimalFormat("#.0");
int skillCheck = Misc.skillCheck((int)skillValue, critMaxBonusLevel); int skillCheck = Misc.skillCheck((int)skillValue, critMaxBonusLevel);
impactDamage = String.valueOf(1 + ((int) skillValue / greaterImpactIncreaseLevel)); impactDamage = String.valueOf(1 + ((double) skillValue / (double) greaterImpactIncreaseLevel));
skullSplitterLength = String.valueOf(2 + ((int) skillValue / abilityLengthIncreaseLevel)); skullSplitterLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel));
greaterImpactDamage = "2"; greaterImpactDamage = "2";
if (skillValue >= critMaxBonusLevel) critChance = df.format(critMaxChance); if (skillValue >= critMaxBonusLevel) critChance = df.format(critMaxChance);
else critChance = String.valueOf((critMaxChance / critMaxBonusLevel) * (float)skillCheck); else critChance = String.valueOf(((double) critMaxChance / (double) critMaxBonusLevel) * (double) skillCheck);
if (skillValue >= bonusDamageAxesMaxBonusLevel) bonusDamage = String.valueOf(bonusDamageAxesBonusMax); if (skillValue >= bonusDamageAxesMaxBonusLevel) bonusDamage = String.valueOf(bonusDamageAxesBonusMax);
else bonusDamage = String.valueOf((int) skillValue / (bonusDamageAxesMaxBonusLevel / bonusDamageAxesBonusMax)); else bonusDamage = String.valueOf((double) skillValue / ((double) bonusDamageAxesMaxBonusLevel / (double) bonusDamageAxesBonusMax));
} }
@Override @Override

View File

@ -22,7 +22,7 @@ public class ExcavationCommand extends SkillCommand {
@Override @Override
protected void dataCalculations() { protected void dataCalculations() {
gigaDrillBreakerLength = String.valueOf(2 + ((int) skillValue / abilityLengthIncreaseLevel)); gigaDrillBreakerLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel));
} }
@Override @Override

View File

@ -30,10 +30,10 @@ public class FishingCommand extends SkillCommand {
@Override @Override
protected void dataCalculations() { protected void dataCalculations() {
lootTier = Fishing.getFishingLootTier(profile); lootTier = Fishing.getFishingLootTier(profile);
magicChance = percent.format((float) lootTier / 15); magicChance = percent.format((double) lootTier / 15D);
int dropChance = Fishing.getShakeChance(lootTier); int dropChance = Fishing.getShakeChance(lootTier);
if (player.hasPermission("mcmmo.perks.lucky.fishing")) { if (player.hasPermission("mcmmo.perks.lucky.fishing")) {
dropChance = (int) (dropChance * 1.25); dropChance = (int) ((double) dropChance * 1.25D);
} }
shakeChance = String.valueOf(dropChance); shakeChance = String.valueOf(dropChance);

View File

@ -43,20 +43,20 @@ public class HerbalismCommand extends SkillCommand {
@Override @Override
protected void dataCalculations() { protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("#.0"); DecimalFormat df = new DecimalFormat("#.0");
greenTerraLength = String.valueOf(2 + ((int) skillValue / abilityLengthIncreaseLevel)); greenTerraLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel));
//FARMERS DIET //FARMERS DIET
if(skillValue >= farmersDietMaxLevel) farmersDietRank = "5"; if(skillValue >= farmersDietMaxLevel) farmersDietRank = "5";
else farmersDietRank = String.valueOf((int)skillValue / farmersDietRankChange); else farmersDietRank = String.valueOf((double) skillValue / (double) farmersDietRankChange);
//GREEN THUMB //GREEN THUMB
if(skillValue >= greenThumbStageMaxLevel) greenThumbStage = "4"; if(skillValue >= greenThumbStageMaxLevel) greenThumbStage = "4";
else greenThumbStage = String.valueOf((int)skillValue / greenThumbStageChange); else greenThumbStage = String.valueOf((double) skillValue / (double) greenThumbStageChange);
if(skillValue >= greenThumbMaxLevel) greenThumbChance = String.valueOf(greenThumbMaxBonus); if(skillValue >= greenThumbMaxLevel) greenThumbChance = String.valueOf(greenThumbMaxBonus);
else greenThumbChance = String.valueOf((greenThumbMaxBonus / greenThumbMaxLevel) * skillValue); else greenThumbChance = String.valueOf(((double) greenThumbMaxBonus / (double) greenThumbMaxLevel) * (double) skillValue);
//DOUBLE DROPS //DOUBLE DROPS
if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus); if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus);
else doubleDropChance = df.format((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue); else doubleDropChance = df.format(((double) doubleDropsMaxBonus / (double) doubleDropsMaxLevel) * (double) skillValue);
} }
@Override @Override

View File

@ -46,9 +46,9 @@ public class MiningCommand extends SkillCommand {
@Override @Override
protected void dataCalculations() { protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("#.0"); DecimalFormat df = new DecimalFormat("#.0");
superBreakerLength = String.valueOf(2 + ((int) skillValue / abilityLengthIncreaseLevel)); superBreakerLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel));
if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus); if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus);
else doubleDropChance = df.format((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue); else doubleDropChance = df.format(((double) doubleDropsMaxBonus / (double) doubleDropsMaxLevel) * (double) skillValue);
if (skillValue >= blastMiningRank8) { if (skillValue >= blastMiningRank8) {
blastMiningRank = "8"; blastMiningRank = "8";

View File

@ -35,6 +35,7 @@ public class RepairCommand extends SkillCommand {
private boolean canRepairString; private boolean canRepairString;
private boolean canRepairLeather; private boolean canRepairLeather;
private boolean canRepairWood; private boolean canRepairWood;
private boolean arcaneBypass;
private int salvageLevel; private int salvageLevel;
private int diamondLevel; private int diamondLevel;
@ -63,10 +64,10 @@ public class RepairCommand extends SkillCommand {
salvageLevel = Config.getInstance().getSalvageUnlockLevel(); salvageLevel = Config.getInstance().getSalvageUnlockLevel();
if(skillValue >= repairMasteryMaxBonusLevel) repairMasteryBonus = df.format(repairMasteryChanceMax); 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); 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); arcaneForgingRank = Repair.getArcaneForgingRank(profile);
} }
@ -84,6 +85,7 @@ public class RepairCommand extends SkillCommand {
canRepairString = permInstance.stringRepair(player); canRepairString = permInstance.stringRepair(player);
canRepairLeather = permInstance.leatherRepair(player); canRepairLeather = permInstance.leatherRepair(player);
canRepairWood = permInstance.woodRepair(player); canRepairWood = permInstance.woodRepair(player);
arcaneBypass = permInstance.arcaneBypass(player);
} }
@Override @Override
@ -154,11 +156,11 @@ public class RepairCommand extends SkillCommand {
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Rank", new Object[] { arcaneForgingRank })); player.sendMessage(LocaleLoader.getString("Repair.Arcane.Rank", new Object[] { arcaneForgingRank }));
if (Config.getInstance().getArcaneForgingEnchantLossEnabled()) { 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()) { 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)) }));
} }
} }
} }

View File

@ -37,16 +37,16 @@ public class SwordsCommand extends SkillCommand {
@Override @Override
protected void dataCalculations() { protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("#.0"); DecimalFormat df = new DecimalFormat("#.0");
serratedStrikesLength = String.valueOf(2 + ((int) skillValue / abilityLengthIncreaseLevel)); serratedStrikesLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel));
if (skillValue >= bleedMaxLevel) bleedLength = String.valueOf(bleedMaxTicks); if (skillValue >= bleedMaxLevel) bleedLength = String.valueOf(bleedMaxTicks);
else bleedLength = String.valueOf(bleedBaseTicks); else bleedLength = String.valueOf(bleedBaseTicks);
if(skillValue >= bleedMaxLevel) bleedChance = df.format(bleedChanceMax); if(skillValue >= bleedMaxLevel) bleedChance = df.format(bleedChanceMax);
else bleedChance = df.format((bleedChanceMax / bleedMaxLevel) * skillValue); else bleedChance = df.format(((double) bleedChanceMax / (double) bleedMaxLevel) * (double) skillValue);
if(skillValue >= counterMaxLevel) counterAttackChance = df.format(counterChanceMax); if(skillValue >= counterMaxLevel) counterAttackChance = df.format(counterChanceMax);
else counterAttackChance = df.format((counterChanceMax / counterMaxLevel) * skillValue); else counterAttackChance = df.format(((double) counterChanceMax / (double) counterMaxLevel) * (double) skillValue);
serratedStrikesLength = String.valueOf(serratedBleedTicks); serratedStrikesLength = String.valueOf(serratedBleedTicks);
} }

View File

@ -40,7 +40,7 @@ public class TamingCommand extends SkillCommand {
protected void dataCalculations() { protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("#.0"); DecimalFormat df = new DecimalFormat("#.0");
if(skillValue >= goreMaxLevel) goreChance = df.format(goreChanceMax); if(skillValue >= goreMaxLevel) goreChance = df.format(goreChanceMax);
else goreChance = df.format((goreChanceMax / goreMaxLevel) * skillValue); else goreChance = df.format(((double) goreChanceMax / (double) goreMaxLevel) * (double) skillValue);
} }
@Override @Override

View File

@ -36,16 +36,16 @@ public class UnarmedCommand extends SkillCommand {
@Override @Override
protected void dataCalculations() { protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("#.0"); DecimalFormat df = new DecimalFormat("#.0");
berserkLength = String.valueOf(2 + ((int) skillValue / abilityLengthIncreaseLevel)); berserkLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel));
if(skillValue >= disarmMaxLevel) disarmChance = df.format(disarmChanceMax); 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); 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); 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 @Override

View File

@ -33,9 +33,9 @@ public class WoodcuttingCommand extends SkillCommand {
protected void dataCalculations() { protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("0.0"); DecimalFormat df = new DecimalFormat("0.0");
treeFellerLength = String.valueOf(2 + ((int) skillValue / abilityLengthIncreaseLevel)); treeFellerLength = String.valueOf(2 + ((double) skillValue / (double) abilityLengthIncreaseLevel));
if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus); if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus);
else doubleDropChance = df.format((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue); else doubleDropChance = df.format(((double) doubleDropsMaxBonus / (double) doubleDropsMaxLevel) * (double) skillValue);
} }
@Override @Override

View File

@ -57,7 +57,7 @@ public class ArcheryManager {
if (player.hasPermission("mcmmo.perks.lucky.archery")) { if (player.hasPermission("mcmmo.perks.lucky.archery")) {
randomChance = (int) (randomChance * 0.75); 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)) { if (chance > Archery.getRandom().nextInt(randomChance)) {
eventHandler.addToTracker(); eventHandler.addToTracker();
} }
@ -88,7 +88,7 @@ public class ArcheryManager {
randomChance = (int) (randomChance * 0.75); 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)) { if (chance > Archery.getRandom().nextInt(randomChance)) {
eventHandler.handleDazeEffect(); eventHandler.handleDazeEffect();
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();

View File

@ -40,7 +40,7 @@ public class Axes {
final int INCREASE_LEVEL = MAX_LEVEL / MAX_BONUS; final int INCREASE_LEVEL = MAX_LEVEL / MAX_BONUS;
/* Add 1 DMG for every 50 skill levels */ /* 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) { if (bonus > MAX_BONUS) {
bonus = MAX_BONUS; bonus = MAX_BONUS;
@ -87,7 +87,7 @@ public class Axes {
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL); int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
int randomChance = 100; 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")) { if (attacker.hasPermission("mcmmo.perks.lucky.axes")) {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
@ -130,7 +130,7 @@ public class Axes {
/* Every 30 Skill Levels you gain 1 durability damage */ /* Every 30 Skill Levels you gain 1 durability damage */
int impactIncreaseLevel = advancedConfig.getGreaterImpactIncreaseLevel(); 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)) { if (!hasArmor(targetPlayer)) {
applyGreaterImpact(attacker, target, event); applyGreaterImpact(attacker, target, event);

View File

@ -329,7 +329,7 @@ public class Mining {
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL); int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
int randomChance = 100; 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")) { if (player.hasPermission("mcmmo.perks.lucky.mining")) {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);

View File

@ -345,7 +345,7 @@ public class WoodCutting {
Material mat = Material.getMaterial(block.getTypeId()); Material mat = Material.getMaterial(block.getTypeId());
int randomChance = 100; 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")) { if (player.hasPermission("mcmmo.perks.lucky.woodcutting")) {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);

View File

@ -91,6 +91,10 @@ public class Repair {
* @param is Item being repaired * @param is Item being repaired
*/ */
protected static void addEnchants(Player player, ItemStack is) { protected static void addEnchants(Player player, ItemStack is) {
if(permInstance.arcaneBypass(player)) {
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Perfect"));
return;
}
Map<Enchantment, Integer> enchants = is.getEnchantments(); Map<Enchantment, Integer> enchants = is.getEnchantments();
if (enchants.size() == 0) { if (enchants.size() == 0) {
@ -122,7 +126,7 @@ public class Repair {
int enchantLevel = enchant.getValue(); int enchantLevel = enchant.getValue();
if (configInstance.getArcaneForgingDowngradeEnabled() && enchantLevel > 1) { if (configInstance.getArcaneForgingDowngradeEnabled() && enchantLevel > 1) {
if (random.nextInt(100) < getDowngradeChance(rank)) { if (random.nextInt(randomChance) < getDowngradeChance(rank)) {
is.addEnchantment(enchantment, --enchantLevel); is.addEnchantment(enchantment, --enchantLevel);
downgraded = true; downgraded = true;
} }
@ -209,7 +213,7 @@ public class Repair {
// float bonus = (float) skillLevel / 500; // float bonus = (float) skillLevel / 500;
float bonus; float bonus;
if(skillLevel >= repairMasteryMaxBonusLevel) bonus = repairMasteryChanceMax; if(skillLevel >= repairMasteryMaxBonusLevel) bonus = repairMasteryChanceMax;
else bonus = (repairMasteryChanceMax / repairMasteryMaxBonusLevel) * skillLevel; else bonus = ((float) skillLevel / (float) repairMasteryMaxBonusLevel) * (float) repairMasteryChanceMax;
if (permInstance.repairMastery(player)) { if (permInstance.repairMastery(player)) {
bonus = (repairAmount * bonus); bonus = (repairAmount * bonus);
@ -242,7 +246,7 @@ public class Repair {
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR); int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
int randomChance = 100; 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 (skillLevel >= MAX_BONUS_LEVEL) chance = MAX_CHANCE;
if (player.hasPermission("mcmmo.perks.lucky.repair")) randomChance = (int) (randomChance * 0.75); if (player.hasPermission("mcmmo.perks.lucky.repair")) randomChance = (int) (randomChance * 0.75);

View File

@ -50,7 +50,7 @@ public class SwordsManager {
randomChance = (int) (randomChance * 0.75); 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)) { if (chance > Swords.getRandom().nextInt(randomChance)) {
eventHandler.addBleedTicks(); eventHandler.addBleedTicks();
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();
@ -81,7 +81,7 @@ public class SwordsManager {
randomChance = (int) (randomChance * 0.75); 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)) { if (chance > Swords.getRandom().nextInt(randomChance)) {
eventHandler.dealDamage(); eventHandler.dealDamage();
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();

View File

@ -111,7 +111,7 @@ public class TamingManager {
randomChance = (int) (randomChance * 0.75); 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)) { if (chance > Taming.getRandom().nextInt(randomChance)) {
eventHandler.modifyEventDamage(); eventHandler.modifyEventDamage();
eventHandler.applyBleed(); eventHandler.applyBleed();

View File

@ -51,7 +51,7 @@ public class UnarmedManager {
randomChance = (int) (randomChance * 0.75); 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 (chance > Unarmed.getRandom().nextInt(randomChance)) {
if (!hasIronGrip(defender)) { if (!hasIronGrip(defender)) {
eventHandler.sendAbilityMessage(); eventHandler.sendAbilityMessage();
@ -88,7 +88,7 @@ public class UnarmedManager {
randomChance = (int) (randomChance * 0.75); 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)) { if (chance > Unarmed.getRandom().nextInt(randomChance)) {
eventHandler.cancelEvent(); eventHandler.cancelEvent();
eventHandler.sendAbilityMessage(); eventHandler.sendAbilityMessage();
@ -144,7 +144,7 @@ public class UnarmedManager {
randomChance = (int) (randomChance * 0.75); 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)) { if (chance > Unarmed.getRandom().nextInt(randomChance)) {
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();
return true; return true;