Changed the Quick Feet upgrade and the speed boost sigil so that their speeds are applied when strafing and walking backwards as well.

Added the Disoriented Downgrade. Muahaha
This commit is contained in:
WayofTime 2016-09-29 16:37:41 -04:00
parent 1a510c694c
commit 006cbeaa83
4 changed files with 74 additions and 2 deletions

View file

@ -0,0 +1,69 @@
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 LivingArmourUpgradeDisoriented extends LivingArmourUpgrade
{
public static final int[] costs = new int[] { -10, -20 };
public static final double[] chance = new double[] { 0.001, 0.002 };
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])
{
player.rotationYaw = (float) (world.rand.nextFloat() * 360);
player.rotationPitch = (float) (world.rand.nextFloat() * 180 - 90);
}
}
@Override
public boolean runOnClient()
{
return true;
}
@Override
public String getUniqueIdentifier()
{
return Constants.Mod.MODID + ".upgrade.disoriented";
}
@Override
public int getMaxTier()
{
return 2;
}
@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 + "disoriented";
}
}

View file

@ -3,6 +3,7 @@ package WayofTime.bloodmagic.registry;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourHandler;
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeBattleHungry;
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeCrippledArm;
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeDisoriented;
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeMeleeDecrease;
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeQuenched;
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlippery;
@ -102,5 +103,6 @@ public class ModArmourTrackers
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeBattleHungry(0));
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeQuenched(0));
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeMeleeDecrease(0));
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeDisoriented(0));
}
}

View file

@ -196,9 +196,9 @@ public class LivingArmourHandler
}
}
if (percentIncrease > 0 && (player.onGround || player.capabilities.isFlying) && player.moveForward > 0F)
if (percentIncrease > 0 && (player.onGround || player.capabilities.isFlying) && (Math.abs(player.moveForward) > 0 || Math.abs(player.moveStrafing) > 0))
{
player.moveRelative(0F, 1F, player.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease);
player.moveRelative(player.moveStrafing, player.moveForward, player.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease);
}
}
}