1.7.2 commit

This commit is contained in:
WayofTime 2014-02-14 15:20:20 -05:00
parent 92e097eaa2
commit 9aaa65feb4
548 changed files with 46982 additions and 2 deletions

View file

@ -0,0 +1,611 @@
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;
//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(worldObj.getWorldVec3Pool().getVecFromPool(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 = worldObj.getWorldVec3Pool().getVecFromPool(posX, posY, posZ);
Vec3 var3 = worldObj.getWorldVec3Pool().getVecFromPool(posX + motionX, posY + motionY, posZ + motionZ);
MovingObjectPosition var4 = worldObj.func_147447_a(var17, var3, true, false, true);
var17 = worldObj.getWorldVec3Pool().getVecFromPool(posX, posY, posZ);
var3 = worldObj.getWorldVec3Pool().getVecFromPool(posX + motionX, posY + motionY, posZ + motionZ);
if (var4 != null)
{
var3 = worldObj.getWorldVec3Pool().getVecFromPool(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);
}
/**
* (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");
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);
}
}
}
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;
}
}

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,157 @@
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 ArrayList();
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();
}
}
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,99 @@
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 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;
}
@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.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,221 @@
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.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);
}
}
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 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 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,176 @@
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;
public class SpellEffectEarth extends SpellEffect
{
@Override
public void defaultModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void offensiveModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void defensiveModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void environmentalModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void defaultModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void offensiveModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void defensiveModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void environmentalModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void defaultModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void offensiveModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void defensiveModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void environmentalModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
protected int getCostForDefaultProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefaultSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefaultMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentMelee()
{
// TODO Auto-generated method stub
return 0;
}
}

View file

@ -0,0 +1,178 @@
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.effect.impactEffects.fire.ProjectileDefaultFire;
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;
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)
{
// TODO Auto-generated method stub
parad.addImpactEffect(new ProjectileDefaultFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
parad.damage+=this.potencyEnhancement;
}
@Override
public void defensiveModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
parad.addImpactEffect(new ProjectileDefaultFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
parad.damage+=this.potencyEnhancement;
}
@Override
public void environmentalModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
parad.addImpactEffect(new ProjectileDefaultFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
parad.damage+=this.potencyEnhancement;
}
@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)
{
// TODO Auto-generated method stub
}
@Override
public void offensiveModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void defensiveModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void environmentalModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
protected int getCostForDefaultProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefaultSelf()
{
return 10*(int)(10*Math.pow(1.5, this.powerEnhancement+1.5*this.potencyEnhancement));
}
@Override
protected int getCostForOffenseSelf()
{
return 500*(int)((this.powerEnhancement+1)*Math.pow(2, potencyEnhancement));
}
@Override
protected int getCostForDefenseSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentSelf()
{
return (int) ((15*Math.pow(1.7, powerEnhancement)+10*Math.pow(potencyEnhancement,1.8))*Math.pow(0.8, costEnhancement));
}
@Override
protected int getCostForDefaultMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentMelee()
{
// TODO Auto-generated method stub
return 0;
}
}

View file

@ -0,0 +1,167 @@
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.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;
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));
}
}

View file

@ -0,0 +1,176 @@
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;
public class SpellEffectWind extends SpellEffect
{
@Override
public void defaultModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void offensiveModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void defensiveModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void environmentalModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void defaultModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void offensiveModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void defensiveModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void environmentalModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void defaultModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void offensiveModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void defensiveModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void environmentalModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
protected int getCostForDefaultProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefaultSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefaultMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentMelee()
{
// TODO Auto-generated method stub
return 0;
}
}

View file

@ -0,0 +1,184 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.WorldProvider;
import net.minecraftforge.common.util.ForgeDirection;
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<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 player.getDisplayName();
}
public static void sendParticleToPlayer(EntityPlayer player, String str, double xCoord, double yCoord, double zCoord, double xVel, double yVel, double zVel)
{
}
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);
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);
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);
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);
}
}
}
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)
{
}
}

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))
{
hit++;
}
}
}
}
}
protected abstract boolean entityEffect(World world, Entity entity);
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);
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,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,44 @@
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.world.World;
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)
{
mop.setFire((int)Math.pow(2,this.powerUpgrades));
}
@Override
public void onTileImpact(World world, MovingObjectPosition mop)
{
int x = mop.blockX;
int y = mop.blockY;
int z = mop.blockZ;
int range = 0;
for(int i=-range; i<=range;i++)
{
for(int j=-range; j<=range;j++)
{
for(int k=-range; k<=range; 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,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,24 @@
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.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)
{
// TODO Auto-generated method stub
world.playAuxSFXAtEntity(player, 1008, (int)player.posX, (int)player.posY, (int)player.posZ, 0);
}
}

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,(this.powerUpgrades+1)*this.powerUpgrades,this.potencyUpgrades));
}
}

View file

@ -0,0 +1,27 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
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)
{
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,38 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
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)
{
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,45 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
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)
{
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)
{
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,50 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.block.Block;
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)
{
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)
{
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,43 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import ibxm.Player;
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.PacketHandler;
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,20 @@
package WayofTime.alchemicalWizardry.common.spell.complex.enhancement;
public class SpellEnhancement
{
public static final int POWER = 0;
public static final int EFFICIENCY = 1;
public static final int POTENCY = 2;
private int state = this.POWER;
protected SpellEnhancement(int state)
{
this.state = state;
}
public int getState()
{
return this.state;
}
}

View file

@ -0,0 +1,10 @@
package WayofTime.alchemicalWizardry.common.spell.complex.enhancement;
public class SpellEnhancementCost extends SpellEnhancement
{
public SpellEnhancementCost()
{
super(SpellEnhancement.EFFICIENCY);
}
}

View file

@ -0,0 +1,10 @@
package WayofTime.alchemicalWizardry.common.spell.complex.enhancement;
public class SpellEnhancementPotency extends SpellEnhancement
{
public SpellEnhancementPotency()
{
super(SpellEnhancement.POTENCY);
}
}

View file

@ -0,0 +1,10 @@
package WayofTime.alchemicalWizardry.common.spell.complex.enhancement;
public class SpellEnhancementPower extends SpellEnhancement
{
public SpellEnhancementPower()
{
super(SpellEnhancement.POWER);
}
}