Spells spells, did I mention spells?

This commit is contained in:
WayofTime 2014-03-19 20:47:14 -04:00
parent 0dd830480c
commit 4394ba4541
21 changed files with 296 additions and 33 deletions

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,50 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityFallingSand;
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(3*power + 2);
}
@Override
public void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ)
{
int radius = this.potencyUpgrades;
double wantedVel = 0.5d;
for(int i=-radius; i<=radius; i++)
{
for(int j=-radius; j<=radius; j++)
{
for(int k=-radius; k<=radius; k++)
{
Block block = Block.blocksList[world.getBlockId(posX+i, posY+j, posZ+k)];
int meta = world.getBlockMetadata(posX+i, posY+j, posZ+k);
if(SpellHelper.isBlockFluid(block)&&world.rand.nextFloat()<0.9f)
{
EntityFallingSand liquid = new EntityFallingSand(world, posX+i, posY+j, posZ+k, block.blockID, meta);
if(liquid!=null)
{
liquid.motionX = (world.rand.nextDouble()-world.rand.nextDouble())*wantedVel;
liquid.motionY = (world.rand.nextDouble()-world.rand.nextDouble())*wantedVel;
liquid.motionZ = (world.rand.nextDouble()-world.rand.nextDouble())*wantedVel;
world.spawnEntityInWorld(liquid);
}
}
}
}
}
}
}

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,34 @@
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.2 + this.powerUpgrades*0.3;
player.motionX = vec.xCoord * wantedVelocity;
player.motionY = vec.yCoord * wantedVelocity;
player.motionZ = vec.zCoord * wantedVelocity;
player.fallDistance = 0;
}
}