diff --git a/src/main/java/com/minelittlepony/unicopia/spell/SpellAwkward.java b/src/main/java/com/minelittlepony/unicopia/spell/SpellAwkward.java new file mode 100644 index 00000000..98c5a557 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/spell/SpellAwkward.java @@ -0,0 +1,63 @@ +package com.minelittlepony.unicopia.spell; + +import java.util.List; + +import com.google.common.collect.Lists; +import com.minelittlepony.util.shape.Sphere; + +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.math.MathHelper; + +public class SpellAwkward extends AbstractSpell { + + private final List names = Lists.newArrayList(EnumParticleTypes.getParticleNames()); + + private final int max = names.size(); + + @Override + public String getName() { + return "awkward"; + } + + @Override + public SpellAffinity getAffinity() { + return SpellAffinity.NEUTRAL; + } + + @Override + public int getTint() { + return 0x248712; + } + + @Override + public boolean update(ICaster source, int level) { + return true; + } + + @Override + public void render(ICaster source, int level) { + source.spawnParticles(new Sphere(false, (1 + level) * 8), 10, pos -> { + int index = (int)MathHelper.nextDouble(source.getWorld().rand, 0, max); + + EnumParticleTypes type = EnumParticleTypes.getByName(names.get(index)); + + if (shouldSpawnParticle(type)) { + int[] arguments = new int[type.getArgumentCount()]; + + source.getWorld().spawnParticle(type, pos.x, pos.y, pos.z, 0, 0, 0, arguments); + } + }); + } + + protected boolean shouldSpawnParticle(EnumParticleTypes type) { + switch (type) { + case BARRIER: + case SMOKE_LARGE: + case MOB_APPEARANCE: + case EXPLOSION_HUGE: + case EXPLOSION_LARGE: + case EXPLOSION_NORMAL: return false; + default: return true; + } + } +} diff --git a/src/main/java/com/minelittlepony/unicopia/spell/SpellRegistry.java b/src/main/java/com/minelittlepony/unicopia/spell/SpellRegistry.java index d8f7f900..c067130a 100644 --- a/src/main/java/com/minelittlepony/unicopia/spell/SpellRegistry.java +++ b/src/main/java/com/minelittlepony/unicopia/spell/SpellRegistry.java @@ -39,6 +39,7 @@ public class SpellRegistry { registerSpell(SpellVortex::new); registerSpell(SpellDisguise::new); registerSpell(SpellNecromancy::new); + registerSpell(SpellAwkward::new); } @Nullable diff --git a/src/main/resources/assets/unicopia/lang/en_US.lang b/src/main/resources/assets/unicopia/lang/en_US.lang index 4e4cee82..c54eb78f 100644 --- a/src/main/resources/assets/unicopia/lang/en_US.lang +++ b/src/main/resources/assets/unicopia/lang/en_US.lang @@ -33,6 +33,9 @@ item.corrupted_gem.enchanted.name=Fractured Gem of %s spell.shield.name=Defense spell.shield.tagline=Protection I +spell.awkward.name=Awkwardness +spell.awkward.tagline=*Derp* + spell.portal.name=Transportation spell.portal.tagline=Teleportation I @@ -51,6 +54,9 @@ spell.ice.tagline=Ice I curse.shield.name=Repulsion curse.shield.tagline=Hostility I +curse.awkward.name=Awkwardness +curse.awkward.tagline=*Derp* + curse.vortex.name=Suffering curse.vortex.tagline=Torture I