Finished self-spells for Fire
This commit is contained in:
parent
091bb3db3f
commit
4f0b6199f6
|
@ -7,10 +7,12 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.SpellModifierDefault;
|
import WayofTime.alchemicalWizardry.common.spell.complex.SpellModifierOffensive;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
|
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf;
|
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffectFire;
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffectFire;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancementPotency;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancementPower;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@ -54,9 +56,16 @@ public class ItemComplexSpellCrystal extends EnergyItems
|
||||||
return par1ItemStack;
|
return par1ItemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(par2World.isRemote)
|
||||||
|
{
|
||||||
|
return par1ItemStack;
|
||||||
|
}
|
||||||
|
|
||||||
SpellParadigm parad = new SpellParadigmSelf();
|
SpellParadigm parad = new SpellParadigmSelf();
|
||||||
parad.addBufferedEffect(new SpellEffectFire());
|
parad.addBufferedEffect(new SpellEffectFire());
|
||||||
parad.modifyBufferedEffect(new SpellModifierDefault());
|
parad.modifyBufferedEffect(new SpellModifierOffensive());
|
||||||
|
parad.applyEnhancement(new SpellEnhancementPower());
|
||||||
|
parad.applyEnhancement(new SpellEnhancementPotency());
|
||||||
parad.castSpell(par2World, par3EntityPlayer, par1ItemStack);
|
parad.castSpell(par2World, par3EntityPlayer, par1ItemStack);
|
||||||
|
|
||||||
return par1ItemStack;
|
return par1ItemStack;
|
||||||
|
|
|
@ -4,6 +4,6 @@ public class SpellModifierEnvironmental extends SpellModifier
|
||||||
{
|
{
|
||||||
public SpellModifierEnvironmental()
|
public SpellModifierEnvironmental()
|
||||||
{
|
{
|
||||||
super(SpellModifier.DEFENSIVE);
|
super(SpellModifier.ENVIRONMENTAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,4 +118,40 @@ public abstract class SpellParadigm
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract int 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,4 +154,19 @@ public abstract class SpellEffect
|
||||||
protected abstract int getCostForOffenseMelee();
|
protected abstract int getCostForOffenseMelee();
|
||||||
protected abstract int getCostForDefenseMelee();
|
protected abstract int getCostForDefenseMelee();
|
||||||
protected abstract int getCostForEnvironmentMelee();
|
protected abstract int getCostForEnvironmentMelee();
|
||||||
|
|
||||||
|
public int getPowerEnhancements()
|
||||||
|
{
|
||||||
|
return this.powerEnhancement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCostEnhancements()
|
||||||
|
{
|
||||||
|
return this.costEnhancement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPotencyEnhancements()
|
||||||
|
{
|
||||||
|
return this.potencyEnhancement;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,9 @@ import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile;
|
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf;
|
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfDefaultFire;
|
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
|
public class SpellEffectFire extends SpellEffect
|
||||||
{
|
{
|
||||||
|
@ -43,22 +46,19 @@ public class SpellEffectFire extends SpellEffect
|
||||||
@Override
|
@Override
|
||||||
public void offensiveModificationSelf(SpellParadigmSelf parad)
|
public void offensiveModificationSelf(SpellParadigmSelf parad)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
parad.addSelfSpellEffect(new SelfOffensiveFire(powerEnhancement,potencyEnhancement,costEnhancement));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void defensiveModificationSelf(SpellParadigmSelf parad)
|
public void defensiveModificationSelf(SpellParadigmSelf parad)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
parad.addSelfSpellEffect(new SelfDefensiveFire(powerEnhancement,potencyEnhancement,costEnhancement));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void environmentalModificationSelf(SpellParadigmSelf parad)
|
public void environmentalModificationSelf(SpellParadigmSelf parad)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
parad.addSelfSpellEffect(new SelfEnvironmentalFire(powerEnhancement, potencyEnhancement, costEnhancement));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -120,15 +120,13 @@ public class SpellEffectFire extends SpellEffect
|
||||||
@Override
|
@Override
|
||||||
protected int getCostForDefaultSelf()
|
protected int getCostForDefaultSelf()
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
return 10*(int)(10*Math.pow(1.5, this.powerEnhancement+1.5*this.potencyEnhancement));
|
||||||
return 1000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getCostForOffenseSelf()
|
protected int getCostForOffenseSelf()
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
return 100*(int)((this.powerEnhancement+1)*Math.pow(2, potencyEnhancement));
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -141,8 +139,7 @@ public class SpellEffectFire extends SpellEffect
|
||||||
@Override
|
@Override
|
||||||
protected int getCostForEnvironmentSelf()
|
protected int getCostForEnvironmentSelf()
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
return (int) ((15*Math.pow(1.7, powerEnhancement)+10*Math.pow(potencyEnhancement,1.8))*Math.pow(0.8, costEnhancement));
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
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.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class SpellHelper
|
||||||
|
{
|
||||||
|
public static Random rand = new Random();
|
||||||
|
|
||||||
|
public static void smeltBlockInWorld(World world, int posX, int posY, int posZ)
|
||||||
|
{
|
||||||
|
FurnaceRecipes recipes = FurnaceRecipes.smelting();
|
||||||
|
|
||||||
|
Block block = Block.blocksList[world.getBlockId(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, smeltedStack.itemID, 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 double gaussian(double d)
|
||||||
|
{
|
||||||
|
return d * ((rand.nextFloat() - 0.5D));
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
|
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
|
||||||
|
|
||||||
public class SelfEnvironmentalFire extends SelfSpellEffect
|
public class SelfEnvironmentalFire extends SelfSpellEffect
|
||||||
|
@ -17,5 +19,38 @@ public class SelfEnvironmentalFire extends SelfSpellEffect
|
||||||
int posX = (int) Math.round(player.posX - 0.5f);
|
int posX = (int) Math.round(player.posX - 0.5f);
|
||||||
int posY = (int) player.posY;
|
int posY = (int) player.posY;
|
||||||
int posZ = (int) Math.round(player.posZ - 0.5f);
|
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, Block.fire.blockID);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue