Repackage living armor upgrades and trackers

all the organizations
This commit is contained in:
Nick 2016-01-28 14:56:49 -08:00
parent a408f9a959
commit d769ee2d37
20 changed files with 48 additions and 44 deletions

View file

@ -0,0 +1,66 @@
package WayofTime.bloodmagic.livingArmour.upgrade;
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.ILivingArmour;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
public class LivingArmourUpgradeArrowShot extends LivingArmourUpgrade
{
public static final int[] costs = new int[] { 20, 50, 90, 160, 290 };
public static final int[] extraArrow = new int[] { 1, 2, 3, 4, 5 };
public LivingArmourUpgradeArrowShot(int level)
{
super(level);
}
@Override
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
{
}
@Override
public String getUniqueIdentifier()
{
return Constants.Mod.MODID + ".upgrade.arrowShot";
}
@Override
public int getMaxTier()
{
return 5; // 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)
{
}
@Override
public void readFromNBT(NBTTagCompound tag)
{
}
@Override
public String getUnlocalizedName()
{
return tooltipBase + "arrowShot";
}
public int getExtraArrows()
{
return extraArrow[this.level];
}
}

View file

@ -0,0 +1,85 @@
package WayofTime.bloodmagic.livingArmour.upgrade;
import java.util.HashMap;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
public class LivingArmourUpgradeDigging extends LivingArmourUpgrade
{
public static HashMap<ILivingArmour, Boolean> changeMap = new HashMap<ILivingArmour, Boolean>();
public static final int[] costs = new int[] { 5, 10, 18, 35, 65, 100, 160 };
public static final int[] digHasteTime = new int[] { 20, 40, 60, 100, 100, 100 };
public static final int[] digHasteLevel = new int[] { 0, 0, 1, 1, 2, 2, 2 };
public static final int[] digSpeedTime = new int[] { 0, 60, 60, 100, 100, 100, 100 };
public static final int[] digSpeedLevel = new int[] { 0, 0, 0, 1, 1, 1, 1 };
public static void hasDug(LivingArmour armour)
{
changeMap.put(armour, true);
}
public LivingArmourUpgradeDigging(int level)
{
super(level);
}
@Override
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
{
if (changeMap.containsKey(livingArmour) && changeMap.get(livingArmour))
{
changeMap.put(livingArmour, false);
player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, digHasteTime[this.level], digHasteLevel[this.level], false, false));
if (digSpeedTime[this.level] > 0)
{
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, digSpeedTime[this.level], digSpeedLevel[this.level], false, false));
}
}
}
@Override
public String getUniqueIdentifier()
{
return Constants.Mod.MODID + ".upgrade.digging";
}
@Override
public int getMaxTier()
{
return 5; // 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 + "digging";
}
}

View file

@ -0,0 +1,78 @@
package WayofTime.bloodmagic.livingArmour.upgrade;
import java.util.UUID;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
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.ILivingArmour;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
public class LivingArmourUpgradeHealthboost extends LivingArmourUpgrade
{
public static final int[] costs = new int[] { 5, 12, 20, 35, 49, 78, 110, 160, 215, 320 };
public static final int[] healthModifier = new int[] { 4, 8, 12, 16, 20, 26, 32, 38, 44, 50 };
public LivingArmourUpgradeHealthboost(int level)
{
super(level);
}
@Override
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
{
}
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers()
{
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
modifierMap.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(9423688, 1), "Health modifier" + 1, healthModifier[this.level], 0));
return modifierMap;
}
@Override
public String getUniqueIdentifier()
{
return Constants.Mod.MODID + ".upgrade.health";
}
@Override
public int getMaxTier()
{
return 10;
}
@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 + "health";
}
}

View file

@ -0,0 +1,75 @@
package WayofTime.bloodmagic.livingArmour.upgrade;
import java.util.UUID;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.nbt.NBTTagCompound;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
public class LivingArmourUpgradeKnockbackResist extends LivingArmourUpgrade
{
public static final int[] costs = new int[] { 3, 7, 13, 26, 42 };
public static final double[] kbModifier = new double[] { 0.2, 0.4, 0.6, 0.8, 1.0 };
public static final int[] healthModifier = new int[] { 0, 0, 0, 4, 10 };
public LivingArmourUpgradeKnockbackResist(int level)
{
super(level);
}
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers()
{
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
modifierMap.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(895132, 1), "Knockback modifier" + 1, kbModifier[this.level], 0));
if (healthModifier[this.level] > 0)
{
modifierMap.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(952142, 1), "Health modifier" + 1, healthModifier[this.level], 0));
}
return modifierMap;
}
@Override
public String getUniqueIdentifier()
{
return Constants.Mod.MODID + ".upgrade.knockback";
}
@Override
public int getMaxTier()
{
return 5;
}
@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 + "knockback";
}
}

View file

@ -0,0 +1,78 @@
package WayofTime.bloodmagic.livingArmour.upgrade;
import java.util.UUID;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
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.ILivingArmour;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
public class LivingArmourUpgradeMeleeDamage extends LivingArmourUpgrade
{
public static final int[] costs = new int[] { 5, 12, 20, 35, 49, 78, 110, 160, 215, 320 };
public static final double[] meleeDamage = new double[] { 0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 6, 7 };
public LivingArmourUpgradeMeleeDamage(int level)
{
super(level);
}
@Override
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
{
}
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers()
{
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
modifierMap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(9423688, 1), "damage modifier" + 1, meleeDamage[this.level], 0));
return modifierMap;
}
@Override
public String getUniqueIdentifier()
{
return Constants.Mod.MODID + ".upgrade.meleeDamage";
}
@Override
public int getMaxTier()
{
return 10;
}
@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 + "meleeDamage";
}
}

View file

@ -0,0 +1,63 @@
package WayofTime.bloodmagic.livingArmour.upgrade;
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.77, 0.80, 0.83 };
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";
}
}

View file

@ -0,0 +1,81 @@
package WayofTime.bloodmagic.livingArmour.upgrade;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.util.ChatUtil;
import WayofTime.bloodmagic.util.helper.TextHelper;
public class LivingArmourUpgradePoisonResist extends LivingArmourUpgrade
{
public static final int[] costs = new int[] { 2, 6, 14, 25, 40 };
public static final int[] poisonCooldownTime = new int[] { 1200, 800, 600, 300, 100 };
public static final int[] poisonMaxCure = new int[] { 0, 1, 2, 2, 3 };
public int poisonCooldown = 0;
public LivingArmourUpgradePoisonResist(int level)
{
super(level);
}
@Override
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
{
if (player.isPotionActive(Potion.poison) && poisonCooldown <= 0)
{
PotionEffect eff = player.getActivePotionEffect(Potion.poison);
if (eff.getAmplifier() <= poisonMaxCure[this.level])
{
player.removePotionEffect(Potion.poison.id);
poisonCooldown = poisonCooldownTime[this.level];
ChatUtil.sendNoSpam(player, TextHelper.localize(chatBase + "poisonRemove"));
}
} else if (poisonCooldown > 0)
{
poisonCooldown--;
}
}
@Override
public String getUniqueIdentifier()
{
return Constants.Mod.MODID + ".upgrade.poisonResist";
}
@Override
public int getMaxTier()
{
return 5; // 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)
{
tag.setInteger(Constants.NBT.UPGRADE_POISON_TIMER, poisonCooldown);
}
@Override
public void readFromNBT(NBTTagCompound tag)
{
poisonCooldown = tag.getInteger(Constants.NBT.UPGRADE_POISON_TIMER);
}
@Override
public String getUnlocalizedName()
{
return tooltipBase + "poisonResist";
}
}

View file

@ -0,0 +1,58 @@
package WayofTime.bloodmagic.livingArmour.upgrade;
import net.minecraft.nbt.NBTTagCompound;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
public class LivingArmourUpgradeSelfSacrifice extends LivingArmourUpgrade
{
//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)
{
super(level);
}
public double getSacrificeModifier()
{
return sacrificeModifier[this.level];
}
@Override
public String getUniqueIdentifier()
{
return Constants.Mod.MODID + ".upgrade.selfSacrifice";
}
@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 + "selfSacrifice";
}
}

View file

@ -0,0 +1,100 @@
package WayofTime.bloodmagic.livingArmour.upgrade;
import java.util.UUID;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
public class LivingArmourUpgradeSpeed extends LivingArmourUpgrade
{
public static final int[] costs = new int[] { 3, 7, 13, 26, 42, 60, 90, 130, 180, 250 };
public static final double[] speedModifier = new double[] { 0.1, 0.2, 0.3, 0.4, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5 };
public static final int[] sprintSpeedTime = new int[] { 0, 0, 0, 0, 0, 20, 60, 60, 100, 200 };
public static final int[] sprintSpeedLevel = new int[] { 0, 0, 0, 0, 0, 0, 0, 1, 1, 2 };
public static final int[] healthModifier = new int[] { 0, 0, 0, 0, 0, 0, 0, 4, 10, 20 };
public static final int[] sprintRegenTime = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 25 };
public LivingArmourUpgradeSpeed(int level)
{
super(level);
}
@Override
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
{
if (player.isSprinting())
{
if (sprintSpeedTime[this.level] > 0)
{
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, sprintSpeedTime[this.level], sprintSpeedLevel[this.level], false, false));
}
if (sprintRegenTime[this.level] > 0 && !player.isPotionActive(Potion.regeneration))
{
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, sprintRegenTime[this.level], 0, false, false));
}
}
}
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers()
{
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
modifierMap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(895132, 1), "Speed modifier" + 1, speedModifier[this.level], 1));
if (healthModifier[this.level] > 0)
{
modifierMap.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(952142, 1), "Health modifier" + 1, healthModifier[this.level], 0));
}
return modifierMap;
}
@Override
public String getUniqueIdentifier()
{
return Constants.Mod.MODID + ".upgrade.movement";
}
@Override
public int getMaxTier()
{
return 10;
}
@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 + "speed";
}
}