Add fangs spell
This commit is contained in:
@@ -243,6 +243,7 @@ public final class Spells {
|
|||||||
public static final Spell blinding_flash = placeholder();
|
public static final Spell blinding_flash = placeholder();
|
||||||
|
|
||||||
public static final Spell stormcloud = placeholder();
|
public static final Spell stormcloud = placeholder();
|
||||||
|
public static final Spell fangs = placeholder();
|
||||||
public static final Spell radiant_totem = placeholder();
|
public static final Spell radiant_totem = placeholder();
|
||||||
|
|
||||||
public static final Spell firestorm = placeholder();
|
public static final Spell firestorm = placeholder();
|
||||||
@@ -452,6 +453,7 @@ public final class Spells {
|
|||||||
registry.register(new BlindingFlash());
|
registry.register(new BlindingFlash());
|
||||||
|
|
||||||
registry.register(new Stormcloud());
|
registry.register(new Stormcloud());
|
||||||
|
registry.register(new Fangs());
|
||||||
registry.register(new RadiantTotem());
|
registry.register(new RadiantTotem());
|
||||||
|
|
||||||
registry.register(new Firestorm());
|
registry.register(new Firestorm());
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package electroblob.wizardry.spell;
|
||||||
|
|
||||||
|
import electroblob.wizardry.item.SpellActions;
|
||||||
|
import electroblob.wizardry.registry.WizardryItems;
|
||||||
|
import electroblob.wizardry.util.BlockUtils;
|
||||||
|
import electroblob.wizardry.util.GeometryUtils;
|
||||||
|
import electroblob.wizardry.util.ParticleBuilder;
|
||||||
|
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||||
|
import electroblob.wizardry.util.SpellModifiers;
|
||||||
|
import net.minecraft.entity.EntityLiving;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.projectile.EntityEvokerFangs;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumFacing.Axis;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public class Fangs extends Spell {
|
||||||
|
|
||||||
|
private static final double FANG_SPACING = 1.25;
|
||||||
|
|
||||||
|
public Fangs(){
|
||||||
|
super("fangs", SpellActions.SUMMON, false);
|
||||||
|
addProperties(RANGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){
|
||||||
|
if(!spawnFangs(world, new Vec3d(caster.posX, caster.getEntityBoundingBox().minY, caster.posZ),
|
||||||
|
GeometryUtils.replaceComponent(caster.getLookVec(), Axis.Y, 0), caster, modifiers)) return false;
|
||||||
|
this.playSound(world, caster, ticksInUse, -1, modifiers);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean cast(World world, EntityLiving caster, EnumHand hand, int ticksInUse, EntityLivingBase target, SpellModifiers modifiers){
|
||||||
|
if(!spawnFangs(world, caster.getPositionVector(), target.getPositionVector().subtract(caster.getPositionVector()), caster, modifiers)) return false;
|
||||||
|
this.playSound(world, caster, ticksInUse, -1, modifiers);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean cast(World world, double x, double y, double z, EnumFacing direction, int ticksInUse, int duration, SpellModifiers modifiers){
|
||||||
|
if(!spawnFangs(world, new Vec3d(x, y, z), new Vec3d(direction.getDirectionVec()), null, modifiers)) return false;
|
||||||
|
this.playSound(world, x, y, z, ticksInUse, -1, modifiers);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean spawnFangs(World world, Vec3d origin, Vec3d direction, @Nullable EntityLivingBase caster, SpellModifiers modifiers){
|
||||||
|
|
||||||
|
boolean flag = false;
|
||||||
|
|
||||||
|
if(world.isRemote){
|
||||||
|
|
||||||
|
double x = origin.x;
|
||||||
|
double y = caster == null ? origin.y : origin.y + caster.getEyeHeight();
|
||||||
|
double z = origin.z;
|
||||||
|
|
||||||
|
for(int i = 0; i < 12; i++){
|
||||||
|
ParticleBuilder.create(Type.DARK_MAGIC, world.rand, x, y, z, 0.5, false)
|
||||||
|
.clr(0.4f, 0.3f, 0.35f).spawn(world); // Colour from EntitySpellcasterIllager
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
int count = (int)(getProperty(RANGE).doubleValue() * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
float yaw = (float)MathHelper.atan2(direction.z, direction.x); // Yes, this is the right way round!
|
||||||
|
|
||||||
|
for(int i = 0; i < count; i++){
|
||||||
|
|
||||||
|
Vec3d vec = origin.add(direction.scale(i * FANG_SPACING));
|
||||||
|
// Not exactly the same as evokers but it's how constructs work so it kinda fits
|
||||||
|
Integer y = BlockUtils.getNearestFloor(world, new BlockPos(vec), 5);
|
||||||
|
|
||||||
|
if(y != null){
|
||||||
|
world.spawnEntity(new EntityEvokerFangs(world, vec.x, y, vec.z, yaw, i, caster)); // null is fine here
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Events to handle damage modifiers, ADS, etc. for fang entities (probably could do with this for other vanilla-entity spells)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -779,6 +779,7 @@ spell.ebwizardry\:earthquake=Earthquake
|
|||||||
spell.ebwizardry\:empowering_presence=Empowering Presence
|
spell.ebwizardry\:empowering_presence=Empowering Presence
|
||||||
spell.ebwizardry\:entrapment=Entrapment
|
spell.ebwizardry\:entrapment=Entrapment
|
||||||
spell.ebwizardry\:evade=Evade
|
spell.ebwizardry\:evade=Evade
|
||||||
|
spell.ebwizardry\:fangs=Fangs
|
||||||
spell.ebwizardry\:fireball=Fireball
|
spell.ebwizardry\:fireball=Fireball
|
||||||
spell.ebwizardry\:firebolt=Firebolt
|
spell.ebwizardry\:firebolt=Firebolt
|
||||||
spell.ebwizardry\:firebomb=Firebomb
|
spell.ebwizardry\:firebomb=Firebomb
|
||||||
@@ -958,6 +959,7 @@ spell.ebwizardry\:earthquake.desc=A true master of earth magic can move mountain
|
|||||||
spell.ebwizardry\:empowering_presence.desc=Grants the caster and nearby allies increased magic damage for 30 seconds.
|
spell.ebwizardry\:empowering_presence.desc=Grants the caster and nearby allies increased magic damage for 30 seconds.
|
||||||
spell.ebwizardry\:entrapment.desc=Traps the target in a sphere of darkness which pulls it helplessly upwards and continually damages it.
|
spell.ebwizardry\:entrapment.desc=Traps the target in a sphere of darkness which pulls it helplessly upwards and continually damages it.
|
||||||
spell.ebwizardry\:evade.desc=Causes the caster to quickly jump sideways to dodge incoming attacks.
|
spell.ebwizardry\:evade.desc=Causes the caster to quickly jump sideways to dodge incoming attacks.
|
||||||
|
spell.ebwizardry\:fangs.desc=Summons a row of evoker fangs in front of the caster that rise from the ground, biting mobs in their path.
|
||||||
spell.ebwizardry\:fireball.desc=Launches a fireball in the direction you are pointing.
|
spell.ebwizardry\:fireball.desc=Launches a fireball in the direction you are pointing.
|
||||||
spell.ebwizardry\:firebolt.desc=Shoots a jet of fire a short distance in front of you.
|
spell.ebwizardry\:firebolt.desc=Shoots a jet of fire a short distance in front of you.
|
||||||
spell.ebwizardry\:firebomb.desc=Lanches a firebomb in the direction you are pointing which explodes on impact, setting targets on fire.
|
spell.ebwizardry\:firebomb.desc=Lanches a firebomb in the direction you are pointing which explodes on impact, setting targets on fire.
|
||||||
|
|||||||
@@ -779,6 +779,7 @@ spell.ebwizardry\:earthquake=Earthquake
|
|||||||
spell.ebwizardry\:empowering_presence=Empowering Presence
|
spell.ebwizardry\:empowering_presence=Empowering Presence
|
||||||
spell.ebwizardry\:entrapment=Entrapment
|
spell.ebwizardry\:entrapment=Entrapment
|
||||||
spell.ebwizardry\:evade=Evade
|
spell.ebwizardry\:evade=Evade
|
||||||
|
spell.ebwizardry\:fangs=Fangs
|
||||||
spell.ebwizardry\:fireball=Fireball
|
spell.ebwizardry\:fireball=Fireball
|
||||||
spell.ebwizardry\:firebolt=Firebolt
|
spell.ebwizardry\:firebolt=Firebolt
|
||||||
spell.ebwizardry\:firebomb=Firebomb
|
spell.ebwizardry\:firebomb=Firebomb
|
||||||
@@ -958,6 +959,7 @@ spell.ebwizardry\:earthquake.desc=A true master of earth magic can move mountain
|
|||||||
spell.ebwizardry\:empowering_presence.desc=Grants the caster and nearby allies increased magic damage for 30 seconds.
|
spell.ebwizardry\:empowering_presence.desc=Grants the caster and nearby allies increased magic damage for 30 seconds.
|
||||||
spell.ebwizardry\:entrapment.desc=Traps the target in a sphere of darkness which pulls it helplessly upwards and continually damages it.
|
spell.ebwizardry\:entrapment.desc=Traps the target in a sphere of darkness which pulls it helplessly upwards and continually damages it.
|
||||||
spell.ebwizardry\:evade.desc=Causes the caster to quickly jump sideways to dodge incoming attacks.
|
spell.ebwizardry\:evade.desc=Causes the caster to quickly jump sideways to dodge incoming attacks.
|
||||||
|
spell.ebwizardry\:fangs.desc=Summons a row of evoker fangs in front of the caster that rise from the ground, biting mobs in their path.
|
||||||
spell.ebwizardry\:fireball.desc=Launches a fireball in the direction you are pointing.
|
spell.ebwizardry\:fireball.desc=Launches a fireball in the direction you are pointing.
|
||||||
spell.ebwizardry\:firebolt.desc=Shoots a jet of fire a short distance in front of you.
|
spell.ebwizardry\:firebolt.desc=Shoots a jet of fire a short distance in front of you.
|
||||||
spell.ebwizardry\:firebomb.desc=Lanches a firebomb in the direction you are pointing which explodes on impact, setting targets on fire.
|
spell.ebwizardry\:firebomb.desc=Lanches a firebomb in the direction you are pointing which explodes on impact, setting targets on fire.
|
||||||
|
|||||||
@@ -162,6 +162,7 @@
|
|||||||
"spell.empowering_presence": {"category": "spells", "sounds": ["ebwizardry:buff"]},
|
"spell.empowering_presence": {"category": "spells", "sounds": ["ebwizardry:buff"]},
|
||||||
"spell.entrapment": {"category": "spells", "sounds": ["mob/evocation_illager/prepare_attack1", "mob/evocation_illager/prepare_attack2"]},
|
"spell.entrapment": {"category": "spells", "sounds": ["mob/evocation_illager/prepare_attack1", "mob/evocation_illager/prepare_attack2"]},
|
||||||
"spell.evade": {"category": "spells", "sounds": ["random/bow"]},
|
"spell.evade": {"category": "spells", "sounds": ["random/bow"]},
|
||||||
|
"spell.fangs": {"category": "spells", "sounds": ["mob/evocation_illager/prepare_attack1", "mob/evocation_illager/prepare_attack2"]},
|
||||||
"spell.fireball": {"category": "spells", "sounds": ["mob/ghast/fireball4"]},
|
"spell.fireball": {"category": "spells", "sounds": ["mob/ghast/fireball4"]},
|
||||||
"spell.firebolt": {"category": "spells", "sounds": ["mob/ghast/fireball4"]},
|
"spell.firebolt": {"category": "spells", "sounds": ["mob/ghast/fireball4"]},
|
||||||
"spell.firebomb": {"category": "spells", "sounds": ["random/bow"]},
|
"spell.firebomb": {"category": "spells", "sounds": ["random/bow"]},
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"enabled": {
|
||||||
|
"book": true,
|
||||||
|
"scroll": true,
|
||||||
|
"wands": true,
|
||||||
|
"npcs": true,
|
||||||
|
"dispensers": true,
|
||||||
|
"commands": true,
|
||||||
|
"treasure": true,
|
||||||
|
"trades": true,
|
||||||
|
"looting": true
|
||||||
|
},
|
||||||
|
"tier": "advanced",
|
||||||
|
"element": "earth",
|
||||||
|
"type": "attack",
|
||||||
|
"cost": 40,
|
||||||
|
"chargeup": 5,
|
||||||
|
"cooldown": 60,
|
||||||
|
"base_properties": {
|
||||||
|
"range": 10
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
Reference in New Issue
Block a user