5/12 Finished for SpellEffectIce

This commit is contained in:
WayofTime 2014-02-01 12:30:03 -05:00
parent 2bb7a5fffb
commit 05c86e03bf
9 changed files with 211 additions and 20 deletions

View file

@ -23,8 +23,8 @@ public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntity
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
this.range = 2;
this.radius = 2;
this.range = 0;
this.radius = 0;
this.maxHit = 1;
}
@ -33,7 +33,7 @@ public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntity
{
Vec3 lookVec = entityPlayer.getLook(range);
double x = entityPlayer.posX + lookVec.xCoord;
double y = entityPlayer.posY + lookVec.yCoord;
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));
@ -43,7 +43,7 @@ public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntity
{
for(Entity entity : entities)
{
if(hit<maxHit)
if(hit<maxHit&&!entity.equals(entityPlayer))
{
if(this.entityEffect(world, entity))
{

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,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.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.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), Block.ice.blockID);
}
}
}
}
}

View file

@ -15,9 +15,9 @@ public class MeleeOffensiveIce extends ExtrapolatedMeleeEntityEffect
public MeleeOffensiveIce(int power, int potency, int cost)
{
super(power, potency, cost);
this.setMaxNumberHit(2);
this.setRadius(1);
this.setRange(2);
this.setMaxNumberHit(1+potency);
this.setRadius(2);
this.setRange(3);
}
@Override
@ -29,7 +29,7 @@ public class MeleeOffensiveIce extends ExtrapolatedMeleeEntityEffect
int posY = (int)(blockVector.yCoord);
int posZ = (int)(blockVector.zCoord);
double yVel = 1*(0.4*this.powerUpgrades+0.75);
double yVel = 1*(0.3*this.powerUpgrades+0.90);
entity.motionY = yVel;

View file

@ -0,0 +1,46 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.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), Block.ice.blockID);
}
}
}
}
}