Added another proper Armour Downgrade: Battle Hunger. More to follow.
This commit is contained in:
parent
9112f5ae04
commit
f9185817a1
6 changed files with 188 additions and 10 deletions
|
@ -0,0 +1,78 @@
|
|||
package WayofTime.bloodmagic.livingArmour.downgrade;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class 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)
|
||||
{
|
||||
super(level);
|
||||
}
|
||||
|
||||
public void resetTimer()
|
||||
{
|
||||
this.timer = delay[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (timer > 0)
|
||||
{
|
||||
timer--;
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.ticksExisted % 20 == 0)
|
||||
{
|
||||
player.addExhaustion(exhaustionAdded[this.level]); //TODO: Change exhaustion added per level.
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
return Constants.Mod.MODID + ".upgrade.battleHunger";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
tag.setInteger("timer", timer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
timer = tag.getInteger("timer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
return tooltipBase + "battleHunger";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package WayofTime.bloodmagic.livingArmour.downgrade;
|
||||
|
||||
import net.minecraft.block.BlockIce;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeSlippery extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { -50 };
|
||||
public static final int[] slipperyDuration = new int[] { 30 * 20 };
|
||||
|
||||
public double prevMotionX = 0;
|
||||
public double prevMotionZ = 0;
|
||||
|
||||
public LivingArmourUpgradeSlippery(int level)
|
||||
{
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
double weight = 0.05;
|
||||
if (world.isRemote && player.onGround)
|
||||
{
|
||||
if (player.moveForward == 0)
|
||||
{
|
||||
player.motionX = (player.motionX - this.prevMotionX) * weight + this.prevMotionX;
|
||||
player.motionZ = (player.motionZ - this.prevMotionZ) * weight + this.prevMotionZ;
|
||||
|
||||
player.velocityChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
this.prevMotionX = player.motionX;
|
||||
this.prevMotionZ = player.motionZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
return Constants.Mod.MODID + ".upgrade.slippery";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
return tooltipBase + "slippery";
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue