mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +01:00
Fixing some issues with Arcane Forging.
This commit is contained in:
parent
b8755b808e
commit
b1cf9d139a
@ -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;
|
||||||
@ -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)) }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user