Updated forge, did random stuff to the armour before realizing issues with armour calculations
This commit is contained in:
parent
b56bbef29e
commit
aa480af518
|
@ -2,12 +2,12 @@ mod_name=BloodMagic
|
|||
package_group=com.wayoftime.bloodmagic
|
||||
mod_version=2.0.0
|
||||
mc_version=1.9
|
||||
forge_version=12.16.0.1840-1.9
|
||||
forge_version=12.16.0.1852-1.9
|
||||
curse_id=224791
|
||||
|
||||
mappings_version=snapshot_20160321
|
||||
|
||||
jei_version=3.2.5.179
|
||||
jei_version=3.2.8.182
|
||||
waila_version=1.6.0-B3
|
||||
thaumcraft_version=5.1.5
|
||||
baubles_version=1.1.3.0
|
||||
|
|
|
@ -39,6 +39,8 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP
|
|||
{
|
||||
public static String[] names = { "helmet", "chest", "legs", "boots" };
|
||||
|
||||
public static final boolean useSpecialArmourCalculation = true;
|
||||
|
||||
//TODO: Save/delete cache periodically.
|
||||
public static Map<ItemStack, LivingArmour> armourMap = new HashMap<ItemStack, LivingArmour>();
|
||||
|
||||
|
@ -67,6 +69,18 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP
|
|||
}
|
||||
}
|
||||
|
||||
public double getRemainderForDamage(double damage, double plating) //TODO: Add plating, which shifts the damage
|
||||
{
|
||||
if (damage <= 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
double protectionAmount = 1 - Math.max(3, 15 - damage / 2) / 25; //This puts the base armour protection at vanilla iron level
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArmorProperties getProperties(EntityLivingBase player, ItemStack stack, DamageSource source, double damage, int slot)
|
||||
{
|
||||
|
@ -126,12 +140,6 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP
|
|||
{
|
||||
LivingArmourUpgrade upgrade = entry.getValue();
|
||||
remainder *= (1 - upgrade.getArmourProtection(player, 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,103 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
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;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeArrowProtect;
|
||||
|
||||
public class StatTrackerArrowProtect 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, 7000, 15000 };
|
||||
|
||||
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.arrowProtect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
this.totalDamage = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
totalDamage = tag.getInteger(Constants.Mod.MODID + ".tracker.arrowProtect");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
tag.setInteger(Constants.Mod.MODID + ".tracker.arrowProtect", 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 void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalDamage >= damageRequired[i])
|
||||
{
|
||||
upgradeList.add(new LivingArmourUpgradeArrowProtect(i));
|
||||
}
|
||||
}
|
||||
|
||||
return upgradeList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
return key.equals(Constants.Mod.MODID + ".upgrade.arrowProtect");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeArrowProtect 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.77, 0.80, 0.83 };
|
||||
|
||||
public LivingArmourUpgradeArrowProtect(int level)
|
||||
{
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getArmourProtection(EntityLivingBase wearer, DamageSource source)
|
||||
{
|
||||
if (source.isProjectile())
|
||||
{
|
||||
return protectionLevel[this.level];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
return Constants.Mod.MODID + ".upgrade.arrowProtect";
|
||||
}
|
||||
|
||||
@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 + "arrowProtect";
|
||||
}
|
||||
}
|
|
@ -85,6 +85,7 @@ import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
|||
import WayofTime.bloodmagic.item.armour.ItemSentientArmour;
|
||||
import WayofTime.bloodmagic.item.gear.ItemPackSacrifice;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerArrowProtect;
|
||||
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerArrowShot;
|
||||
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerDigging;
|
||||
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerExperience;
|
||||
|
@ -601,6 +602,10 @@ public class EventHandler
|
|||
{
|
||||
EntityPlayer attackedPlayer = (EntityPlayer) attackedEntity;
|
||||
|
||||
System.out.println("Damage: " + event.getAmount());
|
||||
|
||||
System.out.println("New damage: " + net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(attackedPlayer, attackedPlayer.inventory.armorInventory, event.getSource(), event.getAmount()));
|
||||
|
||||
// Living Armor Handling
|
||||
if (LivingArmour.hasFullSet(attackedPlayer))
|
||||
{
|
||||
|
@ -619,6 +624,11 @@ public class EventHandler
|
|||
{
|
||||
StatTrackerFallProtect.incrementCounter(armour, amount);
|
||||
}
|
||||
|
||||
if (source.isProjectile())
|
||||
{
|
||||
StatTrackerArrowProtect.incrementCounter(armour, amount);
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue