Run formatter
This commit is contained in:
parent
61c44a831b
commit
08258fd6ef
606 changed files with 13464 additions and 22975 deletions
|
@ -1,11 +1,14 @@
|
|||
package WayofTime.bloodmagic.livingArmour;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import WayofTime.bloodmagic.api.iface.IUpgradeTrainer;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourHandler;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -15,19 +18,14 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.iface.IUpgradeTrainer;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourHandler;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class LivingArmour implements ILivingArmour
|
||||
{
|
||||
public class LivingArmour implements ILivingArmour {
|
||||
public static String chatBase = "chat.bloodmagic.livingArmour.";
|
||||
public HashMap<String, StatTracker> trackerMap = new HashMap<String, StatTracker>();
|
||||
public HashMap<String, LivingArmourUpgrade> upgradeMap = new HashMap<String, LivingArmourUpgrade>();
|
||||
|
@ -35,52 +33,42 @@ public class LivingArmour implements ILivingArmour
|
|||
public int maxUpgradePoints = 100;
|
||||
public int totalUpgradePoints = 0;
|
||||
|
||||
public StatTracker getTracker(String key)
|
||||
{
|
||||
public StatTracker getTracker(String key) {
|
||||
return trackerMap.get(key);
|
||||
}
|
||||
|
||||
public double getAdditionalDamageOnHit(double damage, EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon)
|
||||
{
|
||||
public double getAdditionalDamageOnHit(double damage, EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon) {
|
||||
double total = 0;
|
||||
for (Entry<String, LivingArmourUpgrade> entry : upgradeMap.entrySet())
|
||||
{
|
||||
for (Entry<String, LivingArmourUpgrade> entry : upgradeMap.entrySet()) {
|
||||
total += entry.getValue().getAdditionalDamageOnHit(damage, wearer, hitEntity, weapon);
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
public double getKnockbackOnHit(EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon)
|
||||
{
|
||||
public double getKnockbackOnHit(EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon) {
|
||||
double total = 0;
|
||||
for (Entry<String, LivingArmourUpgrade> entry : upgradeMap.entrySet())
|
||||
{
|
||||
for (Entry<String, LivingArmourUpgrade> entry : upgradeMap.entrySet()) {
|
||||
total += entry.getValue().getKnockbackOnHit(wearer, hitEntity, weapon);
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
public void recalculateUpgradePoints()
|
||||
{
|
||||
public void recalculateUpgradePoints() {
|
||||
totalUpgradePoints = 0;
|
||||
for (LivingArmourUpgrade upgrade : upgradeMap.values())
|
||||
{
|
||||
for (LivingArmourUpgrade upgrade : upgradeMap.values()) {
|
||||
totalUpgradePoints += upgrade.getCostOfUpgrade();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers()
|
||||
{
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers() {
|
||||
HashMultimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
|
||||
|
||||
for (Entry<String, LivingArmourUpgrade> entry : upgradeMap.entrySet())
|
||||
{
|
||||
for (Entry<String, LivingArmourUpgrade> entry : upgradeMap.entrySet()) {
|
||||
LivingArmourUpgrade upgrade = entry.getValue();
|
||||
if (upgrade == null)
|
||||
{
|
||||
if (upgrade == null) {
|
||||
continue;
|
||||
}
|
||||
modifierMap.putAll(upgrade.getAttributeModifiers());
|
||||
|
@ -90,41 +78,33 @@ public class LivingArmour implements ILivingArmour
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean upgradeArmour(EntityPlayer user, LivingArmourUpgrade upgrade)
|
||||
{
|
||||
public boolean upgradeArmour(EntityPlayer user, LivingArmourUpgrade upgrade) {
|
||||
String key = upgrade.getUniqueIdentifier();
|
||||
if (upgradeMap.containsKey(key))
|
||||
{
|
||||
if (upgradeMap.containsKey(key)) {
|
||||
//Check if this is a higher level than the previous upgrade
|
||||
int nextLevel = upgrade.getUpgradeLevel();
|
||||
int currentLevel = upgradeMap.get(key).getUpgradeLevel();
|
||||
|
||||
if (nextLevel > currentLevel)
|
||||
{
|
||||
if (nextLevel > currentLevel) {
|
||||
int upgradePointDifference = upgrade.getCostOfUpgrade() - upgradeMap.get(key).getCostOfUpgrade();
|
||||
if (totalUpgradePoints + upgradePointDifference <= maxUpgradePoints)
|
||||
{
|
||||
if (totalUpgradePoints + upgradePointDifference <= maxUpgradePoints) {
|
||||
upgradeMap.put(key, upgrade);
|
||||
totalUpgradePoints += upgradePointDifference;
|
||||
notifyPlayerOfUpgrade(user, upgrade);
|
||||
for (StatTracker tracker : trackerMap.values())
|
||||
{
|
||||
for (StatTracker tracker : trackerMap.values()) {
|
||||
tracker.onArmourUpgradeAdded(upgrade);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
int upgradePoints = upgrade.getCostOfUpgrade();
|
||||
if (totalUpgradePoints + upgradePoints <= maxUpgradePoints)
|
||||
{
|
||||
if (totalUpgradePoints + upgradePoints <= maxUpgradePoints) {
|
||||
upgradeMap.put(key, upgrade);
|
||||
totalUpgradePoints += upgradePoints;
|
||||
notifyPlayerOfUpgrade(user, upgrade);
|
||||
for (StatTracker tracker : trackerMap.values())
|
||||
{
|
||||
for (StatTracker tracker : trackerMap.values()) {
|
||||
tracker.onArmourUpgradeAdded(upgrade);
|
||||
}
|
||||
|
||||
|
@ -136,28 +116,22 @@ public class LivingArmour implements ILivingArmour
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canApplyUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade)
|
||||
{
|
||||
public boolean canApplyUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade) {
|
||||
String key = upgrade.getUniqueIdentifier();
|
||||
if (upgradeMap.containsKey(key))
|
||||
{
|
||||
if (upgradeMap.containsKey(key)) {
|
||||
//Check if this is a higher level than the previous upgrade
|
||||
int nextLevel = upgrade.getUpgradeLevel();
|
||||
int currentLevel = upgradeMap.get(key).getUpgradeLevel();
|
||||
|
||||
if (nextLevel > currentLevel)
|
||||
{
|
||||
if (nextLevel > currentLevel) {
|
||||
int upgradePointDifference = upgrade.getCostOfUpgrade() - upgradeMap.get(key).getCostOfUpgrade();
|
||||
if (totalUpgradePoints + upgradePointDifference <= maxUpgradePoints)
|
||||
{
|
||||
if (totalUpgradePoints + upgradePointDifference <= maxUpgradePoints) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
int upgradePoints = upgrade.getCostOfUpgrade();
|
||||
if (totalUpgradePoints + upgradePoints <= maxUpgradePoints)
|
||||
{
|
||||
if (totalUpgradePoints + upgradePoints <= maxUpgradePoints) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -166,85 +140,69 @@ public class LivingArmour implements ILivingArmour
|
|||
}
|
||||
|
||||
@Override
|
||||
public void notifyPlayerOfUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade)
|
||||
{
|
||||
public void notifyPlayerOfUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade) {
|
||||
user.sendStatusMessage(new TextComponentString(TextHelper.localizeEffect(chatBase + "newUpgrade")), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ticks the upgrades and stat trackers, passing in the world and player as
|
||||
* well as the LivingArmour
|
||||
*
|
||||
*
|
||||
* @param world
|
||||
* @param player
|
||||
*/
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player)
|
||||
{
|
||||
for (Entry<String, LivingArmourUpgrade> entry : upgradeMap.entrySet())
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player) {
|
||||
for (Entry<String, LivingArmourUpgrade> entry : upgradeMap.entrySet()) {
|
||||
LivingArmourUpgrade upgrade = entry.getValue();
|
||||
|
||||
if (upgrade == null)
|
||||
{
|
||||
if (upgrade == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!world.isRemote || upgrade.runOnClient())
|
||||
{
|
||||
if (!world.isRemote || upgrade.runOnClient()) {
|
||||
upgrade.onTick(world, player, this);
|
||||
}
|
||||
}
|
||||
|
||||
if (world.isRemote)
|
||||
{
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> allowedUpgradesList = new ArrayList<String>();
|
||||
for (ItemStack stack : player.inventory.mainInventory)
|
||||
{
|
||||
if (stack != null && stack.getItem() instanceof IUpgradeTrainer)
|
||||
{
|
||||
for (ItemStack stack : player.inventory.mainInventory) {
|
||||
if (stack != null && stack.getItem() instanceof IUpgradeTrainer) {
|
||||
List<String> keyList = ((IUpgradeTrainer) stack.getItem()).getTrainedUpgrades(stack);
|
||||
if (!keyList.isEmpty())
|
||||
{
|
||||
if (!keyList.isEmpty()) {
|
||||
allowedUpgradesList.addAll(keyList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<String, StatTracker> entry : trackerMap.entrySet())
|
||||
{
|
||||
for (Entry<String, StatTracker> entry : trackerMap.entrySet()) {
|
||||
StatTracker tracker = entry.getValue();
|
||||
|
||||
if (tracker == null)
|
||||
{
|
||||
if (tracker == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!allowedUpgradesList.isEmpty())
|
||||
{
|
||||
if (!allowedUpgradesList.isEmpty()) {
|
||||
boolean allowed = false;
|
||||
|
||||
for (String key : allowedUpgradesList)
|
||||
{
|
||||
if (tracker.providesUpgrade(key))
|
||||
{
|
||||
for (String key : allowedUpgradesList) {
|
||||
if (tracker.providesUpgrade(key)) {
|
||||
allowed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!allowed)
|
||||
{
|
||||
if (!allowed) {
|
||||
tracker.onDeactivatedTick(world, player, this);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (tracker.onTick(world, player, this))
|
||||
{
|
||||
if (tracker.onTick(world, player, this)) {
|
||||
List<LivingArmourUpgrade> upgradeList = tracker.getUpgrades();
|
||||
|
||||
for (LivingArmourUpgrade upgrade : upgradeList) //TODO: make a getNextUpgrade?
|
||||
|
@ -257,62 +215,51 @@ public class LivingArmour implements ILivingArmour
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
maxUpgradePoints = Math.max(100, tag.getInteger("maxUpgradePoints"));
|
||||
|
||||
NBTTagList upgradeTags = tag.getTagList("upgrades", 10);
|
||||
if (upgradeTags != null)
|
||||
{
|
||||
for (int i = 0; i < upgradeTags.tagCount(); i++)
|
||||
{
|
||||
if (upgradeTags != null) {
|
||||
for (int i = 0; i < upgradeTags.tagCount(); i++) {
|
||||
NBTTagCompound upgradeTag = upgradeTags.getCompoundTagAt(i);
|
||||
String key = upgradeTag.getString("key");
|
||||
int level = upgradeTag.getInteger("level");
|
||||
NBTTagCompound nbtTag = upgradeTag.getCompoundTag("upgrade");
|
||||
LivingArmourUpgrade upgrade = LivingArmourHandler.generateUpgradeFromKey(key, level, nbtTag);
|
||||
if (upgrade != null)
|
||||
{
|
||||
if (upgrade != null) {
|
||||
upgradeMap.put(key, upgrade);
|
||||
totalUpgradePoints += upgrade.getCostOfUpgrade();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Class<? extends StatTracker> clazz : LivingArmourHandler.trackers)
|
||||
{
|
||||
try
|
||||
{
|
||||
for (Class<? extends StatTracker> clazz : LivingArmourHandler.trackers) {
|
||||
try {
|
||||
Constructor<?> ctor = clazz.getConstructor();
|
||||
Object obj = ctor.newInstance();
|
||||
if (!(obj instanceof StatTracker))
|
||||
{
|
||||
if (!(obj instanceof StatTracker)) {
|
||||
// ?????
|
||||
}
|
||||
StatTracker tracker = (StatTracker) obj;
|
||||
String key = tracker.getUniqueIdentifier();
|
||||
NBTTagCompound trackerTag = tag.getCompoundTag(key);
|
||||
if (!trackerTag.hasNoTags())
|
||||
{
|
||||
if (!trackerTag.hasNoTags()) {
|
||||
tracker.readFromNBT(trackerTag);
|
||||
}
|
||||
trackerMap.put(key, tracker);
|
||||
} catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag, boolean forceWrite)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag, boolean forceWrite) {
|
||||
tag.setInteger("maxUpgradePoints", maxUpgradePoints);
|
||||
|
||||
NBTTagList tags = new NBTTagList();
|
||||
|
||||
for (Entry<String, LivingArmourUpgrade> entry : upgradeMap.entrySet())
|
||||
{
|
||||
for (Entry<String, LivingArmourUpgrade> entry : upgradeMap.entrySet()) {
|
||||
NBTTagCompound upgradeTag = new NBTTagCompound();
|
||||
|
||||
LivingArmourUpgrade upgrade = entry.getValue();
|
||||
|
@ -328,19 +275,16 @@ public class LivingArmour implements ILivingArmour
|
|||
|
||||
tag.setTag("upgrades", tags);
|
||||
|
||||
for (Entry<String, StatTracker> entry : trackerMap.entrySet())
|
||||
{
|
||||
for (Entry<String, StatTracker> entry : trackerMap.entrySet()) {
|
||||
StatTracker tracker = entry.getValue();
|
||||
|
||||
if (tracker == null)
|
||||
{
|
||||
if (tracker == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String key = tracker.getUniqueIdentifier();
|
||||
|
||||
if (forceWrite || tracker.isDirty())
|
||||
{
|
||||
if (forceWrite || tracker.isDirty()) {
|
||||
NBTTagCompound trackerTag = new NBTTagCompound();
|
||||
tracker.writeToNBT(trackerTag);
|
||||
|
||||
|
@ -354,27 +298,34 @@ public class LivingArmour implements ILivingArmour
|
|||
/**
|
||||
* Writes the LivingArmour to the NBTTag. This will only write the trackers
|
||||
* that are dirty.
|
||||
*
|
||||
*
|
||||
* @param tag
|
||||
*/
|
||||
@Override
|
||||
public void writeDirtyToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeDirtyToNBT(NBTTagCompound tag) {
|
||||
writeToNBT(tag, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
writeToNBT(tag, true);
|
||||
}
|
||||
|
||||
public static boolean hasFullSet(EntityPlayer player)
|
||||
{
|
||||
for (EntityEquipmentSlot slot : EntityEquipmentSlot.values())
|
||||
{
|
||||
if (slot.getSlotType() != EntityEquipmentSlot.Type.ARMOR)
|
||||
{
|
||||
@Override
|
||||
public boolean removeUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade) {
|
||||
String key = upgrade.getUniqueIdentifier();
|
||||
if (upgradeMap.containsKey(key)) {
|
||||
upgradeMap.remove(key);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hasFullSet(EntityPlayer player) {
|
||||
for (EntityEquipmentSlot slot : EntityEquipmentSlot.values()) {
|
||||
if (slot.getSlotType() != EntityEquipmentSlot.Type.ARMOR) {
|
||||
continue;
|
||||
}
|
||||
ItemStack slotStack = player.getItemStackFromSlot(slot);
|
||||
|
@ -384,18 +335,4 @@ public class LivingArmour implements ILivingArmour
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade)
|
||||
{
|
||||
String key = upgrade.getUniqueIdentifier();
|
||||
if (upgradeMap.containsKey(key))
|
||||
{
|
||||
upgradeMap.remove(key);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,84 +1,71 @@
|
|||
package WayofTime.bloodmagic.livingArmour.downgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeBattleHungry extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { -10, -20, -35, -50, -75 };
|
||||
public static final float[] exhaustionAdded = new float[] { 0.02f, 0.04f, 0.06f, 0.08f, 0.1f };
|
||||
public static final int[] delay = new int[] { 600, 600, 600, 500, 400 };
|
||||
public class LivingArmourUpgradeBattleHungry extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{-10, -20, -35, -50, -75};
|
||||
public static final float[] exhaustionAdded = new float[]{0.02f, 0.04f, 0.06f, 0.08f, 0.1f};
|
||||
public static final int[] delay = new int[]{600, 600, 600, 500, 400};
|
||||
|
||||
public int timer = 0;
|
||||
|
||||
public LivingArmourUpgradeBattleHungry(int level)
|
||||
{
|
||||
public LivingArmourUpgradeBattleHungry(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
public void resetTimer()
|
||||
{
|
||||
public void resetTimer() {
|
||||
this.timer = delay[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (timer > 0)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
if (timer > 0) {
|
||||
timer--;
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.ticksExisted % 20 == 0)
|
||||
{
|
||||
if (player.ticksExisted % 20 == 0) {
|
||||
player.addExhaustion(exhaustionAdded[this.level]); //TODO: Change exhaustion added per level.
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.battleHunger";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger("timer", timer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
timer = tag.getInteger("timer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "battleHunger";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDowngrade()
|
||||
{
|
||||
public boolean isDowngrade() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,64 +1,54 @@
|
|||
package WayofTime.bloodmagic.livingArmour.downgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeCrippledArm extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { -150 };
|
||||
public class LivingArmourUpgradeCrippledArm extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{-150};
|
||||
|
||||
public LivingArmourUpgradeCrippledArm(int level)
|
||||
{
|
||||
public LivingArmourUpgradeCrippledArm(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.crippledArm";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "crippledArm";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDowngrade()
|
||||
{
|
||||
public boolean isDowngrade() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,78 +1,65 @@
|
|||
package WayofTime.bloodmagic.livingArmour.downgrade;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeDigSlowdown extends LivingArmourUpgrade
|
||||
{
|
||||
import java.util.HashMap;
|
||||
|
||||
public class LivingArmourUpgradeDigSlowdown extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{-10, -17, -28, -42, -60, -80, -100, -125, -160, -200};
|
||||
public static final double[] digSpeedModifier = new double[]{0.9, 0.8, 0.7, 0.6, 0.55, 0.5, 0.4, 0.35, 0.3, 0.2};
|
||||
public static HashMap<ILivingArmour, Boolean> changeMap = new HashMap<ILivingArmour, Boolean>();
|
||||
|
||||
public static final int[] costs = new int[] { -10, -17, -28, -42, -60, -80, -100, -125, -160, -200 };
|
||||
|
||||
public static final double[] digSpeedModifier = new double[] { 0.9, 0.8, 0.7, 0.6, 0.55, 0.5, 0.4, 0.35, 0.3, 0.2 };
|
||||
|
||||
public LivingArmourUpgradeDigSlowdown(int level)
|
||||
{
|
||||
public LivingArmourUpgradeDigSlowdown(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMiningSpeedModifier(EntityPlayer player)
|
||||
{
|
||||
public double getMiningSpeedModifier(EntityPlayer player) {
|
||||
return digSpeedModifier[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.digSlowdown";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "digSlowdown";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDowngrade()
|
||||
{
|
||||
public boolean isDowngrade() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,75 +1,63 @@
|
|||
package WayofTime.bloodmagic.livingArmour.downgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeDisoriented extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { -10, -20, -30, -40, -70, -80, -100, -140, -180, -220 };
|
||||
public static final double[] chance = new double[] { 0.001, 0.002, 0.003, 0.004, 0.005, 0.006, 0.008, 0.0010, 0.0012, 0.014 };
|
||||
public class LivingArmourUpgradeDisoriented extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{-10, -20, -30, -40, -70, -80, -100, -140, -180, -220};
|
||||
public static final double[] chance = new double[]{0.001, 0.002, 0.003, 0.004, 0.005, 0.006, 0.008, 0.0010, 0.0012, 0.014};
|
||||
|
||||
public LivingArmourUpgradeDisoriented(int level)
|
||||
{
|
||||
public LivingArmourUpgradeDisoriented(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (world.isRemote && player.ticksExisted % 20 == 0 && world.rand.nextDouble() <= chance[this.level])
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
if (world.isRemote && player.ticksExisted % 20 == 0 && world.rand.nextDouble() <= chance[this.level]) {
|
||||
player.rotationYaw = world.rand.nextFloat() * 360;
|
||||
player.rotationPitch = world.rand.nextFloat() * 180 - 90;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean runOnClient()
|
||||
{
|
||||
public boolean runOnClient() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.disoriented";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "disoriented";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDowngrade()
|
||||
{
|
||||
public boolean isDowngrade() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -3,10 +3,8 @@ package WayofTime.bloodmagic.livingArmour.downgrade;
|
|||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -16,25 +14,21 @@ import org.apache.commons.codec.binary.StringUtils;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
public class LivingArmourUpgradeMeleeDecrease extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { -10, -17, -28, -42, -60, -80, -100, -125, -160, -200 };
|
||||
public static final double[] meleeDamage = new double[] { -0.1, -0.2, -0.25, -0.3, -0.35, -0.4, -0.5, -0.6, -0.7, -0.8 };
|
||||
public class LivingArmourUpgradeMeleeDecrease extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{-10, -17, -28, -42, -60, -80, -100, -125, -160, -200};
|
||||
public static final double[] meleeDamage = new double[]{-0.1, -0.2, -0.25, -0.3, -0.35, -0.4, -0.5, -0.6, -0.7, -0.8};
|
||||
|
||||
public LivingArmourUpgradeMeleeDecrease(int level)
|
||||
{
|
||||
public LivingArmourUpgradeMeleeDecrease(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers()
|
||||
{
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers() {
|
||||
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
|
||||
|
||||
String name = getUniqueIdentifier() + "-DamageModifier1";
|
||||
|
@ -44,44 +38,37 @@ public class LivingArmourUpgradeMeleeDecrease extends LivingArmourUpgrade
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.meleeDecrease";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "meleeDecrease";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDowngrade()
|
||||
{
|
||||
public boolean isDowngrade() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,64 +1,54 @@
|
|||
package WayofTime.bloodmagic.livingArmour.downgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeQuenched extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { -100 };
|
||||
public class LivingArmourUpgradeQuenched extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{-100};
|
||||
|
||||
public LivingArmourUpgradeQuenched(int level)
|
||||
{
|
||||
public LivingArmourUpgradeQuenched(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.quenched";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "quenched";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDowngrade()
|
||||
{
|
||||
public boolean isDowngrade() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,36 +1,31 @@
|
|||
package WayofTime.bloodmagic.livingArmour.downgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeSlippery extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { -50 };
|
||||
public static final int[] slipperyDuration = new int[] { 30 * 20 };
|
||||
public class LivingArmourUpgradeSlippery extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{-50};
|
||||
public static final int[] slipperyDuration = new int[]{30 * 20};
|
||||
|
||||
public LivingArmourUpgradeSlippery(int level)
|
||||
{
|
||||
public LivingArmourUpgradeSlippery(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (world.isRemote && player.onGround)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
if (world.isRemote && player.onGround) {
|
||||
// if (player.moveForward == 0)
|
||||
{
|
||||
|
||||
float f6 = 0.91F;
|
||||
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain(player.posX, player.getEntityBoundingBox().minY - 1.0D, player.posZ);
|
||||
|
||||
if (player.onGround)
|
||||
{
|
||||
if (player.onGround) {
|
||||
f6 = world.getBlockState(blockpos$pooledmutableblockpos).getBlock().slipperiness * 0.91F;
|
||||
}
|
||||
|
||||
|
@ -40,11 +35,9 @@ public class LivingArmourUpgradeSlippery extends LivingArmourUpgrade
|
|||
float f7 = 0.16277136F / (f6 * f6 * f6);
|
||||
float f8;
|
||||
|
||||
if (player.onGround)
|
||||
{
|
||||
if (player.onGround) {
|
||||
f8 = player.getAIMoveSpeed() * f7;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
f8 = player.jumpMovementFactor;
|
||||
}
|
||||
|
||||
|
@ -59,48 +52,40 @@ public class LivingArmourUpgradeSlippery extends LivingArmourUpgrade
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean runOnClient()
|
||||
{
|
||||
public boolean runOnClient() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.slippery";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "slippery";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDowngrade()
|
||||
{
|
||||
public boolean isDowngrade() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,73 +1,62 @@
|
|||
package WayofTime.bloodmagic.livingArmour.downgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeSlowHeal extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { -10, -17, -28, -42, -60, -80, -100, -125, -160, -200 };
|
||||
public class LivingArmourUpgradeSlowHeal extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{-10, -17, -28, -42, -60, -80, -100, -125, -160, -200};
|
||||
|
||||
public static final double[] healModifier = new double[] { 0.9, 0.8, 0.7, 0.6, 0.55, 0.5, 0.4, 0.35, 0.3, 0.2 };
|
||||
public static final double[] healModifier = new double[]{0.9, 0.8, 0.7, 0.6, 0.55, 0.5, 0.4, 0.35, 0.3, 0.2};
|
||||
|
||||
public LivingArmourUpgradeSlowHeal(int level)
|
||||
{
|
||||
public LivingArmourUpgradeSlowHeal(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
public double getHealingModifier()
|
||||
{
|
||||
public double getHealingModifier() {
|
||||
return healModifier[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.slowHeal";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "slowHeal";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDowngrade()
|
||||
{
|
||||
public boolean isDowngrade() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,33 +1,29 @@
|
|||
package WayofTime.bloodmagic.livingArmour.downgrade;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
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.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import org.apache.commons.codec.binary.StringUtils;
|
||||
|
||||
public class LivingArmourUpgradeSlowness extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { -10, -17, -23, -35, -48, -60, -80, -110, -160, -200 };
|
||||
public static final double[] speedModifier = new double[] { -0.1, -0.2, -0.3, -0.4, -0.45, -0.5, -0.55, -0.6, -0.65, -0.7 };
|
||||
import java.util.UUID;
|
||||
|
||||
public LivingArmourUpgradeSlowness(int level)
|
||||
{
|
||||
public class LivingArmourUpgradeSlowness extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{-10, -17, -23, -35, -48, -60, -80, -110, -160, -200};
|
||||
public static final double[] speedModifier = new double[]{-0.1, -0.2, -0.3, -0.4, -0.45, -0.5, -0.55, -0.6, -0.65, -0.7};
|
||||
|
||||
public LivingArmourUpgradeSlowness(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers()
|
||||
{
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers() {
|
||||
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
|
||||
|
||||
String name = getUniqueIdentifier() + "-SpeedModifier1";
|
||||
|
@ -37,48 +33,40 @@ public class LivingArmourUpgradeSlowness extends LivingArmourUpgrade
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.slowness";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "slowness";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDowngrade()
|
||||
{
|
||||
public boolean isDowngrade() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,70 +1,59 @@
|
|||
package WayofTime.bloodmagic.livingArmour.downgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeStormTrooper extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { -10, -25, -40, 65, -90 };
|
||||
public static final float[] inaccuracy = new float[] { 0.04f, 0.08f, 0.12f, 0.16f, 0.2f };
|
||||
public class LivingArmourUpgradeStormTrooper extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{-10, -25, -40, 65, -90};
|
||||
public static final float[] inaccuracy = new float[]{0.04f, 0.08f, 0.12f, 0.16f, 0.2f};
|
||||
|
||||
public LivingArmourUpgradeStormTrooper(int level)
|
||||
{
|
||||
public LivingArmourUpgradeStormTrooper(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
|
||||
}
|
||||
|
||||
public float getArrowJiggle(EntityPlayer player)
|
||||
{
|
||||
public float getArrowJiggle(EntityPlayer player) {
|
||||
return inaccuracy[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.stormTrooper";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "stormTrooper";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDowngrade()
|
||||
{
|
||||
public boolean isDowngrade() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,63 +1,49 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeArrowProtect;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
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 class StatTrackerArrowProtect extends StatTracker {
|
||||
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 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()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.arrowProtect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalDamage = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalDamage = tag.getInteger(BloodMagic.MODID + ".tracker.arrowProtect");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger(BloodMagic.MODID + ".tracker.arrowProtect", totalDamage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
double change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalDamage += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0d);
|
||||
|
@ -72,23 +58,18 @@ public class StatTrackerArrowProtect extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalDamage >= damageRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (totalDamage >= damageRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeArrowProtect(i));
|
||||
}
|
||||
}
|
||||
|
@ -97,28 +78,27 @@ public class StatTrackerArrowProtect extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalDamage, damageRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.arrowProtect");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeArrowProtect)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeArrowProtect) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < damageRequired.length)
|
||||
{
|
||||
if (level < damageRequired.length) {
|
||||
totalDamage = Math.max(totalDamage, damageRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +1,49 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeArrowShot;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerArrowShot extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerArrowShot extends StatTracker {
|
||||
public static HashMap<LivingArmour, Integer> changeMap = new HashMap<LivingArmour, Integer>();
|
||||
public static int[] shotsRequired = new int[]{50, 200, 700, 1500, 3000};
|
||||
public int totalShots = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Integer> changeMap = new HashMap<LivingArmour, Integer>();
|
||||
public static int[] shotsRequired = new int[] { 50, 200, 700, 1500, 3000 };
|
||||
|
||||
public static void incrementCounter(LivingArmour armour)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + 1 : 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.trickShot";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalShots = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalShots = tag.getInteger(BloodMagic.MODID + ".tracker.trickShot");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger(BloodMagic.MODID + ".tracker.trickShot", totalShots);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
int change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalShots += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0);
|
||||
|
@ -72,23 +58,18 @@ public class StatTrackerArrowShot extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (totalShots >= shotsRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (totalShots >= shotsRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeArrowShot(i));
|
||||
}
|
||||
}
|
||||
|
@ -97,28 +78,27 @@ public class StatTrackerArrowShot extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalShots, shotsRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.arrowShot");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeArrowShot)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeArrowShot) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < shotsRequired.length)
|
||||
{
|
||||
if (level < shotsRequired.length) {
|
||||
totalShots = Math.max(totalShots, shotsRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + 1 : 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +1,49 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeCriticalStrike;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerCriticalStrike extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerCriticalStrike extends StatTracker {
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] damageRequired = new int[]{200, 800, 1300, 2500, 3800};
|
||||
public double totalDamageDealt = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] damageRequired = new int[] { 200, 800, 1300, 2500, 3800 };
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.criticalStrike";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalDamageDealt = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalDamageDealt = tag.getDouble(BloodMagic.MODID + ".tracker.criticalStrike");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setDouble(BloodMagic.MODID + ".tracker.criticalStrike", totalDamageDealt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
double change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalDamageDealt += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0d);
|
||||
|
@ -72,23 +58,18 @@ public class StatTrackerCriticalStrike extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (totalDamageDealt >= damageRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (totalDamageDealt >= damageRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeCriticalStrike(i));
|
||||
}
|
||||
}
|
||||
|
@ -97,28 +78,27 @@ public class StatTrackerCriticalStrike extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalDamageDealt, damageRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.criticalStrike");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeCriticalStrike)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeCriticalStrike) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < damageRequired.length)
|
||||
{
|
||||
if (level < damageRequired.length) {
|
||||
totalDamageDealt = Math.max(totalDamageDealt, damageRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +1,49 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeDigging;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerDigging extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerDigging extends StatTracker {
|
||||
public static HashMap<LivingArmour, Integer> changeMap = new HashMap<LivingArmour, Integer>();
|
||||
public static int[] blocksRequired = new int[]{128, 512, 1024, 2048, 8192, 16000, 32000, 50000, 80000, 150000};
|
||||
public int totalBlocksDug = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Integer> changeMap = new HashMap<LivingArmour, Integer>();
|
||||
public static int[] blocksRequired = new int[] { 128, 512, 1024, 2048, 8192, 16000, 32000, 50000, 80000, 150000 };
|
||||
|
||||
public static void incrementCounter(LivingArmour armour)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + 1 : 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.digging";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalBlocksDug = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalBlocksDug = tag.getInteger(BloodMagic.MODID + ".tracker.digging");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger(BloodMagic.MODID + ".tracker.digging", totalBlocksDug);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
int change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalBlocksDug += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0);
|
||||
|
@ -72,23 +58,18 @@ public class StatTrackerDigging extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalBlocksDug >= blocksRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (totalBlocksDug >= blocksRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeDigging(i));
|
||||
}
|
||||
}
|
||||
|
@ -97,28 +78,27 @@ public class StatTrackerDigging extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalBlocksDug, blocksRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.digging");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeDigging)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeDigging) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < blocksRequired.length)
|
||||
{
|
||||
if (level < blocksRequired.length) {
|
||||
totalBlocksDug = Math.max(totalBlocksDug, blocksRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + 1 : 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +1,49 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeExperience;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerExperience extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerExperience extends StatTracker {
|
||||
public static HashMap<LivingArmour, Integer> changeMap = new HashMap<LivingArmour, Integer>();
|
||||
public static int[] experienceRequired = new int[]{100, 400, 1000, 1600, 3200, 5000, 7000, 9200, 11500, 140000};
|
||||
public double totalExperienceGained = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Integer> changeMap = new HashMap<LivingArmour, Integer>();
|
||||
public static int[] experienceRequired = new int[] { 100, 400, 1000, 1600, 3200, 5000, 7000, 9200, 11500, 140000 };
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, int exp)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + exp : exp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.experienced";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalExperienceGained = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalExperienceGained = tag.getDouble(BloodMagic.MODID + ".tracker.experienced");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setDouble(BloodMagic.MODID + ".tracker.experienced", totalExperienceGained);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
double change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalExperienceGained += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0);
|
||||
|
@ -72,23 +58,18 @@ public class StatTrackerExperience extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalExperienceGained >= experienceRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (totalExperienceGained >= experienceRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeExperience(i));
|
||||
}
|
||||
}
|
||||
|
@ -97,28 +78,27 @@ public class StatTrackerExperience extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalExperienceGained, experienceRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.experienced");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeExperience)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeExperience) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < experienceRequired.length)
|
||||
{
|
||||
if (level < experienceRequired.length) {
|
||||
totalExperienceGained = Math.max(totalExperienceGained, experienceRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, int exp) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + exp : exp);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +1,49 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeFallProtect;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerFallProtect extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerFallProtect extends StatTracker {
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] damageRequired = new int[]{30, 200, 400, 800, 1500};
|
||||
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 };
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.fallProtect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalDamage = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalDamage = tag.getInteger(BloodMagic.MODID + ".tracker.fallProtect");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger(BloodMagic.MODID + ".tracker.fallProtect", totalDamage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
double change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalDamage += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0d);
|
||||
|
@ -72,23 +58,18 @@ public class StatTrackerFallProtect extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (totalDamage >= damageRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (totalDamage >= damageRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeFallProtect(i));
|
||||
}
|
||||
}
|
||||
|
@ -97,28 +78,27 @@ public class StatTrackerFallProtect extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalDamage, damageRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.fallProtect");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeFallProtect)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeFallProtect) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < damageRequired.length)
|
||||
{
|
||||
if (level < damageRequired.length) {
|
||||
totalDamage = Math.max(totalDamage, damageRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,53 +1,45 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeFireResist;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerFireResist extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerFireResist extends StatTracker {
|
||||
public static int[] fireTicksRequired = new int[]{60 * 20, 3 * 60 * 20, 10 * 60 * 20, 20 * 60 * 20, 25 * 60 * 20};
|
||||
public int totalFireTicks = 0;
|
||||
|
||||
public static int[] fireTicksRequired = new int[] { 60 * 20, 3 * 60 * 20, 10 * 60 * 20, 20 * 60 * 20, 25 * 60 * 20 };
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.fire";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalFireTicks = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalFireTicks = tag.getInteger(BloodMagic.MODID + ".tracker.fire");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger(BloodMagic.MODID + ".tracker.fire", totalFireTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (player.isBurning())
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (player.isBurning()) {
|
||||
totalFireTicks++;
|
||||
this.markDirty();
|
||||
return true;
|
||||
|
@ -57,20 +49,16 @@ public class StatTrackerFireResist extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (totalFireTicks >= fireTicksRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (totalFireTicks >= fireTicksRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeFireResist(i));
|
||||
}
|
||||
}
|
||||
|
@ -79,25 +67,20 @@ public class StatTrackerFireResist extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalFireTicks, fireTicksRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.fireResist");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeFireResist)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeFireResist) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < fireTicksRequired.length)
|
||||
{
|
||||
if (level < fireTicksRequired.length) {
|
||||
totalFireTicks = Math.max(totalFireTicks, fireTicksRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
|
|
|
@ -1,58 +1,51 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeKnockbackResist;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeKnockbackResist;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class StatTrackerFood extends StatTracker
|
||||
{
|
||||
public class StatTrackerFood extends StatTracker {
|
||||
public static Map<EntityPlayer, Integer> lastFoodEatenMap = new HashMap<EntityPlayer, Integer>();
|
||||
|
||||
public static int[] foodRequired = new int[] { 100, 200, 300, 500, 1000 };
|
||||
public static int[] foodRequired = new int[]{100, 200, 300, 500, 1000};
|
||||
|
||||
public int foodEaten = 0;
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.foodEaten";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.foodEaten = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
foodEaten = tag.getInteger(BloodMagic.MODID + ".tracker.foodEaten");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger(BloodMagic.MODID + ".tracker.foodEaten", foodEaten);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (!lastFoodEatenMap.containsKey(player))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (!lastFoodEatenMap.containsKey(player)) {
|
||||
lastFoodEatenMap.put(player, 20);
|
||||
return false;
|
||||
}
|
||||
|
@ -61,8 +54,7 @@ public class StatTrackerFood extends StatTracker
|
|||
int prevFood = lastFoodEatenMap.get(player);
|
||||
lastFoodEatenMap.put(player, currentFood);
|
||||
|
||||
if (currentFood > prevFood)
|
||||
{
|
||||
if (currentFood > prevFood) {
|
||||
foodEaten += (currentFood - prevFood);
|
||||
|
||||
markDirty();
|
||||
|
@ -74,23 +66,18 @@ public class StatTrackerFood extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (lastFoodEatenMap.containsKey(player))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (lastFoodEatenMap.containsKey(player)) {
|
||||
lastFoodEatenMap.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < foodRequired.length; i++)
|
||||
{
|
||||
if (foodEaten >= foodRequired[i])
|
||||
{
|
||||
for (int i = 0; i < foodRequired.length; i++) {
|
||||
if (foodEaten >= foodRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeKnockbackResist(i));
|
||||
}
|
||||
}
|
||||
|
@ -99,25 +86,20 @@ public class StatTrackerFood extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(foodEaten, foodRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.knockback");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeKnockbackResist)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeKnockbackResist) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < foodRequired.length)
|
||||
{
|
||||
if (level < foodRequired.length) {
|
||||
foodEaten = Math.max(foodEaten, foodRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
|
|
|
@ -1,63 +1,49 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeGraveDigger;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerGraveDigger extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerGraveDigger extends StatTracker {
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] damageRequired = new int[]{200, 800, 1300, 2500, 3800, 5000, 7000, 9200, 11500, 140000};
|
||||
public double totalDamageDealt = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] damageRequired = new int[] { 200, 800, 1300, 2500, 3800, 5000, 7000, 9200, 11500, 140000 };
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.graveDigger";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalDamageDealt = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalDamageDealt = tag.getDouble(BloodMagic.MODID + ".tracker.graveDigger");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setDouble(BloodMagic.MODID + ".tracker.graveDigger", totalDamageDealt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
double change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalDamageDealt += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0d);
|
||||
|
@ -72,23 +58,18 @@ public class StatTrackerGraveDigger extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalDamageDealt >= damageRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (totalDamageDealt >= damageRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeGraveDigger(i));
|
||||
}
|
||||
}
|
||||
|
@ -97,28 +78,27 @@ public class StatTrackerGraveDigger extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalDamageDealt, damageRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.graveDigger");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeGraveDigger)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeGraveDigger) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < damageRequired.length)
|
||||
{
|
||||
if (level < damageRequired.length) {
|
||||
totalDamageDealt = Math.max(totalDamageDealt, damageRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,70 +1,49 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeGrimReaperSprint;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerGrimReaperSprint extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerGrimReaperSprint extends StatTracker {
|
||||
public static HashMap<LivingArmour, Integer> changeMap = new HashMap<LivingArmour, Integer>();
|
||||
public static int[] deathsRequired = new int[]{6, 10, 15, 25, 50, 70, 90, 120, 150, 200}; //TODO: Modify
|
||||
public int totalDeaths = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Integer> changeMap = new HashMap<LivingArmour, Integer>();
|
||||
public static int[] deathsRequired = new int[] { 6, 10, 15, 25, 50, 70, 90, 120, 150, 200 }; //TODO: Modify
|
||||
|
||||
public static void incrementCounter(LivingArmour armour)
|
||||
{
|
||||
StatTracker tracker = armour.getTracker(BloodMagic.MODID + ".tracker.grimReaper");
|
||||
if (tracker instanceof StatTrackerGrimReaperSprint)
|
||||
{
|
||||
((StatTrackerGrimReaperSprint) tracker).totalDeaths++;
|
||||
System.out.println(((StatTrackerGrimReaperSprint) tracker).totalDeaths);
|
||||
tracker.markDirty();
|
||||
}
|
||||
// changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + 1 : 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.grimReaper";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalDeaths = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalDeaths = tag.getInteger(BloodMagic.MODID + ".tracker.grimReaper");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger(BloodMagic.MODID + ".tracker.grimReaper", totalDeaths);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
double change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalDeaths += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0);
|
||||
|
@ -79,23 +58,18 @@ public class StatTrackerGrimReaperSprint extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalDeaths >= deathsRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (totalDeaths >= deathsRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeGrimReaperSprint(i));
|
||||
}
|
||||
}
|
||||
|
@ -104,28 +78,33 @@ public class StatTrackerGrimReaperSprint extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalDeaths, deathsRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.grimReaper");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeGrimReaperSprint)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeGrimReaperSprint) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < deathsRequired.length)
|
||||
{
|
||||
if (level < deathsRequired.length) {
|
||||
totalDeaths = Math.max(totalDeaths, deathsRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour) {
|
||||
StatTracker tracker = armour.getTracker(BloodMagic.MODID + ".tracker.grimReaper");
|
||||
if (tracker instanceof StatTrackerGrimReaperSprint) {
|
||||
((StatTrackerGrimReaperSprint) tracker).totalDeaths++;
|
||||
System.out.println(((StatTrackerGrimReaperSprint) tracker).totalDeaths);
|
||||
tracker.markDirty();
|
||||
}
|
||||
// changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + 1 : 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +1,49 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeHealthboost;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerHealthboost extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerHealthboost extends StatTracker {
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] healthedRequired = new int[]{80, 200, 340, 540, 800, 1600, 2800, 5000, 7600, 10000};
|
||||
public double totalHealthGenned = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] healthedRequired = new int[] { 80, 200, 340, 540, 800, 1600, 2800, 5000, 7600, 10000 };
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double health)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + health : health);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.health";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalHealthGenned = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalHealthGenned = tag.getDouble(BloodMagic.MODID + ".tracker.health");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setDouble(BloodMagic.MODID + ".tracker.health", totalHealthGenned);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
double change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalHealthGenned += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0d);
|
||||
|
@ -72,23 +58,18 @@ public class StatTrackerHealthboost extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalHealthGenned >= healthedRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (totalHealthGenned >= healthedRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeHealthboost(i));
|
||||
}
|
||||
}
|
||||
|
@ -97,28 +78,27 @@ public class StatTrackerHealthboost extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalHealthGenned, healthedRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.health");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeHealthboost)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeHealthboost) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < healthedRequired.length)
|
||||
{
|
||||
if (level < healthedRequired.length) {
|
||||
totalHealthGenned = Math.max(totalHealthGenned, healthedRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double health) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + health : health);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,64 +1,51 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeJump;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerJump extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerJump extends StatTracker {
|
||||
public static HashMap<LivingArmour, Integer> changeMap = new HashMap<LivingArmour, Integer>();
|
||||
public static int[] jumpsRequired = new int[] { 30, 200, 400, 700, 1100, 1500, 2000, 2800, 3600, 5000 }; //testing
|
||||
public static int[] jumpsRequired = new int[]{30, 200, 400, 700, 1100, 1500, 2000, 2800, 3600, 5000}; //testing
|
||||
|
||||
public int totalJumps = 0;
|
||||
|
||||
public static void incrementCounter(LivingArmour armour)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + 1 : 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.jump";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalJumps = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalJumps = tag.getInteger(BloodMagic.MODID + ".tracker.jump");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger(BloodMagic.MODID + ".tracker.jump", totalJumps);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
int change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalJumps += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0);
|
||||
|
@ -73,23 +60,18 @@ public class StatTrackerJump extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalJumps >= jumpsRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (totalJumps >= jumpsRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeJump(i));
|
||||
}
|
||||
}
|
||||
|
@ -98,28 +80,27 @@ public class StatTrackerJump extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalJumps, jumpsRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.jump");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeJump)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeJump) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < jumpsRequired.length)
|
||||
{
|
||||
if (level < jumpsRequired.length) {
|
||||
totalJumps = Math.max(totalJumps, jumpsRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + 1 : 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +1,49 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeMeleeDamage;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerMeleeDamage extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerMeleeDamage extends StatTracker {
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] damageRequired = new int[]{200, 800, 1300, 2500, 3800, 5000, 7000, 9200, 11500, 140000};
|
||||
public double totalDamageDealt = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] damageRequired = new int[] { 200, 800, 1300, 2500, 3800, 5000, 7000, 9200, 11500, 140000 };
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.meleeDamage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalDamageDealt = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalDamageDealt = tag.getDouble(BloodMagic.MODID + ".tracker.meleeDamage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setDouble(BloodMagic.MODID + ".tracker.meleeDamage", totalDamageDealt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
double change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalDamageDealt += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0d);
|
||||
|
@ -72,23 +58,18 @@ public class StatTrackerMeleeDamage extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalDamageDealt >= damageRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (totalDamageDealt >= damageRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeMeleeDamage(i));
|
||||
}
|
||||
}
|
||||
|
@ -97,28 +78,27 @@ public class StatTrackerMeleeDamage extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalDamageDealt, damageRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.meleeDamage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeMeleeDamage)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeMeleeDamage) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < damageRequired.length)
|
||||
{
|
||||
if (level < damageRequired.length) {
|
||||
totalDamageDealt = Math.max(totalDamageDealt, damageRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,73 +1,64 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSpeed;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSpeed;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class StatTrackerMovement extends StatTracker
|
||||
{
|
||||
public class StatTrackerMovement extends StatTracker {
|
||||
public static Map<EntityPlayer, Double> lastPosX = new HashMap<EntityPlayer, Double>();
|
||||
public static Map<EntityPlayer, Double> lastPosZ = new HashMap<EntityPlayer, Double>();
|
||||
|
||||
public static int[] blocksRequired = new int[] { 200, 1000, 2000, 4000, 7000, 15000, 25000, 35000, 50000, 70000 };
|
||||
public static int[] blocksRequired = new int[]{200, 1000, 2000, 4000, 7000, 15000, 25000, 35000, 50000, 70000};
|
||||
|
||||
public double totalMovement = 0;
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.movement";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalMovement = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalMovement = tag.getDouble(BloodMagic.MODID + ".tracker.movement");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setDouble(BloodMagic.MODID + ".tracker.movement", totalMovement);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (!lastPosX.containsKey(player))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (!lastPosX.containsKey(player)) {
|
||||
lastPosX.put(player, player.posX);
|
||||
lastPosZ.put(player, player.posZ);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!player.onGround)
|
||||
{
|
||||
if (!player.onGround) {
|
||||
return false;
|
||||
}
|
||||
|
||||
double distanceTravelled = Math.sqrt(Math.pow(lastPosX.get(player) - player.posX, 2) + Math.pow(lastPosZ.get(player) - player.posZ, 2));
|
||||
|
||||
if (distanceTravelled > 0.0001 && distanceTravelled < 2)
|
||||
{
|
||||
if (distanceTravelled > 0.0001 && distanceTravelled < 2) {
|
||||
totalMovement += distanceTravelled;
|
||||
|
||||
lastPosX.put(player, player.posX);
|
||||
|
@ -85,20 +76,16 @@ public class StatTrackerMovement extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalMovement >= blocksRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (totalMovement >= blocksRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeSpeed(i));
|
||||
}
|
||||
}
|
||||
|
@ -107,25 +94,20 @@ public class StatTrackerMovement extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalMovement, blocksRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.movement");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeSpeed)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeSpeed) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < blocksRequired.length)
|
||||
{
|
||||
if (level < blocksRequired.length) {
|
||||
totalMovement = Math.max(totalMovement, blocksRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
|
|
|
@ -1,72 +1,57 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeNightSight;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerNightSight extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerNightSight extends StatTracker {
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] damageRequired = new int[]{0, 200, 800, 1300, 2500, 3800, 5000, 7000, 9200, 11500};
|
||||
public static int neededNightVision = 3 * 60 * 20;
|
||||
public double totalDamageDealt = 0;
|
||||
public int totalNightVision = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] damageRequired = new int[] { 0, 200, 800, 1300, 2500, 3800, 5000, 7000, 9200, 11500 };
|
||||
|
||||
public static int neededNightVision = 3 * 60 * 20;
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.nightSight";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalDamageDealt = 0;
|
||||
this.totalNightVision = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalDamageDealt = tag.getDouble(BloodMagic.MODID + ".tracker.nightSight");
|
||||
totalNightVision = tag.getInteger(BloodMagic.MODID + ".tracker.nightSightVision");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setDouble(BloodMagic.MODID + ".tracker.nightSight", totalDamageDealt);
|
||||
tag.setInteger(BloodMagic.MODID + ".tracker.nightSightVision", totalNightVision);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
boolean test = false;
|
||||
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
double change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalDamageDealt += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0d);
|
||||
|
@ -75,14 +60,12 @@ public class StatTrackerNightSight extends StatTracker
|
|||
}
|
||||
}
|
||||
|
||||
if (world.getLight(player.getPosition()) <= 9 && player.isPotionActive(MobEffects.NIGHT_VISION))
|
||||
{
|
||||
if (world.getLight(player.getPosition()) <= 9 && player.isPotionActive(MobEffects.NIGHT_VISION)) {
|
||||
totalNightVision++;
|
||||
test = true;
|
||||
}
|
||||
|
||||
if (test)
|
||||
{
|
||||
if (test) {
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
|
@ -90,28 +73,22 @@ public class StatTrackerNightSight extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
if (totalNightVision < neededNightVision)
|
||||
{
|
||||
if (totalNightVision < neededNightVision) {
|
||||
return upgradeList;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalDamageDealt >= damageRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (totalDamageDealt >= damageRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeNightSight(i));
|
||||
}
|
||||
}
|
||||
|
@ -120,29 +97,28 @@ public class StatTrackerNightSight extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalDamageDealt, damageRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.nightSight");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeNightSight)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeNightSight) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < damageRequired.length)
|
||||
{
|
||||
if (level < damageRequired.length) {
|
||||
totalDamageDealt = Math.max(totalDamageDealt, damageRequired[level]);
|
||||
totalNightVision = neededNightVision;
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +1,49 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradePhysicalProtect;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerPhysicalProtect extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerPhysicalProtect extends StatTracker {
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] damageRequired = new int[]{30, 50, 80, 140, 200, 300, 400, 500, 650, 800};
|
||||
public int totalDamage = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] damageRequired = new int[] { 30, 50, 80, 140, 200, 300, 400, 500, 650, 800 };
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.physicalProtect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalDamage = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalDamage = tag.getInteger(BloodMagic.MODID + ".tracker.physicalProtect");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger(BloodMagic.MODID + ".tracker.physicalProtect", totalDamage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
double change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalDamage += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0d);
|
||||
|
@ -72,23 +58,18 @@ public class StatTrackerPhysicalProtect extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalDamage >= damageRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (totalDamage >= damageRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradePhysicalProtect(i));
|
||||
}
|
||||
}
|
||||
|
@ -97,28 +78,27 @@ public class StatTrackerPhysicalProtect extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalDamage, damageRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.physicalProtect");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradePhysicalProtect)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradePhysicalProtect) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < damageRequired.length)
|
||||
{
|
||||
if (level < damageRequired.length) {
|
||||
totalDamage = Math.max(totalDamage, damageRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,54 +1,46 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradePoisonResist;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerPoison extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerPoison extends StatTracker {
|
||||
public static int[] poisonTicksRequired = new int[]{60 * 20, 3 * 60 * 20, 10 * 60 * 20, 20 * 60 * 20, 25 * 60 * 20};
|
||||
public int totalPoisonTicks = 0;
|
||||
|
||||
public static int[] poisonTicksRequired = new int[] { 60 * 20, 3 * 60 * 20, 10 * 60 * 20, 20 * 60 * 20, 25 * 60 * 20 };
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.poison";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalPoisonTicks = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalPoisonTicks = tag.getInteger(BloodMagic.MODID + ".tracker.poison");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger(BloodMagic.MODID + ".tracker.poison", totalPoisonTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (player.isPotionActive(MobEffects.POISON))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (player.isPotionActive(MobEffects.POISON)) {
|
||||
totalPoisonTicks++;
|
||||
this.markDirty();
|
||||
return true;
|
||||
|
@ -58,20 +50,16 @@ public class StatTrackerPoison extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (totalPoisonTicks >= poisonTicksRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (totalPoisonTicks >= poisonTicksRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradePoisonResist(i));
|
||||
}
|
||||
}
|
||||
|
@ -80,25 +68,20 @@ public class StatTrackerPoison extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalPoisonTicks, poisonTicksRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.poisonResist");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradePoisonResist)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradePoisonResist) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < poisonTicksRequired.length)
|
||||
{
|
||||
if (level < poisonTicksRequired.length) {
|
||||
totalPoisonTicks = Math.max(totalPoisonTicks, poisonTicksRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
|
|
|
@ -1,63 +1,49 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeRepairing;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerRepairing extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerRepairing extends StatTracker {
|
||||
public static HashMap<LivingArmour, Integer> changeMap = new HashMap<LivingArmour, Integer>();
|
||||
public static int[] damageRequired = new int[]{500};
|
||||
public double totalDamage = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Integer> changeMap = new HashMap<LivingArmour, Integer>();
|
||||
public static int[] damageRequired = new int[] { 500 };
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, int receivedDamage)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + receivedDamage : receivedDamage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.repair";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalDamage = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalDamage = tag.getDouble(BloodMagic.MODID + ".tracker.repair");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setDouble(BloodMagic.MODID + ".tracker.repair", totalDamage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
double change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalDamage += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0);
|
||||
|
@ -72,23 +58,18 @@ public class StatTrackerRepairing extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
if (totalDamage >= damageRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 1; i++) {
|
||||
if (totalDamage >= damageRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeRepairing(i));
|
||||
}
|
||||
}
|
||||
|
@ -97,28 +78,27 @@ public class StatTrackerRepairing extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalDamage, damageRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.repair");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeRepairing)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeRepairing) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < damageRequired.length)
|
||||
{
|
||||
if (level < damageRequired.length) {
|
||||
totalDamage = Math.max(totalDamage, damageRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, int receivedDamage) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + receivedDamage : receivedDamage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,64 +1,51 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSelfSacrifice;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerSelfSacrifice extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerSelfSacrifice extends StatTracker {
|
||||
public static HashMap<LivingArmour, Integer> changeMap = new HashMap<LivingArmour, Integer>();
|
||||
public static int[] sacrificesRequired = new int[] { 30, 200, 400, 700, 1100, 1500, 2000, 2800, 3600, 5000 }; //testing
|
||||
public static int[] sacrificesRequired = new int[]{30, 200, 400, 700, 1100, 1500, 2000, 2800, 3600, 5000}; //testing
|
||||
|
||||
public int totalSacrifices = 0;
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, int hearts)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + hearts : hearts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.selfSacrifice";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalSacrifices = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalSacrifices = tag.getInteger(BloodMagic.MODID + ".tracker.selfSacrifice");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger(BloodMagic.MODID + ".tracker.selfSacrifice", totalSacrifices);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
int change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalSacrifices += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0);
|
||||
|
@ -73,23 +60,18 @@ public class StatTrackerSelfSacrifice extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalSacrifices >= sacrificesRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (totalSacrifices >= sacrificesRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeSelfSacrifice(i));
|
||||
}
|
||||
}
|
||||
|
@ -98,28 +80,27 @@ public class StatTrackerSelfSacrifice extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalSacrifices, sacrificesRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.selfSacrifice");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeSelfSacrifice)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeSelfSacrifice) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < sacrificesRequired.length)
|
||||
{
|
||||
if (level < sacrificesRequired.length) {
|
||||
totalSacrifices = Math.max(totalSacrifices, sacrificesRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, int hearts) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + hearts : hearts);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +1,49 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSolarPowered;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerSolarPowered extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerSolarPowered extends StatTracker {
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] healthedRequired = new int[]{70, 150, 300, 500, 700, 1400, 2400, 4000, 7000, 9000};
|
||||
public double totalHealthGenned = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] healthedRequired = new int[] { 70, 150, 300, 500, 700, 1400, 2400, 4000, 7000, 9000 };
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double health)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + health : health);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.solarPowered";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalHealthGenned = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalHealthGenned = tag.getDouble(BloodMagic.MODID + ".tracker.solarPowered");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setDouble(BloodMagic.MODID + ".tracker.solarPowered", totalHealthGenned);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
double change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalHealthGenned += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0d);
|
||||
|
@ -72,23 +58,18 @@ public class StatTrackerSolarPowered extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalHealthGenned >= healthedRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (totalHealthGenned >= healthedRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeSolarPowered(i));
|
||||
}
|
||||
}
|
||||
|
@ -97,28 +78,27 @@ public class StatTrackerSolarPowered extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalHealthGenned, healthedRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.solarPowered");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeSolarPowered)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeSolarPowered) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < healthedRequired.length)
|
||||
{
|
||||
if (level < healthedRequired.length) {
|
||||
totalHealthGenned = Math.max(totalHealthGenned, healthedRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double health) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + health : health);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +1,49 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSprintAttack;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class StatTrackerSprintAttack extends StatTracker
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StatTrackerSprintAttack extends StatTracker {
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] damageRequired = new int[]{200, 800, 1300, 2500, 3800};
|
||||
public double totalDamageDealt = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||
public static int[] damageRequired = new int[] { 200, 800, 1300, 2500, 3800 };
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage)
|
||||
{
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.sprintAttack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalDamageDealt = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalDamageDealt = tag.getDouble(BloodMagic.MODID + ".tracker.sprintAttack");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setDouble(BloodMagic.MODID + ".tracker.sprintAttack", totalDamageDealt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
double change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
if (change > 0) {
|
||||
totalDamageDealt += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0d);
|
||||
|
@ -72,23 +58,18 @@ public class StatTrackerSprintAttack extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour)) {
|
||||
changeMap.remove(livingArmour);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (totalDamageDealt >= damageRequired[i])
|
||||
{
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (totalDamageDealt >= damageRequired[i]) {
|
||||
upgradeList.add(new LivingArmourUpgradeSprintAttack(i));
|
||||
}
|
||||
}
|
||||
|
@ -97,28 +78,27 @@ public class StatTrackerSprintAttack extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
return Utils.calculateStandardProgress(totalDamageDealt, damageRequired, currentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.sprintAttack");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeSprintAttack)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeSprintAttack) {
|
||||
int level = upgrade.getUpgradeLevel();
|
||||
if (level < damageRequired.length)
|
||||
{
|
||||
if (level < damageRequired.length) {
|
||||
totalDamageDealt = Math.max(totalDamageDealt, damageRequired[level]);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementCounter(LivingArmour armour, double damage) {
|
||||
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeStepAssist;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeStepAssist;
|
||||
|
||||
public class StatTrackerStepAssist extends StatTracker
|
||||
{
|
||||
public class StatTrackerStepAssist extends StatTracker {
|
||||
public static Map<EntityPlayer, Double> lastPosX = new HashMap<EntityPlayer, Double>();
|
||||
public static Map<EntityPlayer, Double> lastPosZ = new HashMap<EntityPlayer, Double>();
|
||||
|
||||
|
@ -24,49 +23,41 @@ public class StatTrackerStepAssist extends StatTracker
|
|||
public double totalMovement = 0;
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".tracker.stepAssist";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
public void resetTracker() {
|
||||
this.totalMovement = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
totalMovement = tag.getDouble(BloodMagic.MODID + ".tracker.stepAssist");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setDouble(BloodMagic.MODID + ".tracker.stepAssist", totalMovement);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (!lastPosX.containsKey(player))
|
||||
{
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
if (!lastPosX.containsKey(player)) {
|
||||
lastPosX.put(player, player.posX);
|
||||
lastPosZ.put(player, player.posZ);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!player.onGround || player.stepHeight < 1)
|
||||
{
|
||||
if (!player.onGround || player.stepHeight < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
double distanceTravelled = Math.sqrt(Math.pow(lastPosX.get(player) - player.posX, 2) + Math.pow(lastPosZ.get(player) - player.posZ, 2));
|
||||
|
||||
if (distanceTravelled > 0.0001 && distanceTravelled < 2)
|
||||
{
|
||||
if (distanceTravelled > 0.0001 && distanceTravelled < 2) {
|
||||
double previousMovement = totalMovement;
|
||||
totalMovement += distanceTravelled;
|
||||
|
||||
|
@ -85,18 +76,15 @@ public class StatTrackerStepAssist extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
public List<LivingArmourUpgrade> getUpgrades() {
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
if (totalMovement >= blocksRequired)
|
||||
{
|
||||
if (totalMovement >= blocksRequired) {
|
||||
upgradeList.add(new LivingArmourUpgradeStepAssist(0));
|
||||
}
|
||||
|
||||
|
@ -104,8 +92,7 @@ public class StatTrackerStepAssist extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel)
|
||||
{
|
||||
public double getProgress(LivingArmour livingArmour, int currentLevel) {
|
||||
if (currentLevel == 1)
|
||||
return 1.0D;
|
||||
|
||||
|
@ -113,16 +100,13 @@ public class StatTrackerStepAssist extends StatTracker
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean providesUpgrade(String key)
|
||||
{
|
||||
public boolean providesUpgrade(String key) {
|
||||
return key.equals(BloodMagic.MODID + ".upgrade.stepAssist");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
|
||||
{
|
||||
if (upgrade instanceof LivingArmourUpgradeStepAssist)
|
||||
{
|
||||
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade) {
|
||||
if (upgrade instanceof LivingArmourUpgradeStepAssist) {
|
||||
totalMovement = Math.max(totalMovement, blocksRequired);
|
||||
this.markDirty();
|
||||
}
|
||||
|
|
|
@ -1,26 +1,22 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeArrowProtect extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 4, 9, 16, 30, 60, 90, 125, 165, 210, 250 };
|
||||
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 class LivingArmourUpgradeArrowProtect extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{4, 9, 16, 30, 60, 90, 125, 165, 210, 250};
|
||||
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)
|
||||
{
|
||||
public LivingArmourUpgradeArrowProtect(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getArmourProtection(EntityLivingBase wearer, DamageSource source)
|
||||
{
|
||||
if (source.isProjectile())
|
||||
{
|
||||
public double getArmourProtection(EntityLivingBase wearer, DamageSource source) {
|
||||
if (source.isProjectile()) {
|
||||
return protectionLevel[this.level];
|
||||
}
|
||||
|
||||
|
@ -28,38 +24,32 @@ public class LivingArmourUpgradeArrowProtect extends LivingArmourUpgrade
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.arrowProtect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "arrowProtect";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,60 +7,50 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
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 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)
|
||||
{
|
||||
public LivingArmourUpgradeArrowShot(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.arrowShot";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 5; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "arrowShot";
|
||||
}
|
||||
|
||||
public int getExtraArrows()
|
||||
{
|
||||
public int getExtraArrows() {
|
||||
return extraArrow[this.level];
|
||||
}
|
||||
}
|
|
@ -1,74 +1,63 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeCriticalStrike extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 5, 12, 22, 35, 49 };
|
||||
public static final double[] damageBoost = new double[] { 0.1, 0.2, 0.3, 0.4, 0.5 };
|
||||
public class LivingArmourUpgradeCriticalStrike extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{5, 12, 22, 35, 49};
|
||||
public static final double[] damageBoost = new double[]{0.1, 0.2, 0.3, 0.4, 0.5};
|
||||
|
||||
public LivingArmourUpgradeCriticalStrike(int level)
|
||||
{
|
||||
public LivingArmourUpgradeCriticalStrike(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAdditionalDamageOnHit(double damage, EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon)
|
||||
{
|
||||
public double getAdditionalDamageOnHit(double damage, EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon) {
|
||||
boolean flag = wearer.fallDistance > 0.0F && !wearer.onGround && !wearer.isOnLadder() && !wearer.isInWater() && !wearer.isPotionActive(MobEffects.BLINDNESS) && !wearer.isRiding() && !wearer.isSprinting();
|
||||
|
||||
if (flag)
|
||||
{
|
||||
if (flag) {
|
||||
return getDamageModifier() * damage;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getDamageModifier()
|
||||
{
|
||||
public double getDamageModifier() {
|
||||
return damageBoost[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.criticalStrike";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "criticalStrike";
|
||||
}
|
||||
}
|
|
@ -1,90 +1,75 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
|
||||
public class LivingArmourUpgradeDigging extends LivingArmourUpgrade
|
||||
{
|
||||
import java.util.HashMap;
|
||||
|
||||
public class LivingArmourUpgradeDigging extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{5, 10, 18, 32, 60, 90, 140, 180, 240, 300};
|
||||
public static final int[] digSpeedTime = new int[]{0, 50, 60, 100, 100, 100, 100, 150, 150, 150};
|
||||
public static final int[] digSpeedLevel = new int[]{0, 0, 0, 1, 1, 1, 1, 1, 2, 2};
|
||||
public static final double[] digSpeedModifier = new double[]{1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2, 2.2, 2.5};
|
||||
public static HashMap<ILivingArmour, Boolean> changeMap = new HashMap<ILivingArmour, Boolean>();
|
||||
|
||||
public static final int[] costs = new int[] { 5, 10, 18, 32, 60, 90, 140, 180, 240, 300 };
|
||||
public static final int[] digSpeedTime = new int[] { 0, 50, 60, 100, 100, 100, 100, 150, 150, 150 };
|
||||
public static final int[] digSpeedLevel = new int[] { 0, 0, 0, 1, 1, 1, 1, 1, 2, 2 };
|
||||
|
||||
public static final double[] digSpeedModifier = new double[] { 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2, 2.2, 2.5 };
|
||||
|
||||
public static void hasDug(LivingArmour armour)
|
||||
{
|
||||
changeMap.put(armour, true);
|
||||
}
|
||||
|
||||
public LivingArmourUpgradeDigging(int level)
|
||||
{
|
||||
public LivingArmourUpgradeDigging(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMiningSpeedModifier(EntityPlayer player)
|
||||
{
|
||||
public double getMiningSpeedModifier(EntityPlayer player) {
|
||||
return digSpeedModifier[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour) && changeMap.get(livingArmour))
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
if (changeMap.containsKey(livingArmour) && changeMap.get(livingArmour)) {
|
||||
changeMap.put(livingArmour, false);
|
||||
|
||||
if (digSpeedTime[this.level] > 0)
|
||||
{
|
||||
if (digSpeedTime[this.level] > 0) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.SPEED, digSpeedTime[this.level], digSpeedLevel[this.level], false, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.digging";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "digging";
|
||||
}
|
||||
|
||||
public static void hasDug(LivingArmour armour) {
|
||||
changeMap.put(armour, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,54 +7,45 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class LivingArmourUpgradeElytra extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 20 };
|
||||
public class LivingArmourUpgradeElytra extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{20};
|
||||
|
||||
public LivingArmourUpgradeElytra(int level)
|
||||
{
|
||||
public LivingArmourUpgradeElytra(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.elytra";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 1; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "elytra";
|
||||
}
|
||||
}
|
|
@ -4,54 +4,45 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class LivingArmourUpgradeExperience extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 7, 13, 22, 40, 65, 90, 130, 180, 250, 350 };
|
||||
public static final double[] experienceModifier = new double[] { 0.15, 0.3, 0.45, 0.6, 0.75, 0.9, 1.05, 1.2, 1.35, 1.5 };
|
||||
public class LivingArmourUpgradeExperience extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{7, 13, 22, 40, 65, 90, 130, 180, 250, 350};
|
||||
public static final double[] experienceModifier = new double[]{0.15, 0.3, 0.45, 0.6, 0.75, 0.9, 1.05, 1.2, 1.35, 1.5};
|
||||
|
||||
public LivingArmourUpgradeExperience(int level)
|
||||
{
|
||||
public LivingArmourUpgradeExperience(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
public double getExperienceModifier()
|
||||
{
|
||||
public double getExperienceModifier() {
|
||||
return experienceModifier[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.experienced";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "experienced";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,21 +6,17 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
||||
public class LivingArmourUpgradeFallProtect extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 2, 5, 9, 15, 25 };
|
||||
public static final double[] protectionLevel = new double[] { 0.2, 0.4, 0.6, 0.8, 1 };
|
||||
public class LivingArmourUpgradeFallProtect extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{2, 5, 9, 15, 25};
|
||||
public static final double[] protectionLevel = new double[]{0.2, 0.4, 0.6, 0.8, 1};
|
||||
|
||||
public LivingArmourUpgradeFallProtect(int level)
|
||||
{
|
||||
public LivingArmourUpgradeFallProtect(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getArmourProtection(EntityLivingBase wearer, DamageSource source)
|
||||
{
|
||||
if (source.equals(DamageSource.FALL))
|
||||
{
|
||||
public double getArmourProtection(EntityLivingBase wearer, DamageSource source) {
|
||||
if (source.equals(DamageSource.FALL)) {
|
||||
return protectionLevel[this.level];
|
||||
}
|
||||
|
||||
|
@ -28,38 +24,32 @@ public class LivingArmourUpgradeFallProtect extends LivingArmourUpgrade
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.fallProtect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 5; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "fallProtect";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,80 +1,69 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
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.helper.TextHelper;
|
||||
|
||||
public class LivingArmourUpgradeFireResist extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 2, 6, 14, 25, 40 };
|
||||
public static final int[] fireCooldownTime = new int[] { 5 * 60 * 20, 5 * 60 * 20, 4 * 60 * 20, 3 * 60 * 20, 2 * 60 * 20 };
|
||||
public static final int[] fireResistDuration = new int[] { 30 * 20, 30 * 20, 40 * 20, 50 * 20, 60 * 20 };
|
||||
public class LivingArmourUpgradeFireResist extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{2, 6, 14, 25, 40};
|
||||
public static final int[] fireCooldownTime = new int[]{5 * 60 * 20, 5 * 60 * 20, 4 * 60 * 20, 3 * 60 * 20, 2 * 60 * 20};
|
||||
public static final int[] fireResistDuration = new int[]{30 * 20, 30 * 20, 40 * 20, 50 * 20, 60 * 20};
|
||||
|
||||
public int fireCooldown = 0;
|
||||
|
||||
public LivingArmourUpgradeFireResist(int level)
|
||||
{
|
||||
public LivingArmourUpgradeFireResist(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (player.isBurning() && fireCooldown <= 0)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
if (player.isBurning() && fireCooldown <= 0) {
|
||||
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, fireResistDuration[this.level]));
|
||||
fireCooldown = fireCooldownTime[this.level];
|
||||
|
||||
player.sendStatusMessage(new TextComponentString(TextHelper.localizeEffect(chatBase + "fireRemove")), true);
|
||||
|
||||
} else if (fireCooldown > 0)
|
||||
{
|
||||
} else if (fireCooldown > 0) {
|
||||
fireCooldown--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.fireResist";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 5; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger(Constants.NBT.UPGRADE_FIRE_TIMER, fireCooldown);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
fireCooldown = tag.getInteger(Constants.NBT.UPGRADE_FIRE_TIMER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "fireResist";
|
||||
}
|
||||
}
|
|
@ -1,72 +1,61 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeGraveDigger extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 5, 12, 20, 35, 49, 78, 110, 160, 215, 320 };
|
||||
public static final double[] damageBoost = new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||
public class LivingArmourUpgradeGraveDigger extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{5, 12, 20, 35, 49, 78, 110, 160, 215, 320};
|
||||
public static final double[] damageBoost = new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||
|
||||
public LivingArmourUpgradeGraveDigger(int level)
|
||||
{
|
||||
public LivingArmourUpgradeGraveDigger(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAdditionalDamageOnHit(double damage, EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon)
|
||||
{
|
||||
if (!weapon.isEmpty() && weapon.getItem() instanceof ItemSpade)
|
||||
{
|
||||
public double getAdditionalDamageOnHit(double damage, EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon) {
|
||||
if (!weapon.isEmpty() && weapon.getItem() instanceof ItemSpade) {
|
||||
return getDamageModifier();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getDamageModifier()
|
||||
{
|
||||
public double getDamageModifier() {
|
||||
return damageBoost[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.graveDigger";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "graveDigger";
|
||||
}
|
||||
}
|
|
@ -1,91 +1,78 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
public class LivingArmourUpgradeGrimReaperSprint extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 20, 50, 130, 270, 450, 580, 700, 800, 900, 1000 };
|
||||
public static final int[] rebirthDelay = new int[] { 20 * 60 * 60, 20 * 60 * 50, 20 * 60 * 45, 20 * 60 * 40, 20 * 60 * 30, 20 * 60 * 25, 20 * 60 * 15, 20 * 60 * 10, 20 * 60 * 5, 20 * 60 };
|
||||
public static final int[] strengthDuration = new int[] { 0, 0, 100, 100, 200, 200, 200, 300, 300, 400 };
|
||||
public static final int[] strengthValue = new int[] { 0, 0, 0, 0, 0, 1, 1, 2, 2, 3 };
|
||||
public static final int[] resistanceDuration = new int[] { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 };
|
||||
public static final int[] resistanceValue = new int[] { 0, 0, 0, 0, 0, 1, 1, 2, 2, 3 };
|
||||
public static final float[] healthOnRevive = new float[] { 0.2f, 0.2f, 0.3f, 0.3f, 0.4f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f };
|
||||
public class LivingArmourUpgradeGrimReaperSprint extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{20, 50, 130, 270, 450, 580, 700, 800, 900, 1000};
|
||||
public static final int[] rebirthDelay = new int[]{20 * 60 * 60, 20 * 60 * 50, 20 * 60 * 45, 20 * 60 * 40, 20 * 60 * 30, 20 * 60 * 25, 20 * 60 * 15, 20 * 60 * 10, 20 * 60 * 5, 20 * 60};
|
||||
public static final int[] strengthDuration = new int[]{0, 0, 100, 100, 200, 200, 200, 300, 300, 400};
|
||||
public static final int[] strengthValue = new int[]{0, 0, 0, 0, 0, 1, 1, 2, 2, 3};
|
||||
public static final int[] resistanceDuration = new int[]{100, 100, 100, 100, 100, 100, 100, 100, 100, 100};
|
||||
public static final int[] resistanceValue = new int[]{0, 0, 0, 0, 0, 1, 1, 2, 2, 3};
|
||||
public static final float[] healthOnRevive = new float[]{0.2f, 0.2f, 0.3f, 0.3f, 0.4f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f};
|
||||
|
||||
public int deathTimer = 0;
|
||||
|
||||
public LivingArmourUpgradeGrimReaperSprint(int level)
|
||||
{
|
||||
public LivingArmourUpgradeGrimReaperSprint(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (deathTimer > 0)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
if (deathTimer > 0) {
|
||||
deathTimer--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.grimReaper";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
deathTimer = tag.getInteger(BloodMagic.MODID + ".tracker.grimReaper");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger(BloodMagic.MODID + ".tracker.grimReaper", deathTimer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "grimReaper";
|
||||
}
|
||||
|
||||
public void applyEffectOnRebirth(EntityPlayer player)
|
||||
{
|
||||
public void applyEffectOnRebirth(EntityPlayer player) {
|
||||
player.setHealth(player.getMaxHealth() * healthOnRevive[this.level]);
|
||||
|
||||
int strDur = strengthDuration[this.level];
|
||||
if (strDur > 0)
|
||||
{
|
||||
if (strDur > 0) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, strDur, strengthValue[this.level]));
|
||||
}
|
||||
|
||||
int resDur = resistanceDuration[this.level];
|
||||
if (resDur > 0)
|
||||
{
|
||||
if (resDur > 0) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, resDur, resistanceValue[this.level]));
|
||||
}
|
||||
|
||||
|
@ -93,8 +80,7 @@ public class LivingArmourUpgradeGrimReaperSprint extends LivingArmourUpgrade
|
|||
player.sendStatusMessage(new TextComponentString(TextHelper.localizeEffect(chatBase + "grimReaper")), true);
|
||||
}
|
||||
|
||||
public boolean canSavePlayer(EntityPlayer player)
|
||||
{
|
||||
public boolean canSavePlayer(EntityPlayer player) {
|
||||
return deathTimer <= 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,25 +14,21 @@ import org.apache.commons.codec.binary.StringUtils;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
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 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)
|
||||
{
|
||||
public LivingArmourUpgradeHealthboost(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers()
|
||||
{
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers() {
|
||||
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
|
||||
|
||||
String name = getUniqueIdentifier() + "-HealthModifier1";
|
||||
|
@ -42,38 +38,32 @@ public class LivingArmourUpgradeHealthboost extends LivingArmourUpgrade
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.health";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "health";
|
||||
}
|
||||
}
|
|
@ -1,75 +1,63 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeJump extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 3, 6, 11, 23, 37, 50, 70, 100, 140, 200 };
|
||||
public static final double[] jumpModifier = new double[] { 0.10, 0.2, 0.3, 0.4, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5 };
|
||||
public static final double[] fallModifier = new double[] { 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.75, 0.8, 0.85 };
|
||||
public class LivingArmourUpgradeJump extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{3, 6, 11, 23, 37, 50, 70, 100, 140, 200};
|
||||
public static final double[] jumpModifier = new double[]{0.10, 0.2, 0.3, 0.4, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5};
|
||||
public static final double[] fallModifier = new double[]{0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.75, 0.8, 0.85};
|
||||
|
||||
public LivingArmourUpgradeJump(int level)
|
||||
{
|
||||
public LivingArmourUpgradeJump(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
public double getJumpModifier()
|
||||
{
|
||||
public double getJumpModifier() {
|
||||
return jumpModifier[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.jump";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
if (!world.isRemote) {
|
||||
double motionY = player.motionY;
|
||||
|
||||
if (motionY < 0)
|
||||
{
|
||||
if (motionY < 0) {
|
||||
player.fallDistance = (float) Math.max(0, player.fallDistance + motionY * fallModifier[this.level]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "jump";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,27 +11,23 @@ import org.apache.commons.codec.binary.StringUtils;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
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 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)
|
||||
{
|
||||
public LivingArmourUpgradeKnockbackResist(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers()
|
||||
{
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers() {
|
||||
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
|
||||
|
||||
String name = getUniqueIdentifier() + "-KnockbackModifier1";
|
||||
modifierMap.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getName(), new AttributeModifier(UUID.nameUUIDFromBytes(StringUtils.getBytesUtf8(name)), "KnockbackModifier1", kbModifier[this.level], 0));
|
||||
|
||||
if (healthModifier[this.level] > 0)
|
||||
{
|
||||
if (healthModifier[this.level] > 0) {
|
||||
name = getUniqueIdentifier() + "-HealthModifier1";
|
||||
modifierMap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(UUID.nameUUIDFromBytes(StringUtils.getBytesUtf8(name)), "HealthModifier1", healthModifier[this.level], 0));
|
||||
}
|
||||
|
@ -40,38 +36,32 @@ public class LivingArmourUpgradeKnockbackResist extends LivingArmourUpgrade
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.knockback";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "knockback";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,25 +14,21 @@ import org.apache.commons.codec.binary.StringUtils;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
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 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)
|
||||
{
|
||||
public LivingArmourUpgradeMeleeDamage(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers()
|
||||
{
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers() {
|
||||
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
|
||||
|
||||
String name = getUniqueIdentifier() + "-DamageModifier1";
|
||||
|
@ -42,38 +38,32 @@ public class LivingArmourUpgradeMeleeDamage extends LivingArmourUpgrade
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.meleeDamage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "meleeDamage";
|
||||
}
|
||||
}
|
|
@ -1,6 +1,9 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
|
@ -8,84 +11,67 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
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 LivingArmourUpgradeNightSight extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 5, 8, 15, 20, 34, 45, 70, 100, 150, 200 };
|
||||
public static final double[] meleeDamage = new double[] { 0, 0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 6 };
|
||||
public class LivingArmourUpgradeNightSight extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{5, 8, 15, 20, 34, 45, 70, 100, 150, 200};
|
||||
public static final double[] meleeDamage = new double[]{0, 0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 6};
|
||||
|
||||
public boolean isActive = false;
|
||||
|
||||
public LivingArmourUpgradeNightSight(int level)
|
||||
{
|
||||
public LivingArmourUpgradeNightSight(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAdditionalDamageOnHit(double damage, EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon)
|
||||
{
|
||||
public double getAdditionalDamageOnHit(double damage, EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon) {
|
||||
return isActive ? meleeDamage[this.level] : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (world.getLight(player.getPosition()) <= 9)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
if (world.getLight(player.getPosition()) <= 9) {
|
||||
isActive = true;
|
||||
if (player.isPotionActive(MobEffects.NIGHT_VISION))
|
||||
{
|
||||
if (player.isPotionActive(MobEffects.NIGHT_VISION)) {
|
||||
int dur = player.getActivePotionEffect(MobEffects.NIGHT_VISION).getDuration();
|
||||
if (dur > 100 && dur < 20 * 60 * 20)
|
||||
{
|
||||
if (dur > 100 && dur < 20 * 60 * 20) {
|
||||
//Don't override the potion effect if the other potion effect is sufficiently long.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, Constants.Misc.NIGHT_VISION_CONSTANT_BEGIN, 0, false, false));
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
isActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.nightSight";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "nightSight";
|
||||
}
|
||||
}
|
|
@ -6,21 +6,17 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
||||
public class LivingArmourUpgradePhysicalProtect extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 5, 10, 18, 35, 65, 100, 140, 190, 250, 300 };
|
||||
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 class LivingArmourUpgradePhysicalProtect extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{5, 10, 18, 35, 65, 100, 140, 190, 250, 300};
|
||||
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)
|
||||
{
|
||||
public LivingArmourUpgradePhysicalProtect(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getArmourProtection(EntityLivingBase wearer, DamageSource source)
|
||||
{
|
||||
if (source.getTrueSource() != null && !source.isMagicDamage() && !source.isProjectile())
|
||||
{
|
||||
public double getArmourProtection(EntityLivingBase wearer, DamageSource source) {
|
||||
if (source.getTrueSource() != null && !source.isMagicDamage() && !source.isProjectile()) {
|
||||
return protectionLevel[this.level];
|
||||
}
|
||||
|
||||
|
@ -28,38 +24,32 @@ public class LivingArmourUpgradePhysicalProtect extends LivingArmourUpgrade
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.physicalProtect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "physicalProtect";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,82 +1,70 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
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.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 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)
|
||||
{
|
||||
public LivingArmourUpgradePoisonResist(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (player.isPotionActive(MobEffects.POISON) && poisonCooldown <= 0)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
if (player.isPotionActive(MobEffects.POISON) && poisonCooldown <= 0) {
|
||||
PotionEffect eff = player.getActivePotionEffect(MobEffects.POISON);
|
||||
if (eff.getAmplifier() <= poisonMaxCure[this.level])
|
||||
{
|
||||
if (eff.getAmplifier() <= poisonMaxCure[this.level]) {
|
||||
player.removePotionEffect(MobEffects.POISON);
|
||||
poisonCooldown = poisonCooldownTime[this.level];
|
||||
|
||||
player.sendStatusMessage(new TextComponentString(TextHelper.localize(chatBase + "poisonRemove")), true);
|
||||
}
|
||||
} else if (poisonCooldown > 0)
|
||||
{
|
||||
} else if (poisonCooldown > 0) {
|
||||
poisonCooldown--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.poisonResist";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 5; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger(Constants.NBT.UPGRADE_POISON_TIMER, poisonCooldown);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
poisonCooldown = tag.getInteger(Constants.NBT.UPGRADE_POISON_TIMER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "poisonResist";
|
||||
}
|
||||
}
|
|
@ -1,87 +1,73 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeRepairing extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 15 };
|
||||
public static final int[] repairDelay = new int[] { 200 };
|
||||
public class LivingArmourUpgradeRepairing extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{15};
|
||||
public static final int[] repairDelay = new int[]{200};
|
||||
|
||||
int maxRepair = 1;
|
||||
|
||||
int delay = 0;
|
||||
|
||||
public LivingArmourUpgradeRepairing(int level)
|
||||
{
|
||||
public LivingArmourUpgradeRepairing(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (delay <= 0)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
if (delay <= 0) {
|
||||
delay = repairDelay[this.level];
|
||||
|
||||
EntityEquipmentSlot randomSlot = EntityEquipmentSlot.values()[2 + world.rand.nextInt(4)];
|
||||
ItemStack repairStack = player.getItemStackFromSlot(randomSlot);
|
||||
if (!repairStack.isEmpty())
|
||||
{
|
||||
if (repairStack.isItemStackDamageable() && repairStack.isItemDamaged())
|
||||
{
|
||||
if (!repairStack.isEmpty()) {
|
||||
if (repairStack.isItemStackDamageable() && repairStack.isItemDamaged()) {
|
||||
int toRepair = Math.min(maxRepair, repairStack.getItemDamage());
|
||||
if (toRepair > 0)
|
||||
{
|
||||
if (toRepair > 0) {
|
||||
repairStack.setItemDamage(repairStack.getItemDamage() - toRepair);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
delay--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.repair";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 1; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger("repairingDelay", delay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
delay = tag.getInteger("repairingDelay");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "repair";
|
||||
}
|
||||
}
|
|
@ -4,55 +4,46 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class LivingArmourUpgradeSelfSacrifice extends 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 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)
|
||||
{
|
||||
public LivingArmourUpgradeSelfSacrifice(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
public double getSacrificeModifier()
|
||||
{
|
||||
public double getSacrificeModifier() {
|
||||
return sacrificeModifier[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.selfSacrifice";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "selfSacrifice";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
|
@ -8,29 +10,23 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeSolarPowered extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 5, 12, 20, 35, 49, 78, 110, 160, 215, 320 };
|
||||
public static final int[] regenCooldown = new int[] { 200, 180, 160, 120, 100, 80, 40, 20, 10, 10 };
|
||||
public static final int[] fireResistCooldown = new int[] { 1, 1, 60 * 60, 50 * 60, 40 * 60, 35 * 60, 30 * 60, 25 * 60, 20 * 60, 10 * 60 };
|
||||
public static final int[] fireResistTime = new int[] { 0, 0, 15 * 60, 20 * 60, 30 * 60, 35 * 60, 40 * 60, 50 * 60, 60 * 60, 100 * 60 };
|
||||
public static final double[] protectionLevel = new double[] { 0.02, 0.04, 0.06, 0.08, 0.10, 0.13, 0.16, 0.19, 0.22, 0.25 };
|
||||
public class LivingArmourUpgradeSolarPowered extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{5, 12, 20, 35, 49, 78, 110, 160, 215, 320};
|
||||
public static final int[] regenCooldown = new int[]{200, 180, 160, 120, 100, 80, 40, 20, 10, 10};
|
||||
public static final int[] fireResistCooldown = new int[]{1, 1, 60 * 60, 50 * 60, 40 * 60, 35 * 60, 30 * 60, 25 * 60, 20 * 60, 10 * 60};
|
||||
public static final int[] fireResistTime = new int[]{0, 0, 15 * 60, 20 * 60, 30 * 60, 35 * 60, 40 * 60, 50 * 60, 60 * 60, 100 * 60};
|
||||
public static final double[] protectionLevel = new double[]{0.02, 0.04, 0.06, 0.08, 0.10, 0.13, 0.16, 0.19, 0.22, 0.25};
|
||||
|
||||
public int counter = 0;
|
||||
|
||||
public LivingArmourUpgradeSolarPowered(int level)
|
||||
{
|
||||
public LivingArmourUpgradeSolarPowered(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getArmourProtection(EntityLivingBase wearer, DamageSource source)
|
||||
{
|
||||
if (wearer.getEntityWorld().canSeeSky(wearer.getPosition()) || wearer.getEntityWorld().provider.isDaytime())
|
||||
{
|
||||
public double getArmourProtection(EntityLivingBase wearer, DamageSource source) {
|
||||
if (wearer.getEntityWorld().canSeeSky(wearer.getPosition()) || wearer.getEntityWorld().provider.isDaytime()) {
|
||||
return protectionLevel[this.level];
|
||||
}
|
||||
|
||||
|
@ -38,56 +34,46 @@ public class LivingArmourUpgradeSolarPowered extends LivingArmourUpgrade
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
counter++;
|
||||
if (world.canSeeSky(player.getPosition()) || world.provider.isDaytime())
|
||||
{
|
||||
if (counter % regenCooldown[this.level] == 0 && player.getHealth() < player.getMaxHealth())
|
||||
{
|
||||
if (world.canSeeSky(player.getPosition()) || world.provider.isDaytime()) {
|
||||
if (counter % regenCooldown[this.level] == 0 && player.getHealth() < player.getMaxHealth()) {
|
||||
player.heal(1);
|
||||
}
|
||||
|
||||
if (fireResistTime[this.level] != 0 && counter % fireResistCooldown[this.level] == 0)
|
||||
{
|
||||
if (fireResistTime[this.level] != 0 && counter % fireResistCooldown[this.level] == 0) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, fireResistTime[this.level], 0, false, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.solarPowered";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger(BloodMagic.MODID + ".tracker.solarPowered", counter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
counter = tag.getInteger(BloodMagic.MODID + ".tracker.solarPowered");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "solarPowered";
|
||||
}
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -10,58 +12,46 @@ import net.minecraft.init.MobEffects;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import org.apache.commons.codec.binary.StringUtils;
|
||||
|
||||
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 };
|
||||
import java.util.UUID;
|
||||
|
||||
public LivingArmourUpgradeSpeed(int level)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
public double getSpeedModifier()
|
||||
{
|
||||
public double getSpeedModifier() {
|
||||
return speedModifier[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (player.isSprinting())
|
||||
{
|
||||
if (sprintSpeedTime[this.level] > 0)
|
||||
{
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
|
||||
if (player.isSprinting()) {
|
||||
if (sprintSpeedTime[this.level] > 0) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.SPEED, sprintSpeedTime[this.level], sprintSpeedLevel[this.level], false, false));
|
||||
}
|
||||
|
||||
if (sprintRegenTime[this.level] > 0 && !player.isPotionActive(MobEffects.REGENERATION))
|
||||
{
|
||||
if (sprintRegenTime[this.level] > 0 && !player.isPotionActive(MobEffects.REGENERATION)) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, sprintRegenTime[this.level], 0, false, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers()
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (healthModifier[this.level] > 0) {
|
||||
String name = getUniqueIdentifier() + "-HealthModifier1";
|
||||
modifierMap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(UUID.nameUUIDFromBytes(StringUtils.getBytesUtf8(name)), "HealthModifier1", healthModifier[this.level], 0));
|
||||
}
|
||||
|
@ -70,38 +60,32 @@ public class LivingArmourUpgradeSpeed extends LivingArmourUpgrade
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.movement";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "speed";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,28 +1,24 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeSprintAttack extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 3, 7, 15, 25, 40 };
|
||||
public static final double[] damageBoost = new double[] { 0.5, 0.75, 1, 1.25, 1.5 };
|
||||
public static final double[] knockbackModifier = new double[] { 1, 2, 3, 4, 5 };
|
||||
public class LivingArmourUpgradeSprintAttack extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{3, 7, 15, 25, 40};
|
||||
public static final double[] damageBoost = new double[]{0.5, 0.75, 1, 1.25, 1.5};
|
||||
public static final double[] knockbackModifier = new double[]{1, 2, 3, 4, 5};
|
||||
|
||||
public LivingArmourUpgradeSprintAttack(int level)
|
||||
{
|
||||
public LivingArmourUpgradeSprintAttack(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAdditionalDamageOnHit(double damage, EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon)
|
||||
{
|
||||
if (wearer.isSprinting())
|
||||
{
|
||||
public double getAdditionalDamageOnHit(double damage, EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon) {
|
||||
if (wearer.isSprinting()) {
|
||||
return getDamageModifier();
|
||||
}
|
||||
|
||||
|
@ -30,59 +26,49 @@ public class LivingArmourUpgradeSprintAttack extends LivingArmourUpgrade
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getKnockbackOnHit(EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon)
|
||||
{
|
||||
if (wearer.isSprinting())
|
||||
{
|
||||
public double getKnockbackOnHit(EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon) {
|
||||
if (wearer.isSprinting()) {
|
||||
return getKnockbackModifier();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getDamageModifier()
|
||||
{
|
||||
public double getDamageModifier() {
|
||||
return damageBoost[this.level];
|
||||
}
|
||||
|
||||
public double getKnockbackModifier()
|
||||
{
|
||||
public double getKnockbackModifier() {
|
||||
return knockbackModifier[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.sprintAttack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "sprintAttack";
|
||||
}
|
||||
}
|
|
@ -5,10 +5,9 @@ import WayofTime.bloodmagic.api.Constants;
|
|||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class LivingArmourUpgradeStepAssist extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 20 };
|
||||
public static final float[] assist = new float[] { Constants.Misc.ALTERED_STEP_HEIGHT };
|
||||
public class LivingArmourUpgradeStepAssist extends LivingArmourUpgrade {
|
||||
public static final int[] costs = new int[]{20};
|
||||
public static final float[] assist = new float[]{Constants.Misc.ALTERED_STEP_HEIGHT};
|
||||
|
||||
// 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 };
|
||||
|
@ -16,49 +15,41 @@ public class LivingArmourUpgradeStepAssist extends LivingArmourUpgrade
|
|||
// 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 LivingArmourUpgradeStepAssist(int level)
|
||||
{
|
||||
public LivingArmourUpgradeStepAssist(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
public String getUniqueIdentifier() {
|
||||
return BloodMagic.MODID + ".upgrade.stepAssist";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
public int getMaxTier() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
public int getCostOfUpgrade() {
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
public String getUnlocalizedName() {
|
||||
return tooltipBase + "stepAssist";
|
||||
}
|
||||
|
||||
public float getStepAssist()
|
||||
{
|
||||
public float getStepAssist() {
|
||||
return assist[this.level];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue