More spells
This commit is contained in:
parent
5c6a5d0c0b
commit
ba19b04154
|
@ -268,14 +268,21 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
||||||
par1NBTTagCompound.setByte("inData", (byte)inData);
|
par1NBTTagCompound.setByte("inData", (byte)inData);
|
||||||
par1NBTTagCompound.setByte("inGround", (byte)(inGround ? 1 : 0));
|
par1NBTTagCompound.setByte("inGround", (byte)(inGround ? 1 : 0));
|
||||||
|
|
||||||
NBTTagList tagList = par1NBTTagCompound.getTagList("Effects");
|
NBTTagList effectList = new NBTTagList();
|
||||||
this.effectList = new LinkedList();
|
|
||||||
for (int i = 0; i < tagList.tagCount(); i++)
|
|
||||||
{
|
|
||||||
NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i);
|
|
||||||
|
|
||||||
this.effectList.add(tag.getString("Class"));
|
for (String str : this.effectList)
|
||||||
|
{
|
||||||
|
if (str != null)
|
||||||
|
{
|
||||||
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
|
||||||
|
tag.setString("Class", str);
|
||||||
|
effectList.appendTag(tag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
par1NBTTagCompound.setTag("Effects", effectList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -291,20 +298,17 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
||||||
inData = par1NBTTagCompound.getByte("inData") & 255;
|
inData = par1NBTTagCompound.getByte("inData") & 255;
|
||||||
inGround = par1NBTTagCompound.getByte("inGround") == 1;
|
inGround = par1NBTTagCompound.getByte("inGround") == 1;
|
||||||
|
|
||||||
NBTTagList effectList = new NBTTagList();
|
NBTTagList tagList = par1NBTTagCompound.getTagList("Effects");
|
||||||
|
this.effectList = new LinkedList();
|
||||||
for (String str : this.effectList)
|
for (int i = 0; i < tagList.tagCount(); i++)
|
||||||
{
|
{
|
||||||
if (str != null)
|
NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i);
|
||||||
{
|
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
|
||||||
|
|
||||||
tag.setString("Class", str);
|
this.effectList.add(tag.getString("Class"));
|
||||||
effectList.appendTag(tag);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
par1NBTTagCompound.setTag("Effects", effectList);
|
SpellParadigmProjectile parad = SpellParadigmProjectile.getParadigmForStringArray(effectList);
|
||||||
|
parad.prepareProjectile(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -382,22 +386,15 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
||||||
{
|
{
|
||||||
shootingEntity.attackEntityFrom(DamageSource.causePlayerDamage(shootingEntity), 1);
|
shootingEntity.attackEntityFrom(DamageSource.causePlayerDamage(shootingEntity), 1);
|
||||||
this.setDead();
|
this.setDead();
|
||||||
} else if (this.isUndead(mop)) {
|
}
|
||||||
doDamage(16 + d12(), mop);
|
else
|
||||||
} else {
|
{
|
||||||
doDamage(8 + d6(), mop);
|
doDamage(this.damage, mop);
|
||||||
}
|
}
|
||||||
spawnHitParticles("exorcism", 8);
|
spawnHitParticles("exorcism", 8);
|
||||||
this.setDead();
|
this.setDead();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int d12() {
|
|
||||||
return rand.nextInt(12) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int d6() {
|
|
||||||
return rand.nextInt(6) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void spawnHitParticles(String string, int i) {
|
private void spawnHitParticles(String string, int i) {
|
||||||
for (int particles = 0; particles < i; particles++) {
|
for (int particles = 0; particles < i; particles++) {
|
||||||
|
@ -405,15 +402,13 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doDamage(int i, Entity mop) {
|
private void doDamage(float f, Entity mop)
|
||||||
mop.attackEntityFrom(this.getDamageSource(), i);
|
{
|
||||||
|
mop.attackEntityFrom(this.getDamageSource(), f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isUndead(Entity mop) {
|
private DamageSource getDamageSource()
|
||||||
return mop instanceof EntitySkeleton || mop instanceof EntityGhast || mop instanceof EntityWither || mop instanceof EntityZombie || mop instanceof EntityPigZombie;
|
{
|
||||||
}
|
|
||||||
|
|
||||||
private DamageSource getDamageSource() {
|
|
||||||
return DamageSource.causePlayerDamage(shootingEntity);
|
return DamageSource.causePlayerDamage(shootingEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
package WayofTime.alchemicalWizardry.common.spell.complex;
|
|
||||||
|
|
||||||
public class SpellEnhancement
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package WayofTime.alchemicalWizardry.common.spell.complex;
|
||||||
|
|
||||||
|
public class SpellModifierDefault extends SpellModifier
|
||||||
|
{
|
||||||
|
public SpellModifierDefault()
|
||||||
|
{
|
||||||
|
super(SpellModifier.DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package WayofTime.alchemicalWizardry.common.spell.complex;
|
||||||
|
|
||||||
|
public class SpellModifierDefensive extends SpellModifier
|
||||||
|
{
|
||||||
|
public SpellModifierDefensive()
|
||||||
|
{
|
||||||
|
super(SpellModifier.DEFENSIVE);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package WayofTime.alchemicalWizardry.common.spell.complex;
|
||||||
|
|
||||||
|
public class SpellModifierEnvironmental extends SpellModifier
|
||||||
|
{
|
||||||
|
public SpellModifierEnvironmental()
|
||||||
|
{
|
||||||
|
super(SpellModifier.DEFENSIVE);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package WayofTime.alchemicalWizardry.common.spell.complex;
|
||||||
|
|
||||||
|
public class SpellModifierOffensive extends SpellModifier
|
||||||
|
{
|
||||||
|
public SpellModifierOffensive()
|
||||||
|
{
|
||||||
|
super(SpellModifier.OFFENSIVE);
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ 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.common.spell.complex.effect.SpellEffect;
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
|
||||||
|
|
||||||
public abstract class SpellParadigm
|
public abstract class SpellParadigm
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package WayofTime.alchemicalWizardry.common.spell.complex;
|
||||||
|
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class SpellParadigmMelee extends SpellParadigm
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enhanceParadigm(SpellEnhancement enh)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
|
||||||
|
|
||||||
public class SpellParadigmProjectile extends SpellParadigm
|
public class SpellParadigmProjectile extends SpellParadigm
|
||||||
{
|
{
|
||||||
|
@ -18,7 +19,7 @@ public class SpellParadigmProjectile extends SpellParadigm
|
||||||
public List<IProjectileImpactEffect> impactList = new ArrayList();
|
public List<IProjectileImpactEffect> impactList = new ArrayList();
|
||||||
public List<IProjectileUpdateEffect> updateEffectList = new ArrayList();
|
public List<IProjectileUpdateEffect> updateEffectList = new ArrayList();
|
||||||
public boolean penetration = false;
|
public boolean penetration = false;
|
||||||
|
public int ricochetMax = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enhanceParadigm(SpellEnhancement enh)
|
public void enhanceParadigm(SpellEnhancement enh)
|
||||||
|
@ -31,7 +32,8 @@ public class SpellParadigmProjectile extends SpellParadigm
|
||||||
public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack)
|
public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack)
|
||||||
{
|
{
|
||||||
EntitySpellProjectile proj = new EntitySpellProjectile(world, entityPlayer);
|
EntitySpellProjectile proj = new EntitySpellProjectile(world, entityPlayer);
|
||||||
|
this.prepareProjectile(proj);
|
||||||
|
world.spawnEntityInWorld(proj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SpellParadigmProjectile getParadigmForStringArray(List<String> stringList)
|
public static SpellParadigmProjectile getParadigmForStringArray(List<String> stringList)
|
||||||
|
@ -86,6 +88,7 @@ public class SpellParadigmProjectile extends SpellParadigm
|
||||||
proj.setUpdateEffectList(updateEffectList);
|
proj.setUpdateEffectList(updateEffectList);
|
||||||
proj.setPenetration(penetration);
|
proj.setPenetration(penetration);
|
||||||
proj.setEffectList(effectList);
|
proj.setEffectList(effectList);
|
||||||
|
proj.setRicochetMax(ricochetMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package WayofTime.alchemicalWizardry.common.spell.complex;
|
package WayofTime.alchemicalWizardry.common.spell.complex;
|
||||||
|
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
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;
|
||||||
|
|
|
@ -1,17 +1,28 @@
|
||||||
package WayofTime.alchemicalWizardry.common.spell.complex.effect;
|
package WayofTime.alchemicalWizardry.common.spell.complex.effect;
|
||||||
|
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.SpellEnhancement;
|
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.SpellModifier;
|
import WayofTime.alchemicalWizardry.common.spell.complex.SpellModifier;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
|
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
|
||||||
|
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.enhancement.SpellEnhancement;
|
||||||
|
|
||||||
public abstract class SpellEffect
|
public abstract class SpellEffect
|
||||||
{
|
{
|
||||||
public int modifierState = SpellModifier.DEFAULT;
|
public int modifierState = SpellModifier.DEFAULT;
|
||||||
|
public int powerEnhancement = 0;
|
||||||
|
public int costEnhancement = 0;
|
||||||
|
|
||||||
public void enhanceEffect(SpellEnhancement enh)
|
public void enhanceEffect(SpellEnhancement enh)
|
||||||
{
|
{
|
||||||
|
if(enh!=null)
|
||||||
|
{
|
||||||
|
switch(enh.getState())
|
||||||
|
{
|
||||||
|
case SpellEnhancement.POWER: this.powerEnhancement++; break;
|
||||||
|
case SpellEnhancement.EFFICIENCY: this.costEnhancement++; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void modifyEffect(SpellModifier mod)
|
public void modifyEffect(SpellModifier mod)
|
||||||
|
@ -43,4 +54,87 @@ public abstract class SpellEffect
|
||||||
public abstract void offensiveModificationProjectile(SpellParadigmProjectile parad);
|
public abstract void offensiveModificationProjectile(SpellParadigmProjectile parad);
|
||||||
public abstract void defensiveModificationProjectile(SpellParadigmProjectile parad);
|
public abstract void defensiveModificationProjectile(SpellParadigmProjectile parad);
|
||||||
public abstract void environmentalModificationProjectile(SpellParadigmProjectile parad);
|
public abstract void environmentalModificationProjectile(SpellParadigmProjectile parad);
|
||||||
|
|
||||||
|
public void modifySelfParadigm(SpellParadigmSelf parad)
|
||||||
|
{
|
||||||
|
switch(modifierState)
|
||||||
|
{
|
||||||
|
case SpellModifier.DEFAULT: this.defaultModificationSelf(parad); break;
|
||||||
|
case SpellModifier.OFFENSIVE: this.offensiveModificationSelf(parad); break;
|
||||||
|
case SpellModifier.DEFENSIVE: this.defensiveModificationSelf(parad); break;
|
||||||
|
case SpellModifier.ENVIRONMENTAL: this.environmentalModificationSelf(parad); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void defaultModificationSelf(SpellParadigmSelf parad);
|
||||||
|
public abstract void offensiveModificationSelf(SpellParadigmSelf parad);
|
||||||
|
public abstract void defensiveModificationSelf(SpellParadigmSelf parad);
|
||||||
|
public abstract void environmentalModificationSelf(SpellParadigmSelf parad);
|
||||||
|
|
||||||
|
public void modifyMeleeParadigm(SpellParadigmMelee parad)
|
||||||
|
{
|
||||||
|
switch(modifierState)
|
||||||
|
{
|
||||||
|
case SpellModifier.DEFAULT: this.defaultModificationMelee(parad); break;
|
||||||
|
case SpellModifier.OFFENSIVE: this.offensiveModificationMelee(parad); break;
|
||||||
|
case SpellModifier.DEFENSIVE: this.defensiveModificationMelee(parad); break;
|
||||||
|
case SpellModifier.ENVIRONMENTAL: this.environmentalModificationMelee(parad); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void defaultModificationMelee(SpellParadigmMelee parad);
|
||||||
|
public abstract void offensiveModificationMelee(SpellParadigmMelee parad);
|
||||||
|
public abstract void defensiveModificationMelee(SpellParadigmMelee parad);
|
||||||
|
public abstract void environmentalModificationMelee(SpellParadigmMelee parad);
|
||||||
|
|
||||||
|
public int getCostForProjectile()
|
||||||
|
{
|
||||||
|
switch(this.modifierState)
|
||||||
|
{
|
||||||
|
case SpellModifier.DEFAULT: return this.getCostForDefaultProjectile();
|
||||||
|
case SpellModifier.OFFENSIVE: return this.getCostForOffenseProjectile();
|
||||||
|
case SpellModifier.DEFENSIVE: return this.getCostForDefenseProjectile();
|
||||||
|
case SpellModifier.ENVIRONMENTAL: return this.getCostForEnvironmentProjectile();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract int getCostForDefaultProjectile();
|
||||||
|
public abstract int getCostForOffenseProjectile();
|
||||||
|
public abstract int getCostForDefenseProjectile();
|
||||||
|
public abstract int getCostForEnvironmentProjectile();
|
||||||
|
|
||||||
|
public int getCostForSelf()
|
||||||
|
{
|
||||||
|
switch(this.modifierState)
|
||||||
|
{
|
||||||
|
case SpellModifier.DEFAULT: return this.getCostForDefaultSelf();
|
||||||
|
case SpellModifier.OFFENSIVE: return this.getCostForOffenseSelf();
|
||||||
|
case SpellModifier.DEFENSIVE: return this.getCostForDefenseSelf();
|
||||||
|
case SpellModifier.ENVIRONMENTAL: return this.getCostForEnvironmentSelf();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract int getCostForDefaultSelf();
|
||||||
|
public abstract int getCostForOffenseSelf();
|
||||||
|
public abstract int getCostForDefenseSelf();
|
||||||
|
public abstract int getCostForEnvironmentSelf();
|
||||||
|
|
||||||
|
public int getCostForMelee()
|
||||||
|
{
|
||||||
|
switch(this.modifierState)
|
||||||
|
{
|
||||||
|
case SpellModifier.DEFAULT: return this.getCostForDefaultMelee();
|
||||||
|
case SpellModifier.OFFENSIVE: return this.getCostForOffenseMelee();
|
||||||
|
case SpellModifier.DEFENSIVE: return this.getCostForDefenseMelee();
|
||||||
|
case SpellModifier.ENVIRONMENTAL: return this.getCostForEnvironmentMelee();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract int getCostForDefaultMelee();
|
||||||
|
public abstract int getCostForOffenseMelee();
|
||||||
|
public abstract int getCostForDefenseMelee();
|
||||||
|
public abstract int getCostForEnvironmentMelee();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package WayofTime.alchemicalWizardry.common.spell.complex.enhancement;
|
||||||
|
|
||||||
|
public class SpellEnhancement
|
||||||
|
{
|
||||||
|
public static final int POWER = 0;
|
||||||
|
public static final int EFFICIENCY = 1;
|
||||||
|
|
||||||
|
private int state = this.POWER;
|
||||||
|
|
||||||
|
protected SpellEnhancement(int state)
|
||||||
|
{
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getState()
|
||||||
|
{
|
||||||
|
return this.state;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package WayofTime.alchemicalWizardry.common.spell.complex.enhancement;
|
||||||
|
|
||||||
|
public class SpellEnhancementCost extends SpellEnhancement
|
||||||
|
{
|
||||||
|
|
||||||
|
public SpellEnhancementCost()
|
||||||
|
{
|
||||||
|
super(SpellEnhancement.EFFICIENCY);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package WayofTime.alchemicalWizardry.common.spell.complex.enhancement;
|
||||||
|
|
||||||
|
public class SpellEnhancementPower extends SpellEnhancement
|
||||||
|
{
|
||||||
|
|
||||||
|
public SpellEnhancementPower()
|
||||||
|
{
|
||||||
|
super(SpellEnhancement.POWER);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue