Added Physical Protection upgrade. Reorganized some of the upgrades.
This commit is contained in:
parent
72ac385861
commit
6dedb234fb
|
@ -1,3 +1,9 @@
|
|||
------------------------------------------------------
|
||||
Version 2.0.0-4
|
||||
------------------------------------------------------
|
||||
- Added Physical resistance upgrade.
|
||||
|
||||
|
||||
------------------------------------------------------
|
||||
Version 2.0.0-3
|
||||
------------------------------------------------------
|
||||
|
|
|
@ -49,13 +49,13 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor
|
|||
|
||||
if (this == ModItems.livingArmourBoots || this == ModItems.livingArmourHelmet)
|
||||
{
|
||||
damageAmount = 3f / 25f;
|
||||
damageAmount = 3d / 20d * 0.6;
|
||||
} else if (this == ModItems.livingArmourLegs)
|
||||
{
|
||||
damageAmount = 6f / 25f;
|
||||
damageAmount = 6d / 20d * 0.6;
|
||||
} else if (this == ModItems.livingArmourChest)
|
||||
{
|
||||
damageAmount = 0.52;
|
||||
damageAmount = 0.64;
|
||||
}
|
||||
|
||||
double armourPenetrationReduction = 0;
|
||||
|
@ -74,7 +74,7 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor
|
|||
|
||||
if (this == ModItems.livingArmourChest)
|
||||
{
|
||||
armourReduction = 0.32 / 0.52; // This values puts it at about iron level
|
||||
armourReduction = 0.24 / 0.64; // This values puts it at iron level
|
||||
|
||||
ItemStack helmet = player.getEquipmentInSlot(4);
|
||||
ItemStack leggings = player.getEquipmentInSlot(2);
|
||||
|
@ -100,6 +100,11 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor
|
|||
{
|
||||
LivingArmourUpgrade upgrade = entry.getValue();
|
||||
remainder *= (1 - upgrade.getArmourProtection(source));
|
||||
/*
|
||||
* Just as a side note, if one upgrade provides
|
||||
* upgrade.getArmourProtection(source) = 0.5, the
|
||||
* armour would have a diamond level protection
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package WayofTime.bloodmagic.livingArmour;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradePhysicalProtect extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 5, 10, 18, 35, 65, 100, 160, 220, 280, 350 };
|
||||
public static final double[] protectionLevel = new double[] { 0.1, 0.3, 0.4, 0.5, 0.6, 0.7, 0.75, 0.8, 0.85, 0.9 };
|
||||
|
||||
public LivingArmourUpgradePhysicalProtect(int level)
|
||||
{
|
||||
super(level);
|
||||
}
|
||||
|
||||
public double getArmourProtection(DamageSource source)
|
||||
{
|
||||
if (source.getEntity() != null)
|
||||
{
|
||||
return protectionLevel[this.level];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
return Constants.Mod.MODID + ".upgrade.physicalProtect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
return 10; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
return tooltipBase + "physicalProtect";
|
||||
}
|
||||
}
|
|
@ -6,8 +6,9 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
|||
|
||||
public class LivingArmourUpgradeSelfSacrifice extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 10, 25, 50, 80, 120 };
|
||||
public static final double[] sacrificeModifier = new double[] { 0.2, 0.4, 0.6, 0.8, 1.0 };
|
||||
//TODO: Add extra effects for higher levels
|
||||
public static final int[] costs = new int[] { 7, 13, 22, 40, 65, 90, 130, 180, 250, 350 };
|
||||
public static final double[] sacrificeModifier = new double[] { 0.15, 0.3, 0.45, 0.6, 0.75, 0.9, 1.05, 1.2, 1.35, 1.5 };
|
||||
|
||||
public LivingArmourUpgradeSelfSacrifice(int level)
|
||||
{
|
||||
|
@ -28,7 +29,7 @@ public class LivingArmourUpgradeSelfSacrifice extends LivingArmourUpgrade
|
|||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
return 5; // Set to here until I can add more upgrades to it.
|
||||
return 10; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
package WayofTime.bloodmagic.livingArmour;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
|
||||
public class StatTrackerPhysicalProtect extends StatTracker
|
||||
{
|
||||
public int totalDamage = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] damageRequired = new int[] { 30, 200, 400, 800, 1500, 2500, 3500, 5000, 6000 };
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
return Constants.Mod.MODID + ".tracker.physicalProtect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
this.totalDamage = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
totalDamage = tag.getInteger(Constants.Mod.MODID + ".tracker.physicalProtect");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
tag.setInteger(Constants.Mod.MODID + ".tracker.physicalProtect", totalDamage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
double change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
totalDamage += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0d);
|
||||
|
||||
this.markDirty();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
if (totalDamage >= damageRequired[i])
|
||||
{
|
||||
upgradeList.add(new LivingArmourUpgradePhysicalProtect(i));
|
||||
}
|
||||
}
|
||||
|
||||
return upgradeList;
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
|||
public class StatTrackerSelfSacrifice extends StatTracker
|
||||
{
|
||||
public static HashMap<LivingArmour, Integer> changeMap = new HashMap<LivingArmour, Integer>();
|
||||
public static int[] sacrificesRequired = new int[] { 50, 200, 400, 600, 800 }; //testing
|
||||
public static int[] sacrificesRequired = new int[] { 30, 200, 400, 700, 1100, 1500, 2000, 2800, 3600, 5000 }; //testing
|
||||
|
||||
public int totalSacrifices = 0;
|
||||
|
||||
|
@ -72,12 +72,11 @@ public class StatTrackerSelfSacrifice extends StatTracker
|
|||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalSacrifices > sacrificesRequired[i])
|
||||
if (totalSacrifices >= sacrificesRequired[i])
|
||||
{
|
||||
upgradeList.add(new LivingArmourUpgradeSelfSacrifice(i));
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
|
@ -30,6 +31,7 @@ import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
|||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeDigging;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeSelfSacrifice;
|
||||
import WayofTime.bloodmagic.livingArmour.StatTrackerDigging;
|
||||
import WayofTime.bloodmagic.livingArmour.StatTrackerPhysicalProtect;
|
||||
import WayofTime.bloodmagic.livingArmour.StatTrackerSelfSacrifice;
|
||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
|
@ -174,6 +176,7 @@ public class EventHandler
|
|||
@SubscribeEvent
|
||||
public void onEntityAttacked(LivingAttackEvent event)
|
||||
{
|
||||
DamageSource source = event.source;
|
||||
Entity sourceEntity = event.source.getEntity();
|
||||
EntityLivingBase attackedEntity = event.entityLiving;
|
||||
|
||||
|
@ -182,7 +185,7 @@ public class EventHandler
|
|||
return;
|
||||
}
|
||||
|
||||
if (sourceEntity != null && attackedEntity instanceof EntityPlayer)
|
||||
if (attackedEntity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer attackedPlayer = (EntityPlayer) attackedEntity;
|
||||
|
||||
|
@ -202,7 +205,16 @@ public class EventHandler
|
|||
if (hasFullSet)
|
||||
{
|
||||
System.out.println(amount);
|
||||
|
||||
ItemStack chestStack = attackedPlayer.getCurrentArmor(2);
|
||||
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||
if (armour != null)
|
||||
{
|
||||
if (sourceEntity != null && !source.isMagicDamage())
|
||||
{
|
||||
// Add resistance to the upgrade that protects against non-magic damage
|
||||
StatTrackerPhysicalProtect.incrementCounter(armour, amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,6 +223,7 @@ tooltip.BloodMagic.livingArmour.upgrade.digging=Dwarven Might
|
|||
tooltip.BloodMagic.livingArmour.upgrade.poisonResist=Poison Resistance
|
||||
tooltip.BloodMagic.livingArmour.upgrade.selfSacrifice=Tough Palms
|
||||
tooltip.BloodMagic.livingArmour.upgrade.knockback=Body Builder
|
||||
tooltip.BloodMagic.livingArmour.upgrade.physicalProtect=Tough Skin
|
||||
tooltip.BloodMagic.livingArmour.upgrade.level=(Level %d)
|
||||
|
||||
# Ritual
|
||||
|
|
Loading…
Reference in a new issue