From ba19b041542b1504e12f2d8e6ef22e1f8cc99a30 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Sat, 18 Jan 2014 11:45:31 -0500 Subject: [PATCH] More spells --- .../spell/complex/EntitySpellProjectile.java | 65 ++++++------ .../spell/complex/SpellEnhancement.java | 6 -- .../spell/complex/SpellModifierDefault.java | 9 ++ .../spell/complex/SpellModifierDefensive.java | 9 ++ .../complex/SpellModifierEnvironmental.java | 9 ++ .../spell/complex/SpellModifierOffensive.java | 9 ++ .../common/spell/complex/SpellParadigm.java | 1 + .../spell/complex/SpellParadigmMelee.java | 25 +++++ .../complex/SpellParadigmProjectile.java | 7 +- .../spell/complex/SpellParadigmSelf.java | 1 + .../spell/complex/effect/SpellEffect.java | 98 ++++++++++++++++++- .../complex/enhancement/SpellEnhancement.java | 19 ++++ .../enhancement/SpellEnhancementCost.java | 10 ++ .../enhancement/SpellEnhancementPower.java | 10 ++ 14 files changed, 233 insertions(+), 45 deletions(-) delete mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellEnhancement.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierDefault.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierDefensive.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierEnvironmental.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierOffensive.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmMelee.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/enhancement/SpellEnhancement.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/enhancement/SpellEnhancementCost.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/enhancement/SpellEnhancementPower.java diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/EntitySpellProjectile.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/EntitySpellProjectile.java index 45d3cdf2..9b41c684 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/EntitySpellProjectile.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/EntitySpellProjectile.java @@ -268,14 +268,21 @@ public class EntitySpellProjectile extends Entity implements IProjectile par1NBTTagCompound.setByte("inData", (byte)inData); par1NBTTagCompound.setByte("inGround", (byte)(inGround ? 1 : 0)); - NBTTagList tagList = par1NBTTagCompound.getTagList("Effects"); - this.effectList = new LinkedList(); - for (int i = 0; i < tagList.tagCount(); i++) - { - NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i); + NBTTagList effectList = new NBTTagList(); - 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; inGround = par1NBTTagCompound.getByte("inGround") == 1; - NBTTagList effectList = new NBTTagList(); - - for (String str : this.effectList) + NBTTagList tagList = par1NBTTagCompound.getTagList("Effects"); + this.effectList = new LinkedList(); + for (int i = 0; i < tagList.tagCount(); i++) { - if (str != null) - { - NBTTagCompound tag = new NBTTagCompound(); + NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i); - tag.setString("Class", str); - effectList.appendTag(tag); - } + this.effectList.add(tag.getString("Class")); } - - 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); this.setDead(); - } else if (this.isUndead(mop)) { - doDamage(16 + d12(), mop); - } else { - doDamage(8 + d6(), mop); + } + else + { + doDamage(this.damage, mop); } spawnHitParticles("exorcism", 8); 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) { 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) { - mop.attackEntityFrom(this.getDamageSource(), i); + private void doDamage(float f, Entity mop) + { + mop.attackEntityFrom(this.getDamageSource(), f); } - private boolean isUndead(Entity mop) { - return mop instanceof EntitySkeleton || mop instanceof EntityGhast || mop instanceof EntityWither || mop instanceof EntityZombie || mop instanceof EntityPigZombie; - } - - private DamageSource getDamageSource() { + private DamageSource getDamageSource() + { return DamageSource.causePlayerDamage(shootingEntity); } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellEnhancement.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellEnhancement.java deleted file mode 100644 index 58a1c6b6..00000000 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellEnhancement.java +++ /dev/null @@ -1,6 +0,0 @@ -package WayofTime.alchemicalWizardry.common.spell.complex; - -public class SpellEnhancement -{ - -} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierDefault.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierDefault.java new file mode 100644 index 00000000..fd379ae1 --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierDefault.java @@ -0,0 +1,9 @@ +package WayofTime.alchemicalWizardry.common.spell.complex; + +public class SpellModifierDefault extends SpellModifier +{ + public SpellModifierDefault() + { + super(SpellModifier.DEFAULT); + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierDefensive.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierDefensive.java new file mode 100644 index 00000000..f9f69dbe --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierDefensive.java @@ -0,0 +1,9 @@ +package WayofTime.alchemicalWizardry.common.spell.complex; + +public class SpellModifierDefensive extends SpellModifier +{ + public SpellModifierDefensive() + { + super(SpellModifier.DEFENSIVE); + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierEnvironmental.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierEnvironmental.java new file mode 100644 index 00000000..1da4620a --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierEnvironmental.java @@ -0,0 +1,9 @@ +package WayofTime.alchemicalWizardry.common.spell.complex; + +public class SpellModifierEnvironmental extends SpellModifier +{ + public SpellModifierEnvironmental() + { + super(SpellModifier.DEFENSIVE); + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierOffensive.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierOffensive.java new file mode 100644 index 00000000..783ab1e3 --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellModifierOffensive.java @@ -0,0 +1,9 @@ +package WayofTime.alchemicalWizardry.common.spell.complex; + +public class SpellModifierOffensive extends SpellModifier +{ + public SpellModifierOffensive() + { + super(SpellModifier.OFFENSIVE); + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigm.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigm.java index 2eca17f9..d83f7b91 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigm.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigm.java @@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect; +import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement; public abstract class SpellParadigm { diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmMelee.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmMelee.java new file mode 100644 index 00000000..c967ff6c --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmMelee.java @@ -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 + + } + +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmProjectile.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmProjectile.java index af6e4930..b88be812 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmProjectile.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmProjectile.java @@ -9,6 +9,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect; +import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement; public class SpellParadigmProjectile extends SpellParadigm { @@ -18,7 +19,7 @@ public class SpellParadigmProjectile extends SpellParadigm public List impactList = new ArrayList(); public List updateEffectList = new ArrayList(); public boolean penetration = false; - + public int ricochetMax = 0; @Override public void enhanceParadigm(SpellEnhancement enh) @@ -31,7 +32,8 @@ public class SpellParadigmProjectile extends SpellParadigm public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack) { EntitySpellProjectile proj = new EntitySpellProjectile(world, entityPlayer); - + this.prepareProjectile(proj); + world.spawnEntityInWorld(proj); } public static SpellParadigmProjectile getParadigmForStringArray(List stringList) @@ -86,6 +88,7 @@ public class SpellParadigmProjectile extends SpellParadigm proj.setUpdateEffectList(updateEffectList); proj.setPenetration(penetration); proj.setEffectList(effectList); + proj.setRicochetMax(ricochetMax); } } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmSelf.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmSelf.java index 41a72da8..e65cd0d9 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmSelf.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmSelf.java @@ -1,5 +1,6 @@ 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; diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffect.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffect.java index 95098863..5a02f0e2 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffect.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffect.java @@ -1,17 +1,28 @@ 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.SpellParadigm; +import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee; 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 int modifierState = SpellModifier.DEFAULT; + public int powerEnhancement = 0; + public int costEnhancement = 0; 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) @@ -43,4 +54,87 @@ public abstract class SpellEffect public abstract void offensiveModificationProjectile(SpellParadigmProjectile parad); public abstract void defensiveModificationProjectile(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(); } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/enhancement/SpellEnhancement.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/enhancement/SpellEnhancement.java new file mode 100644 index 00000000..0d9078da --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/enhancement/SpellEnhancement.java @@ -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; + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/enhancement/SpellEnhancementCost.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/enhancement/SpellEnhancementCost.java new file mode 100644 index 00000000..2e0df1fb --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/enhancement/SpellEnhancementCost.java @@ -0,0 +1,10 @@ +package WayofTime.alchemicalWizardry.common.spell.complex.enhancement; + +public class SpellEnhancementCost extends SpellEnhancement +{ + + public SpellEnhancementCost() + { + super(SpellEnhancement.EFFICIENCY); + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/enhancement/SpellEnhancementPower.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/enhancement/SpellEnhancementPower.java new file mode 100644 index 00000000..527dfe46 --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/enhancement/SpellEnhancementPower.java @@ -0,0 +1,10 @@ +package WayofTime.alchemicalWizardry.common.spell.complex.enhancement; + +public class SpellEnhancementPower extends SpellEnhancement +{ + + public SpellEnhancementPower() + { + super(SpellEnhancement.POWER); + } +}