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

@ -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();
}
}