That's one heck of a commit you've got there...
I may have got a bit behind with version control. A lot behind, in fact. Maybe I'll go back and split this sometime - then again, I probably won't. But hey, at least it's here!
This commit is contained in:
@@ -1,56 +1,52 @@
|
||||
package electroblob.wizardry.spell;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import electroblob.wizardry.constants.Element;
|
||||
import electroblob.wizardry.constants.SpellType;
|
||||
import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.*;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.network.play.server.SPacketEntityVelocity;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LightningPulse extends Spell {
|
||||
|
||||
private static final double BASE_RADIUS = 3;
|
||||
private static final float BASE_DAMAGE = 8;
|
||||
|
||||
public static final String REPULSION_VELOCITY = "repulsion_velocity";
|
||||
|
||||
public LightningPulse(){
|
||||
super("lightning_pulse", Tier.ADVANCED, Element.LIGHTNING, SpellType.ATTACK, 25, 75, EnumAction.NONE, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesSpellRequirePacket(){
|
||||
return false;
|
||||
super("lightning_pulse", EnumAction.NONE, false);
|
||||
addProperties(EFFECT_RADIUS, DAMAGE, REPULSION_VELOCITY);
|
||||
this.soundValues(2, 1, 0);
|
||||
}
|
||||
|
||||
// TODO: NPC casting support
|
||||
|
||||
@Override
|
||||
protected SoundEvent[] createSounds(){
|
||||
return createSoundsWithSuffixes("spark", "explosion");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){
|
||||
|
||||
if(caster.onGround){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(
|
||||
BASE_RADIUS * modifiers.get(WizardryItems.blast_upgrade), caster.posX, caster.posY, caster.posZ, world);
|
||||
getProperty(EFFECT_RADIUS).floatValue() * modifiers.get(WizardryItems.blast_upgrade),
|
||||
caster.posX, caster.posY, caster.posZ, world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
if(WizardryUtilities.isValidTarget(caster, target)){
|
||||
if(AllyDesignationSystem.isValidTarget(caster, target)){
|
||||
// Base damage is 4 hearts no matter where the target is.
|
||||
target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.SHOCK),
|
||||
BASE_DAMAGE * modifiers.get(SpellModifiers.POTENCY));
|
||||
getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY));
|
||||
|
||||
if(!world.isRemote){
|
||||
|
||||
@@ -61,9 +57,9 @@ public class LightningPulse extends Spell {
|
||||
dx /= vectorLength;
|
||||
dz /= vectorLength;
|
||||
|
||||
target.motionX = 0.8 * dx;
|
||||
target.motionX = getProperty(REPULSION_VELOCITY).floatValue() * dx;
|
||||
target.motionY = 0;
|
||||
target.motionZ = 0.8 * dz;
|
||||
target.motionZ = getProperty(REPULSION_VELOCITY).floatValue() * dz;
|
||||
|
||||
// Player motion is handled on that player's client so needs packets
|
||||
if(target instanceof EntityPlayerMP){
|
||||
@@ -80,8 +76,7 @@ public class LightningPulse extends Spell {
|
||||
}
|
||||
|
||||
caster.swingArm(hand);
|
||||
WizardryUtilities.playSoundAtPlayer(caster, WizardrySounds.SPELL_LIGHTNING, 1, 1);
|
||||
WizardryUtilities.playSoundAtPlayer(caster, WizardrySounds.SPELL_SHOCKWAVE, 2, 1);
|
||||
this.playSound(world, caster, ticksInUse, -1, modifiers);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user