mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-17 10:24:23 +01:00
Added the dispel evil spell
This commit is contained in:
parent
82bdce6c51
commit
38fb168ac0
3 changed files with 57 additions and 0 deletions
|
@ -0,0 +1,54 @@
|
|||
package com.minelittlepony.unicopia.ability.magic.spell.effect;
|
||||
|
||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.*;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.SpellTraits;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
||||
import com.minelittlepony.unicopia.particle.UParticles;
|
||||
import com.minelittlepony.unicopia.projectile.MagicProjectileEntity;
|
||||
import com.minelittlepony.unicopia.projectile.ProjectileDelegate;
|
||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public class DispellEvilSpell extends AbstractSpell implements ProjectileDelegate.HitListener {
|
||||
public static final SpellTraits DEFAULT_TRAITS = new SpellTraits.Builder()
|
||||
.with(Trait.POWER, 10)
|
||||
.build();
|
||||
|
||||
protected DispellEvilSpell(CustomisedSpellType<?> type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tick(Caster<?> source, Situation situation) {
|
||||
if (situation == Situation.PROJECTILE) {
|
||||
return !isDead();
|
||||
}
|
||||
|
||||
source.findAllEntitiesInRange(getTraits().get(Trait.POWER) * 10, e -> e.getType() == EntityType.PHANTOM).forEach(entity -> {
|
||||
entity.damage(MagicalDamageSource.MAGIC, 50);
|
||||
if (entity instanceof LivingEntity l) {
|
||||
double d = source.getOriginVector().getX() - entity.getX();
|
||||
double e = source.getOriginVector().getZ() - entity.getZ();
|
||||
while (d * d + e * e < 1.0E-4) {
|
||||
d = (Math.random() - Math.random()) * 0.01;
|
||||
e = (Math.random() - Math.random()) * 0.01;
|
||||
}
|
||||
l.takeKnockback(1, d, e);
|
||||
}
|
||||
|
||||
source.addParticle(UParticles.LIGHTNING_BOLT, entity.getPos(), Vec3d.ZERO);
|
||||
});
|
||||
source.subtractEnergyCost(1000);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onImpact(MagicProjectileEntity projectile) {
|
||||
tick(projectile, Situation.GROUND);
|
||||
}
|
||||
}
|
|
@ -73,6 +73,7 @@ public final class SpellType<T extends Spell> implements Affine, SpellPredicate<
|
|||
public static final SpellType<MindSwapSpell> MIND_SWAP = register("mind_swap", Affinity.BAD, 0xF9FF99, true, SpellTraits.EMPTY, MindSwapSpell::new);
|
||||
public static final SpellType<HydrophobicSpell> HYDROPHOBIC = register("hydrophobic", Affinity.NEUTRAL, 0xF999FF, true, SpellTraits.EMPTY, s -> new HydrophobicSpell(s, FluidTags.WATER));
|
||||
public static final SpellType<BubbleSpell> BUBBLE = register("bubble", Affinity.NEUTRAL, 0xF999FF, true, BubbleSpell.DEFAULT_TRAITS, BubbleSpell::new);
|
||||
public static final SpellType<DispellEvilSpell> DISPEL_EVIL = register("dispel_evil", Affinity.GOOD, 0x00FF00, true, DispellEvilSpell.DEFAULT_TRAITS, DispellEvilSpell::new);
|
||||
|
||||
public static void bootstrap() {}
|
||||
|
||||
|
|
|
@ -247,6 +247,8 @@
|
|||
"spell.unicopia.feather_fall.lore": "Slows the descent of the caster and surrounding allies",
|
||||
"spell.unicopia.catapult": "Catapult",
|
||||
"spell.unicopia.catapult.lore": "Grabs a nearby block or entity and throws it into the air",
|
||||
"spell.unicopia.dispel_evil": "Dispel Evil",
|
||||
"spell.unicopia.dispel_evil.lore": "Casts away any nearby unearthly forces.",
|
||||
|
||||
"gui.unicopia.trait.label": "Element of %s",
|
||||
"gui.unicopia.trait.group": "\n %s",
|
||||
|
|
Loading…
Reference in a new issue