Made the costs scale properly for players and non-players

This commit is contained in:
WayofTime 2016-09-07 19:44:28 -04:00
parent 8f6bb85362
commit 5451f1ff8d
2 changed files with 22 additions and 9 deletions

View file

@ -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

View file

@ -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