Made Arcane Forging fully configurable.

This commit is contained in:
gmcferrin 2012-01-27 12:26:35 -05:00
parent 486fb5635d
commit 7d19fe68d9

View File

@ -314,17 +314,22 @@ public class Repair {
int rank = getArcaneForgingRank(PP); int rank = getArcaneForgingRank(PP);
if(rank == 0) if(rank == 0)
{
if(LoadProperties.mayLoseEnchants())
{ {
player.sendMessage(mcLocale.getString("Repair.LostEnchants")); player.sendMessage(mcLocale.getString("Repair.LostEnchants"));
for(Enchantment x : enchants) for(Enchantment x : enchants)
{ {
is.removeEnchantment(x); is.removeEnchantment(x);
} }
}
return; return;
} }
boolean failure = false, downgrade = false; boolean failure = false, downgrade = false;
if(LoadProperties.mayLoseEnchants())
{
for(Enchantment x : enchants) for(Enchantment x : enchants)
{ {
//Remove enchant //Remove enchant
@ -335,6 +340,8 @@ public class Repair {
if(Math.random() * 100 <= getEnchantChance(rank)) if(Math.random() * 100 <= getEnchantChance(rank))
{ {
if(enchantsLvl[pos] > 1) if(enchantsLvl[pos] > 1)
{
if(LoadProperties.mayDowngradeEnchants())
{ {
if(Math.random() * 100 <= getDowngradeChance(rank)) if(Math.random() * 100 <= getDowngradeChance(rank))
{ {
@ -345,6 +352,7 @@ public class Repair {
is.addEnchantment(x, enchantsLvl[pos]); is.addEnchantment(x, enchantsLvl[pos]);
} }
} }
}
else { else {
is.addEnchantment(x, enchantsLvl[pos]); is.addEnchantment(x, enchantsLvl[pos]);
} }
@ -354,6 +362,7 @@ public class Repair {
} }
pos++; pos++;
} }
}
if(failure == false && downgrade == false) if(failure == false && downgrade == false)
{ {
@ -369,13 +378,13 @@ public class Repair {
switch(rank) switch(rank)
{ {
case 4: case 4:
return 40; return LoadProperties.keepEnchantsRank4;
case 3: case 3:
return 30; return LoadProperties.keepEnchantsRank3;
case 2: case 2:
return 20; return LoadProperties.keepEnchantsRank2;
case 1: case 1:
return 10; return LoadProperties.keepEnchantsRank1;
default: default:
return 0; return 0;
} }
@ -385,13 +394,13 @@ public class Repair {
switch(rank) switch(rank)
{ {
case 4: case 4:
return 15; return LoadProperties.downgradeRank4;
case 3: case 3:
return 25; return LoadProperties.downgradeRank3;
case 2: case 2:
return 50; return LoadProperties.downgradeRank2;
case 1: case 1:
return 75; return LoadProperties.downgradeRank1;
default: default:
return 100; return 100;
} }