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")) { 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

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

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