Added the Ritual of the Feathered Knife
This commit is contained in:
parent
7eee77ffe1
commit
241c0b8dda
|
@ -24,7 +24,6 @@ import javax.annotation.Nullable;
|
|||
@Setter
|
||||
public class SoulNetwork extends WorldSavedData
|
||||
{
|
||||
|
||||
@Nullable
|
||||
private final EntityPlayer player;
|
||||
private int currentEssence;
|
||||
|
@ -142,9 +141,9 @@ public class SoulNetwork extends WorldSavedData
|
|||
|
||||
public void hurtPlayer(float syphon)
|
||||
{
|
||||
System.out.println("Called");
|
||||
if (getPlayer() != null)
|
||||
{
|
||||
getPlayer().addPotionEffect(new PotionEffect(Potion.confusion.getId(), 20));
|
||||
if (syphon < 100 && syphon > 0)
|
||||
{
|
||||
if (!getPlayer().capabilities.isCreativeMode)
|
||||
|
@ -166,4 +165,14 @@ public class SoulNetwork extends WorldSavedData
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void causeNauseaToPlayer()
|
||||
{
|
||||
System.out.println("Hai! I'm adding the bane of your existence!");
|
||||
|
||||
if (getPlayer() != null)
|
||||
{
|
||||
getPlayer().addPotionEffect(new PotionEffect(Potion.confusion.getId(), 20));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public class ModRituals
|
|||
public static Ritual greenGroveRitual;
|
||||
public static Ritual jumpRitual;
|
||||
public static Ritual sufferingRitual;
|
||||
public static Ritual featheredKnifeRitual;
|
||||
|
||||
public static ImperfectRitual imperfectNight;
|
||||
public static ImperfectRitual imperfectRain;
|
||||
|
@ -32,6 +33,7 @@ public class ModRituals
|
|||
greenGroveRitual = new RitualGreenGrove();
|
||||
jumpRitual = new RitualJumping();
|
||||
sufferingRitual = new RitualWellOfSuffering();
|
||||
featheredKnifeRitual = new RitualFeatheredKnife();
|
||||
|
||||
RitualRegistry.registerRitual(testRitual, testRitual.getName());
|
||||
RitualRegistry.registerRitual(waterRitual, waterRitual.getName());
|
||||
|
@ -39,6 +41,7 @@ public class ModRituals
|
|||
RitualRegistry.registerRitual(greenGroveRitual, greenGroveRitual.getName());
|
||||
RitualRegistry.registerRitual(jumpRitual, jumpRitual.getName());
|
||||
RitualRegistry.registerRitual(sufferingRitual, sufferingRitual.getName());
|
||||
RitualRegistry.registerRitual(featheredKnifeRitual, featheredKnifeRitual.getName());
|
||||
}
|
||||
|
||||
public static void initImperfectRituals()
|
||||
|
|
|
@ -0,0 +1,142 @@
|
|||
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.tileentity.TileEntity;
|
||||
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;
|
||||
import WayofTime.bloodmagic.tile.TileAltar;
|
||||
|
||||
public class RitualFeatheredKnife extends Ritual
|
||||
{
|
||||
public static final String ALTAR_RANGE = "altar";
|
||||
public static final String DAMAGE_RANGE = "damage";
|
||||
|
||||
public static final int SACRIFICE_AMOUNT = 100;
|
||||
|
||||
public BlockPos altarOffsetPos = new BlockPos(0, 0, 0); //TODO: Save!
|
||||
|
||||
public RitualFeatheredKnife()
|
||||
{
|
||||
super("ritualFeatheredKnife", 0, 1000, "ritual." + Constants.Mod.MODID + ".featheredKnifeRitual");
|
||||
addBlockRange(ALTAR_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-5, -10, -5), 11, 21, 11));
|
||||
addBlockRange(DAMAGE_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-15, -20, -15), 31, 41, 31));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
World world = masterRitualStone.getWorld();
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner(), world);
|
||||
int currentEssence = network.getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
return;
|
||||
}
|
||||
|
||||
BlockPos pos = masterRitualStone.getPos();
|
||||
|
||||
int maxEffects = currentEssence / getRefreshCost();
|
||||
int totalEffects = 0;
|
||||
|
||||
BlockPos altarPos = pos.add(altarOffsetPos);
|
||||
|
||||
TileEntity tile = world.getTileEntity(altarPos);
|
||||
|
||||
AreaDescriptor altarRange = getBlockRange(ALTAR_RANGE);
|
||||
|
||||
if (!altarRange.isWithinArea(altarOffsetPos) || !(tile instanceof TileAltar))
|
||||
{
|
||||
for (BlockPos newPos : altarRange.getContainedPositions(pos))
|
||||
{
|
||||
TileEntity nextTile = world.getTileEntity(newPos);
|
||||
if (nextTile instanceof TileAltar)
|
||||
{
|
||||
tile = nextTile;
|
||||
altarOffsetPos = newPos.subtract(pos);
|
||||
|
||||
altarRange.resetCache();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tile instanceof TileAltar)
|
||||
{
|
||||
TileAltar tileAltar = (TileAltar) tile;
|
||||
|
||||
AreaDescriptor damageRange = getBlockRange(DAMAGE_RANGE);
|
||||
AxisAlignedBB range = damageRange.getAABB(pos);
|
||||
|
||||
List<EntityPlayer> entities = world.getEntitiesWithinAABB(EntityPlayer.class, range);
|
||||
|
||||
for (EntityLivingBase player : entities)
|
||||
{
|
||||
float health = player.getHealth();
|
||||
if (health > 6)
|
||||
{
|
||||
player.setHealth(health - 1);
|
||||
|
||||
tileAltar.sacrificialDaggerCall(SACRIFICE_AMOUNT, false);
|
||||
|
||||
totalEffects++;
|
||||
|
||||
if (totalEffects >= maxEffects)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
network.syphon(getRefreshCost() * totalEffects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addParallelRunes(components, 1, 0, EnumRuneType.DUSK);
|
||||
this.addParallelRunes(components, 2, -1, EnumRuneType.WATER);
|
||||
this.addCornerRunes(components, 1, -1, EnumRuneType.AIR);
|
||||
this.addOffsetRunes(components, 2, 4, -1, EnumRuneType.FIRE);
|
||||
this.addOffsetRunes(components, 2, 4, 0, EnumRuneType.EARTH);
|
||||
this.addOffsetRunes(components, 4, 3, 0, EnumRuneType.EARTH);
|
||||
this.addCornerRunes(components, 3, 0, EnumRuneType.AIR);
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
return new RitualFeatheredKnife();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue