Fixing some issues with Arcane Forging.

This commit is contained in:
Glitchfinder 2012-11-24 15:47:28 -08:00
parent b8755b808e
commit b1cf9d139a
2 changed files with 18 additions and 12 deletions

View File

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

View File

@ -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<Enchantment, Integer> 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);