From b1a532950dfee38db1bf11d9c9f7facd404f4bb8 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Thu, 31 Mar 2016 12:37:39 -0400 Subject: [PATCH] Added damage boost and attack speed penalty for the Destructive sentient armour --- .../item/armour/ItemLivingArmour.java | 2 +- .../item/armour/ItemSentientArmour.java | 67 ++++++++++++++++++- .../bloodmagic/item/soul/ItemSoulGem.java | 10 +++ 3 files changed, 76 insertions(+), 3 deletions(-) diff --git a/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java b/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java index 9762baff..6d5abf52 100644 --- a/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java +++ b/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java @@ -260,7 +260,7 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP @Override public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName(stack) + names[armorType.getIndex()]; + return super.getUnlocalizedName(stack) + names[3 - armorType.getIndex()]; } @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java b/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java index 13e0fc75..ddf155f9 100644 --- a/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java +++ b/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java @@ -47,8 +47,11 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes public static double[] extraProtectionLevel = new double[] { 0, 0.25, 0.5, 0.6, 0.7, 0.75, 0.85, 0.9 }; public static double[] steadfastProtectionLevel = new double[] { 0.25, 0.5, 0.6, 0.7, 0.75, 0.85, 0.9, 0.95 }; - public static double[] healthBonus = new double[] { 3, 6, 9, 12, 15, 20, 25 }; - public static double[] knockbackBonus = new double[] { 0.2, 0.4, 0.6, 0.8, 1, 1, 1 }; + public static double[] healthBonus = new double[] { 3, 6, 9, 12, 15, 20, 25, 30 }; + public static double[] knockbackBonus = new double[] { 0.2, 0.4, 0.6, 0.8, 1, 1, 1, 1 }; + + public static double[] damageBoost = new double[] { 0.03, 0.06, 0.09, 0.12, 0.15, 0.18, 0.22, 0.25 }; + public static double[] attackSpeed = new double[] { -0.02, -0.04, -0.06, -0.08, -0.1, -0.12, -0.14, -0.16 }; public static double[] speedBonus = new double[] { 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4 }; @@ -374,6 +377,8 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes multimap.put(SharedMonsterAttributes.MAX_HEALTH.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 318145), "Armor modifier", this.getHealthBonus(stack), 0)); multimap.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 8145), "Armor modifier", this.getKnockbackResistance(stack), 0)); multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 94021), "Armor modifier", this.getSpeedBoost(stack), 2)); + multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 96721), "Armor modifier", this.getDamageBoost(stack), 2)); + multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(0, 73245), "Armor modifier", this.getAttackSpeedBoost(stack), 2)); } return multimap; } @@ -503,6 +508,8 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes this.setHealthBonus(armourStack, this.getHealthModifier(type, willBracket)); this.setKnockbackResistance(armourStack, getKnockbackModifier(type, willBracket)); this.setSpeedBoost(armourStack, getSpeedModifier(type, willBracket)); + this.setDamageBoost(armourStack, getDamageModifier(type, willBracket)); + this.setAttackSpeedBoost(armourStack, getAttackSpeedModifier(type, willBracket)); } } } @@ -551,6 +558,28 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes } } + public double getDamageModifier(EnumDemonWillType type, int willBracket) + { + switch (type) + { + case DESTRUCTIVE: + return damageBoost[willBracket]; + default: + return 0; + } + } + + public double getAttackSpeedModifier(EnumDemonWillType type, int willBracket) + { + switch (type) + { + case DESTRUCTIVE: + return attackSpeed[willBracket]; + default: + return 0; + } + } + public static boolean canSustainArmour(EnumDemonWillType type, double willValue) { return getWillBracket(willValue) >= 0; @@ -621,4 +650,38 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes tag.setDouble("speed", speed); } + + public double getDamageBoost(ItemStack stack) + { + NBTHelper.checkNBT(stack); + + NBTTagCompound tag = stack.getTagCompound(); + return tag.getDouble("damage"); + } + + public void setDamageBoost(ItemStack stack, double damage) + { + NBTHelper.checkNBT(stack); + + NBTTagCompound tag = stack.getTagCompound(); + + tag.setDouble("damage", damage); + } + + public double getAttackSpeedBoost(ItemStack stack) + { + NBTHelper.checkNBT(stack); + + NBTTagCompound tag = stack.getTagCompound(); + return tag.getDouble("attackSpeed"); + } + + public void setAttackSpeedBoost(ItemStack stack, double attackSpeed) + { + NBTHelper.checkNBT(stack); + + NBTTagCompound tag = stack.getTagCompound(); + + tag.setDouble("attackSpeed", attackSpeed); + } } diff --git a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulGem.java b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulGem.java index 967a0d84..c028970d 100644 --- a/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulGem.java +++ b/src/main/java/WayofTime/bloodmagic/item/soul/ItemSoulGem.java @@ -258,6 +258,16 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I NBTTagCompound tag = soulGemStack.getTagCompound(); + if (type == EnumDemonWillType.DEFAULT) + { + if (tag.hasKey(Constants.NBT.WILL_TYPE)) + { + tag.removeTag(Constants.NBT.WILL_TYPE); + } + + return; + } + tag.setString(Constants.NBT.WILL_TYPE, type.toString()); }