From 5451f1ff8d0b21b470467fc4d8eb1d9075225feb Mon Sep 17 00:00:00 2001 From: WayofTime Date: Wed, 7 Sep 2016 19:44:28 -0400 Subject: [PATCH] Made the costs scale properly for players and non-players --- changelog.txt | 1 + .../bloodmagic/ritual/RitualRegeneration.java | 30 +++++++++++++------ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/changelog.txt b/changelog.txt index b07f0f4c..10e1dac2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -7,6 +7,7 @@ Version 2.1.0-59 - Added a temporary texture (finally) for the Inspectoris Scandalum - Fixed Specters spawning with the /give command - Fixed the sacrifice range of the altar. +- Fixed the Regeneration ritual so that it works on non-players ------------------------------------------------------ Version 2.0.4-58 diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualRegeneration.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualRegeneration.java index 8b0aea9b..f9c7c769 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/RitualRegeneration.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualRegeneration.java @@ -3,7 +3,6 @@ package WayofTime.bloodmagic.ritual; import java.util.ArrayList; import java.util.List; -import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.MobEffects; @@ -12,12 +11,12 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import WayofTime.bloodmagic.api.Constants; -import WayofTime.bloodmagic.api.saving.SoulNetwork; import WayofTime.bloodmagic.api.ritual.AreaDescriptor; import WayofTime.bloodmagic.api.ritual.EnumRuneType; import WayofTime.bloodmagic.api.ritual.IMasterRitualStone; import WayofTime.bloodmagic.api.ritual.Ritual; import WayofTime.bloodmagic.api.ritual.RitualComponent; +import WayofTime.bloodmagic.api.saving.SoulNetwork; import WayofTime.bloodmagic.api.util.helper.NetworkHelper; public class RitualRegeneration extends Ritual @@ -51,6 +50,8 @@ public class RitualRegeneration extends Ritual int maxEffects = currentEssence / getRefreshCost(); int totalEffects = 0; + int totalCost = 0; + AreaDescriptor damageRange = getBlockRange(HEAL_RANGE); AxisAlignedBB range = damageRange.getAABB(pos); @@ -61,18 +62,29 @@ public class RitualRegeneration extends Ritual float health = entity.getHealth(); if (health <= entity.getMaxHealth() - 1) { - entity.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 50, 0, false, false)); - - totalEffects++; - - if (totalEffects >= maxEffects) + if (entity.isPotionApplicable(new PotionEffect(MobEffects.REGENERATION))) { - break; + if (entity instanceof EntityPlayer) + { + totalCost += getRefreshCost(); + } else + { + totalCost += getRefreshCost() / 10; + } + + entity.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 50, 0, false, false)); + + totalEffects++; + + if (totalEffects >= maxEffects) + { + break; + } } } } - network.syphon(getRefreshCost() * totalEffects); + network.syphon(totalCost); } @Override