diff --git a/src/main/java/WayofTime/bloodmagic/api/livingArmour/LivingArmourUpgrade.java b/src/main/java/WayofTime/bloodmagic/api/livingArmour/LivingArmourUpgrade.java index 3b410dbe..3d63ad8e 100644 --- a/src/main/java/WayofTime/bloodmagic/api/livingArmour/LivingArmourUpgrade.java +++ b/src/main/java/WayofTime/bloodmagic/api/livingArmour/LivingArmourUpgrade.java @@ -27,7 +27,7 @@ public abstract class LivingArmourUpgrade */ public LivingArmourUpgrade(int level) { - this.level = level; + this.level = Math.min(level, getMaxTier() - 1); } public int getUpgradeLevel() diff --git a/src/main/java/WayofTime/bloodmagic/livingArmour/LivingArmourUpgradeSpeed.java b/src/main/java/WayofTime/bloodmagic/livingArmour/LivingArmourUpgradeSpeed.java index 11a603f1..73b37180 100644 --- a/src/main/java/WayofTime/bloodmagic/livingArmour/LivingArmourUpgradeSpeed.java +++ b/src/main/java/WayofTime/bloodmagic/livingArmour/LivingArmourUpgradeSpeed.java @@ -2,29 +2,61 @@ package WayofTime.bloodmagic.livingArmour; import java.util.UUID; -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.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.world.World; import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; + public class LivingArmourUpgradeSpeed extends LivingArmourUpgrade { + public static final int[] costs = new int[] { 3, 7, 13, 26, 42, 60, 90, 130, 180, 250 }; + public static final double[] speedModifier = new double[] { 0.1, 0.2, 0.3, 0.4, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5 }; + public static final int[] sprintSpeedTime = new int[] { 0, 0, 0, 0, 0, 20, 60, 60, 100, 200 }; + public static final int[] sprintSpeedLevel = new int[] { 0, 0, 0, 0, 0, 0, 0, 1, 1, 2 }; + public static final int[] healthModifier = new int[] { 0, 0, 0, 0, 0, 0, 0, 4, 10, 20 }; + public static final int[] sprintRegenTime = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 25 }; + public LivingArmourUpgradeSpeed(int level) { super(level); } + @Override + public void onTick(World world, EntityPlayer player, LivingArmour livingArmour) + { + if (player.isSprinting()) + { + if (sprintSpeedTime[this.level] > 0) + { + player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, sprintSpeedTime[this.level], sprintSpeedLevel[this.level], false, false)); + } + + if (sprintRegenTime[this.level] > 0 && !player.isPotionActive(Potion.regeneration)) + { + player.addPotionEffect(new PotionEffect(Potion.regeneration.id, sprintRegenTime[this.level], 0, false, false)); + } + } + } + @Override public Multimap getAttributeModifiers() { Multimap modifierMap = HashMultimap.create(); - // Adds 5% per level - modifierMap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(895132, 1), "Speed modifier" + 1, (this.level + 1) * 0.05, 1)); + modifierMap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(895132, 1), "Speed modifier" + 1, speedModifier[this.level], 1)); + + if (healthModifier[this.level] > 0) + { + modifierMap.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(952142, 1), "Health modifier" + 1, healthModifier[this.level], 0)); + } return modifierMap; } @@ -44,7 +76,7 @@ public class LivingArmourUpgradeSpeed extends LivingArmourUpgrade @Override public int getCostOfUpgrade() { - return 3 * (this.level + 1) * (this.level + 1) * (this.level + 1); + return costs[this.level]; } @Override diff --git a/src/main/java/WayofTime/bloodmagic/livingArmour/StatTrackerMovement.java b/src/main/java/WayofTime/bloodmagic/livingArmour/StatTrackerMovement.java index 28e9fbee..bf855cc7 100644 --- a/src/main/java/WayofTime/bloodmagic/livingArmour/StatTrackerMovement.java +++ b/src/main/java/WayofTime/bloodmagic/livingArmour/StatTrackerMovement.java @@ -17,6 +17,8 @@ public class StatTrackerMovement extends StatTracker public static Map lastPosX = new HashMap(); public static Map lastPosZ = new HashMap(); + public static int[] blocksRequired = new int[] { 200, 1000, 2000, 4000, 7000, 15000, 25000, 35000, 50000, 70000 }; + public double totalMovement = 0; @Override @@ -70,11 +72,6 @@ public class StatTrackerMovement extends StatTracker markDirty(); - if (world.getWorldTime() % 20 == 0) - { - System.out.println("Total movement since activated: " + totalMovement); - } - return true; } @@ -87,9 +84,9 @@ public class StatTrackerMovement extends StatTracker // TODO Auto-generated method stub List upgradeList = new ArrayList(); - for (int i = 0; i < 5; i++) + for (int i = 0; i < 10; i++) { - if (totalMovement > (i + 1) * (i + 1) * (i + 1) * 100) + if (totalMovement > blocksRequired[i]) { upgradeList.add(new LivingArmourUpgradeSpeed(i)); } diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java index 87fa4500..1c476c65 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java @@ -125,6 +125,11 @@ public class ModRecipes AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.diamond_axe), new AlchemyArrayEffectBinding(new ItemStack(ModItems.boundAxe))); AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.diamond_pickaxe), new AlchemyArrayEffectBinding(new ItemStack(ModItems.boundPickaxe))); AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.diamond_shovel), new AlchemyArrayEffectBinding(new ItemStack(ModItems.boundShovel))); + AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.iron_helmet), new AlchemyArrayEffectBinding(new ItemStack(ModItems.livingArmourHelmet))); + AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.iron_chestplate), new AlchemyArrayEffectBinding(new ItemStack(ModItems.livingArmourChest))); + AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.iron_leggings), new AlchemyArrayEffectBinding(new ItemStack(ModItems.livingArmourLegs))); + AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.iron_boots), new AlchemyArrayEffectBinding(new ItemStack(ModItems.livingArmourBoots))); + AlchemyArrayRecipeRegistry.registerCraftingRecipe(new ItemStack(Items.redstone), new ItemStack(ModItems.slate), new ItemStack(ModItems.sigilDivination), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/DivinationSigil.png")); AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_WATER), new ItemStack(ModItems.slate), new ItemStack(ModItems.sigilWater), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WaterSigil.png"));