diff --git a/changelog.txt b/changelog.txt index c156e786..0e103462 100644 --- a/changelog.txt +++ b/changelog.txt @@ -15,6 +15,7 @@ Version 2.1.0-67 - Increased the effectiveness of animals for the Gathering of the Forsaken Souls ritual by a factor of 4. - Added the framework for the Purification Altar. - Fixed a crash with the Ritual Diviner when attempting to replace certain blocks. +- Snares can no longer hit the thrower of the snare within 20 ticks of throwing it. ------------------------------------------------------ Version 2.1.0-66 diff --git a/src/main/java/WayofTime/bloodmagic/entity/projectile/EntitySoulSnare.java b/src/main/java/WayofTime/bloodmagic/entity/projectile/EntitySoulSnare.java index fb94bca8..aa26da03 100644 --- a/src/main/java/WayofTime/bloodmagic/entity/projectile/EntitySoulSnare.java +++ b/src/main/java/WayofTime/bloodmagic/entity/projectile/EntitySoulSnare.java @@ -32,7 +32,12 @@ public class EntitySoulSnare extends EntityThrowable @Override protected void onImpact(RayTraceResult result) { - if (result.entityHit != null) + if (result.entityHit == this.getThrower() && this.ticksExisted < 20) + { + return; + } + + if (result.entityHit != null && result.entityHit != this.getThrower()) { if (result.entityHit instanceof EntityLivingBase && result.entityHit.worldObj.rand.nextDouble() < 0.25) { diff --git a/src/main/java/WayofTime/bloodmagic/livingArmour/downgrade/LivingArmourUpgradeDigSlowdown.java b/src/main/java/WayofTime/bloodmagic/livingArmour/downgrade/LivingArmourUpgradeDigSlowdown.java index eff78004..8da4d5bc 100644 --- a/src/main/java/WayofTime/bloodmagic/livingArmour/downgrade/LivingArmourUpgradeDigSlowdown.java +++ b/src/main/java/WayofTime/bloodmagic/livingArmour/downgrade/LivingArmourUpgradeDigSlowdown.java @@ -18,11 +18,6 @@ public class LivingArmourUpgradeDigSlowdown extends LivingArmourUpgrade 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 void hasDug(LivingArmour armour) - { - changeMap.put(armour, true); - } - public LivingArmourUpgradeDigSlowdown(int level) { super(level); diff --git a/src/main/java/WayofTime/bloodmagic/livingArmour/downgrade/LivingArmourUpgradeSlowHeal.java b/src/main/java/WayofTime/bloodmagic/livingArmour/downgrade/LivingArmourUpgradeSlowHeal.java new file mode 100644 index 00000000..5951579a --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/livingArmour/downgrade/LivingArmourUpgradeSlowHeal.java @@ -0,0 +1,73 @@ +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 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 LivingArmourUpgradeSlowHeal(int level) + { + super(level); + } + + public double getHealingModifier() + { + return healModifier[this.level]; + } + + @Override + public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) + { + + } + + @Override + public String getUniqueIdentifier() + { + return Constants.Mod.MODID + ".upgrade.slowHeal"; + } + + @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) + { + // EMPTY + } + + @Override + public void readFromNBT(NBTTagCompound tag) + { + // EMPTY + } + + @Override + public String getUnlocalizedName() + { + return tooltipBase + "slowHeal"; + } + + @Override + public boolean isDowngrade() + { + return true; + } +} diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModArmourTrackers.java b/src/main/java/WayofTime/bloodmagic/registry/ModArmourTrackers.java index 2fb4d4d7..ca58b1b7 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModArmourTrackers.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModArmourTrackers.java @@ -8,6 +8,7 @@ import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeDisoriente import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeMeleeDecrease; import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeQuenched; import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlippery; +import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlowHeal; import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlowness; import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeStormTrooper; import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerArrowShot; @@ -112,5 +113,6 @@ public class ModArmourTrackers LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeDisoriented(0)); LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeDigSlowdown(0)); LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeStormTrooper(0)); + LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeSlowHeal(0)); } } diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java index 8930806a..c65bac65 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java @@ -9,9 +9,12 @@ import java.util.Map.Entry; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.MobEffects; +import net.minecraft.init.PotionTypes; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.potion.PotionEffect; +import net.minecraft.potion.PotionType; +import net.minecraft.potion.PotionUtils; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentTranslation; @@ -503,11 +506,13 @@ public class ModRecipes ItemStack bowStack = new ItemStack(Items.BOW); ItemStack bottleStack = new ItemStack(Items.POTIONITEM, 1, 0); ItemStack swordStack = new ItemStack(Items.STONE_SWORD); + ItemStack healingPotionStack = PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM, 1, 0), PotionTypes.HEALING); Map> dialogueMap = new HashMap>(); dialogueMap.put(bowStack, Pair.of("bow", new int[] { 1, 100, 300, 500 })); dialogueMap.put(bottleStack, Pair.of("quenched", new int[] { 1, 100, 300, 500 })); dialogueMap.put(swordStack, Pair.of("dulledBlade", new int[] { 1, 100, 300, 500, 700 })); + dialogueMap.put(healingPotionStack, Pair.of("slowHeal", new int[] { 1, 100, 300, 500, 700 })); for (Entry> entry : dialogueMap.entrySet()) { diff --git a/src/main/java/WayofTime/bloodmagic/util/handler/event/LivingArmourHandler.java b/src/main/java/WayofTime/bloodmagic/util/handler/event/LivingArmourHandler.java index 77d309ee..727e3f75 100644 --- a/src/main/java/WayofTime/bloodmagic/util/handler/event/LivingArmourHandler.java +++ b/src/main/java/WayofTime/bloodmagic/util/handler/event/LivingArmourHandler.java @@ -16,6 +16,7 @@ import net.minecraft.world.World; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingEvent; +import net.minecraftforge.event.entity.living.LivingHealEvent; import net.minecraftforge.event.entity.player.ArrowLooseEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -29,6 +30,7 @@ import WayofTime.bloodmagic.item.armour.ItemLivingArmour; import WayofTime.bloodmagic.livingArmour.LivingArmour; import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeCrippledArm; import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeQuenched; +import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlowHeal; import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeStormTrooper; import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerArrowShot; import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerGrimReaperSprint; @@ -43,6 +45,35 @@ import WayofTime.bloodmagic.registry.ModPotions; @Handler public class LivingArmourHandler { + @SubscribeEvent + public void onEntityHealed(LivingHealEvent event) + { + if (event.getEntityLiving() instanceof EntityPlayer) + { + EntityPlayer player = (EntityPlayer) event.getEntity(); + if (LivingArmour.hasFullSet(player)) + { + ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); + LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); + if (armour != null) + { + double modifier = 1; + LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(Constants.Mod.MODID + ".upgrade.slowHeal", chestStack); + + if (upgrade instanceof LivingArmourUpgradeSlowHeal) + { + modifier *= ((LivingArmourUpgradeSlowHeal) upgrade).getHealingModifier(); + } + + if (modifier != 1) + { + event.setAmount((float) (event.getAmount() * modifier)); + } + } + } + } + } + @SubscribeEvent public void onMiningSpeedCheck(PlayerEvent.BreakSpeed event) { diff --git a/src/main/resources/assets/bloodmagic/lang/en_US.lang b/src/main/resources/assets/bloodmagic/lang/en_US.lang index d531e9e6..491dba4f 100644 --- a/src/main/resources/assets/bloodmagic/lang/en_US.lang +++ b/src/main/resources/assets/bloodmagic/lang/en_US.lang @@ -507,6 +507,7 @@ tooltip.BloodMagic.livingArmour.upgrade.quenched=Quenched tooltip.BloodMagic.livingArmour.upgrade.meleeDecrease=Dulled Blade tooltip.BloodMagic.livingArmour.upgrade.digSlowdown=Weakened Pick tooltip.BloodMagic.livingArmour.upgrade.stormTrooper=Storm Trooper +tooltip.BloodMagic.livingArmour.upgrade.slowHeal=Diseased tooltip.BloodMagic.livingArmour.upgrade.level=%s (Level %d) tooltip.BloodMagic.livingArmour.upgrade.progress=%s (%d/100) tooltip.BloodMagic.livingArmour.upgrade.points=&6Upgrade points: %s / %s @@ -725,6 +726,10 @@ ritual.BloodMagic.downgradeRitual.dialogue.dulledBlade.100=If it is strength bey ritual.BloodMagic.downgradeRitual.dialogue.dulledBlade.300=I can expand the capabilities of your armour, allowing you to achieve greater heights. However, I will need something from you in return: your strength in physical combat. ritual.BloodMagic.downgradeRitual.dialogue.dulledBlade.500=By agreeing to this, you will no longer be able to swing a weapon with as much certainty, only able to do a fraction of the damage you could before. ritual.BloodMagic.downgradeRitual.dialogue.dulledBlade.700=So, the choice is yours: will you kneel at this altar, or will you still take up your sword? +ritual.BloodMagic.downgradeRitual.dialogue.slowHeal.1=Beware, mortal, for you are on shaky ground. +ritual.BloodMagic.downgradeRitual.dialogue.slowHeal.100=Unlike my comrades, I offer one of the most grim deals that you could possibly hope for as a magician that deals in your own health. +ritual.BloodMagic.downgradeRitual.dialogue.slowHeal.300=Although your wounds may heal, they will do so slowly if you accept my "offering," and the stings of battle will plague you even more. +ritual.BloodMagic.downgradeRitual.dialogue.slowHeal.500=So think carefully before you rush into something that you may regret, since even though your cup may be empty it will be almost impossible to fill once more... # Chat chat.BloodMagic.altarMaker.setTier=Set Tier to: %d