Add blinding flash spell
This commit is contained in:
@@ -240,6 +240,8 @@ public final class Spells {
|
||||
|
||||
// Wizardry 4.3 spells
|
||||
|
||||
public static final Spell blinding_flash = placeholder();
|
||||
|
||||
public static final Spell stormcloud = placeholder();
|
||||
|
||||
public static final Spell zombie_apocalypse = placeholder();
|
||||
@@ -445,6 +447,8 @@ public final class Spells {
|
||||
|
||||
// Wizardry 4.3 spells
|
||||
|
||||
registry.register(new BlindingFlash());
|
||||
|
||||
registry.register(new Stormcloud());
|
||||
|
||||
registry.register(new ZombieApocalypse());
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package electroblob.wizardry.spell;
|
||||
|
||||
import electroblob.wizardry.item.SpellActions;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlindingFlash extends SpellAreaEffect {
|
||||
|
||||
public BlindingFlash(){
|
||||
super("blinding_flash", SpellActions.POINT_UP, false);
|
||||
this.alwaysSucceed(true);
|
||||
addProperties(EFFECT_DURATION); // No effect strength, you're either blinded or you're not!
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean affectEntity(World world, Vec3d origin, @Nullable EntityLivingBase caster, EntityLivingBase target, int targetCount, int ticksInUse, SpellModifiers modifiers){
|
||||
|
||||
if(EntityUtils.isLiving(target)){
|
||||
int duration = (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade));
|
||||
target.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, duration, 0));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void spawnParticleEffect(World world, Vec3d origin, double radius, @Nullable EntityLivingBase caster, SpellModifiers modifiers){
|
||||
if(caster != null) origin = origin.add(0, caster.height + 1, 0);
|
||||
ParticleBuilder.create(Type.SPHERE).pos(origin).scale((float)radius * 0.8f).spawn(world);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user