LOTS of alchemy changes...

This commit is contained in:
WayofTime 2014-08-25 07:58:39 -04:00
parent 64ccc50698
commit 2b749000b6
99 changed files with 7488 additions and 659 deletions

View file

@ -5,20 +5,30 @@ import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectAnimalGrowth extends RitualEffect
{
public static final int breedingCost = 50;
public static final int reductusDrain = 1;
public static final int virtusDrain = 10;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -43,49 +53,91 @@ public class RitualEffectAnimalGrowth extends RitualEffect
return;
}
int d0 = 2;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y + 1, (double) z, (double) (x + 1), (double) (y + 3), (double) (z + 1)).expand(d0, 0, d0);
List list = world.getEntitiesWithinAABB(EntityAgeable.class, axisalignedbb);
Iterator iterator1 = list.iterator();
EntityAgeable entity;
double range = 2;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y + 1, (double) z, (double) (x + 1), (double) (y + 3), (double) (z + 1)).expand(range, 0, range);
List<EntityAgeable> list = world.getEntitiesWithinAABB(EntityAgeable.class, axisalignedbb);
int entityCount = 0;
boolean flag = false;
while (iterator1.hasNext())
if (currentEssence < this.getCostPerRefresh() * list.size())
{
entity = (EntityAgeable) iterator1.next();
entityCount++;
}
if (currentEssence < this.getCostPerRefresh() * entityCount)
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
Iterator iterator2 = list.iterator();
entityCount = 0;
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
while (iterator2.hasNext())
for(EntityAgeable entity : list)
{
entity = (EntityAgeable) iterator2.next();
if (entity.getGrowingAge() < 0)
{
entity.addGrowth(5);
entityCount++;
}
}else
{
hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
if(hasReductus && entity instanceof EntityAnimal && entity.getGrowingAge() > 0)
{
EntityAnimal animal = (EntityAnimal)entity;
entity.setGrowingAge(Math.max(0, animal.getGrowingAge() - 20*2));
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
entityCount++;
}
}
}
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
data.markDirty();
}
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
if(hasVirtus && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, breedingCost))
{
List<EntityAnimal> animalList = world.getEntitiesWithinAABB(EntityAnimal.class, axisalignedbb);
TileEntity tile = world.getTileEntity(x, y+1, z);
IInventory inventory = null;
if(tile instanceof IInventory)
{
inventory = (IInventory)tile;
}else
{
tile = world.getTileEntity(x, y-1, z);
if(tile instanceof IInventory)
{
inventory = (IInventory)tile;
}
}
if(inventory != null)
{
for(EntityAnimal entityAnimal : animalList)
{
if(entityAnimal.isInLove() || entityAnimal.isChild() || entityAnimal.getGrowingAge() > 0)
{
continue;
}
hasVirtus = hasVirtus && this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
boolean hasLP = SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, breedingCost);
for(int i=0; i<inventory.getSizeInventory(); i++)
{
ItemStack stack = inventory.getStackInSlot(i);
if(stack != null && entityAnimal.isBreedingItem(stack))
{
inventory.decrStackSize(i, 1);
entityAnimal.func_146082_f(null);
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
SoulNetworkHandler.syphonFromNetwork(owner, breedingCost);
break;
}
}
}
}
}
}
@Override

View file

@ -173,7 +173,7 @@ public class RitualEffectAutoAlchemy extends RitualEffect
flag++;
break;
}
else if(curStack.isItemEqual(outputStack)&&curStack.stackSize<curStack.getMaxStackSize())
else if(curStack.isItemEqual(outputStack)&&curStack.stackSize<curStack.getMaxStackSize() && ItemStack.areItemStackTagsEqual(outputStack, curStack))
{
outputStack.stackSize--;
if(outputStack.stackSize<=0)
@ -228,7 +228,7 @@ public class RitualEffectAutoAlchemy extends RitualEffect
flag++;
break;
}
else if(curStack.isItemEqual(alchStack)&&curStack.stackSize<curStack.getMaxStackSize())
else if(curStack.isItemEqual(alchStack)&&curStack.stackSize<curStack.getMaxStackSize()&&ItemStack.areItemStackTagsEqual(alchStack, curStack))
{
alchStack.stackSize--;
if(alchStack.stackSize<=0)

View file

@ -1,24 +1,32 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.ReflectionHelper;
public class RitualEffectContainment extends RitualEffect
{
public static final String[] TIME_SINCE_IGNITED = new String[] { "timeSinceIgnited", "field_70833_d", "bq" };
public static final int crepitousDrain = 1;
public static final int terraeDrain = 3;
public static final int magicalesDrain = 10;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -40,51 +48,58 @@ public class RitualEffectContainment extends RitualEffect
if (currentEssence < this.getCostPerRefresh())
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
int d0 = 5;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, d0, d0);
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityLivingBase livingEntity;
List<Entity> entityList = SpellHelper.getEntitiesInRange(world, x+0.5, y+0.5, z+0.5, d0, d0);
boolean flag = false;
while (iterator.hasNext())
boolean hasCrepitous = this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, false);
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
boolean hasMagicales = this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false);
for(Entity entity : entityList)
{
livingEntity = (EntityLivingBase) iterator.next();
if(!(entity instanceof EntityLivingBase))
{
continue;
}
EntityLivingBase livingEntity = (EntityLivingBase)entity;
if (livingEntity instanceof EntityPlayer)
{
continue;
}
//if (!(livingEntity.getEntityName().equals(owner)))
double xDif = livingEntity.posX - (x + 0.5);
double yDif = livingEntity.posY - (y + 3);
double zDif = livingEntity.posZ - (z + 0.5);
livingEntity.motionX = -0.05 * xDif;
livingEntity.motionY = -0.05 * yDif;
livingEntity.motionZ = -0.05 * zDif;
flag = true;
livingEntity.fallDistance = 0;
if(hasMagicales && this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false))
{
double xDif = livingEntity.posX - (x + 0.5);
double yDif = livingEntity.posY - (y + 3);
double zDif = livingEntity.posZ - (z + 0.5);
livingEntity.motionX = -0.05 * xDif;
livingEntity.motionY = -0.05 * yDif;
livingEntity.motionZ = -0.05 * zDif;
flag = true;
//livingEntity.setVelocity(-0.05 * xDif, -0.05 * yDif, -0.05 * zDif);
if (world.rand.nextInt(10) == 0)
{
//PacketDispatcher.sendPacketToAllPlayers(TEAltar.getParticlePacket(livingEntity.posX, livingEntity.posY, livingEntity.posZ, (short) 1));
SpellHelper.sendIndexedParticleToAllAround(world, x, y, z, 20, world.provider.dimensionId, 1, x, y, z);
}
livingEntity.fallDistance = 0;
//entityplayer.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
if(!livingEntity.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding))
{
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionPlanarBinding.id,100,0));
this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, true);
}
}
if(hasCrepitous && this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, false))
{
if(entity instanceof EntityCreeper)
{
ReflectionHelper.setPrivateValue(EntityCreeper.class, (EntityCreeper) entity, 2, TIME_SINCE_IGNITED);
((EntityCreeper)entity).setAttackTarget(null);
this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, true);
}
}
}

View file

@ -5,24 +5,31 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectCrushing extends RitualEffect
{
public static final int crystallosDrain = 10;
public static final int orbisTerraeDrain = 10;
public static final int potentiaDrain = 10;
public static final int virtusDrain = 10;
public static final int incendiumDrain = 10;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -39,12 +46,11 @@ public class RitualEffectCrushing extends RitualEffect
int currentEssence = data.currentEssence;
World world = ritualStone.getWorld();
if (world.getWorldTime() % 40 != 20)
if (world.getWorldTime() % 10 != 5)
{
return;
}
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
@ -64,19 +70,36 @@ public class RitualEffectCrushing extends RitualEffect
return;
}
boolean isSilkTouch = this.isSilkTouch(world, x, y, z);
int fortuneLevel = this.getFortuneLevel(world, x, y, z);
boolean hasRoom = false;
for(int i=0; i<tileEntity.getSizeInventory(); i++)
{
if(tileEntity.getStackInSlot(i) == null)
{
hasRoom = true;
break;
}
}
if(!hasRoom)
{
return; //Prevents overflow
}
boolean hasCrystallos = this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false);
boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false);
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
boolean hasIncendium = this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, false);
boolean isSilkTouch = hasCrystallos;
int fortuneLevel = 0;
if(hasOrbisTerrae){fortuneLevel++;}
if(hasPotentia){fortuneLevel++;}
if(hasVirtus){fortuneLevel++;}
if (currentEssence < this.getCostPerRefresh())
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
//boolean flag = false;
@ -91,50 +114,19 @@ public class RitualEffectCrushing extends RitualEffect
if (block != null && !world.isAirBlock(x + i, y + j, z + k))
{
if ((block.equals(ModBlocks.ritualStone) || block.equals(ModBlocks.blockMasterStone)))
if ((block.equals(ModBlocks.ritualStone) || block.equals(ModBlocks.blockMasterStone)) || SpellHelper.isBlockFluid(block))
{
continue;
}
if(isSilkTouch && block.canSilkHarvest(world, null, x + i, y + j, z + k, meta))
{
int invSize = tileEntity.getSizeInventory();
//int invSize = tileEntity.getSizeInventory();
ItemStack item = new ItemStack(block,1,meta);
ItemStack copyStack = item.copyItemStack(item);
for (int n = 0; n < invSize; n++)
{
if (tileEntity.isItemValidForSlot(n, copyStack) && copyStack.stackSize != 0)
{
ItemStack itemStack = tileEntity.getStackInSlot(n);
if (itemStack == null)
{
tileEntity.setInventorySlotContents(n, item);
copyStack.stackSize = 0;
} else
{
if (itemStack.getItem().equals(copyStack.getItem()) && itemStack.getItemDamage() == copyStack.getItemDamage())
{
int itemSize = itemStack.stackSize;
int copySize = copyStack.stackSize;
int maxSize = itemStack.getMaxStackSize();
if (copySize + itemSize < maxSize)
{
copyStack.stackSize = 0;
itemStack.stackSize = itemSize + copySize;
tileEntity.setInventorySlotContents(n, itemStack);
} else
{
copyStack.stackSize = itemSize + copySize - maxSize;
itemStack.stackSize = maxSize;
}
}
}
}
}
SpellHelper.insertStackIntoInventory(copyStack, tileEntity);
if (copyStack.stackSize > 0)
{
@ -142,6 +134,10 @@ public class RitualEffectCrushing extends RitualEffect
//flag=true;
}
if(hasCrystallos)
{
this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, true);
}
}
else
{
@ -153,46 +149,59 @@ public class RitualEffectCrushing extends RitualEffect
for (ItemStack item : itemDropList)
{
hasIncendium = hasIncendium && this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, false);
ItemStack copyStack = item.copyItemStack(item);
for (int n = 0; n < invSize; n++)
if(this.usesIncendium(copyStack))
{
if (tileEntity.isItemValidForSlot(n, copyStack) && copyStack.stackSize != 0)
{
ItemStack itemStack = tileEntity.getStackInSlot(n);
if (itemStack == null)
{
tileEntity.setInventorySlotContents(n, item);
copyStack.stackSize = 0;
} else
{
if (itemStack.getItem().equals(copyStack.getItem()) && itemStack.getItemDamage() == copyStack.getItemDamage())
{
int itemSize = itemStack.stackSize;
int copySize = copyStack.stackSize;
int maxSize = itemStack.getMaxStackSize();
if (copySize + itemSize < maxSize)
{
copyStack.stackSize = 0;
itemStack.stackSize = itemSize + copySize;
tileEntity.setInventorySlotContents(n, itemStack);
} else
{
copyStack.stackSize = itemSize + copySize - maxSize;
itemStack.stackSize = maxSize;
}
}
}
}
copyStack = this.transformToNewItem(copyStack, hasIncendium, false);
this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, true);
}
SpellHelper.insertStackIntoInventory(copyStack, tileEntity);
// for (int n = 0; n < invSize; n++)
// {
// if (tileEntity.isItemValidForSlot(n, copyStack) && copyStack.stackSize != 0)
// {
// ItemStack itemStack = tileEntity.getStackInSlot(n);
//
// if (itemStack == null)
// {
// tileEntity.setInventorySlotContents(n, item);
// copyStack.stackSize = 0;
// } else
// {
// if (itemStack.getItem().equals(copyStack.getItem()) && itemStack.getItemDamage() == copyStack.getItemDamage())
// {
// int itemSize = itemStack.stackSize;
// int copySize = copyStack.stackSize;
// int maxSize = itemStack.getMaxStackSize();
//
// if (copySize + itemSize < maxSize)
// {
// copyStack.stackSize = 0;
// itemStack.stackSize = itemSize + copySize;
// tileEntity.setInventorySlotContents(n, itemStack);
// } else
// {
// copyStack.stackSize = itemSize + copySize - maxSize;
// itemStack.stackSize = maxSize;
// }
// }
// }
// }
// }
if (copyStack.stackSize > 0)
{
world.spawnEntityInWorld(new EntityItem(world, x + 0.4, y + 2, z + 0.5, copyStack));
//flag=true;
}
if(hasOrbisTerrae){this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true);}
if(hasPotentia){this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);}
if(hasVirtus){this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);}
}
}
@ -203,6 +212,9 @@ public class RitualEffectCrushing extends RitualEffect
world.playSoundEffect(x + i, y + j, z + k, "mob.endermen.portal", 1.0F, 1.0F);
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
return;
}
}
@ -211,6 +223,56 @@ public class RitualEffectCrushing extends RitualEffect
}
}
private boolean usesIncendium(ItemStack stack)
{
if(stack != null)
{
Item item = stack.getItem();
if(item instanceof ItemBlock)
{
Block block = ((ItemBlock)item).field_150939_a;
if(block == Blocks.cobblestone || block == Blocks.stone)
{
return true;
}
}else
{
}
}
return false;
}
private ItemStack transformToNewItem(ItemStack stack, boolean hasIncendium, boolean hasCrepitous)
{
if(stack != null)
{
ItemStack copyStack = ItemStack.copyItemStack(stack);
int stackSize = copyStack.stackSize;
Item item = stack.getItem();
if(item instanceof ItemBlock)
{
Block block = ((ItemBlock)item).field_150939_a;
if(hasIncendium)
{
if(block == Blocks.cobblestone || block == Blocks.stone)
{
copyStack = new ItemStack(Blocks.netherrack, stackSize, 0);
}
}
}else
{
}
return copyStack;
}
return stack;
}
public boolean isSilkTouch(World world, int x, int y, int z)
{
int index = 0;

View file

@ -42,14 +42,7 @@ public class RitualEffectEllipsoid extends RitualEffect
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
TileEntity tile = world.getTileEntity(x, y+1, z);
if(((IInventory) tile).getSizeInventory() < 3)
{
return;
}
TileEntity tile = world.getTileEntity(x, y+1, z);
if(!(tile instanceof IInventory) || ((IInventory)tile).getSizeInventory() < 3)
{

View file

@ -1,7 +1,6 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
@ -10,24 +9,33 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport;
public class RitualEffectExpulsion extends RitualEffect
{
public static final int virtusDrain = 10;
public static final int potentiaDrain = 10;
public static final int tennebraeDrain = 5;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -49,45 +57,105 @@ public class RitualEffectExpulsion extends RitualEffect
if (currentEssence < this.getCostPerRefresh())
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
int d0 = 25;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, d0, d0);
axisalignedbb.maxY = Math.min((double) world.getHeight(), (double) (y + 1 + d0));
List list = world.getEntitiesWithinAABB(EntityPlayer.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityPlayer entityplayer;
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
int teleportDistance = hasVirtus ? 300 : 100;
int range = hasPotentia ? 50 : 25;
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
boolean flag = false;
while (iterator.hasNext())
TileEntity tile = world.getTileEntity(x, y+1, z);
IInventory inventoryTile = null;
if(tile instanceof IInventory)
{
entityplayer = (EntityPlayer) iterator.next();
if (!(SpellHelper.getUsername(entityplayer).equals(owner)))
inventoryTile = (IInventory)tile;
}
for(EntityPlayer entityplayer : playerList)
{
String playerString = SpellHelper.getUsername(entityplayer);
if (!playerString.equals(owner))
{
if(entityplayer.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding)||entityplayer.capabilities.isCreativeMode)
if(inventoryTile != null)
{
continue;
for(int i=0; i<inventoryTile.getSizeInventory(); i++)
{
ItemStack stack = inventoryTile.getStackInSlot(i);
if(stack != null && stack.getItem() instanceof IBindable && EnergyItems.getOwnerName(stack).equals(playerString))
{
continue;
}
}
}
// if(entityplayer.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding)||entityplayer.capabilities.isCreativeMode)
// {
// continue;
// }
flag = teleportRandomly(entityplayer,100);
flag = teleportRandomly(entityplayer, teleportDistance) || flag;
}
}
if (flag)
{
if(hasVirtus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
}
if(hasPotentia)
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
}
}
boolean hasTennebrae = this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, false);
if(hasTennebrae && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, 1000))
{
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
int teleportDistance = hasVirtus ? 300 : 100;
int range = hasPotentia ? 50 : 25;
List<EntityLivingBase> livingList = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
boolean flag = false;
for(EntityLivingBase livingEntity : livingList)
{
if(livingEntity instanceof EntityPlayer)
{
continue;
}
flag = teleportRandomly(livingEntity, teleportDistance) || flag;
}
if(flag)
{
if(hasVirtus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
}
if(hasPotentia)
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, true);
SoulNetworkHandler.syphonFromNetwork(owner, 1000);
}
}
}
@Override

View file

@ -11,17 +11,23 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
public class RitualEffectFeatheredKnife extends RitualEffect
{
public final int timeDelay = 20;
public final int amount = 100;
public static final int sanctusDrain = 5;
public static final int reductusDrain = 3;
public static final int magicalesDrain = 2;
public static final int potentiaDrain = 5;
@Override
public void performEffect(IMasterRitualStone ritualStone)
@ -41,16 +47,16 @@ public class RitualEffectFeatheredKnife extends RitualEffect
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
int timeDelay = hasPotentia ? 10 : 20;
if (world.getWorldTime() % this.timeDelay != 0)
if (world.getWorldTime() % timeDelay != 0)
{
return;
}
// if(!(world.getBlockTileEntity(x, y-1, z) instanceof TEAltar))
// {
// return;
// }
TEAltar tileAltar = null;
boolean testFlag = false;
@ -73,73 +79,72 @@ public class RitualEffectFeatheredKnife extends RitualEffect
{
return;
}
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
double range = hasReductus ? 8 : 15;
double vertRange = hasReductus ? 8 : 20;
List<EntityPlayer> list = SpellHelper.getPlayersInRange(world, x+0.5, y+0.5, z+0.5, range, vertRange);
//tileAltar = (TEAltar)world.getBlockTileEntity(x,y-1,z);
int d0 = 15;
int vertRange = 20;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, vertRange, d0);
List list = world.getEntitiesWithinAABB(EntityPlayer.class, axisalignedbb);
Iterator iterator1 = list.iterator();
EntityPlayer entity;
int entityCount = 0;
boolean flag = false;
while (iterator1.hasNext())
if (currentEssence < this.getCostPerRefresh() * list.size())
{
entity = (EntityPlayer) iterator1.next();
if (!SpellHelper.isFakePlayer(world, entity))
{
entityCount++;
}
}
if (currentEssence < this.getCostPerRefresh() * entityCount)
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
Iterator iterator2 = list.iterator();
entityCount = 0;
while (iterator2.hasNext())
boolean hasMagicales = this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false);
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
EntityPlayer ownerPlayer = SpellHelper.getPlayerForUsername(owner);
for(EntityPlayer player : list)
{
entity = (EntityPlayer) iterator2.next();
hasSanctus = hasSanctus && this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
double threshold = hasSanctus ? 0.7d : 0.3d;
//entity = (EntityPlayer)iterator1.next();
if (!SpellHelper.isFakePlayer(world, entity))
{
if (entity.getHealth()/entity.getMaxHealth() > 0.3d)
if((hasMagicales && player == ownerPlayer) || !hasMagicales)
{
if (!SpellHelper.isFakePlayer(world, player))
{
entity.setHealth(entity.getHealth() - 1);
entityCount++;
tileAltar.sacrificialDaggerCall(this.amount, false);
if (player.getHealth()/player.getMaxHealth() > threshold)
{
player.setHealth(player.getHealth() - 1);
entityCount++;
tileAltar.sacrificialDaggerCall(this.amount, false);
if(hasSanctus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
}
if(hasMagicales)
{
this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, true);
break;
}
}
}
}
//entity.setHealth(entity.getHealth()-1);
// if(entity.getHealth()<=0.2f)
// {
// entity.onDeath(DamageSource.inFire);
// }
}
}
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
data.markDirty();
if(entityCount > 0)
{
if(hasReductus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
if(hasPotentia)
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
data.markDirty();
}
}
}
@Override
public int getCostPerRefresh()
{
// TODO Auto-generated method stub
return 20;
}

View file

@ -10,14 +10,19 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectFlight extends RitualEffect
{
public static final int aetherDrain = 10;
public static final int reductusDrain = 5;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -37,12 +42,6 @@ public class RitualEffectFlight extends RitualEffect
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (ritualStone.getCooldown() > 0)
{
//TODO Cool stuffs
ritualStone.setCooldown(0);
}
int range = 20;
int verticalRange = 30;
AxisAlignedBB axis = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(range, verticalRange, range);
@ -50,6 +49,9 @@ public class RitualEffectFlight extends RitualEffect
axis.minY = 0;
List<EntityPlayer> entities = world.getEntitiesWithinAABB(EntityPlayer.class, axis);
int entityCount = 0;
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
for (EntityPlayer entity : entities)
{
@ -58,16 +60,10 @@ public class RitualEffectFlight extends RitualEffect
if (currentEssence < this.getCostPerRefresh() * entityCount)
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
for (EntityPlayer entity : entities)
{
entity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFlight.id, 20, 0));

View file

@ -4,20 +4,25 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.block.BlockFarmland;
import net.minecraft.init.Blocks;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectGrowth extends RitualEffect
{
private static final int aquasalusDrain = 10;
private static final int terraeDrain = 20;
private static final int orbisTerraeDrain = 20;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -39,20 +44,35 @@ public class RitualEffectGrowth extends RitualEffect
if (currentEssence < this.getCostPerRefresh()*9)
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
if (world.getWorldTime() % 20 != 0)
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false);
int speed = this.getSpeedForReagents(hasTerrae, hasOrbisTerrae);
if (world.getWorldTime() % speed != 0)
{
return;
}
if(this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false))
{
int hydrationRange = 1;
for(int i=-hydrationRange; i<=hydrationRange; i++)
{
for(int j=-hydrationRange; j<=hydrationRange; j++)
{
if(this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false))
{
if(SpellHelper.hydrateSoil(world, x + i, y + 1, z + j))
{
this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true);
}
}
}
}
}
int flag = 0;
@ -75,6 +95,9 @@ public class RitualEffectGrowth extends RitualEffect
if (flag > 0)
{
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true);
data.currentEssence = currentEssence - this.getCostPerRefresh()*flag;
data.markDirty();
}
@ -101,4 +124,27 @@ public class RitualEffectGrowth extends RitualEffect
growthRitual.add(new RitualComponent(1, 0, -1, 3));
return growthRitual;
}
public int getSpeedForReagents(boolean hasTerrae, boolean hasOrbisTerrae)
{
if(hasOrbisTerrae)
{
if(hasTerrae)
{
return 10;
}else
{
return 15;
}
}else
{
if(hasTerrae)
{
return 20;
}else
{
return 30;
}
}
}
}

View file

@ -11,17 +11,20 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectHealing extends RitualEffect
{
public final int timeDelay = 50;
//public final int amount = 10;
public static final int reductusDrain = 10;
public static final int virtusDrain = 10;
public static final int praesidiumDrain = 2;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -41,30 +44,25 @@ public class RitualEffectHealing extends RitualEffect
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (world.getWorldTime() % this.timeDelay != 0)
int timeDelay = 50;
if (world.getWorldTime() % timeDelay != 0)
{
return;
}
boolean hasPraesidium = this.canDrainReagent(ritualStone, ReagentRegistry.praesidiumReagent, praesidiumDrain, false);
int range = 15 * (hasPraesidium ? 3 : 1);
int vertRange = 15 * (hasPraesidium ? 3 : 1);
// if(!(world.getBlockTileEntity(x, y-1, z) instanceof TEAltar))
// {
// return;
// }
//tileAltar = (TEAltar)world.getBlockTileEntity(x,y-1,z);
int d0 = 10;
int vertRange = 10;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, vertRange, d0);
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator1 = list.iterator();
EntityLivingBase entity;
List<EntityLivingBase> list = SpellHelper.getLivingEntitiesInRange(world, x+0.5, y+0.5, z+0.5, range, vertRange);
int entityCount = 0;
boolean flag = false;
while (iterator1.hasNext())
for(EntityLivingBase livingEntity : list)
{
entity = (EntityLivingBase) iterator1.next();
if (entity instanceof EntityPlayer)
if (livingEntity instanceof EntityPlayer)
{
entityCount += 10;
} else
@ -72,52 +70,65 @@ public class RitualEffectHealing extends RitualEffect
entityCount++;
}
}
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
int cost = this.getCostPerRefresh() * (hasVirtus ? 3 : 1);
int potency = hasVirtus ? 1 : 0;
if (currentEssence < this.getCostPerRefresh() * entityCount)
if (currentEssence < cost * entityCount)
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
Iterator iterator2 = list.iterator();
entityCount = 0;
while (iterator2.hasNext())
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
for(EntityLivingBase livingEntity : list)
{
entity = (EntityLivingBase) iterator2.next();
if (entity.getHealth() + 0.1f < entity.getMaxHealth())
hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
if(hasReductus && !(livingEntity instanceof EntityPlayer))
{
continue;
}
if (livingEntity.getHealth() + 0.1f < livingEntity.getMaxHealth())
{
entity.addPotionEffect(new PotionEffect(Potion.regeneration.id, timeDelay + 2, 0));
//entity.setHealth(entity.getHealth()-1);
//entity.attackEntityFrom(DamageSource.outOfWorld, 1);
if (entity instanceof EntityPlayer)
{
entityCount += 10;
} else
{
entityCount++;
}
PotionEffect effect = livingEntity.getActivePotionEffect(Potion.regeneration);
if(effect != null && effect.getAmplifier() <= potency && effect.getDuration() <= timeDelay)
{
if(!hasVirtus || (this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false)))
{
livingEntity.addPotionEffect(new PotionEffect(Potion.regeneration.id, timeDelay + 2, potency));
if(hasReductus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
if(hasVirtus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
}
if (livingEntity instanceof EntityPlayer)
{
entityCount += 10;
} else
{
entityCount++;
}
}
}
}
// if(entity.getHealth()<=0.2f)
// {
// entity.onDeath(DamageSource.inFire);
// }
//tileAltar.sacrificialDaggerCall(this.amount, true);
}
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
data.markDirty();
if(entityCount > 0)
{
if(hasPraesidium)
{
this.canDrainReagent(ritualStone, ReagentRegistry.praesidiumReagent, praesidiumDrain, true);
}
data.currentEssence = currentEssence - cost * entityCount;
data.markDirty();
}
}
}

View file

@ -1,24 +1,27 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.Iterator;
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.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectJumping extends RitualEffect
{
public static final int aetherDrain = 10;
public static final int terraeDrain = 10;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -37,55 +40,62 @@ public class RitualEffectJumping extends RitualEffect
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
int range = 0;
List<EntityLivingBase> livingList = SpellHelper.getLivingEntitiesInRange(world, x+0.5, y+0.5, z+0.5, range, range);
if (currentEssence < this.getCostPerRefresh())
if (currentEssence < this.getCostPerRefresh() * livingList.size())
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
int d0 = 0;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y + 1, (double) z, (double) (x + 1), (double) (y + 2), (double) (z + 1)).expand(d0, d0, d0);
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityLivingBase entityplayer;
boolean flag = false;
while (iterator.hasNext())
int flag = 0;
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
for(EntityLivingBase livingEntity : livingList)
{
entityplayer = (EntityLivingBase) iterator.next();
if (entityplayer instanceof EntityPlayer)
if(livingEntity.isSneaking())
{
continue;
}
hasAether = hasAether && this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
hasTerrae = hasTerrae && this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
double motionY = 1.5 * (hasAether ? 2 : 1);
if (livingEntity instanceof EntityPlayer)
{
//PacketDispatcher.sendPacketToPlayer(PacketHandler.getPlayerVelocitySettingPacket(entityplayer.motionX, 1.5, entityplayer.motionZ), (Player) entityplayer);
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)entityplayer, entityplayer.motionX, 1.5, entityplayer.motionZ);
entityplayer.motionY = 1.5;
entityplayer.fallDistance = 0;
flag = true;
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)livingEntity, livingEntity.motionX, motionY, livingEntity.motionZ);
livingEntity.motionY = motionY;
livingEntity.fallDistance = 0;
flag++;
} else
//if (!(entityplayer.getEntityName().equals(owner)))
{
// double xDif = entityplayer.posX - xCoord;
// double yDif = entityplayer.posY - (yCoord + 1);
// double zDif = entityplayer.posZ - zCoord;
//entityplayer.motionX=0.1*xDif;
entityplayer.motionY = 1.5;
//entityplayer.motionZ=0.1*zDif;
entityplayer.fallDistance = 0;
flag = true;
//entityplayer.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
livingEntity.motionY = motionY;
livingEntity.fallDistance = 0;
flag++;
}
if(hasAether)
{
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
}
if(hasTerrae)
{
if(!livingEntity.isPotionActive(AlchemicalWizardry.customPotionFeatherFall))
{
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFeatherFall.id, 3 * 20, 0));
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
}
}
}
if (flag)
if (flag > 0)
{
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.currentEssence = currentEssence - this.getCostPerRefresh()*flag;
data.markDirty();
}
}

View file

@ -4,21 +4,35 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.block.BlockSpectralContainer;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectLava extends RitualEffect
{
public static final int sanctusDrain = 20;
public static final int offensaDrain = 50;
public static final int reductusDrain = 5;
public static final int fireFuseCost = 1000;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -44,14 +58,7 @@ public class RitualEffectLava extends RitualEffect
{
if (currentEssence < this.getCostPerRefresh())
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
for (int i = 0; i < 10; i++)
@ -63,7 +70,59 @@ public class RitualEffectLava extends RitualEffect
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
}
}else
{
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
TileEntity tile = world.getTileEntity(x, y + 1, z);
if(tile instanceof IFluidHandler)
{
int amount = ((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.LAVA, 1000), false);
if(amount >= 1000)
{
((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.LAVA, 1000), true);
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
}
}
}
if(this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false) && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, fireFuseCost))
{
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
boolean drainReductus = world.getWorldTime() % 100 == 0;
int range = 5;
List<EntityLivingBase> entityList = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
EntityPlayer player = SpellHelper.getPlayerForUsername(owner);
for(EntityLivingBase entity : entityList)
{
if(entity != player && this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false) && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, fireFuseCost) && !entity.isPotionActive(AlchemicalWizardry.customPotionFireFuse))
{
if(hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false))
{
if(entity instanceof EntityPlayer)
{
if(drainReductus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
continue;
}
}
entity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFireFuse.id,100,0));
this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, true);
SoulNetworkHandler.syphonFromNetwork(owner, fireFuseCost);
}
}
}
}
@Override

View file

@ -1,24 +1,31 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectLeap extends RitualEffect
{
public static final int aetherDrain = 10;
public static final int terraeDrain = 10;
public static final int reductusDrain = 10;
public static final int tenebraeDrain = 10;
public static final int sanctusDrain = 10;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -38,97 +45,135 @@ public class RitualEffectLeap extends RitualEffect
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (currentEssence < this.getCostPerRefresh())
double range = 2.0;
List<EntityLivingBase> livingList = SpellHelper.getLivingEntitiesInRange(world, x+0.5, y+0.5, z+0.5, range, range);
if(livingList == null){return;}
if (currentEssence < this.getCostPerRefresh() * livingList.size())
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
int direction = ritualStone.getDirection();
int d0 = 2;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y - 1, (double) z, (double) (x + 1), (double) (y + 2), (double) (z + 1)).expand(d0, 0, d0);
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityLivingBase entityplayer;
boolean flag = false;
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
boolean hasTenebrae = this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, false);
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
int direction = ritualStone.getDirection();
while (iterator.hasNext())
int flag = 0;
for(EntityLivingBase livingEntity : livingList)
{
entityplayer = (EntityLivingBase) iterator.next();
if (entityplayer instanceof EntityPlayer)
if(livingEntity.isSneaking())
{
entityplayer.motionY = 1.2;
entityplayer.fallDistance = 0;
continue;
}
hasAether = hasAether && this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
hasTerrae = hasTerrae && this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
hasTenebrae = hasTenebrae && this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, false);
hasSanctus = hasSanctus && this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
double motionY = hasTerrae ? 0.6 : 1.2;
double speed = hasAether ? 6.0 : 3.0;
if (!(hasTenebrae || hasSanctus) && livingEntity instanceof EntityPlayer)
{
livingEntity.motionY = motionY;
livingEntity.fallDistance = 0;
switch (direction)
{
case 1:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)entityplayer, 0, 1.2, -3.0);
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)livingEntity, 0, motionY, -speed);
break;
case 2:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)entityplayer, 3.0, 1.2, 0);
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)livingEntity, speed, motionY, 0);
break;
case 3:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)entityplayer, 0, 1.2, 3.0);
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)livingEntity, 0, motionY, speed);
break;
case 4:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)entityplayer, -3.0, 1.2, 0);
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)livingEntity, -speed, motionY, 0);
break;
}
flag = true;
flag++;
} else
//if (!(entityplayer.getEntityName().equals(owner)))
{
// double xDif = entityplayer.posX - xCoord;
// double yDif = entityplayer.posY - (yCoord + 1);
// double zDif = entityplayer.posZ - zCoord;
//entityplayer.motionX=0.1*xDif;
entityplayer.motionY = 1.2;
if((hasSanctus && !livingEntity.isChild()) || (hasTenebrae && livingEntity.isChild()))
{
continue;
}
livingEntity.motionY = motionY;
switch (direction)
{
case 1:
entityplayer.motionX = 0.0;
entityplayer.motionZ = -3.0;
livingEntity.motionX = 0.0;
livingEntity.motionZ = -speed;
break;
case 2:
entityplayer.motionX = 3.0;
entityplayer.motionZ = 0.0;
livingEntity.motionX = speed;
livingEntity.motionZ = 0.0;
break;
case 3:
entityplayer.motionX = 0.0;
entityplayer.motionZ = -3.0;
livingEntity.motionX = 0.0;
livingEntity.motionZ = -speed;
break;
case 4:
entityplayer.motionX = -3.0;
entityplayer.motionZ = 0.0;
livingEntity.motionX = -speed;
livingEntity.motionZ = 0.0;
break;
}
//entityplayer.motionZ=0.1*zDif;
entityplayer.fallDistance = 0;
flag = true;
//entityplayer.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
livingEntity.fallDistance = 0;
flag++;
}
if(hasAether)
{
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
}
if(hasTerrae)
{
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
}
if(hasReductus)
{
if(!livingEntity.isPotionActive(AlchemicalWizardry.customPotionFeatherFall))
{
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFeatherFall.id, 3*20, 0));
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
}
if(hasTenebrae)
{
this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, true);
}
if(hasSanctus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
}
}
if (flag)
if (flag > 0)
{
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.currentEssence = currentEssence - this.getCostPerRefresh() * flag;
data.markDirty();
}
}

View file

@ -12,15 +12,21 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectMagnetic extends RitualEffect
{
private static final int potentiaDrain = 10;
private static final int terraeDrain = 10;
private static final int orbisTerraeDrain = 10;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -40,24 +46,21 @@ public class RitualEffectMagnetic extends RitualEffect
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (world.getWorldTime() % 40 != 0)
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
if(world.getWorldTime() % (hasPotentia ? 10 : 40) != 0)
{
return;
return;
}
Block powerBlock = world.getBlock(x, y-1, z);
int radius = this.getRadiusForModifierBlock(powerBlock);
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false);
int radius = this.getRadiusForReagents(hasTerrae, hasOrbisTerrae);
if (currentEssence < this.getCostPerRefresh())
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
int xRep = 0;
@ -113,6 +116,22 @@ public class RitualEffectMagnetic extends RitualEffect
BlockTeleposer.swapBlocks(world, world, x + i, j, z + k, xRep, yRep, zRep);
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
if(hasPotentia)
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
if(hasTerrae)
{
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
}
if(hasOrbisTerrae)
{
this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true);
}
return;
}
}
@ -152,28 +171,26 @@ public class RitualEffectMagnetic extends RitualEffect
return magneticRitual;
}
public int getRadiusForModifierBlock(Block block)
public int getRadiusForReagents(boolean hasTerrae, boolean hasOrbisTerrae)
{
if(block == null)
{
return 3;
}
if(block == Blocks.diamond_block)
{
return 31;
}
if(block == Blocks.gold_block)
{
return 15;
}
if(block == Blocks.iron_block)
{
return 7;
}
return 3;
if(hasTerrae)
{
if(hasOrbisTerrae)
{
return 31;
}else
{
return 7;
}
}else
{
if(hasOrbisTerrae)
{
return 12;
}else
{
return 3;
}
}
}
}

View file

@ -0,0 +1,128 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks;
import WayofTime.alchemicalWizardry.common.CoordAndRange;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectSpawnWard extends RitualEffect
{
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
// if (world.getWorldTime() % 20 != 0)
// {
// return;
// }
if (currentEssence < this.getCostPerRefresh())
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
int horizRange = 32;
int vertRange = 32;
int dimension = world.provider.dimensionId;
if(AlchemicalWizardryEventHooks.respawnMap.containsKey(new Integer(dimension)))
{
List<CoordAndRange> list = AlchemicalWizardryEventHooks.respawnMap.get(new Integer(dimension));
if(list != null)
{
if(!list.contains(new CoordAndRange(x,y,z,horizRange,vertRange)))
{
boolean hasFoundAndRemoved = false;
for(CoordAndRange coords : list)
{
int xLocation = coords.xCoord;
int yLocation = coords.yCoord;
int zLocation = coords.zCoord;
if(xLocation == x && yLocation == y && zLocation == z)
{
list.remove(coords);
hasFoundAndRemoved = true;
break;
}
}
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
}
}else
{
list = new LinkedList();
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
AlchemicalWizardryEventHooks.respawnMap.put(new Integer(dimension), list);
}
}else
{
List<CoordAndRange> list = new LinkedList();
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
AlchemicalWizardryEventHooks.respawnMap.put(new Integer(dimension), list);
}
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
}
}
@Override
public int getCostPerRefresh()
{
return 20;
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> animalGrowthRitual = new ArrayList();
animalGrowthRitual.add(new RitualComponent(0, 0, 2, RitualComponent.DUSK));
animalGrowthRitual.add(new RitualComponent(2, 0, 0, RitualComponent.DUSK));
animalGrowthRitual.add(new RitualComponent(0, 0, -2, RitualComponent.DUSK));
animalGrowthRitual.add(new RitualComponent(-2, 0, 0, RitualComponent.DUSK));
animalGrowthRitual.add(new RitualComponent(0, 0, 1, RitualComponent.DUSK));
animalGrowthRitual.add(new RitualComponent(1, 0, 0, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(0, 0, -1, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(1, 0, 2, RitualComponent.EARTH));
animalGrowthRitual.add(new RitualComponent(-1, 0, 2, RitualComponent.EARTH));
animalGrowthRitual.add(new RitualComponent(1, 0, -2, RitualComponent.EARTH));
animalGrowthRitual.add(new RitualComponent(-1, 0, -2, RitualComponent.EARTH));
animalGrowthRitual.add(new RitualComponent(2, 0, 1, RitualComponent.AIR));
animalGrowthRitual.add(new RitualComponent(2, 0, -1, RitualComponent.AIR));
animalGrowthRitual.add(new RitualComponent(-2, 0, 1, RitualComponent.AIR));
animalGrowthRitual.add(new RitualComponent(-2, 0, -1, RitualComponent.AIR));
return animalGrowthRitual;
}
}

View file

@ -0,0 +1,128 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks;
import WayofTime.alchemicalWizardry.common.CoordAndRange;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectVeilOfEvil extends RitualEffect
{
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
World worldSave = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
if (data == null)
{
data = new LifeEssenceNetwork(owner);
worldSave.setItemData(owner, data);
}
int currentEssence = data.currentEssence;
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
// if (world.getWorldTime() % 20 != 0)
// {
// return;
// }
if (currentEssence < this.getCostPerRefresh())
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
int horizRange = 32;
int vertRange = 32;
int dimension = world.provider.dimensionId;
if(AlchemicalWizardryEventHooks.forceSpawnMap.containsKey(new Integer(dimension)))
{
List<CoordAndRange> list = AlchemicalWizardryEventHooks.forceSpawnMap.get(new Integer(dimension));
if(list != null)
{
if(!list.contains(new CoordAndRange(x,y,z,horizRange,vertRange)))
{
boolean hasFoundAndRemoved = false;
for(CoordAndRange coords : list)
{
int xLocation = coords.xCoord;
int yLocation = coords.yCoord;
int zLocation = coords.zCoord;
if(xLocation == x && yLocation == y && zLocation == z)
{
list.remove(coords);
hasFoundAndRemoved = true;
break;
}
}
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
}
}else
{
list = new LinkedList();
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
AlchemicalWizardryEventHooks.forceSpawnMap.put(new Integer(dimension), list);
}
}else
{
List<CoordAndRange> list = new LinkedList();
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
AlchemicalWizardryEventHooks.forceSpawnMap.put(new Integer(dimension), list);
}
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
}
}
@Override
public int getCostPerRefresh()
{
return 20;
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> animalGrowthRitual = new ArrayList();
animalGrowthRitual.add(new RitualComponent(0, 0, 2, RitualComponent.DUSK));
animalGrowthRitual.add(new RitualComponent(2, 0, 0, RitualComponent.DUSK));
animalGrowthRitual.add(new RitualComponent(0, 0, -2, RitualComponent.DUSK));
animalGrowthRitual.add(new RitualComponent(-2, 0, 0, RitualComponent.DUSK));
animalGrowthRitual.add(new RitualComponent(0, 0, 1, RitualComponent.DUSK));
animalGrowthRitual.add(new RitualComponent(1, 0, 0, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(0, 0, -1, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(1, 0, 2, RitualComponent.EARTH));
animalGrowthRitual.add(new RitualComponent(-1, 0, 2, RitualComponent.EARTH));
animalGrowthRitual.add(new RitualComponent(1, 0, -2, RitualComponent.EARTH));
animalGrowthRitual.add(new RitualComponent(-1, 0, -2, RitualComponent.EARTH));
animalGrowthRitual.add(new RitualComponent(2, 0, 1, RitualComponent.AIR));
animalGrowthRitual.add(new RitualComponent(2, 0, -1, RitualComponent.AIR));
animalGrowthRitual.add(new RitualComponent(-2, 0, 1, RitualComponent.AIR));
animalGrowthRitual.add(new RitualComponent(-2, 0, -1, RitualComponent.AIR));
return animalGrowthRitual;
}
}

View file

@ -4,21 +4,37 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.block.BlockSpectralContainer;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectWater extends RitualEffect
{
public static final int aquasalusDrain = 5;
public static final int offensaDrain = 20;
public static final int sanctusDrain = 5;
public static final int reductusDrain = 2;
public static final int crystallosDrain = 10;
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
@ -37,20 +53,77 @@ public class RitualEffectWater extends RitualEffect
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
boolean hasCrystallos = this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false);
boolean hasAquasalus = this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false);
boolean hasOffensa = this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false);
if(hasAquasalus)
{
int hydrationRange = 4;
int vertRange = 3;
for(int i=-hydrationRange; i<=hydrationRange; i++)
{
for(int j=-vertRange; j<=vertRange; j++)
{
for(int k=-hydrationRange; k<=hydrationRange; k++)
{
if(SpellHelper.hydrateSoil(world, x+i, y+j, z+k))
{
this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true);
}
}
}
}
}
if(hasOffensa)
{
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
boolean drainReductus = world.getWorldTime() % 100 == 0;
int range = 10;
List<Entity> list = SpellHelper.getEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
for(Entity entity : list)
{
if(entity instanceof EntityLivingBase)
{
EntityLivingBase livingEntity = (EntityLivingBase) entity;
if(livingEntity == SpellHelper.getPlayerForUsername(owner))
{
continue;
}
if(hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false))
{
if(entity instanceof EntityPlayer)
{
if(drainReductus)
{
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
continue;
}
}
if(!livingEntity.isPotionActive(AlchemicalWizardry.customPotionDrowning))
{
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id,100,0));
this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, true);
}
}
}
}
Block block = world.getBlock(x, y + 1, z);
if (world.isAirBlock(x, y + 1, z) && !(block instanceof BlockSpectralContainer))
{
if (currentEssence < this.getCostPerRefresh())
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
for (int i = 0; i < 10; i++)
@ -62,6 +135,58 @@ public class RitualEffectWater extends RitualEffect
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
}
}else
{
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
TileEntity tile = world.getTileEntity(x, y + 1, z);
if(tile instanceof IFluidHandler)
{
int amount = ((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.WATER, 1000), false);
if(amount >= 1000)
{
((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.WATER, 1000), true);
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
data.currentEssence = currentEssence - this.getCostPerRefresh();
data.markDirty();
}
}
}
if(hasCrystallos)
{
int range = 2;
for(int i=-range; i<=range; i++)
{
for(int j=-range; j<=range; j++)
{
for(int k=-range; k<=range; k++)
{
hasCrystallos = hasCrystallos && this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false);
if(hasCrystallos)
{
boolean success = false;
if(!world.isAirBlock(x+i, y+j, z+k) && SpellHelper.freezeWaterBlock(world, x+i, y+j, z+k))
{
success = true;
}else
{
if(world.rand.nextInt(100) == 0 && world.isSideSolid(x+i, y+j-1, z+k, ForgeDirection.UP))
{
success = true;
}
}
if(success)
{
this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, true);
}
}
}
}
}
}
}

View file

@ -17,13 +17,14 @@ import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
public class RitualEffectWellOfSuffering extends RitualEffect
{
public final int timeDelay = 25;
public final int amount = 10;
public static final int timeDelay = 25;
public static final int amount = 10;
@Override
public void performEffect(IMasterRitualStone ritualStone)
@ -49,10 +50,6 @@ public class RitualEffectWellOfSuffering extends RitualEffect
return;
}
// if(!(world.getBlockTileEntity(x, y-1, z) instanceof TEAltar))
// {
// return;
// }
TEAltar tileAltar = null;
boolean testFlag = false;
@ -76,54 +73,30 @@ public class RitualEffectWellOfSuffering extends RitualEffect
return;
}
//tileAltar = (TEAltar)world.getBlockTileEntity(x,y-1,z);
int d0 = 10;
int vertRange = 10;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, vertRange, d0);
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator1 = list.iterator();
EntityLivingBase entity;
List<EntityLivingBase> list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
int entityCount = 0;
boolean flag = false;
while (iterator1.hasNext())
if (currentEssence < this.getCostPerRefresh() * list.size())
{
entity = (EntityLivingBase) iterator1.next();
entityCount++;
}
if (currentEssence < this.getCostPerRefresh() * entityCount)
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner == null)
{
return;
}
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
Iterator iterator2 = list.iterator();
entityCount = 0;
while (iterator2.hasNext())
for(EntityLivingBase livingEntity : list)
{
entity = (EntityLivingBase) iterator2.next();
if (entity instanceof EntityPlayer || AlchemicalWizardry.wellBlacklist.contains(entity.getClass()))
if (livingEntity instanceof EntityPlayer || AlchemicalWizardry.wellBlacklist.contains(livingEntity.getClass()))
{
continue;
}
//entity.setHealth(entity.getHealth()-1);
entity.attackEntityFrom(DamageSource.outOfWorld, 1);
entityCount++;
// if(entity.getHealth()<=0.2f)
// {
// entity.onDeath(DamageSource.inFire);
// }
tileAltar.sacrificialDaggerCall(this.amount, true);
if(livingEntity.attackEntityFrom(DamageSource.outOfWorld, 1))
{
entityCount++;
tileAltar.sacrificialDaggerCall(this.amount, true);
}
}
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
@ -134,7 +107,6 @@ public class RitualEffectWellOfSuffering extends RitualEffect
@Override
public int getCostPerRefresh()
{
// TODO Auto-generated method stub
return 2;
}