1.7.10 commit of I-still-can't-do-any-branches

This commit is contained in:
WayofTime 2014-06-27 19:43:09 -04:00
parent 6aec0a87ea
commit cabc296b21
763 changed files with 64290 additions and 0 deletions

View file

@ -0,0 +1,624 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.IProjectileImpactEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.IProjectileUpdateEffect;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EntitySpellProjectile extends Entity implements IProjectile
{
private int xTile = -1;
private int yTile = -1;
private int zTile = -1;
private int inTile = 0;
private int inData = 0;
private boolean inGround = false;
/** The owner of this arrow. */
public EntityPlayer shootingEntity;
private int ticksInAir = 0;
private int ricochetCounter = 0;
private boolean scheduledForDeath = false;
private boolean isSilkTouch = false;
//Custom variables
private int maxRicochet = 0;
private float damage = 1;
public List<IProjectileImpactEffect> impactList = new ArrayList();
private boolean penetration = false;
public List<IProjectileUpdateEffect> updateEffectList = new ArrayList();
public List<SpellEffect> spellEffectList = new LinkedList();
private int blocksBroken = 0;
public EntitySpellProjectile(World par1World)
{
super(par1World);
this.setSize(0.5F, 0.5F);
}
public EntitySpellProjectile(World par1World, double par2, double par4, double par6)
{
super(par1World);
this.setSize(0.5F, 0.5F);
this.setPosition(par2, par4, par6);
yOffset = 0.0F;
}
public EntitySpellProjectile(World par1World, EntityPlayer par2EntityPlayer)
{
super(par1World);
shootingEntity = par2EntityPlayer;
float par3 = 0.8F;
this.setSize(0.1F, 0.1F);
this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch);
posX -= MathHelper.cos(rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
posY -= 0.2D;
posZ -= MathHelper.sin(rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
this.setPosition(posX, posY, posZ);
yOffset = 0.0F;
motionX = -MathHelper.sin(rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float)Math.PI);
motionZ = MathHelper.cos(rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float)Math.PI);
motionY = -MathHelper.sin(rotationPitch / 180.0F * (float)Math.PI);
this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F);
}
@Override
protected void entityInit() {
dataWatcher.addObject(16, Byte.valueOf((byte)0));
}
/**
* Similar to setArrowHeading, it's point the throwable entity to a x, y, z
* direction.
*/
@Override
public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) {
float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5);
var1 /= var9;
var3 /= var9;
var5 /= var9;
var1 += rand.nextGaussian() * 0.007499999832361937D * var8;
var3 += rand.nextGaussian() * 0.007499999832361937D * var8;
var5 += rand.nextGaussian() * 0.007499999832361937D * var8;
var1 *= var7;
var3 *= var7;
var5 *= var7;
motionX = var1;
motionY = var3;
motionZ = var5;
float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5);
prevRotationYaw = rotationYaw = (float)(Math.atan2(var1, var5) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float)(Math.atan2(var3, var10) * 180.0D / Math.PI);
}
@Override
@SideOnly(Side.CLIENT)
/**
* Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,
* posY, posZ, yaw, pitch
*/
public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) {
this.setPosition(par1, par3, par5);
this.setRotation(par7, par8);
}
@Override
@SideOnly(Side.CLIENT)
/**
* Sets the velocity to the args. Args: x, y, z
*/
public void setVelocity(double par1, double par3, double par5) {
motionX = par1;
motionY = par3;
motionZ = par5;
if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) {
float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
prevRotationYaw = rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float)(Math.atan2(par3, var7) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch;
prevRotationYaw = rotationYaw;
this.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
}
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate()
{
super.onUpdate();
this.performUpdateEffects();
if (ticksInAir > 600) {
this.setDead();
}
if (shootingEntity == null) {
List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1));
Iterator i = players.iterator();
double closestDistance = Double.MAX_VALUE;
EntityPlayer closestPlayer = null;
while (i.hasNext()) {
EntityPlayer e = (EntityPlayer)i.next();
double distance = e.getDistanceToEntity(this);
if (distance < closestDistance) {
closestPlayer = e;
}
}
if (closestPlayer != null) {
shootingEntity = closestPlayer;
}
}
if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) {
float var1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
prevRotationYaw = rotationYaw = (float)(Math.atan2(motionX, motionZ) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float)(Math.atan2(motionY, var1) * 180.0D / Math.PI);
}
Block var16 = worldObj.getBlock(xTile, yTile, zTile);
if (var16 != null)
{
var16.setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile);
AxisAlignedBB var2 = var16.getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile);
if (var2 != null && var2.isVecInside(Vec3.createVectorHelper(posX, posY, posZ)))
{
inGround = true;
}
}
if (inGround)
{
Block var18 = worldObj.getBlock(xTile, yTile, zTile);
int var19 = worldObj.getBlockMetadata(xTile, yTile, zTile);
if (var18.equals(Block.getBlockById(inTile)) && var19 == inData)
{
// this.groundImpact();
// this.setDead();
}
} else
{
++ticksInAir;
if (ticksInAir > 1 && ticksInAir < 3)
{
//worldObj.spawnParticle("flame", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0D, 0D, 0D);
for (int particles = 0; particles < 3; particles++)
{
this.doFiringParticles();
}
}
Vec3 var17 = Vec3.createVectorHelper(posX, posY, posZ);
Vec3 var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ);
MovingObjectPosition var4 = worldObj.func_147447_a(var17, var3, true, false, false);
var17 = Vec3.createVectorHelper(posX, posY, posZ);
var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ);
if (var4 != null)
{
var3 = Vec3.createVectorHelper(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord);
}
Entity var5 = null;
List var6 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
double var7 = 0.0D;
Iterator var9 = var6.iterator();
float var11;
while (var9.hasNext())
{
Entity var10 = (Entity) var9.next();
if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5))
{
var11 = 0.3F;
AxisAlignedBB var12 = var10.boundingBox.expand(var11, var11, var11);
MovingObjectPosition var13 = var12.calculateIntercept(var17, var3);
if (var13 != null)
{
double var14 = var17.distanceTo(var13.hitVec);
if (var14 < var7 || var7 == 0.0D)
{
var5 = var10;
var7 = var14;
}
}
}
}
if (var5 != null)
{
var4 = new MovingObjectPosition(var5);
}
if (var4 != null)
{
this.onImpact(var4);
if (scheduledForDeath)
{
this.setDead();
}
}
posX += motionX;
posY += motionY;
posZ += motionZ;
MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
this.setPosition(posX, posY, posZ);
//this.doBlockCollisions();
}
}
private void doFlightParticles() {
if (ticksInAir % 3 == 0) {
double gauss = gaussian(1.0F);
worldObj.spawnParticle("mobSpell", posX, posY, posZ, gauss, gauss, 0.0F);
}
}
private void doFiringParticles() {
worldObj.spawnParticle("mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D);
worldObj.spawnParticle("flame", posX, posY, posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ));
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
@Override
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
par1NBTTagCompound.setShort("xTile", (short)xTile);
par1NBTTagCompound.setShort("yTile", (short)yTile);
par1NBTTagCompound.setShort("zTile", (short)zTile);
par1NBTTagCompound.setByte("inTile", (byte)inTile);
par1NBTTagCompound.setByte("inData", (byte)inData);
par1NBTTagCompound.setByte("inGround", (byte)(inGround ? 1 : 0));
NBTTagList effectList = new NBTTagList();
for(SpellEffect eff : spellEffectList)
{
effectList.appendTag(eff.getTag());
}
// for (String str : this.effectList)
// {
// if (str != null)
// {
// NBTTagCompound tag = new NBTTagCompound();
//
// tag.setString("Class", str);
// effectList.appendTag(tag);
// }
// }
par1NBTTagCompound.setTag("Effects", effectList);
par1NBTTagCompound.setInteger("blocksBroken", blocksBroken);
par1NBTTagCompound.setBoolean("isSilkTouch", isSilkTouch);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
@Override
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
xTile = par1NBTTagCompound.getShort("xTile");
yTile = par1NBTTagCompound.getShort("yTile");
zTile = par1NBTTagCompound.getShort("zTile");
inTile = par1NBTTagCompound.getByte("inTile") & 255;
inData = par1NBTTagCompound.getByte("inData") & 255;
inGround = par1NBTTagCompound.getByte("inGround") == 1;
blocksBroken = par1NBTTagCompound.getInteger("blocksBroken");
isSilkTouch = par1NBTTagCompound.getBoolean("isSilkTouch");
NBTTagList tagList = par1NBTTagCompound.getTagList("Effects",Constants.NBT.TAG_COMPOUND);
List<SpellEffect> spellEffectList = new LinkedList();
for (int i = 0; i < tagList.tagCount(); i++)
{
NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
SpellEffect eff = SpellEffect.getEffectFromTag(tag);
if(eff!=null)
{
spellEffectList.add(eff);
}
}
this.spellEffectList = spellEffectList;
// this.effectList = new LinkedList();
// for (int i = 0; i < tagList.tagCount(); i++)
// {
// NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i);
//
// this.effectList.add(tag.getString("Class"));
// }
//SpellParadigmProjectile parad = SpellParadigmProjectile.getParadigmForStringArray(effectList);
SpellParadigmProjectile parad = SpellParadigmProjectile.getParadigmForEffectArray(spellEffectList);
parad.applyAllSpellEffects();
parad.prepareProjectile(this);
}
/**
* returns if this entity triggers Block.onEntityWalking on the blocks they
* walk on. used for spiders and wolves to prevent them from trampling crops
*/
@Override
protected boolean canTriggerWalking() {
return false;
}
@Override
@SideOnly(Side.CLIENT)
public float getShadowSize() {
return 0.0F;
}
/**
* Sets the amount of knockback the arrow applies when it hits a mob.
*/
public void setKnockbackStrength(int par1) {
}
/**
* If returns false, the item will not inflict any damage against entities.
*/
@Override
public boolean canAttackWithItem() {
return false;
}
/**
* Whether the arrow has a stream of critical hit particles flying behind
* it.
*/
public void setIsCritical(boolean par1) {
byte var2 = dataWatcher.getWatchableObjectByte(16);
if (par1) {
dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 1)));
} else {
dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -2)));
}
}
/**
* Whether the arrow has a stream of critical hit particles flying behind
* it.
*/
public boolean getIsCritical() {
byte var1 = dataWatcher.getWatchableObjectByte(16);
return (var1 & 1) != 0;
}
private void onImpact(MovingObjectPosition mop)
{
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
if (mop.entityHit == shootingEntity) return;
this.onImpact(mop.entityHit);
this.performEntityImpactEffects(mop.entityHit);
}
else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
if(!this.penetration)
{
this.groundImpact(mop.sideHit);
this.performTileImpactEffects(mop);
}
}
}
private void onImpact(Entity mop) //TODO
{
if (mop == shootingEntity && ticksInAir > 3)
{
shootingEntity.attackEntityFrom(DamageSource.causePlayerDamage(shootingEntity), 1);
this.setDead();
}
else
{
doDamage(this.damage, mop);
}
spawnHitParticles("exorcism", 8);
this.setDead();
}
private void spawnHitParticles(String string, int i) {
for (int particles = 0; particles < i; particles++) {
worldObj.spawnParticle("mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), posGauss(1.0F), posGauss(1.0F), 0.0F);
}
}
private void doDamage(float f, Entity mop)
{
mop.attackEntityFrom(this.getDamageSource(), f);
}
private DamageSource getDamageSource()
{
return DamageSource.causePlayerDamage(shootingEntity);
}
private void groundImpact(int sideHit) {
this.ricochet(sideHit);
}
private double smallGauss(double d) {
return (worldObj.rand.nextFloat() - 0.5D) * d;
}
private double posGauss(double d) {
return rand.nextFloat() * 0.5D * d;
}
private double gaussian(double d) {
return d + d * ((rand.nextFloat() - 0.5D) / 4);
}
private void ricochet(int sideHit) {
switch (sideHit) {
case 0:
case 1:
// topHit, bottomHit, reflect Y
motionY = motionY * -1;
break;
case 2:
case 3:
// westHit, eastHit, reflect Z
motionZ = motionZ * -1;
break;
case 4:
case 5:
// southHit, northHit, reflect X
motionX = motionX * -1;
break;
}
ricochetCounter++;
if (ricochetCounter > this.getRicochetMax()) {
scheduledForDeath = true;
for (int particles = 0; particles < 4; particles++) {
switch (sideHit) {
case 0:
worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), -gaussian(0.1D), gaussian(0.1D));
break;
case 1:
worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
break;
case 2:
worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), -gaussian(0.1D));
break;
case 3:
worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
break;
case 4:
worldObj.spawnParticle("smoke", posX, posY, posZ, -gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
break;
case 5:
worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
break;
}
}
}
}
//Custom stuff
public int getRicochetMax()
{
return this.maxRicochet;
}
public void setRicochetMax(int ricochet)
{
this.maxRicochet = ricochet;
}
public void setImpactList(List<IProjectileImpactEffect> list)
{
this.impactList = list;
}
public void setUpdateEffectList(List<IProjectileUpdateEffect> list)
{
this.updateEffectList = list;
}
private void performEntityImpactEffects(Entity mop)
{
if(impactList!=null)
{
for(IProjectileImpactEffect impactEffect : impactList)
{
impactEffect.onEntityImpact(mop, this);
}
}
}
private void performTileImpactEffects(MovingObjectPosition mop)
{
if(impactList!=null)
{
for(IProjectileImpactEffect impactEffect : impactList)
{
impactEffect.onTileImpact(worldObj, mop);
}
}
}
private void performUpdateEffects()
{
if(updateEffectList!=null)
{
for(IProjectileUpdateEffect updateEffect : updateEffectList)
{
updateEffect.onUpdateEffect(this);
}
}
}
public void setPenetration(boolean penetration)
{
this.penetration = penetration;
}
public float getDamage()
{
return this.damage;
}
public void setDamage(float damage)
{
this.damage = damage;
}
public void setSpellEffectList(List<SpellEffect> list)
{
this.spellEffectList = list;
}
public int getBlocksBroken()
{
return this.blocksBroken;
}
public void setBlocksBroken(int blocksBroken)
{
this.blocksBroken = blocksBroken;
}
public boolean getIsSilkTouch()
{
return this.isSilkTouch;
}
public void setIsSilkTouch(boolean bool)
{
this.isSilkTouch = bool;
}
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
public class SpellModifier
{
public static final int DEFAULT = 0;
public static final int OFFENSIVE = 1;
public static final int DEFENSIVE = 2;
public static final int ENVIRONMENTAL = 3;
private int modifier;
protected SpellModifier(int modifier)
{
this.modifier = modifier;
}
public int getModifier()
{
return this.modifier;
}
}

View file

@ -0,0 +1,9 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
public class SpellModifierDefault extends SpellModifier
{
public SpellModifierDefault()
{
super(SpellModifier.DEFAULT);
}
}

View file

@ -0,0 +1,9 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
public class SpellModifierDefensive extends SpellModifier
{
public SpellModifierDefensive()
{
super(SpellModifier.DEFENSIVE);
}
}

View file

@ -0,0 +1,9 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
public class SpellModifierEnvironmental extends SpellModifier
{
public SpellModifierEnvironmental()
{
super(SpellModifier.ENVIRONMENTAL);
}
}

View file

@ -0,0 +1,9 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
public class SpellModifierOffensive extends SpellModifier
{
public SpellModifierOffensive()
{
super(SpellModifier.OFFENSIVE);
}
}

View file

@ -0,0 +1,163 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
public abstract class SpellParadigm
{
protected List<SpellEffect> bufferedEffectList = new LinkedList();
public List<String> effectList = new LinkedList();
public void addBufferedEffect(SpellEffect effect)
{
if(effect!=null)
{
this.bufferedEffectList.add(effect);
effectList.add(effect.getClass().getName());
}
}
public void modifyBufferedEffect(SpellModifier modifier)
{
SpellEffect effect = this.getBufferedEffect();
if(effect!=null)
{
effect.modifyEffect(modifier);
effectList.add(modifier.getClass().getName());
}
}
public void applyEnhancement(SpellEnhancement enh)
{
if(enh!=null)
{
if(bufferedEffectList.isEmpty())
{
this.enhanceParadigm(enh);
}
else
{
SpellEffect effect = this.getBufferedEffect();
if(effect!=null)
{
effect.enhanceEffect(enh);
}
}
effectList.add(enh.getClass().getName());
}
}
public abstract void enhanceParadigm(SpellEnhancement enh);
public abstract void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack);
public void applySpellEffect(SpellEffect effect)
{
effect.modifyParadigm(this);
}
public void applyAllSpellEffects()
{
for(SpellEffect effect : bufferedEffectList)
{
this.applySpellEffect(effect);
}
}
public SpellEffect getBufferedEffect()
{
if(bufferedEffectList.isEmpty())
{
return null;
}
else
{
return bufferedEffectList.get(bufferedEffectList.size()-1);
}
}
public int getTotalCost()
{
int cost = 0;
if(this.bufferedEffectList!=null && !this.bufferedEffectList.isEmpty())
{
if(this instanceof SpellParadigmProjectile)
{
for(SpellEffect effect : bufferedEffectList)
{
cost+=effect.getCostForProjectile();
}
}else if(this instanceof SpellParadigmSelf)
{
for(SpellEffect effect : bufferedEffectList)
{
cost+=effect.getCostForSelf();
}
}else if(this instanceof SpellParadigmMelee)
{
for(SpellEffect effect : bufferedEffectList)
{
cost+=effect.getCostForMelee();
}
}else if(this instanceof SpellParadigmTool)
{
for(SpellEffect effect : bufferedEffectList)
{
cost+=effect.getCostForTool();
}
}
return (int)(cost*Math.sqrt(this.bufferedEffectList.size()));
}
return getDefaultCost();
}
public abstract int getDefaultCost();
public int getBufferedEffectPower()
{
SpellEffect eff = this.getBufferedEffect();
if(eff!=null)
{
return eff.getPowerEnhancements();
}
return 0;
}
public int getBufferedEffectCost()
{
SpellEffect eff = this.getBufferedEffect();
if(eff!=null)
{
return eff.getCostEnhancements();
}
return 0;
}
public int getBufferedEffectPotency()
{
SpellEffect eff = this.getBufferedEffect();
if(eff!=null)
{
return eff.getPotencyEnhancements();
}
return 0;
}
}

View file

@ -0,0 +1,70 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.IMeleeSpellEntityEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.IMeleeSpellWorldEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
public class SpellParadigmMelee extends SpellParadigm
{
private List<IMeleeSpellEntityEffect> entityEffectList;
private List<IMeleeSpellWorldEffect> worldEffectList;
public SpellParadigmMelee()
{
this.entityEffectList = new ArrayList();
this.worldEffectList = new ArrayList();
}
@Override
public void enhanceParadigm(SpellEnhancement enh)
{
}
@Override
public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack)
{
for(IMeleeSpellEntityEffect effect : entityEffectList)
{
effect.onEntityImpact(world, entityPlayer);
}
for(IMeleeSpellWorldEffect effect : worldEffectList)
{
effect.onWorldEffect(world, entityPlayer);
}
int cost = this.getTotalCost();
EnergyItems.syphonBatteries(itemStack, entityPlayer, cost);
}
public void addEntityEffect(IMeleeSpellEntityEffect eff)
{
if(eff!=null)
{
this.entityEffectList.add(eff);
}
}
public void addWorldEffect(IMeleeSpellWorldEffect eff)
{
if(eff!=null)
{
this.worldEffectList.add(eff);
}
}
@Override
public int getDefaultCost()
{
return 0;
}
}

View file

@ -0,0 +1,102 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.IProjectileImpactEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.IProjectileUpdateEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ProjectileDefaultFire;
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
public class SpellParadigmProjectile extends SpellParadigm
{
public DamageSource damageSource;
public float damage;
public int cost;
public List<IProjectileImpactEffect> impactList;
public List<IProjectileUpdateEffect> updateEffectList;
public boolean penetration;
public int ricochetMax;
public boolean isSilkTouch;
public SpellParadigmProjectile()
{
this.damageSource = DamageSource.generic;
this.damage = 1;
this.cost = 0;
this.impactList = new ArrayList();
this.updateEffectList = new ArrayList();
this.penetration = false;
this.ricochetMax = 0;
this.isSilkTouch = false;
}
@Override
public void enhanceParadigm(SpellEnhancement enh)
{
}
@Override
public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack)
{
EntitySpellProjectile proj = new EntitySpellProjectile(world, entityPlayer);
this.prepareProjectile(proj);
world.spawnEntityInWorld(proj);
int cost = this.getTotalCost();
EnergyItems.syphonBatteries(itemStack, entityPlayer, cost);
}
public static SpellParadigmProjectile getParadigmForEffectArray(List<SpellEffect> effectList)
{
SpellParadigmProjectile parad = new SpellParadigmProjectile();
for(SpellEffect eff : effectList)
{
parad.addBufferedEffect(eff);
}
return parad;
}
public void prepareProjectile(EntitySpellProjectile proj)
{
proj.setDamage(damage);
proj.setImpactList(impactList);
proj.setUpdateEffectList(updateEffectList);
proj.setPenetration(penetration);
proj.setRicochetMax(ricochetMax);
proj.setIsSilkTouch(isSilkTouch);
proj.setSpellEffectList(bufferedEffectList);
}
public void addImpactEffect(IProjectileImpactEffect eff)
{
if(eff!=null)
{
this.impactList.add(eff);
}
}
public void addUpdateEffect(IProjectileUpdateEffect eff)
{
if(eff!=null)
{
this.updateEffectList.add(eff);
}
}
@Override
public int getDefaultCost()
{
return 50;
}
}

View file

@ -0,0 +1,58 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ISelfSpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class SpellParadigmSelf extends SpellParadigm
{
public List<ISelfSpellEffect> selfSpellEffectList;
public SpellParadigmSelf()
{
selfSpellEffectList = new ArrayList();
}
@Override
public void enhanceParadigm(SpellEnhancement enh)
{
}
@Override
public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack)
{
this.applyAllSpellEffects();
for(ISelfSpellEffect eff : selfSpellEffectList)
{
eff.onSelfUse(world, entityPlayer);
}
int cost = this.getTotalCost();
EnergyItems.syphonBatteries(itemStack, entityPlayer, cost);
}
public void addSelfSpellEffect(ISelfSpellEffect eff)
{
if(eff!=null)
{
this.selfSpellEffectList.add(eff);
}
}
@Override
public int getDefaultCost()
{
return 100;
}
}

View file

@ -0,0 +1,486 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.items.spell.ItemSpellMultiTool;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.IDigAreaEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.IItemManipulator;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.ILeftClickEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.IOnBanishTool;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.IOnBreakBlock;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.IOnSummonTool;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.IRightClickEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.ISpecialDamageEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.IToolUpdateEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.RightClickTunnel;
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
public class SpellParadigmTool extends SpellParadigm
{
private List<ILeftClickEffect> leftClickEffectList;
private List<IRightClickEffect> rightClickEffectList;
private List<IToolUpdateEffect> toolUpdateEffectList;
private List<IOnSummonTool> toolSummonEffectList;
private List<IOnBanishTool> toolBanishEffectList;
private List<IOnBreakBlock> breakBlockEffectList;
private List<IItemManipulator> itemManipulatorEffectList;
private List<IDigAreaEffect> digAreaEffectList;
private List<ISpecialDamageEffect> specialDamageEffectList;
private float maxDamage;
private HashMap<String,Integer> harvestLevel;
private HashMap<String,Float> digSpeed;
private HashMap<String,Float> maxDamageHash;
private HashMap<String,Float> critChanceHash;
private HashMap<String, String> toolInfoString;
private int fortuneLevel;
private boolean silkTouch;
private int duration;
public SpellParadigmTool()
{
this.leftClickEffectList = new LinkedList();
this.rightClickEffectList = new LinkedList();
this.toolUpdateEffectList = new LinkedList();
this.toolSummonEffectList = new LinkedList();
this.toolBanishEffectList = new LinkedList();
this.breakBlockEffectList = new LinkedList();
this.itemManipulatorEffectList = new LinkedList();
this.digAreaEffectList = new LinkedList();
this.toolInfoString = new HashMap();
this.critChanceHash = new HashMap();
this.maxDamage = 5;
this.harvestLevel = new HashMap();
this.harvestLevel.put("pickaxe", 2);
this.harvestLevel.put("shovel", -1);
this.harvestLevel.put("axe", -1);
this.digSpeed = new HashMap();
this.digSpeed.put("pickaxe", 6.0f);
this.digSpeed.put("shovel", 1.0f);
this.digSpeed.put("axe", 1.0f);
this.maxDamageHash = new HashMap();
this.maxDamageHash.put("default", 5.0f);
this.fortuneLevel = 0;
this.silkTouch = false;
this.duration = 2400;
//this.addRightClickEffect(new RightClickTunnel(0,0,0));
//this.addItemManipulatorEffect(new ToolDefaultFire(0,0,0));
//this.addDigAreaEffect(new DigAreaEffect(0,0,0));
}
@Override
public void enhanceParadigm(SpellEnhancement enh)
{
}
@Override
public void castSpell(World world, EntityPlayer entityPlayer, ItemStack crystal)
{
if(entityPlayer.worldObj.isRemote)
{
return;
}
int cost = this.getTotalCost();
EnergyItems.syphonBatteries(crystal, entityPlayer, cost);
ItemStack toolStack = this.prepareTool(crystal, world);
entityPlayer.setCurrentItemOrArmor(0, toolStack);
this.onSummonTool(toolStack, world, entityPlayer);
}
/**
*
* @param crystalStack
* @return stack containing the new multitool
*/
public ItemStack prepareTool(ItemStack crystalStack, World world)
{
ItemStack toolStack = new ItemStack(ModItems.customTool,1);
ItemSpellMultiTool itemTool = (ItemSpellMultiTool) ModItems.customTool;
itemTool.setItemAttack(toolStack, this.composeMaxDamageFromHash());
Set<Entry<String,Integer>> harvestLevelSet = this.harvestLevel.entrySet();
for(Entry<String,Integer> testMap : harvestLevelSet)
{
String tool = testMap.getKey();
int level = testMap.getValue();
itemTool.setHarvestLevel(toolStack, tool, level);
}
Set<Entry<String,Float>> digSpeedSet = this.digSpeed.entrySet();
for(Entry<String,Float> testMap : digSpeedSet)
{
String tool = testMap.getKey();
float speed = testMap.getValue();
itemTool.setDigSpeed(toolStack, tool, speed);
}
itemTool.setFortuneLevel(toolStack, getFortuneLevel());
itemTool.setSilkTouch(toolStack, this.getSilkTouch());
if(this.getSilkTouch())
{
this.addToolString("SilkTouch", "Silk Touch" + " " + SpellHelper.getNumeralForInt(1));
}
if(this.getFortuneLevel() > 0)
{
this.addToolString("Fortune", "Fortune" + " " + SpellHelper.getNumeralForInt(this.getFortuneLevel()));
}
itemTool.setCritChance(toolStack, this.getCritChance()/100f);
List<String> toolStringList = new LinkedList();
for(String str : this.toolInfoString.values())
{
toolStringList.add(str);
}
itemTool.setToolListString(toolStack, toolStringList);
itemTool.setDuration(toolStack, world, this.duration);
itemTool.loadParadigmIntoStack(toolStack, this.bufferedEffectList);
EnergyItems.checkAndSetItemOwner(toolStack, EnergyItems.getOwnerName(crystalStack));
itemTool.setContainedCrystal(toolStack, crystalStack);
return toolStack;
}
@Override
public int getDefaultCost()
{
return 100;
}
public static SpellParadigmTool getParadigmForEffectArray(List<SpellEffect> effectList)
{
SpellParadigmTool parad = new SpellParadigmTool();
for(SpellEffect eff : effectList)
{
parad.addBufferedEffect(eff);
}
parad.applyAllSpellEffects();
return parad;
}
public void addLeftClickEffect(ILeftClickEffect eff)
{
if(eff != null)
{
this.leftClickEffectList.add(eff);
}
}
public void addRightClickEffect(IRightClickEffect eff)
{
if(eff != null)
{
this.rightClickEffectList.add(eff);
}
}
public void addUpdateEffect(IToolUpdateEffect eff)
{
if(eff != null)
{
this.toolUpdateEffectList.add(eff);
}
}
public void addToolSummonEffect(IOnSummonTool eff)
{
if(eff != null)
{
this.toolSummonEffectList.add(eff);
}
}
public void addToolBanishEffect(IOnBanishTool eff)
{
if(eff != null)
{
this.toolBanishEffectList.add(eff);
}
}
public void addBlockBreakEffect(IOnBreakBlock eff)
{
if(eff != null)
{
this.breakBlockEffectList.add(eff);
}
}
public void addItemManipulatorEffect(IItemManipulator eff)
{
if(eff != null)
{
this.itemManipulatorEffectList.add(eff);
}
}
public void addDigAreaEffect(IDigAreaEffect eff)
{
if(eff != null)
{
this.digAreaEffectList.add(eff);
}
}
public void addSpecialDamageEffect(ISpecialDamageEffect eff)
{
if(eff != null)
{
this.specialDamageEffectList.add(eff);
}
}
public int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder)
{
int total = 0;
for(ILeftClickEffect effect : this.leftClickEffectList)
{
total += effect.onLeftClickEntity(stack, attacked, weilder);
}
return total;
}
public int onRightClickBlock(ItemStack toolStack, EntityLivingBase weilder, World world, MovingObjectPosition mop)
{
int total = 0;
for(IRightClickEffect effect : this.rightClickEffectList)
{
total += effect.onRightClickBlock(toolStack, weilder, world, mop);
}
return total;
}
public int onRightClickAir(ItemStack toolStack, World world, EntityPlayer player)
{
int total = 0;
for(IRightClickEffect effect : this.rightClickEffectList)
{
total += effect.onRightClickAir(toolStack, player);
}
return total;
}
public int onUpdate(ItemStack toolStack, World world, Entity par3Entity, int invSlot, boolean inHand)
{
int total = 0;
for(IToolUpdateEffect effect : this.toolUpdateEffectList)
{
total += effect.onUpdate(toolStack, world, par3Entity, invSlot, inHand);
}
return total;
}
public int onSummonTool(ItemStack toolStack, World world, Entity entity)
{
int total = 0;
for(IOnSummonTool effect : this.toolSummonEffectList)
{
total += effect.onSummonTool(toolStack, world, entity);
}
return total;
}
public int onBanishTool(ItemStack toolStack, World world, Entity entity, int invSlot, boolean inHand)
{
int total = 0;
for(IOnBanishTool effect : this.toolBanishEffectList)
{
total += effect.onBanishTool(toolStack, world, entity, invSlot, inHand);
}
return total;
}
public int onBreakBlock(ItemStack container, World world, EntityPlayer player, Block block, int meta, int x, int y, int z, ForgeDirection sideBroken)
{
int total = 0;
for(IOnBreakBlock effect : this.breakBlockEffectList)
{
total += effect.onBlockBroken(container, world, player, block, meta, x, y, z, sideBroken);
}
return total;
}
public List<ItemStack> handleItemList(ItemStack toolStack, List<ItemStack> items)
{
List<ItemStack> heldList = items;
for(IItemManipulator eff : this.itemManipulatorEffectList)
{
List<ItemStack> newHeldList = eff.handleItemsOnBlockBroken(toolStack, heldList);
heldList = newHeldList;
}
return heldList;
}
public int digSurroundingArea(ItemStack container, World world, EntityPlayer player, MovingObjectPosition blockPos, String usedToolClass, float blockHardness, int harvestLvl, ItemSpellMultiTool itemTool)
{
int cost = 0;
for(IDigAreaEffect effect : this.digAreaEffectList)
{
cost += effect.digSurroundingArea(container, world, player, blockPos, usedToolClass, blockHardness, harvestLvl, itemTool);
}
return cost;
}
public int getFortuneLevel()
{
return this.fortuneLevel;
}
public void setFortuneLevel(int fortuneLevel)
{
this.fortuneLevel = fortuneLevel;
}
public boolean getSilkTouch()
{
return this.silkTouch;
}
public void setSilkTouch(boolean silkTouch)
{
this.silkTouch = silkTouch;
}
public int getDuration()
{
return this.duration;
}
public void setDuration(int duration)
{
this.duration = duration;
}
public void setDigSpeed(String toolClass, float digSpeed)
{
this.digSpeed.put(toolClass, digSpeed);
}
public void setHarvestLevel(String toolClass, int hlvl)
{
this.harvestLevel.put(toolClass, hlvl);
}
public float composeMaxDamageFromHash()
{
float damage = 0.0f;
for(float f : this.maxDamageHash.values())
{
damage += f;
}
return damage;
}
public void addDamageToHash(String key, float dmg)
{
this.maxDamageHash.put(key, dmg);
}
public void addToolString(String key, String str)
{
if(str != null && key != null)
{
this.toolInfoString.put(key, str);
}
}
public void addCritChance(String key, float chance)
{
//Chance is in percentage chance i.e. chance = 1.0 means 1.0%
this.critChanceHash.put(key, chance);
}
public float getCritChance()
{
float chance = 0.0f;
for(float fl : this.critChanceHash.values())
{
chance += fl;
}
return chance;
}
public float getAddedDamageForEntity(Entity entity)
{
HashMap<String, Float> hash = new HashMap();
for(ISpecialDamageEffect effect : this.specialDamageEffectList)
{
hash.put(effect.getKey(), effect.getDamageForEntity(entity));
}
float addedDmg = 0.0f;
for(float fl : hash.values())
{
addedDmg += fl;
}
return addedDmg;
}
}

View file

@ -0,0 +1,259 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect;
import net.minecraft.nbt.NBTTagCompound;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellModifier;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmTool;
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
public abstract class SpellEffect
{
protected int modifierState;
protected int powerEnhancement;
protected int costEnhancement;
protected int potencyEnhancement;
public SpellEffect()
{
this.modifierState = SpellModifier.DEFAULT;
this.powerEnhancement = 0;
this.costEnhancement = 0;
this.potencyEnhancement = 0;
}
public void enhanceEffect(SpellEnhancement enh)
{
if(enh!=null)
{
switch(enh.getState())
{
case SpellEnhancement.POWER: this.powerEnhancement++; break;
case SpellEnhancement.EFFICIENCY: this.costEnhancement++; break;
case SpellEnhancement.POTENCY: this.potencyEnhancement++; break;
}
}
}
public void modifyEffect(SpellModifier mod)
{
if(mod!=null)
modifierState = mod.getModifier();
}
public void modifyParadigm(SpellParadigm parad)
{
if(parad instanceof SpellParadigmProjectile)
{
this.modifyProjectileParadigm((SpellParadigmProjectile)parad);
}
if(parad instanceof SpellParadigmSelf)
{
this.modifySelfParadigm((SpellParadigmSelf)parad);
}
if(parad instanceof SpellParadigmMelee)
{
this.modifyMeleeParadigm((SpellParadigmMelee)parad);
}
if(parad instanceof SpellParadigmTool)
{
this.modifyToolParadigm((SpellParadigmTool)parad);
}
}
public void modifyProjectileParadigm(SpellParadigmProjectile parad)
{
switch(modifierState)
{
case SpellModifier.DEFAULT: this.defaultModificationProjectile(parad); break;
case SpellModifier.OFFENSIVE: this.offensiveModificationProjectile(parad); break;
case SpellModifier.DEFENSIVE: this.defensiveModificationProjectile(parad); break;
case SpellModifier.ENVIRONMENTAL: this.environmentalModificationProjectile(parad); break;
}
}
public abstract void defaultModificationProjectile(SpellParadigmProjectile parad);
public abstract void offensiveModificationProjectile(SpellParadigmProjectile parad);
public abstract void defensiveModificationProjectile(SpellParadigmProjectile parad);
public abstract void environmentalModificationProjectile(SpellParadigmProjectile parad);
public void modifySelfParadigm(SpellParadigmSelf parad)
{
switch(modifierState)
{
case SpellModifier.DEFAULT: this.defaultModificationSelf(parad); break;
case SpellModifier.OFFENSIVE: this.offensiveModificationSelf(parad); break;
case SpellModifier.DEFENSIVE: this.defensiveModificationSelf(parad); break;
case SpellModifier.ENVIRONMENTAL: this.environmentalModificationSelf(parad); break;
}
}
public abstract void defaultModificationSelf(SpellParadigmSelf parad);
public abstract void offensiveModificationSelf(SpellParadigmSelf parad);
public abstract void defensiveModificationSelf(SpellParadigmSelf parad);
public abstract void environmentalModificationSelf(SpellParadigmSelf parad);
public void modifyMeleeParadigm(SpellParadigmMelee parad)
{
switch(modifierState)
{
case SpellModifier.DEFAULT: this.defaultModificationMelee(parad); break;
case SpellModifier.OFFENSIVE: this.offensiveModificationMelee(parad); break;
case SpellModifier.DEFENSIVE: this.defensiveModificationMelee(parad); break;
case SpellModifier.ENVIRONMENTAL: this.environmentalModificationMelee(parad); break;
}
}
public abstract void defaultModificationMelee(SpellParadigmMelee parad);
public abstract void offensiveModificationMelee(SpellParadigmMelee parad);
public abstract void defensiveModificationMelee(SpellParadigmMelee parad);
public abstract void environmentalModificationMelee(SpellParadigmMelee parad);
public void modifyToolParadigm(SpellParadigmTool parad)
{
switch(modifierState)
{
case SpellModifier.DEFAULT: this.defaultModificationTool(parad); break;
case SpellModifier.OFFENSIVE: this.offensiveModificationTool(parad); break;
case SpellModifier.DEFENSIVE: this.defensiveModificationTool(parad); break;
case SpellModifier.ENVIRONMENTAL: this.environmentalModificationTool(parad); break;
}
}
public abstract void defaultModificationTool(SpellParadigmTool parad);
public abstract void offensiveModificationTool(SpellParadigmTool parad);
public abstract void defensiveModificationTool(SpellParadigmTool parad);
public abstract void environmentalModificationTool(SpellParadigmTool parad);
public int getCostForProjectile()
{
switch(this.modifierState)
{
case SpellModifier.DEFAULT: return this.getCostForDefaultProjectile();
case SpellModifier.OFFENSIVE: return this.getCostForOffenseProjectile();
case SpellModifier.DEFENSIVE: return this.getCostForDefenseProjectile();
case SpellModifier.ENVIRONMENTAL: return this.getCostForEnvironmentProjectile();
}
return 0;
}
protected abstract int getCostForDefaultProjectile();
protected abstract int getCostForOffenseProjectile();
protected abstract int getCostForDefenseProjectile();
protected abstract int getCostForEnvironmentProjectile();
public int getCostForSelf()
{
switch(this.modifierState)
{
case SpellModifier.DEFAULT: return this.getCostForDefaultSelf();
case SpellModifier.OFFENSIVE: return this.getCostForOffenseSelf();
case SpellModifier.DEFENSIVE: return this.getCostForDefenseSelf();
case SpellModifier.ENVIRONMENTAL: return this.getCostForEnvironmentSelf();
}
return 0;
}
protected abstract int getCostForDefaultSelf();
protected abstract int getCostForOffenseSelf();
protected abstract int getCostForDefenseSelf();
protected abstract int getCostForEnvironmentSelf();
public int getCostForMelee()
{
switch(this.modifierState)
{
case SpellModifier.DEFAULT: return this.getCostForDefaultMelee();
case SpellModifier.OFFENSIVE: return this.getCostForOffenseMelee();
case SpellModifier.DEFENSIVE: return this.getCostForDefenseMelee();
case SpellModifier.ENVIRONMENTAL: return this.getCostForEnvironmentMelee();
}
return 0;
}
protected abstract int getCostForDefaultMelee();
protected abstract int getCostForOffenseMelee();
protected abstract int getCostForDefenseMelee();
protected abstract int getCostForEnvironmentMelee();
public int getCostForTool()
{
switch(this.modifierState)
{
case SpellModifier.DEFAULT: return this.getCostForDefaultTool();
case SpellModifier.OFFENSIVE: return this.getCostForOffenseTool();
case SpellModifier.DEFENSIVE: return this.getCostForDefenseTool();
case SpellModifier.ENVIRONMENTAL: return this.getCostForEnvironmentTool();
}
return 0;
}
protected abstract int getCostForDefaultTool();
protected abstract int getCostForOffenseTool();
protected abstract int getCostForDefenseTool();
protected abstract int getCostForEnvironmentTool();
public int getPowerEnhancements()
{
return this.powerEnhancement;
}
public int getCostEnhancements()
{
return this.costEnhancement;
}
public int getPotencyEnhancements()
{
return this.potencyEnhancement;
}
public NBTTagCompound getTag()
{
NBTTagCompound tag = new NBTTagCompound();
tag.setString("Class", this.getClass().getName());
tag.setInteger("modifier", modifierState);
tag.setInteger("power", powerEnhancement);
tag.setInteger("cost", costEnhancement);
tag.setInteger("potency", potencyEnhancement);
return tag;
}
public static SpellEffect getEffectFromTag(NBTTagCompound tag)
{
try {
Class clazz = Class.forName(tag.getString("Class"));
if(clazz !=null)
{
try {
Object obj = clazz.newInstance();
if(obj instanceof SpellEffect)
{
SpellEffect eff = (SpellEffect) obj;
eff.modifierState = tag.getInteger("modifier");
eff.powerEnhancement = tag.getInteger("power");
eff.costEnhancement = tag.getInteger("cost");
eff.potencyEnhancement = tag.getInteger("potency");
return eff;
}
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}

View file

@ -0,0 +1,284 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmTool;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.MeleeDefaultEarth;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.MeleeDefensiveEarth;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.MeleeEnvironmentalEarth;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.MeleeOffensiveEarth;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.ProjectileDefaultEarth;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.ProjectileDefensiveEarth;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.ProjectileEnvironmentalEarth;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.ProjectileOffensiveEarth;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.SelfDefaultEarth;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.SelfDefensiveEarth;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.SelfEnvironmentalEarth;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.SelfOffensiveEarth;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.ToolEnvironmentalEarth;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth.ToolOffensiveEarth;
public class SpellEffectEarth extends SpellEffect
{
@Override
public void defaultModificationProjectile(SpellParadigmProjectile parad)
{
parad.addImpactEffect(new ProjectileDefaultEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement));
}
@Override
public void offensiveModificationProjectile(SpellParadigmProjectile parad)
{
parad.addImpactEffect(new ProjectileOffensiveEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement));
}
@Override
public void defensiveModificationProjectile(SpellParadigmProjectile parad)
{
parad.addImpactEffect(new ProjectileDefensiveEarth(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void environmentalModificationProjectile(SpellParadigmProjectile parad)
{
parad.addUpdateEffect(new ProjectileEnvironmentalEarth(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defaultModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfDefaultEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement));
}
@Override
public void offensiveModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfOffensiveEarth(this.powerEnhancement,this.potencyEnhancement, this.costEnhancement));
}
@Override
public void defensiveModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfDefensiveEarth(this.powerEnhancement,this.potencyEnhancement, this.costEnhancement));
}
@Override
public void environmentalModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfEnvironmentalEarth(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defaultModificationMelee(SpellParadigmMelee parad)
{
parad.addWorldEffect(new MeleeDefaultEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement));
}
@Override
public void offensiveModificationMelee(SpellParadigmMelee parad)
{
parad.addWorldEffect(new MeleeOffensiveEarth(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defensiveModificationMelee(SpellParadigmMelee parad)
{
parad.addWorldEffect(new MeleeDefensiveEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement));
}
@Override
public void environmentalModificationMelee(SpellParadigmMelee parad)
{
parad.addWorldEffect(new MeleeEnvironmentalEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement));
}
@Override
protected int getCostForDefaultProjectile()
{
return (int)(10*Math.pow((0.5*(this.powerEnhancement)+1)*2 + 1,3)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseProjectile()
{
return (int)(10*(1.5*this.potencyEnhancement+1)*(Math.pow(1*this.powerEnhancement+1,2))*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseProjectile()
{
return (int)(3*Math.pow((this.powerEnhancement*2+1),2)*(this.potencyEnhancement*2+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentProjectile()
{
return (int)(10*2*(0.1d*(this.potencyEnhancement+1))*Math.pow(3.47,this.potencyEnhancement)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefaultSelf()
{
return (int)(20*Math.pow(1.5*powerEnhancement+1,2)*(2*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseSelf()
{
return (int)(10*Math.pow(2*this.powerEnhancement+1,2)*(this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseSelf()
{
return (int)(750*(1.1*this.powerEnhancement+1)*(0.5*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentSelf()
{
return (int)(250*(1.2*this.potencyEnhancement+1)*(3*this.powerEnhancement+2.5)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefaultMelee()
{
return (int)(50*Math.pow(1.5*this.potencyEnhancement + 1,3)*(0.5*this.powerEnhancement + 1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseMelee()
{
return (int)(20*Math.pow(1.5*this.powerEnhancement+1,3)*(0.25*this.powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseMelee()
{
return (int)(5*(1.2*this.powerEnhancement+1)*(1.0f/3.0f*Math.pow(this.potencyEnhancement,2)+2+1.0f/2.0f*this.potencyEnhancement)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentMelee()
{
return (int)(500*Math.pow(2*this.potencyEnhancement+1, 3)*(0.25*this.powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
public void defaultModificationTool(SpellParadigmTool parad)
{
String toolClass = "pickaxe";
float digSpeed = 7.0f;
switch(this.powerEnhancement)
{
case 1:
digSpeed = 9.0f;
break;
case 2:
digSpeed = 12.0f;
break;
case 3:
digSpeed = 16.0f;
break;
case 4:
digSpeed = 21.0f;
break;
case 5:
digSpeed = 27.0f;
break;
}
parad.setDigSpeed(toolClass, digSpeed);
int hlvl = this.potencyEnhancement + 2;
parad.setHarvestLevel(toolClass, hlvl);
}
@Override
public void offensiveModificationTool(SpellParadigmTool parad)
{
parad.addItemManipulatorEffect(new ToolOffensiveEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement));
}
@Override
public void defensiveModificationTool(SpellParadigmTool parad)
{
String toolClass = "shovel";
float digSpeed = 7.0f;
switch(this.powerEnhancement)
{
case 1:
digSpeed = 9.0f;
break;
case 2:
digSpeed = 12.0f;
break;
case 3:
digSpeed = 16.0f;
break;
case 4:
digSpeed = 21.0f;
break;
case 5:
digSpeed = 27.0f;
break;
}
parad.setDigSpeed(toolClass, digSpeed);
int hlvl = this.potencyEnhancement + 2;
parad.setHarvestLevel(toolClass, hlvl);
}
@Override
public void environmentalModificationTool(SpellParadigmTool parad)
{
parad.addDigAreaEffect(new ToolEnvironmentalEarth(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement));
}
@Override
protected int getCostForDefaultTool()
{
return (int)(1000 * (1 + this.potencyEnhancement*0.1f) * (1 + this.powerEnhancement*0.2f) * Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseTool()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseTool()
{
return (int)(1000 * (1 + this.potencyEnhancement*0.1f) * (1 + this.powerEnhancement*0.2f) * Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentTool()
{
return (int)(10 * (1+this.potencyEnhancement*0.8) * Math.pow(1.5*this.powerEnhancement + 3, 2) * Math.pow(0.85, this.costEnhancement));
}
}

View file

@ -0,0 +1,218 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmTool;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.MeleeDefaultFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.MeleeDefensiveFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.MeleeEnvironmentalFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.MeleeOffensiveFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ProjectileDefaultFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ProjectileDefensiveFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ProjectileEnvironmentalFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ProjectileOffensiveFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfDefaultFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfDefensiveFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfEnvironmentalFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfOffensiveFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ToolDefaultFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ToolOffensiveFire;
public class SpellEffectFire extends SpellEffect
{
@Override
public void defaultModificationProjectile(SpellParadigmProjectile parad)
{
parad.addImpactEffect(new ProjectileDefaultFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
parad.damage+=this.potencyEnhancement;
}
@Override
public void offensiveModificationProjectile(SpellParadigmProjectile parad)
{
parad.addImpactEffect(new ProjectileOffensiveFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defensiveModificationProjectile(SpellParadigmProjectile parad)
{
parad.addImpactEffect(new ProjectileDefensiveFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void environmentalModificationProjectile(SpellParadigmProjectile parad)
{
parad.addUpdateEffect(new ProjectileEnvironmentalFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defaultModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfDefaultFire(powerEnhancement, potencyEnhancement, costEnhancement));
}
@Override
public void offensiveModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfOffensiveFire(powerEnhancement,potencyEnhancement,costEnhancement));
}
@Override
public void defensiveModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfDefensiveFire(powerEnhancement,potencyEnhancement,costEnhancement));
}
@Override
public void environmentalModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfEnvironmentalFire(powerEnhancement, potencyEnhancement, costEnhancement));
}
@Override
public void defaultModificationMelee(SpellParadigmMelee parad)
{
parad.addEntityEffect(new MeleeDefaultFire(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement));
}
@Override
public void offensiveModificationMelee(SpellParadigmMelee parad)
{
parad.addEntityEffect(new MeleeOffensiveFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defensiveModificationMelee(SpellParadigmMelee parad)
{
parad.addWorldEffect(new MeleeDefensiveFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void environmentalModificationMelee(SpellParadigmMelee parad)
{
parad.addWorldEffect(new MeleeEnvironmentalFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
protected int getCostForDefaultProjectile()
{
return (int)((5*Math.pow(1.5*this.powerEnhancement+1, 2)*(1.5*this.potencyEnhancement+1)+this.potencyEnhancement*15)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseProjectile()
{
return (int)(10*Math.pow((this.powerEnhancement)*1.3+1,2)*((1.5*this.potencyEnhancement+1))*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseProjectile()
{
return (int)(25*Math.pow(1*this.powerEnhancement+1,2)*(1*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentProjectile()
{
return (int)(75*(0.5*this.powerEnhancement+1)*(0.5*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefaultSelf()
{
return 10*(int)(10*Math.pow(1.5, this.powerEnhancement+1.5*this.potencyEnhancement)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseSelf()
{
return (int)(300*(3*powerEnhancement+1)*(2*potencyEnhancement + 1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseSelf()
{
return (int)(25*(3*this.potencyEnhancement+1)*(2*this.powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentSelf()
{
return (int)((15*Math.pow(1.7, powerEnhancement)+10*Math.pow(potencyEnhancement,1.8))*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefaultMelee()
{
return (int)(25*(1.2*this.potencyEnhancement+1)*(2.5*this.powerEnhancement+2)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseMelee()
{
return (int)(500*(1+this.potencyEnhancement)*(this.powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseMelee()
{
return (int)(30*(1.5*potencyEnhancement+1)*(3*powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentMelee()
{
return (int)(25*Math.pow(1.5*this.powerEnhancement+1,3)*(0.25*this.powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
public void defaultModificationTool(SpellParadigmTool parad)
{
parad.addItemManipulatorEffect(new ToolDefaultFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void offensiveModificationTool(SpellParadigmTool parad)
{
parad.addLeftClickEffect(new ToolOffensiveFire(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement));
parad.addToolString("offFire", "Fire Aspect" + " " + SpellHelper.getNumeralForInt(this.powerEnhancement + 1));
}
@Override
public void defensiveModificationTool(SpellParadigmTool parad) {
// TODO Auto-generated method stub
}
@Override
public void environmentalModificationTool(SpellParadigmTool parad) {
// TODO Auto-generated method stub
}
@Override
protected int getCostForDefaultTool()
{
return 1000;
}
@Override
protected int getCostForOffenseTool()
{
return (int)(0); //TODO
}
@Override
protected int getCostForDefenseTool() {
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentTool() {
// TODO Auto-generated method stub
return 0;
}
}

View file

@ -0,0 +1,241 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmTool;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.MeleeDefaultIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.MeleeDefensiveIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.MeleeEnvironmentalIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.MeleeOffensiveIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ProjectileDefaultIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ProjectileDefensiveIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ProjectileEnvironmentalIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ProjectileOffensiveIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.SelfDefaultIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.SelfDefensiveIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.SelfEnvironmentalIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.SelfOffensiveIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ToolDefaultIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ToolDefensiveIce;
public class SpellEffectIce extends SpellEffect
{
@Override
public void defaultModificationProjectile(SpellParadigmProjectile parad)
{
parad.damage+=this.potencyEnhancement;
parad.addImpactEffect(new ProjectileDefaultIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void offensiveModificationProjectile(SpellParadigmProjectile parad)
{
parad.damage+=2;
parad.addImpactEffect(new ProjectileOffensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defensiveModificationProjectile(SpellParadigmProjectile parad)
{
parad.addImpactEffect(new ProjectileDefensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void environmentalModificationProjectile(SpellParadigmProjectile parad)
{
parad.addUpdateEffect(new ProjectileEnvironmentalIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defaultModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfDefaultIce(this.powerEnhancement,this.potencyEnhancement, this.costEnhancement));
}
@Override
public void offensiveModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfOffensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defensiveModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfDefensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void environmentalModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfEnvironmentalIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defaultModificationMelee(SpellParadigmMelee parad)
{
parad.addEntityEffect(new MeleeDefaultIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void offensiveModificationMelee(SpellParadigmMelee parad)
{
parad.addEntityEffect(new MeleeOffensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defensiveModificationMelee(SpellParadigmMelee parad)
{
parad.addWorldEffect(new MeleeDefensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void environmentalModificationMelee(SpellParadigmMelee parad)
{
parad.addEntityEffect(new MeleeEnvironmentalIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
protected int getCostForDefaultProjectile()
{
return (int)((30)*(this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseProjectile()
{
return (int)((60)*(this.powerEnhancement+1)*(3*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseProjectile()
{
return (int)(75*(2*this.powerEnhancement+1)*(this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentProjectile()
{
return (int)(200*(2*this.powerEnhancement+1)*(2*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefaultSelf()
{
return (int)(20*(this.powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseSelf()
{
return (int)(100*(2*this.powerEnhancement+1)*(2*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseSelf()
{
return (int)(200*(3*powerEnhancement+1)*(2*potencyEnhancement + 1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentSelf()
{
return (int)(10*(1.5*potencyEnhancement+1)*(3*powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefaultMelee()
{
return (int)(250*(potencyEnhancement+1)*(1.5*powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseMelee()
{
return (int)(40*(1.5*potencyEnhancement+1)*Math.pow(1.5, powerEnhancement)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseMelee()
{
return (int)(50*(0.5*potencyEnhancement+1)*(0.7*powerEnhancement+1)*(0.5*powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentMelee()
{
return (int)(20*(0.5*potencyEnhancement+1)*(0*powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
public void defaultModificationTool(SpellParadigmTool parad)
{
parad.addLeftClickEffect(new ToolDefaultIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
parad.addToolString("FrostTouch", "FrostTouch" + " " + SpellHelper.getNumeralForInt((this.powerEnhancement+1)));
parad.addCritChance("FrostCrit", this.potencyEnhancement * 0.5f);
}
@Override
public void offensiveModificationTool(SpellParadigmTool parad)
{
parad.addDamageToHash("Sharpness", (this.powerEnhancement+1)*1.5f);
parad.addToolString("Sharpness", "Sharpness" + " " + SpellHelper.getNumeralForInt((this.powerEnhancement+1)));
parad.addCritChance("SharpCrit", this.potencyEnhancement);
}
@Override
public void defensiveModificationTool(SpellParadigmTool parad)
{
parad.addToolSummonEffect(new ToolDefensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void environmentalModificationTool(SpellParadigmTool parad)
{
parad.addToolString("SilkTouch", "Silk Touch" + " " + SpellHelper.getNumeralForInt((this.powerEnhancement+1)));
parad.setSilkTouch(true);
}
@Override
protected int getCostForDefaultTool()
{
return (int)(500 * (1 + this.powerEnhancement*0.3f) * (1 + this.potencyEnhancement*0.1f) * Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseTool()
{
return (int)(1000 * (1 + this.powerEnhancement*0.3f) * (1 + this.potencyEnhancement*0.2f) * Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseTool()
{
return (int)(500 * (1 + this.powerEnhancement*0.2) * (1 + this.potencyEnhancement*0.5) * Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentTool()
{
return (int)(1000 * Math.pow(0.85, costEnhancement));
}
}

View file

@ -0,0 +1,242 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmTool;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.MeleeDefaultWind;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.MeleeDefensiveWind;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.MeleeEnvironmentalWind;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.MeleeOffensiveWind;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.ProjectileDefaultWind;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.ProjectileEnvironmentalWind;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.ProjectileOffensiveWind;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.SelfDefaultWind;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.SelfDefensiveWind;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.SelfEnvironmentalWind;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.SelfOffensiveWind;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.ToolDefensiveWind;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.ToolEnvironmentalWind;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.ToolOffensiveWind;
public class SpellEffectWind extends SpellEffect
{
@Override
public void defaultModificationProjectile(SpellParadigmProjectile parad)
{
parad.addImpactEffect(new ProjectileDefaultWind(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void offensiveModificationProjectile(SpellParadigmProjectile parad)
{
parad.addImpactEffect(new ProjectileOffensiveWind(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defensiveModificationProjectile(SpellParadigmProjectile parad)
{
parad.isSilkTouch = true;
}
@Override
public void environmentalModificationProjectile(SpellParadigmProjectile parad)
{
parad.addUpdateEffect(new ProjectileEnvironmentalWind(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defaultModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfDefaultWind(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void offensiveModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfOffensiveWind(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defensiveModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfDefensiveWind(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void environmentalModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfEnvironmentalWind(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defaultModificationMelee(SpellParadigmMelee parad)
{
parad.addEntityEffect(new MeleeDefaultWind(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void offensiveModificationMelee(SpellParadigmMelee parad)
{
parad.addEntityEffect(new MeleeOffensiveWind(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defensiveModificationMelee(SpellParadigmMelee parad)
{
parad.addEntityEffect(new MeleeDefensiveWind(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void environmentalModificationMelee(SpellParadigmMelee parad)
{
parad.addWorldEffect(new MeleeEnvironmentalWind(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
protected int getCostForDefaultProjectile()
{
return (int)(100*(this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseProjectile()
{
return (int)(100*(0.5*this.potencyEnhancement+1)*(this.powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseProjectile()
{
return (int)(100*(this.potencyEnhancement+1));
}
@Override
protected int getCostForEnvironmentProjectile()
{
return (int)(50*(this.powerEnhancement+1)*(this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefaultSelf()
{
return (int)(100*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseSelf()
{
return (int)(100*(0.5*this.powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseSelf()
{
return (int)(500*(0.7d*this.powerEnhancement+1)*(0.8*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentSelf()
{
return (int)(500*(0.7d*this.powerEnhancement+1)*(0.2*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefaultMelee()
{
return (int)(350*(1.0*this.potencyEnhancement+1)*(1.2*this.powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseMelee()
{
return (int)(250*(1.0*this.potencyEnhancement+1)*(0.7*this.powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseMelee()
{
return (int)(150*(1.0*this.potencyEnhancement+1)*(0.7*this.powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentMelee()
{
return (int)(100*(1.0*this.potencyEnhancement+1)*(0.7*this.powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
public void defaultModificationTool(SpellParadigmTool parad)
{
String toolClass = "axe";
float digSpeed = 7.0f;
switch(this.powerEnhancement)
{
case 1:
digSpeed = 9.0f;
break;
case 2:
digSpeed = 12.0f;
break;
case 3:
digSpeed = 16.0f;
break;
case 4:
digSpeed = 21.0f;
break;
case 5:
digSpeed = 27.0f;
break;
}
parad.setDigSpeed(toolClass, digSpeed);
int hlvl = this.potencyEnhancement + 2;
parad.setHarvestLevel(toolClass, hlvl);
}
@Override
public void offensiveModificationTool(SpellParadigmTool parad)
{
parad.addLeftClickEffect(new ToolOffensiveWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement));
}
@Override
public void defensiveModificationTool(SpellParadigmTool parad)
{
parad.addLeftClickEffect(new ToolDefensiveWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement));
parad.addToolString("DefWind", "Knockback" + " " + SpellHelper.getNumeralForInt(this.powerEnhancement + 1));
}
@Override
public void environmentalModificationTool(SpellParadigmTool parad)
{
parad.addBlockBreakEffect(new ToolEnvironmentalWind(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement));
}
@Override
protected int getCostForDefaultTool()
{
return (int)(1000 * (1 + this.potencyEnhancement*0.1f) * (1 + this.powerEnhancement*0.2f) * Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseTool()
{
return 0; //Cost is on the attack method
}
@Override
protected int getCostForDefenseTool()
{
return (int)(150 * (1+this.powerEnhancement*0.4f) * (1+this.potencyEnhancement*0.3f) * Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentTool()
{
return (int)(150 * (1+this.powerEnhancement) * Math.pow(0.85, costEnhancement));
}
}

View file

@ -0,0 +1,392 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.management.ServerConfigurationManager;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
public class SpellHelper
{
public static Random rand = new Random();
public static final double root2 = Math.sqrt(2);
public static void smeltBlockInWorld(World world, int posX, int posY, int posZ)
{
FurnaceRecipes recipes = FurnaceRecipes.smelting();
Block block = world.getBlock(posX, posY, posZ);
if(block==null)
{
return;
}
int meta = world.getBlockMetadata(posX, posY, posZ);
ItemStack smeltedStack = recipes.getSmeltingResult(new ItemStack(block,1,meta));
if(smeltedStack!=null && smeltedStack.getItem() instanceof ItemBlock)
{
world.setBlock(posX, posY, posZ, ((ItemBlock)(smeltedStack.getItem())).field_150939_a, smeltedStack.getItemDamage(), 3);
}
}
public static List<Entity> getEntitiesInRange(World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius)
{
return world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(posX-0.5f, posY-0.5f, posZ-0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(horizontalRadius, verticalRadius, horizontalRadius));
}
public static List<EntityItem> getItemsInRange(World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius)
{
return world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(posX-0.5f, posY-0.5f, posZ-0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(horizontalRadius, verticalRadius, horizontalRadius));
}
public static List<EntityPlayer> getPlayersInRange(World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius)
{
return world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX-0.5f, posY-0.5f, posZ-0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(horizontalRadius, verticalRadius, horizontalRadius));
}
public static double gaussian(double d)
{
return d * ((rand.nextFloat() - 0.5D));
}
public static Vec3 getEntityBlockVector(Entity entity)
{
int posX = (int) Math.round(entity.posX - 0.5f);
int posY = (int) entity.posY;
int posZ = (int) Math.round(entity.posZ - 0.5f);
return entity.getLookVec().createVectorHelper(posX, posY, posZ);
}
public static ForgeDirection getDirectionForLookVector(Vec3 lookVec)
{
double distance = lookVec.lengthVector();
if(lookVec.yCoord>distance*0.9)
{
return ForgeDirection.UP;
}
if(lookVec.yCoord<distance*-0.9)
{
return ForgeDirection.DOWN;
}
return getCompassDirectionForLookVector(lookVec);
}
public static ForgeDirection getCompassDirectionForLookVector(Vec3 lookVec)
{
double radius = Math.sqrt(Math.pow(lookVec.xCoord,2)+Math.pow(lookVec.zCoord,2));
if(lookVec.zCoord>radius*1/root2)
{
return ForgeDirection.SOUTH;
}
if(lookVec.zCoord<-radius*1/root2)
{
return ForgeDirection.NORTH;
}
if(lookVec.xCoord>radius*1/root2)
{
return ForgeDirection.EAST;
}
if(lookVec.xCoord<-radius*1/root2)
{
return ForgeDirection.WEST;
}
return ForgeDirection.EAST;
}
public static void freezeWaterBlock(World world, int posX, int posY, int posZ)
{
Block block = world.getBlock(posX, posY, posZ);
if(block == Blocks.water || block == Blocks.flowing_water)
{
world.setBlock(posX, posY, posZ, Blocks.ice);
}
}
public static String getUsername(EntityPlayer player)
{
return SoulNetworkHandler.getUsername(player);
}
public static EntityPlayer getPlayerForUsername(String str)
{
if(MinecraftServer.getServer() == null)
{
return null;
}
return MinecraftServer.getServer().getConfigurationManager().func_152612_a(str);
}
public static void sendParticleToPlayer(EntityPlayer player, String str, double xCoord, double yCoord, double zCoord, double xVel, double yVel, double zVel)
{
if(player instanceof EntityPlayerMP)
{
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getParticlePacket(str, xCoord, yCoord, zCoord, xVel, yVel, zVel),(EntityPlayerMP) player);
}
}
public static void sendIndexedParticleToPlayer(EntityPlayer player, int index, double xCoord, double yCoord, double zCoord)
{
switch(index)
{
case 1:
SpellHelper.sendParticleToPlayer(player, "mobSpell", xCoord + 0.5D + rand.nextGaussian() / 8, yCoord + 1.1D, zCoord + 0.5D + rand.nextGaussian() / 8, 0.5117D, 0.0117D, 0.0117D);
break;
case 2:
SpellHelper.sendParticleToPlayer(player, "reddust", xCoord + 0.5D + rand.nextGaussian() / 8, yCoord + 1.1D, zCoord + 0.5D + rand.nextGaussian() / 8, 0.82D, 0.941D, 0.91D);
break;
case 3:
SpellHelper.sendParticleToPlayer(player, "mobSpell", xCoord + 0.5D + rand.nextGaussian() / 8, yCoord + 1.1D, zCoord + 0.5D + rand.nextGaussian() / 8, 1.0D, 0.371D, 0.371D);
break;
case 4:
float f = (float) 1.0F;
float f1 = f * 0.6F + 0.4F;
float f2 = f * f * 0.7F - 0.5F;
float f3 = f * f * 0.6F - 0.7F;
for (int l = 0; l < 8; ++l)
{
SpellHelper.sendParticleToPlayer(player,"reddust", xCoord + Math.random() - Math.random(), yCoord + Math.random() - Math.random(), zCoord + Math.random() - Math.random(), f1, f2, f3);
}
break;
}
}
public static void sendParticleToAllAround(World world, double xPos, double yPos, double zPos, int radius, int dimension, String str, double xCoord, double yCoord, double zCoord, double xVel, double yVel, double zVel)
{
List<EntityPlayer> entities = SpellHelper.getPlayersInRange(world, xPos, yPos, zPos, radius, radius);
if(entities==null)
{
return;
}
for(EntityPlayer player : entities)
{
SpellHelper.sendParticleToPlayer(player, str, xCoord, yCoord, zCoord, xVel, yVel, zVel);
}
}
public static void sendIndexedParticleToAllAround(World world, double xPos, double yPos, double zPos, int radius, int dimension, int index, double xCoord, double yCoord, double zCoord)
{
List<EntityPlayer> entities = SpellHelper.getPlayersInRange(world, xPos, yPos, zPos, radius, radius);
if(entities==null)
{
return;
}
for(EntityPlayer player : entities)
{
SpellHelper.sendIndexedParticleToPlayer(player, index, xCoord, yCoord, zCoord);
}
}
public static void setPlayerSpeedFromServer(EntityPlayer player, double motionX, double motionY, double motionZ)
{
if(player instanceof EntityPlayerMP)
{
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getVelSettingPacket(motionX, motionY, motionZ), (EntityPlayerMP) player);
}
}
public static boolean isFakePlayer(World world, EntityPlayer player)
{
if(world.isRemote)
{
return false;
}
if(player instanceof FakePlayer || SpellHelper.getUsername(player).contains("[CoFH]"))
{
return true;
}
String str = player.getClass().getSimpleName();
if(str.contains("GC"))
{
return false;
}
if(player.getClass().equals(EntityPlayerMP.class))
{
return false;
}
return false;
}
public static void smashBlock(World world, int posX, int posY, int posZ)
{
Block block = world.getBlock(posX, posY, posZ);
if(block==Blocks.stone)
{
world.setBlock(posX, posY, posZ, Blocks.cobblestone);
return;
}
else if(block==Blocks.cobblestone)
{
world.setBlock(posX, posY, posZ, Blocks.gravel);
return;
}
else if(block==Blocks.gravel)
{
world.setBlock(posX, posY, posZ, Blocks.sand);
return;
}
}
public static boolean isBlockFluid(Block block)
{
return block instanceof BlockLiquid;
}
public static void evaporateWaterBlock(World world, int posX, int posY, int posZ)
{
Block block = world.getBlock(posX, posY, posZ);
if(block == Blocks.water || block == Blocks.flowing_water)
{
world.setBlockToAir(posX, posY, posZ);
}
}
public static ItemStack getDustForOre(ItemStack item)
{
String oreName = OreDictionary.getOreName(OreDictionary.getOreID(item));
if(oreName.contains("ore"))
{
String lowercaseOre = oreName.toLowerCase();
boolean isAllowed = false;
for(String str : AlchemicalWizardry.allowedCrushedOresArray)
{
String testStr = str.toLowerCase();
if(lowercaseOre.contains(testStr))
{
isAllowed = true;
break;
}
}
if(!isAllowed)
{
return null;
}
String dustName = oreName.replace("ore", "dust");
ArrayList<ItemStack> items = OreDictionary.getOres(dustName);
if(items!=null && items.size()>=1)
{
return(items.get(0).copy());
}
}
return null;
}
public static List<ItemStack> getItemsFromBlock(World world, Block block, int x, int y, int z, int meta, boolean silkTouch, int fortune)
{
boolean canSilk = block.canSilkHarvest(world, null, x, y, z, meta);
if(canSilk && silkTouch)
{
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
ItemStack item = new ItemStack(block, 1, meta);
items.add(item);
return items;
}else
{
return block.getDrops(world, x, y, z, meta, fortune);
}
}
public static void spawnItemListInWorld(List<ItemStack> items, World world, float x, float y, float z)
{
for(ItemStack stack : items)
{
EntityItem itemEntity = new EntityItem(world, x, y, z, stack);
itemEntity.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(itemEntity);
}
}
public static MovingObjectPosition raytraceFromEntity (World world, Entity player, boolean par3, double range)
{
float f = 1.0F;
float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f;
float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f;
double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double) f;
double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double) f;
if (!world.isRemote && player instanceof EntityPlayer)
d1 += 1.62D;
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f;
Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2);
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
float f6 = MathHelper.sin(-f1 * 0.017453292F);
float f7 = f4 * f5;
float f8 = f3 * f5;
double d3 = range;
if (player instanceof EntityPlayerMP)
{
d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance();
}
Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
return world.func_147447_a(vec3, vec31, par3, !par3, par3);
}
public static String getNumeralForInt(int num)
{
switch(num)
{
case 1: return "I";
case 2: return "II";
case 3: return "III";
case 4: return "IV";
case 5: return "V";
case 6: return "VI";
case 7: return "VII";
case 8: return "VIII";
case 9: return "IX";
case 10: return "X";
default: return "";
}
}
}

View file

@ -0,0 +1,74 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntityEffect
{
protected float range;
protected float radius;
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
protected int maxHit;
public ExtrapolatedMeleeEntityEffect(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
this.range = 0;
this.radius = 0;
this.maxHit = 1;
}
@Override
public void onEntityImpact(World world, EntityPlayer entityPlayer)
{
Vec3 lookVec = entityPlayer.getLook(range);
double x = entityPlayer.posX + lookVec.xCoord;
double y = entityPlayer.posY + entityPlayer.getEyeHeight() + lookVec.yCoord;
double z = entityPlayer.posZ + lookVec.zCoord;
List<Entity> entities = world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(x-0.5f, y-0.5f, z-0.5f, x + 0.5f, y + 0.5f, z + 0.5f).expand(radius, radius, radius));
int hit = 0;
if(entities!=null)
{
for(Entity entity : entities)
{
if(hit<maxHit&&!entity.equals(entityPlayer))
{
if(this.entityEffect(world, entity, entityPlayer))
{
hit++;
}
}
}
}
}
protected abstract boolean entityEffect(World world, Entity entity, EntityPlayer player);
public void setRange(float range)
{
this.range = range;
}
public void setRadius(float radius)
{
this.radius = radius;
}
public void setMaxNumberHit(int maxHit)
{
this.maxHit = maxHit;
}
}

View file

@ -0,0 +1,9 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public interface IMeleeSpellEntityEffect
{
public void onEntityImpact(World world, EntityPlayer entityPlayer);
}

View file

@ -0,0 +1,10 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public interface IMeleeSpellWorldEffect
{
public void onWorldEffect(World world, EntityPlayer entityPlayer);
}

View file

@ -0,0 +1,11 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import net.minecraft.entity.Entity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public interface IProjectileImpactEffect
{
public void onEntityImpact(Entity mop, Entity projectile);
public void onTileImpact(World world, MovingObjectPosition mop);
}

View file

@ -0,0 +1,8 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import net.minecraft.entity.Entity;
public interface IProjectileUpdateEffect
{
public void onUpdateEffect(Entity projectile);
}

View file

@ -0,0 +1,9 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public interface ISelfSpellEffect
{
public void onSelfUse(World world, EntityPlayer player);
}

View file

@ -0,0 +1,33 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public abstract class MeleeSpellCenteredWorldEffect extends MeleeSpellWorldEffect
{
protected float range;
public MeleeSpellCenteredWorldEffect(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onWorldEffect(World world, EntityPlayer entityPlayer)
{
Vec3 lookVec = entityPlayer.getLook(range).normalize();
int x = (int)(entityPlayer.posX + lookVec.xCoord*range);
int y = (int)(entityPlayer.posY + entityPlayer.getEyeHeight() + lookVec.yCoord*range);
int z = (int)(entityPlayer.posZ + lookVec.zCoord*range);
this.onCenteredWorldEffect(entityPlayer, world, x, y, z);
}
public void setRange(float range)
{
this.range = range;
}
public abstract void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ);
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public abstract class MeleeSpellWorldEffect implements IMeleeSpellWorldEffect
{
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
public MeleeSpellWorldEffect(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
}
@Override
public abstract void onWorldEffect(World world, EntityPlayer entityPlayer);
}

View file

@ -0,0 +1,15 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
public abstract class ProjectileImpactEffect implements IProjectileImpactEffect
{
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
public ProjectileImpactEffect(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
}
}

View file

@ -0,0 +1,15 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
public abstract class ProjectileUpdateEffect implements IProjectileUpdateEffect
{
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
public ProjectileUpdateEffect(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
}
}

View file

@ -0,0 +1,18 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public abstract class SelfSpellEffect implements ISelfSpellEffect
{
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
public SelfSpellEffect(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
}
}

View file

@ -0,0 +1,45 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityFallingBlock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.MeleeSpellCenteredWorldEffect;
public class MeleeDefaultEarth extends MeleeSpellCenteredWorldEffect
{
public MeleeDefaultEarth(int power, int potency, int cost)
{
super(power, potency, cost);
this.setRange(3*power + 2);
}
@Override
public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ)
{
int radius = this.potencyUpgrades;
for(int i=-radius; i<=radius; i++)
{
for(int j=-radius; j<=radius; j++)
{
for(int k=-radius; k<=radius; k++)
{
if(!world.isAirBlock(posX + i, posY + j, posZ + k) && world.getTileEntity(posX + i, posY + j, posZ + k)==null)
{
Block block = world.getBlock(posX + i, posY + j, posZ + k);
if(block.getBlockHardness(world, posX + i, posY + j, posZ + k)==-1)
{
continue;
}
int meta = world.getBlockMetadata(posX + i, posY + j, posZ + k);
EntityFallingBlock entity = new EntityFallingBlock(world, posX + i + 0.5f, posY + j + 0.5f, posZ + k + 0.5f, block, meta);
world.spawnEntityInWorld(entity);
}
}
}
}
}
}

View file

@ -0,0 +1,37 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.MeleeSpellCenteredWorldEffect;
public class MeleeDefensiveEarth extends MeleeSpellCenteredWorldEffect
{
public MeleeDefensiveEarth(int power, int potency, int cost)
{
super(power, potency, cost);
this.setRange(3*power+2);
}
@Override
public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ)
{
ForgeDirection dir = SpellHelper.getDirectionForLookVector(player.getLook(1));
int vertRadius = (int)(2 + 1.0f/2.0f*Math.pow(this.potencyUpgrades,2)+1.0f/2.0f*this.potencyUpgrades);
int horizRadius = this.potencyUpgrades+1;
int xOff = dir.offsetX;
int zOff = dir.offsetZ;
for(int i=-horizRadius; i<=horizRadius; i++)
{
for(int j=0; j<vertRadius; j++)
{
BlockTeleposer.swapBlocks(world, world, posX + i*zOff, posY + j, posZ + i*xOff, posX + i*zOff, posY + j - vertRadius, posZ + i*xOff);
}
}
}
}

View file

@ -0,0 +1,48 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.MeleeSpellCenteredWorldEffect;
public class MeleeEnvironmentalEarth extends MeleeSpellCenteredWorldEffect
{
public MeleeEnvironmentalEarth(int power, int potency, int cost)
{
super(power, potency, cost);
this.setRange(3*power + 2);
}
@Override
public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ)
{
int radius = this.potencyUpgrades;
for(int i=-radius; i<=radius; i++)
{
for(int j=-radius; j<=radius; j++)
{
for(int k=-radius; k<=radius; k++)
{
if(!world.isAirBlock(posX + i, posY + j, posZ + k) && world.getTileEntity(posX + i, posY + j, posZ + k)==null)
{
ItemStack stack = new ItemStack(world.getBlock(posX+i, posY+j, posZ+k),1,world.getBlockMetadata(posX+i, posY+j, posZ+k));
ItemStack dustStack = SpellHelper.getDustForOre(stack);
if(dustStack!=null)
{
dustStack.stackSize *= 3;
world.spawnEntityInWorld(new EntityItem(world,posX,posY,posZ,dustStack));
world.setBlockToAir(posX+i, posY+j, posZ+k);
}
}
}
}
}
}
}

View file

@ -0,0 +1,34 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.MeleeSpellCenteredWorldEffect;
public class MeleeOffensiveEarth extends MeleeSpellCenteredWorldEffect
{
public MeleeOffensiveEarth(int power, int potency, int cost)
{
super(power, potency, cost);
this.setRange(3*power + 2);
}
@Override
public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ)
{
int radius = this.potencyUpgrades;
for(int i=-radius; i<=radius; i++)
{
for(int j=-radius; j<=radius; j++)
{
for(int k=-radius; k<=radius; k++)
{
SpellHelper.smashBlock(world, posX+i, posY+j, posZ+k);
}
}
}
}
}

View file

@ -0,0 +1,57 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
public class ProjectileDefaultEarth extends ProjectileImpactEffect
{
public ProjectileDefaultEarth(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onEntityImpact(Entity mop, Entity proj)
{
// TODO Auto-generated method stub
}
@Override
public void onTileImpact(World world, MovingObjectPosition mop)
{
int horizRange = (int)(0.5*(this.powerUpgrades)+1);
int vertRange = (int)(0.5*(this.powerUpgrades)+1);
int posX = mop.blockX;
int posY = mop.blockY;
int posZ = mop.blockZ;
for(int i=-horizRange; i<=horizRange; i++)
{
for(int j=-vertRange; j<=vertRange; j++)
{
for(int k=-horizRange; k<=horizRange; k++)
{
if(!world.isAirBlock(posX+i, posY+j, posZ+k))
{
Block block = world.getBlock(posX+i, posY+j, posZ+k);
if(block == null || block.getBlockHardness(world, posX+i, posY+j, posZ+k)==-1 || SpellHelper.isBlockFluid(block))
{
continue;
}
//block.breakBlock(world, posX+i, posY+j, posZ+k, block.blockID, world.getBlockMetadata(posX+i, posY+j, posZ+k));
//world.destroyBlock(posX+i, posY+j, posZ+k, true);
world.func_147480_a(posX+i, posY+j, posZ+k, false);
}
}
}
}
}
}

View file

@ -0,0 +1,66 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileUpdateEffect;
public class ProjectileDefensiveEarth extends ProjectileImpactEffect
{
public ProjectileDefensiveEarth(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onEntityImpact(Entity mop, Entity proj)
{
// TODO Auto-generated method stub
}
@Override
public void onTileImpact(World world, MovingObjectPosition mop)
{
int horizRange = (int)(this.powerUpgrades);
int vertRange = (int)(this.potencyUpgrades);
int posX = mop.blockX;
int posY = mop.blockY;
int posZ = mop.blockZ;
for(int i=-horizRange; i<=horizRange; i++)
{
for(int j=-vertRange; j<=vertRange; j++)
{
for(int k=-horizRange; k<=horizRange; k++)
{
if(!world.isAirBlock(posX+i, posY+j, posZ+k))
{
Block block = world.getBlock(posX+i, posY+j, posZ+k);
if(block == null || block.getBlockHardness(world, posX+i, posY+j, posZ+k)==-1)
{
continue;
}
//block.breakBlock(world, posX+i, posY+j, posZ+k, block.blockID, world.getBlockMetadata(posX+i, posY+j, posZ+k));
//world.destroyBlock(posX+i, posY+j, posZ+k, true);
if(world.rand.nextFloat()<0.6f)
{
SpellHelper.smashBlock(world, posX+i, posY+j, posZ+k);
}
}
}
}
}
}
}

View file

@ -0,0 +1,82 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileUpdateEffect;
public class ProjectileEnvironmentalEarth extends ProjectileUpdateEffect
{
public ProjectileEnvironmentalEarth(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onUpdateEffect(Entity projectile)
{
Vec3 posVec = SpellHelper.getEntityBlockVector(projectile);
int horizRange = this.powerUpgrades+1;
int vertRange = (int)(0.5*(this.powerUpgrades+1));
int maxBlocks = (int)(2*Math.pow(3.47, this.potencyUpgrades));
int posX = (int)(posVec.xCoord);
int posY = (int)(posVec.yCoord);
int posZ = (int)(posVec.zCoord);
World worldObj = projectile.worldObj;
if(projectile instanceof EntitySpellProjectile)
{
int blocksBroken = ((EntitySpellProjectile) projectile).getBlocksBroken();
if(blocksBroken>=maxBlocks)
{
return;
}
for(int i=-horizRange; i<=horizRange; i++)
{
for(int j=-vertRange; j<=vertRange; j++)
{
for(int k=-horizRange; k<=horizRange; k++)
{
if(!worldObj.isAirBlock(posX+i, posY+j, posZ+k)&&blocksBroken<maxBlocks)
{
Block block = worldObj.getBlock(posX+i, posY+j, posZ+k);
int meta = worldObj.getBlockMetadata(posX+i, posY+j, posZ+k);
if(block == null || block.getBlockHardness(worldObj, posX+i, posY+j, posZ+k)==-1 || SpellHelper.isBlockFluid(block))
{
continue;
}
if(((EntitySpellProjectile)projectile).getIsSilkTouch()&&block.canSilkHarvest(worldObj, ((EntitySpellProjectile)projectile).shootingEntity, posX+i, posY+j, posZ+k, meta))
{
ItemStack stack = new ItemStack(block,1,meta);
EntityItem itemEntity = new EntityItem(worldObj,posX+i+0.5, posY+j+0.5, posZ+k+0.5,stack);
worldObj.spawnEntityInWorld(itemEntity);
worldObj.setBlockToAir(posX+i, posY+j, posZ+k);
}else
{
worldObj.func_147480_a(posX+i, posY+j, posZ+k, true);
}
//block.breakBlock(worldObj, posX+i, posY+j, posZ+k, block.blockID, worldObj.getBlockMetadata(posX+i, posY+j, posZ+k));
//worldObj.destroyBlock(posX+i, posY+j, posZ+k, true);
blocksBroken++;
}
}
}
}
((EntitySpellProjectile) projectile).setBlocksBroken(blocksBroken);
}
}
}

View file

@ -0,0 +1,92 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
public class ProjectileOffensiveEarth extends ProjectileImpactEffect
{
public ProjectileOffensiveEarth(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onEntityImpact(Entity mop, Entity proj)
{
int horizRange = (int)(this.powerUpgrades);
int vertDepth = (int)(3*this.potencyUpgrades+1);
Vec3 blockVector = SpellHelper.getEntityBlockVector(mop);
int posX = (int)(blockVector.xCoord);
int posY = (int)(blockVector.yCoord);
int posZ = (int)(blockVector.zCoord);
World world = mop.worldObj;
for(int i=-horizRange; i<=horizRange; i++)
{
for(int j=-vertDepth; j<0; j++)
{
for(int k=-horizRange; k<=horizRange; k++)
{
if(!world.isAirBlock(posX+i, posY+j, posZ+k))
{
Block block = world.getBlock(posX+i, posY+j, posZ+k);
if(block == null || block.getBlockHardness(world, posX+i, posY+j, posZ+k)==-1)
{
continue;
}
//block.breakBlock(world, posX+i, posY+j, posZ+k, block.blockID, world.getBlockMetadata(posX+i, posY+j, posZ+k));
//world.destroyBlock(posX+i, posY+j, posZ+k, true);
if(block == Blocks.stone || block == Blocks.cobblestone || block == Blocks.sand || block == Blocks.gravel || block == Blocks.grass || block == Blocks.dirt)
{
world.setBlockToAir(posX+i, posY+j, posZ+k);
}
}
}
}
}
}
@Override
public void onTileImpact(World world, MovingObjectPosition mop)
{
// int horizRange = (int)(this.powerUpgrades);
// int vertRange = (int)(this.potencyUpgrades);
//
// int posX = mop.blockX;
// int posY = mop.blockY;
// int posZ = mop.blockZ;
//
// for(int i=-horizRange; i<=horizRange; i++)
// {
// for(int j=-vertRange; j<=vertRange; j++)
// {
// for(int k=-horizRange; k<=horizRange; k++)
// {
// if(!world.isAirBlock(posX+i, posY+j, posZ+k))
// {
// Block block = world.getBlock(posX+i, posY+j, posZ+k);
// if(block == null || block.getBlockHardness(world, posX+i, posY+j, posZ+k)==-1)
// {
// continue;
// }
// //block.breakBlock(world, posX+i, posY+j, posZ+k, block.blockID, world.getBlockMetadata(posX+i, posY+j, posZ+k));
// //world.destroyBlock(posX+i, posY+j, posZ+k, true);
// if(world.rand.nextFloat()<0.6f)
// {
// SpellHelper.smashBlock(world, posX+i, posY+j, posZ+k);
// }
// }
// }
// }
// }
}
}

View file

@ -0,0 +1,52 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfDefaultEarth extends SelfSpellEffect
{
public SelfDefaultEarth(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
int horizRadius = this.powerUpgrades;
int vertRange = 5 + 10*this.potencyUpgrades;
Vec3 blockVec = SpellHelper.getEntityBlockVector(player);
int posX = (int)(blockVec.xCoord);
int posY = (int)(blockVec.yCoord) - 1;
int posZ = (int)(blockVec.zCoord);
for(int i=-horizRadius; i<=horizRadius; i++)
{
for(int k=-horizRadius; k<=horizRadius; k++)
{
if(!world.isAirBlock(posX+i, posY, posZ+k))
{
continue;
}
for(int j=-1; j>=-vertRange; j--)
{
if(!world.isAirBlock(posX+i, posY+j, posZ+k)&&!SpellHelper.isBlockFluid(world.getBlock(posX+i, posY+j, posZ+k)))
{
BlockTeleposer.swapBlocks(world, world, posX+i, posY, posZ+k, posX+i, posY+j, posZ+k);
break;
}
}
}
}
}
}

View file

@ -0,0 +1,27 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfDefensiveEarth extends SelfSpellEffect
{
public SelfDefensiveEarth(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
int pot = 2*this.potencyUpgrades + 1;
int duration = 20*60*(this.powerUpgrades+1);
player.addPotionEffect(new PotionEffect(Potion.field_76434_w.id,duration, pot));
player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionHeavyHeart.id, duration, pot));
}
}

View file

@ -0,0 +1,37 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfEnvironmentalEarth extends SelfSpellEffect
{
public SelfEnvironmentalEarth(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
float radius = this.powerUpgrades*2 + 1.5f;
int dur = this.powerUpgrades*5*20 + 60;
List<Entity> entities = SpellHelper.getEntitiesInRange(world, player.posX, player.posY, player.posZ, radius, radius);
for(Entity entity : entities)
{
if(entity instanceof EntityLiving)
{
((EntityLiving) entity).addPotionEffect(new PotionEffect(Potion.weakness.id,dur,this.potencyUpgrades));
}
}
}
}

View file

@ -0,0 +1,43 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfOffensiveEarth extends SelfSpellEffect
{
public SelfOffensiveEarth(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
int horizRadius = this.powerUpgrades;
int vertRadius = this.potencyUpgrades + 1;
Vec3 blockVec = SpellHelper.getEntityBlockVector(player);
int posX = (int)(blockVec.xCoord);
int posY = (int)(blockVec.yCoord);
int posZ = (int)(blockVec.zCoord);
for(int i=-horizRadius; i<=horizRadius; i++)
{
for(int j=-vertRadius; j<0; j++)
{
for(int k=-horizRadius; k<=horizRadius; k++)
{
if(world.rand.nextFloat()<0.7f)
{
SpellHelper.smashBlock(world, posX+i, posY+j, posZ+k);
}
}
}
}
}
}

View file

@ -0,0 +1,86 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.items.spell.ItemSpellMultiTool;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.DigAreaEffect;
public class ToolEnvironmentalEarth extends DigAreaEffect
{
public ToolEnvironmentalEarth(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public int digSurroundingArea(ItemStack container, World world, EntityPlayer player, MovingObjectPosition blockPos, String usedToolClass, float blockHardness, int harvestLvl, ItemSpellMultiTool itemTool)
{
if(!blockPos.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK))
{
return 0;
}
int x = blockPos.blockX;
int y = blockPos.blockY;
int z = blockPos.blockZ;
ForgeDirection sidehit = ForgeDirection.getOrientation(blockPos.sideHit);
int radius = 2;
int depth = 5;
depth--;
int posX = radius;
int negX = radius;
int posY = radius;
int negY = radius;
int posZ = radius;
int negZ = radius;
switch(sidehit)
{
case UP:
posY = 0;
negY = depth;
break;
case DOWN:
negY = 0;
posY = depth;
break;
case SOUTH:
posZ = 0;
negZ = depth;
break;
case NORTH:
negZ = 0;
posZ = depth;
break;
case WEST:
negX = 0;
posX = depth;
break;
case EAST:
posX = 0;
negX = depth;
break;
default:
}
for(int xPos = x-negX; xPos <= x+posX; xPos++)
{
for(int yPos = y-negY; yPos <= y+posY; yPos++)
{
for(int zPos = z-negZ; zPos <= z+posZ; zPos++)
{
this.breakBlock(container, world, player, blockHardness, xPos, yPos, zPos, itemTool);
}
}
}
return 0;
}
}

View file

@ -0,0 +1,58 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.earth;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.ItemManipulator;
public class ToolOffensiveEarth extends ItemManipulator
{
public static Block[] mundaneList = new Block[]{Blocks.stone,Blocks.cobblestone,Blocks.sand,Blocks.gravel,Blocks.netherrack,Blocks.dirt};
public ToolOffensiveEarth(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public List<ItemStack> handleItemsOnBlockBroken(ItemStack toolStack, List<ItemStack> itemList)
{
List<ItemStack> newList = new LinkedList();
for(ItemStack stack : itemList)
{
if(stack != null && stack.getItem() instanceof ItemBlock && !this.isMundaneBlock(((ItemBlock)stack.getItem()).field_150939_a))
{
newList.add(stack);
}
}
return newList;
}
public boolean isMundaneBlock(Block block)
{
for(Block test : mundaneList)
{
if(test.equals(block))
{
return true;
}
}
return false;
}
}

View file

@ -0,0 +1,30 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ExtrapolatedMeleeEntityEffect;
public class MeleeDefaultFire extends ExtrapolatedMeleeEntityEffect
{
public MeleeDefaultFire(int power, int potency, int cost)
{
super(power, potency, cost);
this.setRange(3+0.3f*potency);
this.setRadius(2+0.3f*potency);
this.setMaxNumberHit(potency+1);
}
@Override
protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer)
{
if(entity instanceof EntityLiving)
{
entity.setFire(3*this.powerUpgrades+3);
return true;
}
return false;
}
}

View file

@ -0,0 +1,49 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.MeleeSpellWorldEffect;
public class MeleeDefensiveFire extends MeleeSpellWorldEffect
{
public MeleeDefensiveFire(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onWorldEffect(World world, EntityPlayer entityPlayer)
{
ForgeDirection look = SpellHelper.getCompassDirectionForLookVector(entityPlayer.getLookVec());
int width = this.potencyUpgrades + 1;
int length = 5*this.powerUpgrades + 3;
int xOffset = look.offsetX;
int zOffset = look.offsetZ;
Vec3 lookVec = SpellHelper.getEntityBlockVector(entityPlayer);
int xStart = (int)(lookVec.xCoord)+1*xOffset;
int zStart = (int)(lookVec.zCoord)+1*zOffset;
int yStart = (int)(lookVec.yCoord)-1;
for(int i=-width; i<=width; i++)
{
for(int j=0; j<length;j++)
{
for(int k=0;k<3;k++)
{
if(world.isAirBlock(xStart + i*(zOffset) + j*(xOffset), yStart+k, zStart + i*(xOffset) + j*(zOffset)))
{
world.setBlock(xStart + i*(zOffset) + j*(xOffset), yStart+k, zStart + i*(xOffset) + j*(zOffset), Blocks.fire);
}
}
}
}
}
}

View file

@ -0,0 +1,32 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.MeleeSpellCenteredWorldEffect;
public class MeleeEnvironmentalFire extends MeleeSpellCenteredWorldEffect
{
public MeleeEnvironmentalFire(int power, int potency, int cost)
{
super(power, potency, cost);
this.setRange(3*power + 2);
}
@Override
public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ)
{
int radius = this.potencyUpgrades;
for(int i=-radius; i<=radius; i++)
{
for(int j=-radius; j<=radius; j++)
{
for(int k=-radius; k<=radius; k++)
{
SpellHelper.evaporateWaterBlock(world, posX+i, posY+j, posZ+k);
}
}
}
}
}

View file

@ -0,0 +1,32 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ExtrapolatedMeleeEntityEffect;
public class MeleeOffensiveFire extends ExtrapolatedMeleeEntityEffect
{
public MeleeOffensiveFire(int power, int potency, int cost)
{
super(power, potency, cost);
this.setRange(3+0.3f*potency);
this.setRadius(2+0.3f*potency);
this.setMaxNumberHit(1);
}
@Override
protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer)
{
if(entity instanceof EntityLiving)
{
((EntityLiving)entity).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFireFuse.id,20*(7-this.powerUpgrades),this.potencyUpgrades));
return true;
}
return false;
}
}

View file

@ -0,0 +1,70 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
public class ProjectileDefaultFire extends ProjectileImpactEffect
{
public ProjectileDefaultFire(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onEntityImpact(Entity mop, Entity proj)
{
Vec3 blockVec = SpellHelper.getEntityBlockVector(mop);
int x = (int)(blockVec.xCoord);
int y = (int)(blockVec.yCoord);
int z = (int)(blockVec.zCoord);
World world = mop.worldObj;
int horizRange = 0;
int vertRange = 0;
for(int i=-horizRange; i<=horizRange;i++)
{
for(int j=-vertRange; j<=vertRange;j++)
{
for(int k=-horizRange; k<=horizRange; k++)
{
if(world.isAirBlock(x+i, y+j, z+k))
{
world.setBlock(x+i, y+j, z+k, Blocks.fire);
}
}
}
}
}
@Override
public void onTileImpact(World world, MovingObjectPosition mop)
{
int x = mop.blockX;
int y = mop.blockY;
int z = mop.blockZ;
int horizRange = 0;
int vertRange = 0;
for(int i=-horizRange; i<=horizRange;i++)
{
for(int j=-vertRange; j<=vertRange;j++)
{
for(int k=-horizRange; k<=horizRange; k++)
{
if(world.isAirBlock(x+i, y+j, z+k))
{
world.setBlock(x+i, y+j, z+k, Blocks.fire);
}
}
}
}
}
}

View file

@ -0,0 +1,47 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
public class ProjectileDefensiveFire extends ProjectileImpactEffect
{
public ProjectileDefensiveFire(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onEntityImpact(Entity mop, Entity proj)
{
mop.setFire(3*(this.potencyUpgrades+1));
}
@Override
public void onTileImpact(World world, MovingObjectPosition mop)
{
int horizRange = (int)((this.powerUpgrades));
int vertRange = (int)((this.powerUpgrades));
int posX = mop.blockX;
int posY = mop.blockY;
int posZ = mop.blockZ;
for(int i=-horizRange; i<=horizRange; i++)
{
for(int j=-vertRange; j<=vertRange; j++)
{
for(int k=-horizRange; k<=horizRange; k++)
{
if(!world.isAirBlock(posX+i, posY+j, posZ+k))
{
SpellHelper.smeltBlockInWorld(world, posX+i, posY+j, posZ+k);
}
}
}
}
}
}

View file

@ -0,0 +1,46 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileUpdateEffect;
public class ProjectileEnvironmentalFire extends ProjectileUpdateEffect
{
public ProjectileEnvironmentalFire(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onUpdateEffect(Entity projectile)
{
Vec3 posVec = SpellHelper.getEntityBlockVector(projectile);
int horizRange = this.powerUpgrades+1;
int vertRange = (int)(0.5*(this.powerUpgrades+1));
int posX = (int)(posVec.xCoord);
int posY = (int)(posVec.yCoord);
int posZ = (int)(posVec.zCoord);
World worldObj = projectile.worldObj;
for(int i=-horizRange; i<=horizRange; i++)
{
for(int j=-vertRange; j<=vertRange; j++)
{
for(int k=-horizRange; k<=horizRange; k++)
{
if(!worldObj.isAirBlock(posX+i, posY+j, posZ+k))
{
SpellHelper.evaporateWaterBlock(worldObj, posX + i, posY + j, posZ + k);
}
}
}
}
}
}

View file

@ -0,0 +1,81 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
public class ProjectileOffensiveFire extends ProjectileImpactEffect
{
public ProjectileOffensiveFire(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onEntityImpact(Entity mop, Entity proj)
{
int horizRange = (int)(this.powerUpgrades);
int vertDepth = (int)(3*this.potencyUpgrades+1);
Vec3 blockVector = SpellHelper.getEntityBlockVector(mop);
int posX = (int)(blockVector.xCoord);
int posY = (int)(blockVector.yCoord);
int posZ = (int)(blockVector.zCoord);
World world = mop.worldObj;
for(int i=-horizRange; i<=horizRange; i++)
{
for(int j=-vertDepth; j<0; j++)
{
for(int k=-horizRange; k<=horizRange; k++)
{
if(world.isAirBlock(posX+i, posY+j, posZ+k))
{
world.setBlock(posX + i, posY + j, posZ + k, Blocks.flowing_lava,7,3);
}
}
}
}
}
@Override
public void onTileImpact(World world, MovingObjectPosition mop)
{
// int horizRange = (int)(this.powerUpgrades);
// int vertRange = (int)(this.potencyUpgrades);
//
// int posX = mop.blockX;
// int posY = mop.blockY;
// int posZ = mop.blockZ;
//
// for(int i=-horizRange; i<=horizRange; i++)
// {
// for(int j=-vertRange; j<=vertRange; j++)
// {
// for(int k=-horizRange; k<=horizRange; k++)
// {
// if(!world.isAirBlock(posX+i, posY+j, posZ+k))
// {
// Block block = world.getBlock(posX+i, posY+j, posZ+k);
// if(block == null || block.getBlockHardness(world, posX+i, posY+j, posZ+k)==-1)
// {
// continue;
// }
// //block.breakBlock(world, posX+i, posY+j, posZ+k, block.blockID, world.getBlockMetadata(posX+i, posY+j, posZ+k));
// //world.destroyBlock(posX+i, posY+j, posZ+k, true);
// if(world.rand.nextFloat()<0.6f)
// {
// SpellHelper.smashBlock(world, posX+i, posY+j, posZ+k);
// }
// }
// }
// }
// }
}
}

View file

@ -0,0 +1,22 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ISelfSpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
public class SelfDefaultFire extends SelfSpellEffect
{
public SelfDefaultFire(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
player.setFire((int)(10*Math.pow(1.5, powerUpgrades+1.5*potencyUpgrades)));
}
}

View file

@ -0,0 +1,43 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfDefensiveFire extends SelfSpellEffect {
public SelfDefensiveFire(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
int horizRange = (int)(this.powerUpgrades);
int vertDepth = (int)(3*this.potencyUpgrades+1);
Vec3 blockVector = SpellHelper.getEntityBlockVector(player);
int posX = (int)(blockVector.xCoord);
int posY = (int)(blockVector.yCoord);
int posZ = (int)(blockVector.zCoord);
for(int i=-horizRange; i<=horizRange; i++)
{
for(int j=-vertDepth; j<0; j++)
{
for(int k=-horizRange; k<=horizRange; k++)
{
if(world.isAirBlock(posX+i, posY+j, posZ+k))
{
world.setBlock(posX + i, posY + j, posZ + k, Blocks.flowing_lava,7,3);
}
}
}
}
}
}

View file

@ -0,0 +1,56 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfEnvironmentalFire extends SelfSpellEffect
{
public SelfEnvironmentalFire(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
int posX = (int) Math.round(player.posX - 0.5f);
int posY = (int) player.posY;
int posZ = (int) Math.round(player.posZ - 0.5f);
int powRadius = this.powerUpgrades;
int potRadius = this.potencyUpgrades-1;
for(int i=-powRadius;i<=powRadius;i++)
{
for(int j=-powRadius;j<=powRadius;j++)
{
for(int k=-powRadius;k<=powRadius;k++)
{
if(world.isAirBlock(posX+i, posY+j, posZ+k))
{
world.setBlock(posX+i, posY+j, posZ+k, Blocks.fire);
}
}
}
}
for(int i=-potRadius;i<=potRadius;i++)
{
for(int j=-potRadius;j<=potRadius;j++)
{
for(int k=-potRadius;k<=potRadius;k++)
{
if(!world.isAirBlock(posX+i, posY+j, posZ+k))
{
SpellHelper.smeltBlockInWorld(world, posX+i, posY+j, posZ+k);
}
}
}
}
}
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfOffensiveFire extends SelfSpellEffect
{
public SelfOffensiveFire(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFlameCloak.id,300*(2*this.powerUpgrades+1),this.potencyUpgrades));
}
}

View file

@ -0,0 +1,38 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.tileentity.TileEntityFurnace;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.ItemManipulator;
public class ToolDefaultFire extends ItemManipulator
{
public ToolDefaultFire(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public List<ItemStack> handleItemsOnBlockBroken(ItemStack toolStack, List<ItemStack> itemList)
{
LinkedList<ItemStack> newList = new LinkedList();
for(ItemStack item : itemList)
{
ItemStack newItem = FurnaceRecipes.smelting().getSmeltingResult(item);
if(newItem != null)
{
newList.add(newItem);
}
else
{
newList.add(item);
}
}
return newList;
}
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.LeftClickEffect;
public class ToolOffensiveFire extends LeftClickEffect
{
public ToolOffensiveFire(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder)
{
attacked.setFire(3 + 4*this.powerUpgrades);
return (int)(10*(1+this.powerUpgrades)*Math.pow(0.85, this.costUpgrades));
}
}

View file

@ -0,0 +1,28 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ExtrapolatedMeleeEntityEffect;
public class MeleeDefaultIce extends ExtrapolatedMeleeEntityEffect {
public MeleeDefaultIce(int power, int potency, int cost)
{
super(power, potency, cost);
this.setRange(3+0.3f*potency);
this.setRadius(2+0.3f*potency);
this.setMaxNumberHit(potency+1);
}
@Override
protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer)
{
if(entity.hurtResistantTime>0)
{
entity.hurtResistantTime = Math.max(0, -(potencyUpgrades+1)+entity.hurtResistantTime);
}
return true;
}
}

View file

@ -0,0 +1,48 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.MeleeSpellWorldEffect;
public class MeleeDefensiveIce extends MeleeSpellWorldEffect
{
public MeleeDefensiveIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onWorldEffect(World world, EntityPlayer entityPlayer)
{
ForgeDirection look = SpellHelper.getCompassDirectionForLookVector(entityPlayer.getLookVec());
int width = this.powerUpgrades;
int height = this.powerUpgrades + 2;
int xOffset = look.offsetX;
int zOffset = look.offsetZ;
int range = this.potencyUpgrades + 1;
Vec3 lookVec = SpellHelper.getEntityBlockVector(entityPlayer);
int xStart = (int)(lookVec.xCoord) + range * xOffset;
int zStart = (int)(lookVec.zCoord) + range * zOffset;
int yStart = (int)(lookVec.yCoord);
for(int i=-width; i<=width; i++)
{
for(int j=0; j<height;j++)
{
if(world.isAirBlock(xStart + i*(zOffset), yStart + j, zStart + i*(xOffset)))
{
world.setBlock(xStart + i*(zOffset), yStart + j, zStart + i*(xOffset), Blocks.ice);
}
}
}
}
}

View file

@ -0,0 +1,40 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntitySnowball;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ExtrapolatedMeleeEntityEffect;
public class MeleeEnvironmentalIce extends ExtrapolatedMeleeEntityEffect
{
public MeleeEnvironmentalIce(int power, int potency, int cost)
{
super(power, potency, cost);
this.setMaxNumberHit(1+potency);
this.setRadius(2);
this.setRange(3);
}
@Override
protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer)
{
//TODO Change to an Ice Cage
for(int i=0;i<=this.powerUpgrades;i++)
{
double randX = (world.rand.nextDouble()-world.rand.nextDouble())*3;
double randY = -world.rand.nextDouble()*3;
double randZ = (world.rand.nextDouble()-world.rand.nextDouble())*3;
EntitySnowball snowball = new EntitySnowball(world, entity.posX-3*randX, entity.posY-3*randY, entity.posZ-3*randZ);
snowball.motionX = randX;
snowball.motionY = randY;
snowball.motionZ = randZ;
world.spawnEntityInWorld(snowball);
}
return true;
}
}

View file

@ -0,0 +1,46 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ExtrapolatedMeleeEntityEffect;
public class MeleeOffensiveIce extends ExtrapolatedMeleeEntityEffect
{
public MeleeOffensiveIce(int power, int potency, int cost)
{
super(power, potency, cost);
this.setMaxNumberHit(1+potency);
this.setRadius(2);
this.setRange(3);
}
@Override
protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer)
{
Vec3 blockVector = SpellHelper.getEntityBlockVector(entity);
int posX = (int)(blockVector.xCoord);
int posY = (int)(blockVector.yCoord);
int posZ = (int)(blockVector.zCoord);
double yVel = 1*(0.3*this.powerUpgrades+0.90);
entity.motionY = yVel;
for(int i=0;i<2;i++)
{
if(world.isAirBlock(posX,posY+i,posZ))
{
world.setBlock(posX, posY+i, posZ, Blocks.ice);
}
}
entity.fallDistance = 0.0f;
return true;
}
}

View file

@ -0,0 +1,40 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
public class ProjectileDefaultIce extends ProjectileImpactEffect
{
public ProjectileDefaultIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onEntityImpact(Entity mop, Entity proj)
{
return;
}
@Override
public void onTileImpact(World world, MovingObjectPosition mop)
{
int horizRadius = this.powerUpgrades+1;
int vertRadius = this.potencyUpgrades;
ForgeDirection sideHit = ForgeDirection.getOrientation(mop.sideHit);
int posX = mop.blockX + sideHit.offsetX;
int posY = mop.blockY + sideHit.offsetY;
int posZ = mop.blockZ + sideHit.offsetZ;
if(world.isAirBlock(posX, posY, posZ))
{
world.setBlock(posX, posY, posZ, Blocks.ice);
}
}
}

View file

@ -0,0 +1,49 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
public class ProjectileDefensiveIce extends ProjectileImpactEffect
{
public ProjectileDefensiveIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onEntityImpact(Entity mop, Entity proj)
{
return;
}
@Override
public void onTileImpact(World world, MovingObjectPosition mop)
{
int horizRadius = this.powerUpgrades+1;
int vertRadius = this.potencyUpgrades;
int posX = mop.blockX;
int posY = mop.blockY;
int posZ = mop.blockZ;
for(int i=-horizRadius; i<=horizRadius; i++)
{
for(int k=-horizRadius; k<=horizRadius; k++)
{
for(int j=-vertRadius; j<=vertRadius; j++)
{
SpellHelper.freezeWaterBlock(world, posX+i, posY+j, posZ+k);
if(world.isAirBlock(posX+i, posY+j, posZ+k)&&!world.isAirBlock(posX+i, posY+j-1, posZ+k))
{
world.setBlock(posX+i, posY+j, posZ+k, Blocks.snow);
}
}
}
}
}
}

View file

@ -0,0 +1,39 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
import net.minecraft.util.Vec3;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileUpdateEffect;
public class ProjectileEnvironmentalIce extends ProjectileUpdateEffect
{
public ProjectileEnvironmentalIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onUpdateEffect(Entity projectile)
{
Vec3 posVec = SpellHelper.getEntityBlockVector(projectile);
int horizRange = this.powerUpgrades+1;
int vertRange = this.potencyUpgrades+1;
int posX = (int)(posVec.xCoord);
int posY = (int)(posVec.yCoord);
int posZ = (int)(posVec.zCoord);
for(int i=-horizRange; i<=horizRange; i++)
{
for(int j=-vertRange; j<=vertRange; j++)
{
for(int k=-horizRange; k<=horizRange; k++)
{
SpellHelper.freezeWaterBlock(projectile.worldObj, posX+i, posY+j, posZ+k);
}
}
}
}
}

View file

@ -0,0 +1,32 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
public class ProjectileOffensiveIce extends ProjectileImpactEffect
{
public ProjectileOffensiveIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onEntityImpact(Entity mop, Entity proj)
{
if(mop instanceof EntityLivingBase)
{
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id,60*(this.powerUpgrades+1),this.potencyUpgrades));
}
}
@Override
public void onTileImpact(World world, MovingObjectPosition mop)
{
return;
}
}

View file

@ -0,0 +1,41 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfDefaultIce extends SelfSpellEffect
{
public SelfDefaultIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
Vec3 blockVector = SpellHelper.getEntityBlockVector(player);
int posX = (int)(blockVector.xCoord);
int posY = (int)(blockVector.yCoord);
int posZ = (int)(blockVector.zCoord);
double yVel = 1*(0.4*this.powerUpgrades+0.75);
//PacketDispatcher.sendPacketToPlayer(PacketHandler.getPlayerVelocitySettingPacket(player.motionX, yVel, player.motionZ),(Player)player);
SpellHelper.setPlayerSpeedFromServer(player, player.motionX, yVel, player.motionZ);
for(int i=0;i<2;i++)
{
if(world.isAirBlock(posX,posY+i,posZ))
{
world.setBlock(posX, posY+i, posZ, Blocks.ice);
}
}
player.fallDistance = 0.0f;
}
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfDefensiveIce extends SelfSpellEffect
{
public SelfDefensiveIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionIceCloak.id,300*(2*this.powerUpgrades+1),this.potencyUpgrades));
}
}

View file

@ -0,0 +1,46 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfEnvironmentalIce extends SelfSpellEffect
{
public SelfEnvironmentalIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
ForgeDirection look = SpellHelper.getCompassDirectionForLookVector(player.getLookVec());
int width = this.potencyUpgrades + 1;
int length = 5*this.powerUpgrades + 3;
int xOffset = look.offsetX;
int zOffset = look.offsetZ;
Vec3 lookVec = SpellHelper.getEntityBlockVector(player);
int xStart = (int)(lookVec.xCoord);
int zStart = (int)(lookVec.zCoord);
int yStart = (int)(lookVec.yCoord)-1;
for(int i=-width; i<=width; i++)
{
for(int j=0; j<length;j++)
{
if(world.isAirBlock(xStart + i*(zOffset) + j*(xOffset), yStart, zStart + i*(xOffset) + j*(zOffset)))
{
world.setBlock(xStart + i*(zOffset) + j*(xOffset), yStart, zStart + i*(xOffset) + j*(zOffset), Blocks.ice);
}
}
}
}
}

View file

@ -0,0 +1,52 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfOffensiveIce extends SelfSpellEffect
{
public SelfOffensiveIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
double horizRadius = this.powerUpgrades+1;
double vertRadius = 0.5*this.powerUpgrades+1;
List<Entity> entities = SpellHelper.getEntitiesInRange(world, player.posX, player.posY, player.posZ,horizRadius, vertRadius);
if(entities==null)
{
return;
}
int i=0;
int number = this.powerUpgrades+1;
for(Entity entity : entities)
{
if(i>=number)
{
continue;
}
if(entity instanceof EntityLivingBase && !entity.equals(player))
{
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id,60*(1+this.powerUpgrades),this.potencyUpgrades));
i++;
}
}
}
}

View file

@ -0,0 +1,30 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.LeftClickEffect;
public class ToolDefaultIce extends LeftClickEffect
{
public ToolDefaultIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder)
{
int duration = 200;
attacked.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id,duration,this.powerUpgrades));
return 0;
}
}

View file

@ -0,0 +1,62 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.SummonToolEffect;
public class ToolDefensiveIce extends SummonToolEffect
{
public ToolDefensiveIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public int onSummonTool(ItemStack toolStack, World world, Entity entity)
{
int horizRadius = this.powerUpgrades*2+2;
int vertRadius = this.powerUpgrades * 3 + 2;
List<Entity> entityList = SpellHelper.getEntitiesInRange(world, entity.posX, entity.posY, entity.posZ, horizRadius, vertRadius);
for(Entity ent : entityList)
{
if(ent instanceof EntityLivingBase && !ent.equals(entity))
{
((EntityLivingBase)ent).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id,200,this.potencyUpgrades*2));
}
}
Vec3 blockVec = SpellHelper.getEntityBlockVector(entity);
int x = (int)(blockVec.xCoord);
int y = (int)(blockVec.yCoord);
int z = (int)(blockVec.zCoord);
for(int posX = x-horizRadius; posX <= x+horizRadius; posX++)
{
for(int posY = y-vertRadius; posY <= y+vertRadius; posY++)
{
for(int posZ = z-horizRadius; posZ <= z+horizRadius; posZ++)
{
SpellHelper.freezeWaterBlock(world, posX, posY, posZ);
if(world.isSideSolid(posX, posY, posZ, ForgeDirection.UP) && world.isAirBlock(posX, posY+1, posZ))
{
world.setBlock(posX, posY+1, posZ, Blocks.snow_layer);
}
}
}
}
return 0;
}
}

View file

@ -0,0 +1,138 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.items.spell.ItemSpellMultiTool;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmTool;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class DigAreaEffect implements IDigAreaEffect
{
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
public DigAreaEffect(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
}
@Override
public int digSurroundingArea(ItemStack container, World world, EntityPlayer player, MovingObjectPosition blockPos, String usedToolClass, float blockHardness, int harvestLvl, ItemSpellMultiTool itemTool)
{
if(!blockPos.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK))
{
return 0;
}
int x = blockPos.blockX;
int y = blockPos.blockY;
int z = blockPos.blockZ;
ForgeDirection sidehit = ForgeDirection.getOrientation(blockPos.sideHit);
for(int xPos = x-1; xPos <= x+1; xPos++)
{
for(int yPos = y-1; yPos <= y+1; yPos++)
{
for(int zPos = z-1; zPos <= z+1; zPos++)
{
this.breakBlock(container, world, player, blockHardness, xPos, yPos, zPos, itemTool);
}
}
}
return 0;
}
public void breakBlock(ItemStack container, World world, EntityPlayer player, float blockHardness, int x, int y, int z, ItemSpellMultiTool itemTool)
{
int hlvl = -1;
Block localBlock = world.getBlock(x, y, z);
int localMeta = world.getBlockMetadata(x, y, z);
String toolClass = localBlock.getHarvestTool(localMeta);
if (toolClass != null && itemTool.getHarvestLevel(container, toolClass) != -1)
hlvl = localBlock.getHarvestLevel(localMeta);
int toolLevel = itemTool.getHarvestLevel(container, toolClass);
float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, x, y, z);
if (hlvl <= toolLevel && localHardness - this.getHardnessDifference() <= blockHardness)
{
boolean cancelHarvest = false;
if (!cancelHarvest)
{
if (localBlock != null && !(localHardness < 0))
{
boolean isEffective = false;
String localToolClass = itemTool.getToolClassForMaterial(localBlock.getMaterial());
if(localToolClass != null && itemTool.getHarvestLevel(container, toolClass) >= localBlock.getHarvestLevel(localMeta))
{
isEffective = true;
}
if (localBlock.getMaterial().isToolNotRequired())
{
isEffective = true;
}
if (!player.capabilities.isCreativeMode)
{
if (isEffective)
{
if (localBlock.removedByPlayer(world, player, x, y, z))
{
localBlock.onBlockDestroyedByPlayer(world, x, y, z, localMeta);
}
//localBlock.harvestBlock(world, player, x, y, z, localMeta);
localBlock.onBlockHarvested(world, x, y, z, localMeta, player);
if (localHardness > 0f)
itemTool.onBlockDestroyed(container, world, localBlock, x, y, z, player);
List<ItemStack> items = SpellHelper.getItemsFromBlock(world, localBlock, x, y, z, localMeta, itemTool.getSilkTouch(container), itemTool.getFortuneLevel(container));
SpellParadigmTool parad = itemTool.loadParadigmFromStack(container);
items = parad.handleItemList(container, items);
if(!world.isRemote)
{
SpellHelper.spawnItemListInWorld(items, world, x + 0.5f, y + 0.5f, z + 0.5f);
}
world.func_147479_m(x, y, z);
}
else
{
// world.setBlockToAir(x, y, z);
// world.func_147479_m(x, y, z);
}
}
else
{
world.setBlockToAir(x, y, z);
world.func_147479_m(x, y, z);
}
}
}
}
}
public float getHardnessDifference()
{
return 1.5f;
}
}

View file

@ -0,0 +1,171 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.items.spell.ItemSpellMultiTool;
public class DigAreaTunnel extends DigAreaEffect
{
Random rand = new Random();
public DigAreaTunnel(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public int digSurroundingArea(ItemStack container, World world, EntityPlayer player, MovingObjectPosition blockPos, String usedToolClass, float blockHardness, int harvestLvl, ItemSpellMultiTool itemTool)
{
if(!blockPos.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK))
{
return 0;
}
List<Vec3> vectorLine = new LinkedList();
double initialX = blockPos.blockX;
double initialY = blockPos.blockY;
double initialZ = blockPos.blockZ;
ForgeDirection sidehit = ForgeDirection.getOrientation(blockPos.sideHit);
ForgeDirection opposite = sidehit.getOpposite();
System.out.println(opposite.toString());
double initialLength = this.getRandomVectorLength();
Vec3 initialVector = Vec3.createVectorHelper(opposite.offsetX*initialLength, opposite.offsetY*initialLength, opposite.offsetZ*initialLength);
Vec3 lastVec = Vec3.createVectorHelper(initialVector.xCoord, initialVector.yCoord, initialVector.zCoord);
vectorLine.add(initialVector);
double currentLength = lastVec.lengthVector();
double totalLength = this.totalLength();
while(currentLength < totalLength-0.01)
{
Vec3 tempVec = lastVec.addVector(0, 0, 0);
tempVec = tempVec.normalize();
double varr = this.varyRate();
tempVec = tempVec.addVector(varr*(rand.nextFloat() - rand.nextFloat()), varr*(rand.nextFloat() - rand.nextFloat()), varr*(rand.nextFloat() - rand.nextFloat()));
tempVec = tempVec.normalize();
double length = Math.min(this.getRandomVectorLength(), totalLength-currentLength);
tempVec.xCoord = tempVec.xCoord*length;
tempVec.yCoord = tempVec.yCoord*length;
tempVec.zCoord = tempVec.zCoord*length;
vectorLine.add(tempVec);
lastVec = tempVec;
currentLength += tempVec.lengthVector();
}
for(Vec3 testVec : vectorLine)
{
this.travelVector(testVec, world, initialX, initialY, initialZ);
initialX += testVec.xCoord;
initialY += testVec.yCoord;
initialZ += testVec.zCoord;
}
this.travelVector(lastVec, world, initialX, initialY, initialZ);
return 0;
}
public double totalLength()
{
return 100;
}
public double getStepSize()
{
return 1;
}
public double varyRate()
{
return 0.5;
}
public double getRandomVectorLength()
{
return 10;
}
public double getRandomStepLength()
{
return 0.5;
}
public int getRandomRadius()
{
return 3;
}
public void destroySphereOfMundane(World world, double x, double y, double z, int radius)
{
for(int i=-radius; i<=radius; i++)
{
for(int j=-radius; j<=radius; j++)
{
for(int k=-radius; k<=radius; k++)
{
if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f))
{
continue;
}
int newX = (int)(i + x + 0.5);
int newY = (int)(j + y + 0.5);
int newZ = (int)(k + z + 0.5);
this.destroyMunadeAt(world, newX, newY, newZ);
}
}
}
}
public void destroyMunadeAt(World world, int x, int y, int z)
{
world.setBlockToAir(x, y, z);
}
public void travelVector(Vec3 vector, World world, double x, double y, double z)
{
double vecLength = vector.lengthVector();
System.out.println(vecLength);
Vec3 normVec = Vec3.createVectorHelper(vector.xCoord, vector.yCoord, vector.zCoord);
normVec = normVec.normalize();
Vec3 prevVec = Vec3.createVectorHelper(0, 0, 0);
double distanceTravelled = 0;
while(distanceTravelled < vecLength)
{
System.out.println(distanceTravelled);
double stepLength = this.getRandomStepLength();
prevVec = prevVec.addVector(stepLength*normVec.xCoord, stepLength*normVec.yCoord, normVec.zCoord);
this.destroySphereOfMundane(world, prevVec.xCoord + x, prevVec.yCoord + y, prevVec.zCoord + z, this.getRandomRadius());
distanceTravelled = prevVec.lengthVector();
}
}
}

View file

@ -0,0 +1,12 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.items.spell.ItemSpellMultiTool;
public interface IDigAreaEffect
{
public abstract int digSurroundingArea(ItemStack container, World world, EntityPlayer player, MovingObjectPosition blockPos, String usedToolClass, float blockHardness, int harvestLvl, ItemSpellMultiTool itemTool);
}

View file

@ -0,0 +1,10 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
import java.util.List;
import net.minecraft.item.ItemStack;
public interface IItemManipulator
{
public List<ItemStack> handleItemsOnBlockBroken(ItemStack toolStack, List<ItemStack> itemList);
}

View file

@ -0,0 +1,11 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface ILeftClickEffect
{
public abstract int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder);
}

View file

@ -0,0 +1,10 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface IOnBanishTool
{
public abstract int onBanishTool(ItemStack toolStack, World world, Entity entity, int invSlot, boolean inHand);
}

View file

@ -0,0 +1,12 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public interface IOnBreakBlock
{
public abstract int onBlockBroken(ItemStack container, World world, EntityPlayer player, Block block, int meta, int x, int y, int z, ForgeDirection sideBroken);
}

View file

@ -0,0 +1,10 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface IOnSummonTool
{
public abstract int onSummonTool(ItemStack toolStack, World world, Entity entity);
}

View file

@ -0,0 +1,15 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public interface IRightClickEffect
{
//public abstract int onRightClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder);
public abstract int onRightClickBlock(ItemStack stack, EntityLivingBase weilder, World world, MovingObjectPosition mop);
public abstract int onRightClickAir(ItemStack stack, EntityLivingBase weilder);
}

View file

@ -0,0 +1,10 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
import net.minecraft.entity.Entity;
public interface ISpecialDamageEffect
{
public float getDamageForEntity(Entity entity);
public String getKey();
}

View file

@ -0,0 +1,10 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface IToolUpdateEffect
{
public abstract int onUpdate(ItemStack toolStack, World world, Entity par3Entity, int invSlot, boolean inHand);
}

View file

@ -0,0 +1,22 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
import java.util.List;
import net.minecraft.item.ItemStack;
public abstract class ItemManipulator implements IItemManipulator
{
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
public ItemManipulator(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
}
@Override
public abstract List<ItemStack> handleItemsOnBlockBroken(ItemStack toolStack,List<ItemStack> itemList);
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
public abstract class LeftClickEffect implements ILeftClickEffect
{
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
public LeftClickEffect(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
}
@Override
public abstract int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder);
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public abstract class OnBreakBlockEffect implements IOnBreakBlock
{
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
public OnBreakBlockEffect(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
}
}

View file

@ -0,0 +1,15 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
public abstract class RightClickEffect implements IRightClickEffect
{
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
public RightClickEffect(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
}
}

View file

@ -0,0 +1,177 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class RightClickTunnel extends RightClickEffect
{
Random rand = new Random();
public RightClickTunnel(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public int onRightClickBlock(ItemStack stack, EntityLivingBase weilder, World world, MovingObjectPosition mop)
{
if(weilder.worldObj.isRemote)
{
return 0;
}
if(!mop.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK))
{
return 0;
}
List<Vec3> vectorLine = new LinkedList();
double initialX = mop.blockX;
double initialY = mop.blockY;
double initialZ = mop.blockZ;
ForgeDirection sidehit = ForgeDirection.getOrientation(mop.sideHit);
ForgeDirection opposite = sidehit.getOpposite();
double initialLength = this.getRandomVectorLength();
Vec3 initialVector = Vec3.createVectorHelper(opposite.offsetX*initialLength, opposite.offsetY*initialLength, opposite.offsetZ*initialLength);
Vec3 lastVec = Vec3.createVectorHelper(initialVector.xCoord, initialVector.yCoord, initialVector.zCoord);
vectorLine.add(initialVector);
double currentLength = lastVec.lengthVector();
double totalLength = this.totalLength();
while(currentLength < totalLength-0.01)
{
Vec3 tempVec = lastVec.addVector(0, 0, 0);
tempVec = tempVec.normalize();
double varr = this.varyRate();
tempVec = tempVec.addVector(varr*(rand.nextFloat() - rand.nextFloat()), varr*(rand.nextFloat() - rand.nextFloat()), varr*(rand.nextFloat() - rand.nextFloat()));
tempVec = tempVec.normalize();
double length = Math.min(this.getRandomVectorLength(), totalLength-currentLength);
tempVec.xCoord = tempVec.xCoord*length;
tempVec.yCoord = tempVec.yCoord*length;
tempVec.zCoord = tempVec.zCoord*length;
vectorLine.add(tempVec);
lastVec = tempVec;
currentLength += tempVec.lengthVector();
}
for(Vec3 testVec : vectorLine)
{
this.travelVector(testVec, world, initialX, initialY, initialZ);
initialX += testVec.xCoord;
initialY += testVec.yCoord;
initialZ += testVec.zCoord;
}
this.travelVector(lastVec, world, initialX, initialY, initialZ);
return 0;
}
@Override
public int onRightClickAir(ItemStack stack, EntityLivingBase weilder)
{
//Empty Method
return 0;
}
public double totalLength()
{
return 100;
}
public double getStepSize()
{
return 1;
}
public double varyRate()
{
return 0.5;
}
public double getRandomVectorLength()
{
return 10;
}
public double getRandomStepLength()
{
return 0.5;
}
public int getRandomRadius()
{
return 3;
}
public void destroySphereOfMundane(World world, double x, double y, double z, int radius)
{
for(int i=-radius; i<=radius; i++)
{
for(int j=-radius; j<=radius; j++)
{
for(int k=-radius; k<=radius; k++)
{
if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f))
{
continue;
}
int newX = (int)(i + x + 0.5);
int newY = (int)(j + y + 0.5);
int newZ = (int)(k + z + 0.5);
this.destroyMunadeAt(world, newX, newY, newZ);
}
}
}
}
public void destroyMunadeAt(World world, int x, int y, int z)
{
world.setBlockToAir(x, y, z);
}
public void travelVector(Vec3 vector, World world, double x, double y, double z)
{
double vecLength = vector.lengthVector();
Vec3 normVec = Vec3.createVectorHelper(vector.xCoord, vector.yCoord, vector.zCoord);
normVec = normVec.normalize();
Vec3 prevVec = Vec3.createVectorHelper(0, 0, 0);
double distanceTravelled = 0;
while(distanceTravelled < vecLength)
{
double stepLength = this.getRandomStepLength();
prevVec = prevVec.addVector(stepLength*normVec.xCoord, stepLength*normVec.yCoord, normVec.zCoord);
this.destroySphereOfMundane(world, prevVec.xCoord + x, prevVec.yCoord + y, prevVec.zCoord + z, this.getRandomRadius());
distanceTravelled = prevVec.lengthVector();
}
}
}

View file

@ -0,0 +1,15 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool;
public abstract class SummonToolEffect implements IOnSummonTool
{
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
public SummonToolEffect(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
}
}

View file

@ -0,0 +1,40 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ExtrapolatedMeleeEntityEffect;
public class MeleeDefaultWind extends ExtrapolatedMeleeEntityEffect
{
public MeleeDefaultWind(int power, int potency, int cost)
{
super(power, potency, cost);
this.setRange(4+2.0f*potency);
this.setRadius(4+2.0f*potency);
this.setMaxNumberHit(potency+1);
}
@Override
protected boolean entityEffect(World world, Entity entity, EntityPlayer player)
{
double wantedVel = -(0.5d+0.7d*this.powerUpgrades);
if(entity instanceof EntityLiving)
{
double dist = Math.sqrt(entity.getDistanceToEntity(player));
double xVel = wantedVel*(entity.posX - player.posX)/dist;
double yVel = wantedVel*(entity.posY - player.posY)/dist;
double zVel = wantedVel*(entity.posZ - player.posZ)/dist;
entity.motionX = xVel;
entity.motionY = yVel;
entity.motionZ = zVel;
return true;
}
return false;
}
}

View file

@ -0,0 +1,33 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ExtrapolatedMeleeEntityEffect;
public class MeleeDefensiveWind extends ExtrapolatedMeleeEntityEffect
{
public MeleeDefensiveWind(int power, int potency, int cost)
{
super(power, potency, cost);
this.setRange(3+0.3f*potency);
this.setRadius(2+0.3f*potency);
this.setMaxNumberHit(potency+1);
}
@Override
protected boolean entityEffect(World world, Entity entity, EntityPlayer player)
{
double wantedVel = 0.5d+0.5d*this.powerUpgrades;
if(entity instanceof EntityLiving)
{
entity.motionY = wantedVel;
return true;
}
return false;
}
}

View file

@ -0,0 +1,36 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.MeleeSpellCenteredWorldEffect;
public class MeleeEnvironmentalWind extends MeleeSpellCenteredWorldEffect
{
public MeleeEnvironmentalWind(int power, int potency, int cost)
{
super(power, potency, cost);
this.setRange(5*power + 5);
}
@Override
public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ)
{
int radius = 5*this.potencyUpgrades + 3;
List<Entity> entities = SpellHelper.getEntitiesInRange(world, posX, posY, posZ, radius, radius);
for(Entity entity : entities)
{
if(entity instanceof EntityItem)
{
((EntityItem)entity).delayBeforeCanPickup = 0;
entity.onCollideWithPlayer((EntityPlayer)player);
}
}
}
}

View file

@ -0,0 +1,40 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ExtrapolatedMeleeEntityEffect;
public class MeleeOffensiveWind extends ExtrapolatedMeleeEntityEffect
{
public MeleeOffensiveWind(int power, int potency, int cost)
{
super(power, potency, cost);
this.setRange(3+0.3f*potency);
this.setRadius(2+0.3f*potency);
this.setMaxNumberHit(potency+1);
}
@Override
protected boolean entityEffect(World world, Entity entity, EntityPlayer player)
{
double wantedVel = 1.0d+1.0d*this.powerUpgrades;
if(entity instanceof EntityLiving)
{
double dist = Math.sqrt(entity.getDistanceToEntity(player));
double xVel = wantedVel*(entity.posX - player.posX)/dist;
double yVel = wantedVel*(entity.posY - player.posY+0.5f)/dist;
double zVel = wantedVel*(entity.posZ - player.posZ)/dist;
entity.motionX = xVel;
entity.motionY = yVel;
entity.motionZ = zVel;
return true;
}
return false;
}
}

View file

@ -0,0 +1,33 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
public class ProjectileDefaultWind extends ProjectileImpactEffect
{
public ProjectileDefaultWind(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onEntityImpact(Entity mop, Entity proj)
{
float wantedYVel = (float)((0.5)*(0.5*this.potencyUpgrades + 1));
mop.motionX = proj.motionX;
mop.motionY = mop.motionY += wantedYVel;
mop.motionZ = proj.motionZ;
}
@Override
public void onTileImpact(World world, MovingObjectPosition mop)
{
return;
}
}

View file

@ -0,0 +1,53 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileUpdateEffect;
public class ProjectileEnvironmentalWind extends ProjectileUpdateEffect
{
public ProjectileEnvironmentalWind(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onUpdateEffect(Entity projectile)
{
Vec3 posVec = SpellHelper.getEntityBlockVector(projectile);
int horizRange = this.powerUpgrades+1;
int vertRange = 1*this.potencyUpgrades+1;
World worldObj = projectile.worldObj;
if(projectile instanceof EntitySpellProjectile)
{
Entity shooter = ((EntitySpellProjectile) projectile).shootingEntity;
if(shooter instanceof EntityPlayer)
{
List<Entity> entitylist = SpellHelper.getEntitiesInRange(worldObj, projectile.posX, projectile.posY, projectile.posZ, horizRange, vertRange);
if(entitylist !=null)
{
for(Entity entity : entitylist)
{
if(entity instanceof EntityItem)
{
((EntityItem)entity).delayBeforeCanPickup = 0;
entity.onCollideWithPlayer((EntityPlayer)shooter);
}
}
}
}
}
}
}

View file

@ -0,0 +1,33 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
public class ProjectileOffensiveWind extends ProjectileImpactEffect
{
public ProjectileOffensiveWind(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onEntityImpact(Entity mop, Entity proj)
{
if(mop instanceof EntityLiving)
{
((EntityLiving) mop).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionHeavyHeart.id,(int)(100*(2*this.powerUpgrades+1)*(1/(this.potencyUpgrades+1))),this.potencyUpgrades));
}
}
@Override
public void onTileImpact(World world, MovingObjectPosition mop)
{
return;
}
}

View file

@ -0,0 +1,27 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfDefaultWind extends SelfSpellEffect
{
public SelfDefaultWind(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
player.extinguish();
player.fallDistance = 0;
}
}

View file

@ -0,0 +1,39 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfDefensiveWind extends SelfSpellEffect
{
public SelfDefensiveWind(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
double radius = 1.5d*this.powerUpgrades+1.5d;
double posX = player.posX;
double posY = player.posY;
double posZ = player.posZ;
List<Entity> entities = SpellHelper.getEntitiesInRange(world, posX, posY, posZ, radius, radius);
for(Entity entity: entities)
{
if((!entity.equals(player))&&entity instanceof EntityLiving)
{
((EntityLiving)entity).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionHeavyHeart.id,200,this.potencyUpgrades));
}
}
}
}

View file

@ -0,0 +1,45 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfEnvironmentalWind extends SelfSpellEffect
{
public SelfEnvironmentalWind(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
double radius = 1.5d*this.potencyUpgrades+1;
double posX = player.posX;
double posY = player.posY-0.7d;
double posZ = player.posZ;
double wantedVel = 0.7d+0.7d*this.powerUpgrades;
List<Entity> entities = SpellHelper.getEntitiesInRange(world, posX, posY, posZ, radius, radius);
for(Entity entity: entities)
{
if((!entity.equals(player))&&entity instanceof EntityLiving)
{
double dist = Math.sqrt(entity.getDistanceToEntity(player));
double xVel = wantedVel*(entity.posX - posX)/dist;
double yVel = wantedVel*(entity.posY - posY)/dist;
double zVel = wantedVel*(entity.posZ - posZ)/dist;
entity.motionX = xVel;
entity.motionY = yVel;
entity.motionZ = zVel;
}
}
}
}

View file

@ -0,0 +1,32 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfOffensiveWind extends SelfSpellEffect
{
public SelfOffensiveWind(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
Vec3 vec = player.getLookVec();
double wantedVelocity = 1.5 + this.powerUpgrades*0.4;
SpellHelper.setPlayerSpeedFromServer(player, vec.xCoord * wantedVelocity, vec.yCoord * wantedVelocity, vec.zCoord * wantedVelocity);
player.fallDistance = 0;
}
}

View file

@ -0,0 +1,32 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.LeftClickEffect;
public class ToolDefensiveWind extends LeftClickEffect
{
public ToolDefensiveWind(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder)
{
Vec3 vec = weilder.getLookVec();
vec.yCoord = 0;
vec.normalize();
float velocity = 0.5f*(1+this.powerUpgrades*0.8f);
float ratio = 0.1f + 0.3f*this.potencyUpgrades;
attacked.motionX += vec.xCoord*velocity;
attacked.motionY += velocity*ratio;
attacked.motionZ += vec.zCoord*velocity;
return 0;
}
}

View file

@ -0,0 +1,41 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.tool.OnBreakBlockEffect;
public class ToolEnvironmentalWind extends OnBreakBlockEffect
{
public ToolEnvironmentalWind(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public int onBlockBroken(ItemStack container, World world, EntityPlayer player, Block block, int meta, int x, int y, int z, ForgeDirection sideBroken)
{
double vertRange = 0.5 + (this.powerUpgrades*this.powerUpgrades + this.powerUpgrades)/2;
double horizRange = vertRange;
List<EntityItem> itemList = SpellHelper.getItemsInRange(world, x + 0.5f, y + 0.5f, z + 0.5f, horizRange, vertRange);
for(EntityItem entity : itemList)
{
if(!world.isRemote)
{
entity.delayBeforeCanPickup = 0;
entity.onCollideWithPlayer(player);
}
}
return 0;
}
}

Some files were not shown because too many files have changed in this diff Show more