Spell hierarchisation and refactoring, plus miscellaneous renaming and minor refactoring
- Adds new generic spell superclasses which aim to group spells such that duplicate code is eliminated, and functions standardised, as much as possible. - Removes numerous spell classes which are no longer required as a result of this change, and replaces them with instances of the relevant generic spell classes. - Changes the remaining spell classes to fit with the new system, mostly by having them extend the generic spell classes. - Completes the transfer of particle spawning to the ParticleBuilder system.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package electroblob.wizardry.spell;
|
||||
|
||||
import electroblob.wizardry.WizardData;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.constants.Constants;
|
||||
import electroblob.wizardry.constants.Element;
|
||||
import electroblob.wizardry.constants.SpellType;
|
||||
@@ -9,8 +8,9 @@ import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.registry.WizardryEnchantments;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -24,7 +24,7 @@ import net.minecraft.world.World;
|
||||
public class ImbueWeapon extends Spell {
|
||||
|
||||
public ImbueWeapon(){
|
||||
super(Tier.APPRENTICE, 20, Element.SORCERY, "imbue_weapon", SpellType.UTILITY, 50, EnumAction.BOW, false);
|
||||
super("imbue_weapon", Tier.APPRENTICE, Element.SORCERY, SpellType.UTILITY, 20, 50, EnumAction.BOW, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,9 +40,9 @@ public class ImbueWeapon extends Spell {
|
||||
&& WizardData.get(caster).getImbuementDuration(WizardryEnchantments.magic_sword) <= 0){
|
||||
// The enchantment level as determined by the damage multiplier. The + 0.5f is so that
|
||||
// weird float processing doesn't incorrectly round it down.
|
||||
stack.addEnchantment(WizardryEnchantments.magic_sword, modifiers.get(SpellModifiers.DAMAGE) == 1.0f
|
||||
stack.addEnchantment(WizardryEnchantments.magic_sword, modifiers.get(SpellModifiers.POTENCY) == 1.0f
|
||||
? 1
|
||||
: (int)((modifiers.get(SpellModifiers.DAMAGE) - 1.0f) / Constants.DAMAGE_INCREASE_PER_TIER
|
||||
: (int)((modifiers.get(SpellModifiers.POTENCY) - 1.0f) / Constants.DAMAGE_INCREASE_PER_TIER
|
||||
+ 0.5f));
|
||||
WizardData.get(caster).setImbuementDuration(WizardryEnchantments.magic_sword,
|
||||
(int)(900 * modifiers.get(WizardryItems.duration_upgrade)));
|
||||
@@ -52,9 +52,9 @@ public class ImbueWeapon extends Spell {
|
||||
&& WizardData.get(caster).getImbuementDuration(WizardryEnchantments.magic_bow) <= 0){
|
||||
// The enchantment level as determined by the damage multiplier. The + 0.5f is so that
|
||||
// weird float processing doesn't incorrectly round it down.
|
||||
stack.addEnchantment(WizardryEnchantments.magic_bow, modifiers.get(SpellModifiers.DAMAGE) == 1.0f
|
||||
stack.addEnchantment(WizardryEnchantments.magic_bow, modifiers.get(SpellModifiers.POTENCY) == 1.0f
|
||||
? 1
|
||||
: (int)((modifiers.get(SpellModifiers.DAMAGE) - 1.0f) / Constants.DAMAGE_INCREASE_PER_TIER
|
||||
: (int)((modifiers.get(SpellModifiers.POTENCY) - 1.0f) / Constants.DAMAGE_INCREASE_PER_TIER
|
||||
+ 0.5f));
|
||||
WizardData.get(caster).setImbuementDuration(WizardryEnchantments.magic_bow,
|
||||
(int)(900 * modifiers.get(WizardryItems.duration_upgrade)));
|
||||
@@ -64,17 +64,15 @@ public class ImbueWeapon extends Spell {
|
||||
}
|
||||
|
||||
if(world.isRemote){
|
||||
for(int i = 0; i < 10; i++){
|
||||
double x1 = (double)((float)caster.posX + world.rand.nextFloat() * 2 - 1.0F);
|
||||
double y1 = (double)((float)WizardryUtilities.getPlayerEyesPos(caster) - 0.5F
|
||||
+ world.rand.nextFloat());
|
||||
double z1 = (double)((float)caster.posZ + world.rand.nextFloat() * 2 - 1.0F);
|
||||
Wizardry.proxy.spawnParticle(Type.SPARKLE, world, x1, y1, z1, 0, 0.1F, 0,
|
||||
48 + world.rand.nextInt(12), 0.9f, 0.7f, 1.0f);
|
||||
for(int i=0; i<10; i++){
|
||||
double x = caster.posX + world.rand.nextDouble() * 2 - 1;
|
||||
double y = caster.getEntityBoundingBox().minY + caster.getEyeHeight() - 0.5 + world.rand.nextDouble();
|
||||
double z = caster.posZ + world.rand.nextDouble() * 2 - 1;
|
||||
ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(0, 0.1, 0).colour(0.9f, 0.7f, 1).spawn(world);
|
||||
}
|
||||
}
|
||||
|
||||
WizardryUtilities.playSoundAtPlayer(caster, WizardrySounds.SPELL_CONJURATION, 1.0f, 1.0f);
|
||||
WizardryUtilities.playSoundAtPlayer(caster, WizardrySounds.SPELL_CONJURATION, 1, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user