Added fun spell framework

This commit is contained in:
WayofTime 2014-01-17 19:59:31 -05:00
parent 17bbea0e74
commit e583fe429d
11 changed files with 710 additions and 5 deletions

View file

@ -1,5 +1,75 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
public class SpellParadigm {
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
public abstract class SpellParadigm
{
protected List<SpellEffect> bufferedEffectList = new ArrayList();
public void addBufferedEffect(SpellEffect effect)
{
if(effect!=null)
{
this.bufferedEffectList.add(effect);
}
}
public void modifyBufferedEffect(SpellModifier modifier)
{
SpellEffect effect = this.getBufferedEffect();
if(effect!=null)
{
effect.modifyEffect(modifier);
}
}
public void applyEnhancement(SpellEnhancement enh)
{
if(bufferedEffectList.isEmpty())
{
this.enhanceParadigm(enh);
}
else
{
SpellEffect effect = this.getBufferedEffect();
if(effect!=null)
{
effect.enhanceEffect(enh);
}
}
}
public abstract void enhanceParadigm(SpellEnhancement enh);
public abstract void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack);
public void applySpellEffect(SpellEffect effect)
{
effect.modifyParadigm(this);
}
public void applyAllSpellEffects()
{
for(SpellEffect effect : bufferedEffectList)
{
this.applySpellEffect(effect);
}
}
public SpellEffect getBufferedEffect()
{
if(bufferedEffectList.isEmpty())
{
return null;
}
else
{
return bufferedEffectList.get(bufferedEffectList.size()-1);
}
}
}