From 78cfa7d515a3445291ad5f30d2baa1ba274dde65 Mon Sep 17 00:00:00 2001 From: Sollace Date: Wed, 13 Feb 2019 22:46:37 +0200 Subject: [PATCH] Added Spell of Revealing --- .../unicopia/spell/ISuppressable.java | 10 ++++ .../unicopia/spell/SpellReveal.java | 53 +++++++++++++++++++ .../resources/assets/unicopia/lang/en_US.lang | 3 ++ 3 files changed, 66 insertions(+) create mode 100644 src/main/java/com/minelittlepony/unicopia/spell/ISuppressable.java create mode 100644 src/main/java/com/minelittlepony/unicopia/spell/SpellReveal.java diff --git a/src/main/java/com/minelittlepony/unicopia/spell/ISuppressable.java b/src/main/java/com/minelittlepony/unicopia/spell/ISuppressable.java new file mode 100644 index 00000000..382bdae9 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/spell/ISuppressable.java @@ -0,0 +1,10 @@ +package com.minelittlepony.unicopia.spell; + +public interface ISuppressable extends IMagicEffect { + + boolean getSuppressed(); + + boolean isVulnerable(ICaster otherSource, IMagicEffect other); + + void onSuppressed(ICaster otherSource); +} diff --git a/src/main/java/com/minelittlepony/unicopia/spell/SpellReveal.java b/src/main/java/com/minelittlepony/unicopia/spell/SpellReveal.java new file mode 100644 index 00000000..c05af8b1 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/spell/SpellReveal.java @@ -0,0 +1,53 @@ +package com.minelittlepony.unicopia.spell; + +import com.minelittlepony.unicopia.UParticles; +import com.minelittlepony.unicopia.particle.Particles; +import com.minelittlepony.util.shape.IShape; +import com.minelittlepony.util.shape.Sphere; + +import net.minecraft.init.SoundEvents; +import net.minecraft.util.SoundCategory; + +public class SpellReveal extends AbstractSpell { + + @Override + public String getName() { + return "reveal"; + } + + @Override + public int getTint() { + return 0x5CE81F; + } + + @Override + public boolean update(ICaster source) { + source.findAllSpellsInRange(15).forEach(e -> { + ISuppressable spell = e.getEffect(ISuppressable.class, false); + + if (spell != null && spell.isVulnerable(source, this)) { + spell.onSuppressed(source); + source.getWorld().playSound(null, e.getOrigin(), SoundEvents.ENTITY_ZOMBIE_VILLAGER_CURE, SoundCategory.PLAYERS, 1, 1); + } + }); + + return true; + } + + @Override + public void render(ICaster source) { + IShape area = new Sphere(false, 15); + + source.spawnParticles(area, 5, pos -> { + Particles.instance().spawnParticle(UParticles.UNICORN_MAGIC, false, pos, 0, 0, 0); + }); + + source.spawnParticles(UParticles.UNICORN_MAGIC, 5); + } + + @Override + public SpellAffinity getAffinity() { + return SpellAffinity.GOOD; + } + +} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/lang/en_US.lang b/src/main/resources/assets/unicopia/lang/en_US.lang index 482e140c..9e887920 100644 --- a/src/main/resources/assets/unicopia/lang/en_US.lang +++ b/src/main/resources/assets/unicopia/lang/en_US.lang @@ -44,6 +44,9 @@ spell.portal.tagline=Teleportation I spell.light.name=Illumination spell.light.tagline=Discovery I +spell.reveal.name=Revealing +spell.reveal.tagline=Discovery II + spell.fire.name=Flame spell.fire.tagline=Fire I