BloodMagic/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmProjectile.java

102 lines
2.4 KiB
Java
Raw Normal View History

2014-01-18 00:59:31 +00:00
package WayofTime.alchemicalWizardry.common.spell.complex;
import java.util.ArrayList;
import java.util.LinkedList;
2014-01-18 00:59:31 +00:00
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.spell.complex.effect.SpellEffect;
2014-01-18 16:45:31 +00:00
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
2014-01-18 00:59:31 +00:00
public class SpellParadigmProjectile extends SpellParadigm
{
public DamageSource damageSource = DamageSource.generic;
public float damage = 1;
public int cost = 0;
public List<IProjectileImpactEffect> impactList = new ArrayList();
public List<IProjectileUpdateEffect> updateEffectList = new ArrayList();
public boolean penetration = false;
2014-01-18 16:45:31 +00:00
public int ricochetMax = 0;
2014-01-18 00:59:31 +00:00
@Override
public void enhanceParadigm(SpellEnhancement enh)
{
// TODO Auto-generated method stub
}
@Override
public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack)
{
EntitySpellProjectile proj = new EntitySpellProjectile(world, entityPlayer);
2014-01-18 16:45:31 +00:00
this.prepareProjectile(proj);
world.spawnEntityInWorld(proj);
}
public static SpellParadigmProjectile getParadigmForStringArray(List<String> stringList)
{
SpellParadigmProjectile parad = new SpellParadigmProjectile();
try
{
for(String str : stringList)
{
Class clazz = Class.forName(str);
if(clazz!=null)
{
Object obj = clazz.newInstance();
if(obj instanceof SpellEffect)
{
parad.addBufferedEffect((SpellEffect)obj);
continue;
}
if(obj instanceof SpellModifier)
{
parad.modifyBufferedEffect((SpellModifier)obj);
continue;
}
if(obj instanceof SpellEnhancement)
{
parad.applyEnhancement((SpellEnhancement)obj);
continue;
}
}
}
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
2014-01-18 00:59:31 +00:00
return parad;
2014-01-18 00:59:31 +00:00
}
public void prepareProjectile(EntitySpellProjectile proj)
{
proj.setDamage(damage);
proj.setImpactList(impactList);
proj.setUpdateEffectList(updateEffectList);
proj.setPenetration(penetration);
proj.setEffectList(effectList);
2014-01-18 16:45:31 +00:00
proj.setRicochetMax(ricochetMax);
}
2014-01-18 23:05:25 +00:00
@Override
public int getDefaultCost()
{
// TODO Auto-generated method stub
return 50;
}
2014-01-18 00:59:31 +00:00
}