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;
|
||||
@@ -30,7 +30,7 @@ public class FreezingWeapon extends Spell {
|
||||
public static final String FREEZING_ARROW_NBT_KEY = "frostLevel";
|
||||
|
||||
public FreezingWeapon(){
|
||||
super(Tier.ADVANCED, 35, Element.ICE, "freezing_weapon", SpellType.UTILITY, 70, EnumAction.BOW, false);
|
||||
super("freezing_weapon", Tier.ADVANCED, Element.ICE, SpellType.UTILITY, 35, 70, EnumAction.BOW, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,25 +47,23 @@ public class FreezingWeapon extends Spell {
|
||||
// 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.freezing_weapon,
|
||||
modifiers.get(SpellModifiers.DAMAGE) == 1.0f ? 1
|
||||
: (int)((modifiers.get(SpellModifiers.DAMAGE) - 1.0f)
|
||||
modifiers.get(SpellModifiers.POTENCY) == 1.0f ? 1
|
||||
: (int)((modifiers.get(SpellModifiers.POTENCY) - 1.0f)
|
||||
/ Constants.DAMAGE_INCREASE_PER_TIER + 0.5f));
|
||||
|
||||
WizardData.get(caster).setImbuementDuration(WizardryEnchantments.freezing_weapon,
|
||||
(int)(900 * modifiers.get(WizardryItems.duration_upgrade)));
|
||||
|
||||
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