Added the Regeneration ritual. Added localization for ritual activation. Removed the cost of activating a ritual when in creative mode.
This commit is contained in:
parent
75d9a84194
commit
c42bc12e69
|
@ -16,6 +16,7 @@ public class ModRituals
|
|||
public static Ritual jumpRitual;
|
||||
public static Ritual sufferingRitual;
|
||||
public static Ritual featheredKnifeRitual;
|
||||
public static Ritual regenerationRitual;
|
||||
|
||||
public static ImperfectRitual imperfectDay;
|
||||
public static ImperfectRitual imperfectNight;
|
||||
|
@ -32,6 +33,7 @@ public class ModRituals
|
|||
jumpRitual = new RitualJumping();
|
||||
sufferingRitual = new RitualWellOfSuffering();
|
||||
featheredKnifeRitual = new RitualFeatheredKnife();
|
||||
regenerationRitual = new RitualRegeneration();
|
||||
|
||||
RitualRegistry.registerRitual(testRitual, testRitual.getName());
|
||||
RitualRegistry.registerRitual(waterRitual, waterRitual.getName());
|
||||
|
@ -40,6 +42,7 @@ public class ModRituals
|
|||
RitualRegistry.registerRitual(jumpRitual, jumpRitual.getName());
|
||||
RitualRegistry.registerRitual(sufferingRitual, sufferingRitual.getName());
|
||||
RitualRegistry.registerRitual(featheredKnifeRitual, featheredKnifeRitual.getName());
|
||||
RitualRegistry.registerRitual(regenerationRitual, regenerationRitual.getName());
|
||||
}
|
||||
|
||||
public static void initImperfectRituals()
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.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.util.helper.NetworkHelper;
|
||||
|
||||
public class RitualRegeneration extends Ritual
|
||||
{
|
||||
public static final String HEAL_RANGE = "heal";
|
||||
|
||||
public static final int SACRIFICE_AMOUNT = 100;
|
||||
|
||||
public RitualRegeneration()
|
||||
{
|
||||
super("ritualRegeneration", 0, 25000, "ritual." + Constants.Mod.MODID + ".regenerationRitual");
|
||||
addBlockRange(HEAL_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-15, -15, -15), 31));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
World world = masterRitualStone.getWorld();
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
|
||||
int currentEssence = network.getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
return;
|
||||
}
|
||||
|
||||
BlockPos pos = masterRitualStone.getPos();
|
||||
|
||||
int maxEffects = currentEssence / getRefreshCost();
|
||||
int totalEffects = 0;
|
||||
|
||||
AreaDescriptor damageRange = getBlockRange(HEAL_RANGE);
|
||||
AxisAlignedBB range = damageRange.getAABB(pos);
|
||||
|
||||
List<EntityPlayer> entities = world.getEntitiesWithinAABB(EntityPlayer.class, range);
|
||||
|
||||
for (EntityLivingBase player : entities)
|
||||
{
|
||||
float health = player.getHealth();
|
||||
if (health <= player.getMaxHealth() - 1)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 50, 0, false, false));
|
||||
|
||||
totalEffects++;
|
||||
|
||||
if (totalEffects >= maxEffects)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
network.syphon(getRefreshCost() * totalEffects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
return 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
components.add(new RitualComponent(new BlockPos(4, 0, 0), EnumRuneType.AIR));
|
||||
components.add(new RitualComponent(new BlockPos(5, 0, -1), EnumRuneType.AIR));
|
||||
components.add(new RitualComponent(new BlockPos(5, 0, 1), EnumRuneType.AIR));
|
||||
components.add(new RitualComponent(new BlockPos(-4, 0, 0), EnumRuneType.AIR));
|
||||
components.add(new RitualComponent(new BlockPos(-5, 0, -1), EnumRuneType.AIR));
|
||||
components.add(new RitualComponent(new BlockPos(-5, 0, 1), EnumRuneType.AIR));
|
||||
components.add(new RitualComponent(new BlockPos(0, 0, 4), EnumRuneType.FIRE));
|
||||
components.add(new RitualComponent(new BlockPos(1, 0, 5), EnumRuneType.FIRE));
|
||||
components.add(new RitualComponent(new BlockPos(-1, 0, 5), EnumRuneType.FIRE));
|
||||
components.add(new RitualComponent(new BlockPos(0, 0, -4), EnumRuneType.FIRE));
|
||||
components.add(new RitualComponent(new BlockPos(1, 0, -5), EnumRuneType.FIRE));
|
||||
components.add(new RitualComponent(new BlockPos(-1, 0, -5), EnumRuneType.FIRE));
|
||||
this.addOffsetRunes(components, 3, 5, 0, EnumRuneType.WATER);
|
||||
this.addCornerRunes(components, 3, 0, EnumRuneType.DUSK);
|
||||
this.addOffsetRunes(components, 4, 5, 0, EnumRuneType.EARTH);
|
||||
this.addOffsetRunes(components, 4, 5, -1, EnumRuneType.EARTH);
|
||||
this.addCornerRunes(components, 5, 0, EnumRuneType.EARTH);
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
return new RitualRegeneration();
|
||||
}
|
||||
}
|
|
@ -94,7 +94,7 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt
|
|||
{
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(crystalOwner);
|
||||
|
||||
if (network.getCurrentEssence() < ritual.getActivationCost())
|
||||
if (network.getCurrentEssence() < ritual.getActivationCost() && !activator.capabilities.isCreativeMode)
|
||||
{
|
||||
ChatUtil.sendNoSpamUnloc(activator, "chat.BloodMagic.ritual.weak");
|
||||
return false;
|
||||
|
@ -113,7 +113,11 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt
|
|||
|
||||
if (ritual.activateRitual(this, activator))
|
||||
{
|
||||
network.syphon(ritual.getActivationCost());
|
||||
if (!activator.capabilities.isCreativeMode)
|
||||
{
|
||||
network.syphon(ritual.getActivationCost());
|
||||
}
|
||||
|
||||
ChatUtil.sendNoSpamUnloc(activator, "chat.BloodMagic.ritual.activate");
|
||||
this.active = true;
|
||||
// Set the owner of the ritual to the crystal's owner
|
||||
|
|
|
@ -224,6 +224,10 @@ chat.BloodMagic.altarMaker.setTier=Set Tier to: %d
|
|||
chat.BloodMagic.altarMaker.building=Building a Tier %d Altar
|
||||
chat.BloodMagic.altarMaker.destroy=Destroyed a Tier %d Altar
|
||||
chat.BloodMagic.damageSource=%s's soul became too weak
|
||||
chat.BloodMagic.ritual.weak=You feel a push, but are too weak to perform this ritual.
|
||||
chat.BloodMagic.ritual.prevent=The ritual is actively resisting you!
|
||||
chat.BloodMagic.ritual.activate=A rush of energy flows through the ritual!
|
||||
chat.BloodMagic.ritual.notValid=You feel that these runes are not configured correctly...
|
||||
|
||||
# JustEnoughItems
|
||||
jei.BloodMagic.recipe.altar=Blood Altar
|
||||
|
|
Loading…
Reference in a new issue