Finalized Solar Powered perk. Worked a bit more on Grim Reaper's Sprint.
This commit is contained in:
parent
8feae53462
commit
69eb621fc8
11 changed files with 223 additions and 9 deletions
|
@ -18,7 +18,7 @@ public class StatTrackerGrimReaperSprint extends StatTracker
|
|||
public int totalDeaths = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Integer> changeMap = new HashMap<LivingArmour, Integer>();
|
||||
public static int[] deathsRequired = new int[] { 3, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; //TODO: Modify
|
||||
public static int[] deathsRequired = new int[] { 6, 10, 15, 25, 50, 70, 90, 120, 150, 200 }; //TODO: Modify
|
||||
|
||||
public static void incrementCounter(LivingArmour armour)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
package WayofTime.bloodmagic.livingArmour.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSolarPowered;
|
||||
|
||||
public class StatTrackerSolarPowered extends StatTracker
|
||||
{
|
||||
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()
|
||||
{
|
||||
return Constants.Mod.MODID + ".tracker.solarPowered";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
this.totalHealthGenned = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
totalHealthGenned = tag.getDouble(Constants.Mod.MODID + ".tracker.solarPowered");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
tag.setDouble(Constants.Mod.MODID + ".tracker.solarPowered", totalHealthGenned);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour))
|
||||
{
|
||||
double change = Math.abs(changeMap.get(livingArmour));
|
||||
if (change > 0)
|
||||
{
|
||||
totalHealthGenned += Math.abs(changeMap.get(livingArmour));
|
||||
|
||||
changeMap.put(livingArmour, 0d);
|
||||
|
||||
this.markDirty();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LivingArmourUpgrade> getUpgrades()
|
||||
{
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (totalHealthGenned >= healthedRequired[i])
|
||||
{
|
||||
upgradeList.add(new LivingArmourUpgradeSolarPowered(i));
|
||||
}
|
||||
}
|
||||
|
||||
return upgradeList;
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
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 int deathTimer = 0;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
|
@ -15,7 +16,8 @@ public class LivingArmourUpgradePhysicalProtect extends LivingArmourUpgrade
|
|||
super(level);
|
||||
}
|
||||
|
||||
public double getArmourProtection(DamageSource source)
|
||||
@Override
|
||||
public double getArmourProtection(EntityLivingBase wearer, DamageSource source)
|
||||
{
|
||||
if (source.getEntity() != null)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
package WayofTime.bloodmagic.livingArmour.upgrade;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
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 int counter = 0;
|
||||
|
||||
public LivingArmourUpgradeSolarPowered(int level)
|
||||
{
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getArmourProtection(EntityLivingBase wearer, DamageSource source)
|
||||
{
|
||||
if (wearer.worldObj.canSeeSky(wearer.getPosition()) || wearer.worldObj.provider.isDaytime())
|
||||
{
|
||||
return protectionLevel[this.level];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
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())
|
||||
{
|
||||
player.heal(1);
|
||||
}
|
||||
|
||||
if (fireResistTime[this.level] != 0 && counter % fireResistCooldown[this.level] == 0)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, fireResistTime[this.level], 0, false, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
return Constants.Mod.MODID + ".upgrade.solarPowered";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
return 10; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
tag.setInteger(Constants.Mod.MODID + ".tracker.solarPowered", counter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
counter = tag.getInteger(Constants.Mod.MODID + ".tracker.solarPowered");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
return tooltipBase + "solarPowered";
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue