mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Implementing an durability cap for ArmorImpact
This commit is contained in:
parent
bd1850db69
commit
de3bae41ae
@ -61,6 +61,7 @@ public class AdvancedConfig extends ConfigLoader {
|
||||
public int getGreaterImpactBonusDamage() { return config.getInt("Skills.Axes.GreaterImpact_BonusDamage", 2); }
|
||||
|
||||
public int getArmorImpactIncreaseLevel() { return config.getInt("Skills.Axes.ArmorImpact_IncreaseLevel", 50); }
|
||||
public int getArmorImpactMaxDurabilityDamage() { return config.getInt("Skills.Axes.ArmorImpact_MaxPercentageDurabilityDamage", 20); }
|
||||
|
||||
/* EXCAVATION */
|
||||
//Nothing to configure, everything is already configurable in config.yml
|
||||
|
@ -16,6 +16,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.ItemChecks;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
@ -130,6 +131,8 @@ public class Axes {
|
||||
|
||||
/* Every 30 Skill Levels you gain 1 durability damage */
|
||||
int impactIncreaseLevel = advancedConfig.getArmorImpactIncreaseLevel();
|
||||
double impactMaxDamage = (double) advancedConfig.getArmorImpactMaxDurabilityDamage() / 100;
|
||||
short maxDurability;
|
||||
durabilityDamage += (int) ((double) Users.getProfile(attacker).getSkillLevel(SkillType.AXES) / (double) impactIncreaseLevel);
|
||||
|
||||
if (!hasArmor(targetPlayer)) {
|
||||
@ -137,9 +140,12 @@ public class Axes {
|
||||
}
|
||||
else {
|
||||
for (ItemStack armor : targetPlayer.getInventory().getArmorContents()) {
|
||||
if(Math.random() * 100 > 75)
|
||||
if(Math.random() * 100 > 75) {
|
||||
maxDurability = (short) (ItemChecks.getMaxDurabilityArmor(armor) * impactMaxDamage);
|
||||
if (durabilityDamage > maxDurability) durabilityDamage = (short) maxDurability;
|
||||
armor.setDurability((short) (armor.getDurability() + durabilityDamage)); //Damage armor piece
|
||||
}
|
||||
}
|
||||
targetPlayer.updateInventory();
|
||||
}
|
||||
}
|
||||
|
@ -474,4 +474,39 @@ public class ItemChecks {
|
||||
public static boolean isEnchantable(ItemStack is) {
|
||||
return isArmor(is) || isSword(is) || isAxe(is) || isShovel(is) || isPickaxe(is) || (is.getType() == Material.BOW);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum durability of an armor type.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return maximum durability value.
|
||||
*/
|
||||
public static int getMaxDurabilityArmor(ItemStack is) {
|
||||
int durability = 0;
|
||||
if (isDiamondArmor(is)) {
|
||||
if (isHelmet(is)) durability = 364;
|
||||
else if (isChestplate(is)) durability = 529;
|
||||
else if (isPants(is)) durability = 496;
|
||||
else if (isBoots(is)) durability = 430;
|
||||
}
|
||||
else if (isIronArmor(is)) {
|
||||
if (isHelmet(is)) durability = 166;
|
||||
else if (isChestplate(is)) durability = 242;
|
||||
else if (isPants(is)) durability = 226;
|
||||
else if (isBoots(is)) durability = 196;
|
||||
}
|
||||
else if (isGoldArmor(is)) {
|
||||
if (isHelmet(is)) durability = 78;
|
||||
else if (isChestplate(is)) durability = 114;
|
||||
else if (isPants(is)) durability = 106;
|
||||
else if (isBoots(is)) durability = 92;
|
||||
}
|
||||
else if (isLeatherArmor(is)) {
|
||||
if (isHelmet(is)) durability = 56;
|
||||
else if (isChestplate(is)) durability = 82;
|
||||
else if (isPants(is)) durability = 76;
|
||||
else if (isBoots(is)) durability = 66;
|
||||
}
|
||||
return durability;
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ Skills:
|
||||
GreaterImpact_KnockbackModifier: 1.5
|
||||
GreaterImpact_BonusDamage: 2
|
||||
ArmorImpact_IncreaseLevel: 50
|
||||
ArmorImpact_MaxPercentageDurabilityDamage: 20
|
||||
Fishing:
|
||||
Shake_UnlockLevel: 150
|
||||
Enchantment_Chance: 10
|
||||
|
Loading…
Reference in New Issue
Block a user