Files
BloodMagic/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmProjectile.java
T
WayofTime beea2e875a Started working on allowing RitualDiviner to do directions.
Completed refactorization of spell system.
Increased protection against void damage while void sigil is in Bound Armour.
Added an OnRitualStop with an Enum input providing the action.
Added more events.
2014-11-12 17:14:43 -05:00

107 lines
3.0 KiB
Java

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