Fixing more errors with typecasting.

This commit is contained in:
Glitchfinder 2012-11-25 16:40:42 -08:00
parent 082fa2ca0d
commit 0037524cfd
15 changed files with 137 additions and 137 deletions

View File

@ -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,7 +88,7 @@ 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();

View File

@ -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);

View File

@ -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);

View File

@ -246,7 +246,7 @@ public class Repair {
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);

View File

@ -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();

View File

@ -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();

View File

@ -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;