mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-25 22:34:26 +00:00
Added config options for amounts of life essence per sacrifice.
This commit is contained in:
1 parent
b3c70d9d20
commit
a8378b4b24
7 files changed
+124
-74
No files matched your search
+19
-18
@@ -1,5 +1,6 @@
|
||||
package WayofTime.alchemicalWizardry.api.sacrifice;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
@@ -8,7 +9,7 @@ import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
|
||||
import WayofTime.alchemicalWizardry.api.tile.IBloodAltar;
|
||||
|
||||
public class PlayerSacrificeHandler
|
||||
public class PlayerSacrificeHandler
|
||||
{
|
||||
public static float scalingOfSacrifice = 0.001f;
|
||||
public static int soulFrayDuration = 400;
|
||||
@@ -17,12 +18,12 @@ public class PlayerSacrificeHandler
|
||||
{
|
||||
return APISpellHelper.getCurrentIncense(player);
|
||||
}
|
||||
|
||||
|
||||
public static void setPlayerIncense(EntityPlayer player, float amount)
|
||||
{
|
||||
APISpellHelper.setCurrentIncense(player, amount);
|
||||
}
|
||||
|
||||
|
||||
public static boolean incrementIncense(EntityPlayer player, float min, float max, float increment)
|
||||
{
|
||||
float amount = getPlayerIncense(player);
|
||||
@@ -30,52 +31,52 @@ public class PlayerSacrificeHandler
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
amount = amount + Math.min(increment, max - amount);
|
||||
setPlayerIncense(player, amount);
|
||||
|
||||
|
||||
// System.out.println("Amount of incense: " + amount + ", Increment: " + increment);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean sacrificePlayerHealth(EntityPlayer player)
|
||||
{
|
||||
if(player.isPotionActive(soulFrayId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
float amount = getPlayerIncense(player);
|
||||
|
||||
|
||||
if(amount >= 0)
|
||||
{
|
||||
float health = player.getHealth();
|
||||
float maxHealth = player.getMaxHealth();
|
||||
|
||||
|
||||
if(health > maxHealth/10.0)
|
||||
{
|
||||
float sacrificedHealth = health - maxHealth/10.0f;
|
||||
|
||||
if(findAndFillAltar(player.getEntityWorld(), player, (int)(sacrificedHealth * 100f * getModifier(amount))))
|
||||
|
||||
if(findAndFillAltar(player.getEntityWorld(), player, (int)(sacrificedHealth * AlchemicalWizardry.lpPerSacrificeIncense * getModifier(amount))))
|
||||
{
|
||||
player.setHealth(maxHealth/10.0f);
|
||||
setPlayerIncense(player, 0);
|
||||
player.addPotionEffect(new PotionEffect(soulFrayId.id, soulFrayDuration));
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static float getModifier(float amount)
|
||||
{
|
||||
return 1 + amount*scalingOfSacrifice;
|
||||
}
|
||||
|
||||
|
||||
public static boolean findAndFillAltar(World world, EntityPlayer player, int amount)
|
||||
{
|
||||
int posX = (int) Math.round(player.posX - 0.5f);
|
||||
@@ -90,7 +91,7 @@ public class PlayerSacrificeHandler
|
||||
|
||||
altarEntity.sacrificialDaggerCall(amount, false);
|
||||
altarEntity.startCycle();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -105,7 +106,7 @@ public class PlayerSacrificeHandler
|
||||
for (int k = -2; k <= 1; k++)
|
||||
{
|
||||
tileEntity = world.getTileEntity(i + x, k + y, j + z);
|
||||
|
||||
|
||||
if(tileEntity instanceof IBloodAltar)
|
||||
{
|
||||
return (IBloodAltar)tileEntity;
|
||||
|
||||
Reference in new issue
Block a user