mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-30 16:28:00 +01:00
Reimplemented the vortex
This commit is contained in:
parent
634ab607bf
commit
63c51cae64
3 changed files with 51 additions and 1 deletions
|
@ -31,6 +31,7 @@ public class SpellRegistry {
|
||||||
registerSpell(SpellFire::new);
|
registerSpell(SpellFire::new);
|
||||||
registerSpell(SpellIce::new);
|
registerSpell(SpellIce::new);
|
||||||
registerSpell(SpellPortal::new);
|
registerSpell(SpellPortal::new);
|
||||||
|
registerSpell(SpellVortex::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMagicEffect getSpellFromName(String name) {
|
public IMagicEffect getSpellFromName(String name) {
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.minelittlepony.unicopia.spell;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.UParticles;
|
||||||
|
import com.minelittlepony.unicopia.particle.Particles;
|
||||||
|
import com.minelittlepony.unicopia.player.PlayerSpeciesList;
|
||||||
|
import com.minelittlepony.util.shape.Sphere;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
public class SpellVortex extends SpellShield {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "vortex";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void spawnParticles(ICaster<?> source, int strength) {
|
||||||
|
Vec3d pos = source.getOriginVector();
|
||||||
|
|
||||||
|
source.spawnParticles(new Sphere(false, strength), strength * 9, p -> {
|
||||||
|
Particles.instance().spawnParticle(UParticles.MAGIC_PARTICLE, false, p, p.subtract(pos));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void applyRadialEffect(ICaster<?> source, Entity target, double distance, double radius) {
|
||||||
|
Vec3d pos = source.getOriginVector();
|
||||||
|
|
||||||
|
double force = 4 / distance;
|
||||||
|
|
||||||
|
if (source.getAffinity() != SpellAffinity.BAD && target instanceof EntityPlayer) {
|
||||||
|
force *= calculateAdjustedForce(PlayerSpeciesList.instance().getPlayer((EntityPlayer)target));
|
||||||
|
}
|
||||||
|
|
||||||
|
applyForce(pos, target, -force, 0);
|
||||||
|
|
||||||
|
float maxVel = source.getAffinity() != SpellAffinity.BAD ? 1.6f : 1;
|
||||||
|
|
||||||
|
if (target.motionX > maxVel) target.motionX = maxVel;
|
||||||
|
if (target.motionX < -maxVel) target.motionX = -maxVel;
|
||||||
|
if (target.motionY > maxVel) target.motionY = maxVel;
|
||||||
|
if (target.motionY < -maxVel) target.motionY = -maxVel;
|
||||||
|
if (target.motionZ > maxVel) target.motionZ = maxVel;
|
||||||
|
if (target.motionZ < -maxVel) target.motionZ = -maxVel;
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,7 +34,7 @@ spell.fire.name=Flame
|
||||||
spell.infero.name=Burning
|
spell.infero.name=Burning
|
||||||
spell.ice.name=Frost
|
spell.ice.name=Frost
|
||||||
spell.portal.name=Transportation
|
spell.portal.name=Transportation
|
||||||
spell.attract.name=Retention
|
spell.vortex.name=Retention
|
||||||
spell.minion.name=Obedience
|
spell.minion.name=Obedience
|
||||||
|
|
||||||
curse.shield.name=Repulsion
|
curse.shield.name=Repulsion
|
||||||
|
|
Loading…
Reference in a new issue