From c2e99e2ce6950bcce358c30d8925f3900259091d Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Mon, 29 Jun 2020 23:52:05 +0100 Subject: [PATCH] Add fangs spell --- .../electroblob/wizardry/registry/Spells.java | 2 + .../electroblob/wizardry/spell/Fangs.java | 93 ++++++++++++++++++ .../assets/ebwizardry/lang/en_gb.lang | 2 + .../assets/ebwizardry/lang/en_us.lang | 2 + .../resources/assets/ebwizardry/sounds.json | 1 + .../assets/ebwizardry/spells/fangs.json | 22 +++++ .../ebwizardry/textures/spells/fangs.png | Bin 0 -> 4611 bytes 7 files changed, 122 insertions(+) create mode 100644 src/main/java/electroblob/wizardry/spell/Fangs.java create mode 100644 src/main/resources/assets/ebwizardry/spells/fangs.json create mode 100644 src/main/resources/assets/ebwizardry/textures/spells/fangs.png diff --git a/src/main/java/electroblob/wizardry/registry/Spells.java b/src/main/java/electroblob/wizardry/registry/Spells.java index 159c9bbe..dee3c0db 100644 --- a/src/main/java/electroblob/wizardry/registry/Spells.java +++ b/src/main/java/electroblob/wizardry/registry/Spells.java @@ -243,6 +243,7 @@ public final class Spells { public static final Spell blinding_flash = placeholder(); public static final Spell stormcloud = placeholder(); + public static final Spell fangs = placeholder(); public static final Spell radiant_totem = placeholder(); public static final Spell firestorm = placeholder(); @@ -452,6 +453,7 @@ public final class Spells { registry.register(new BlindingFlash()); registry.register(new Stormcloud()); + registry.register(new Fangs()); registry.register(new RadiantTotem()); registry.register(new Firestorm()); diff --git a/src/main/java/electroblob/wizardry/spell/Fangs.java b/src/main/java/electroblob/wizardry/spell/Fangs.java new file mode 100644 index 00000000..4654a8d4 --- /dev/null +++ b/src/main/java/electroblob/wizardry/spell/Fangs.java @@ -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) + +} diff --git a/src/main/resources/assets/ebwizardry/lang/en_gb.lang b/src/main/resources/assets/ebwizardry/lang/en_gb.lang index e5edab31..77db6bcc 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_gb.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_gb.lang @@ -779,6 +779,7 @@ spell.ebwizardry\:earthquake=Earthquake spell.ebwizardry\:empowering_presence=Empowering Presence spell.ebwizardry\:entrapment=Entrapment spell.ebwizardry\:evade=Evade +spell.ebwizardry\:fangs=Fangs spell.ebwizardry\:fireball=Fireball spell.ebwizardry\:firebolt=Firebolt 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\: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\: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\: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. diff --git a/src/main/resources/assets/ebwizardry/lang/en_us.lang b/src/main/resources/assets/ebwizardry/lang/en_us.lang index 94ca5c1e..16efae40 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_us.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_us.lang @@ -779,6 +779,7 @@ spell.ebwizardry\:earthquake=Earthquake spell.ebwizardry\:empowering_presence=Empowering Presence spell.ebwizardry\:entrapment=Entrapment spell.ebwizardry\:evade=Evade +spell.ebwizardry\:fangs=Fangs spell.ebwizardry\:fireball=Fireball spell.ebwizardry\:firebolt=Firebolt 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\: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\: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\: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. diff --git a/src/main/resources/assets/ebwizardry/sounds.json b/src/main/resources/assets/ebwizardry/sounds.json index 345d1770..aa29195e 100644 --- a/src/main/resources/assets/ebwizardry/sounds.json +++ b/src/main/resources/assets/ebwizardry/sounds.json @@ -162,6 +162,7 @@ "spell.empowering_presence": {"category": "spells", "sounds": ["ebwizardry:buff"]}, "spell.entrapment": {"category": "spells", "sounds": ["mob/evocation_illager/prepare_attack1", "mob/evocation_illager/prepare_attack2"]}, "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.firebolt": {"category": "spells", "sounds": ["mob/ghast/fireball4"]}, "spell.firebomb": {"category": "spells", "sounds": ["random/bow"]}, diff --git a/src/main/resources/assets/ebwizardry/spells/fangs.json b/src/main/resources/assets/ebwizardry/spells/fangs.json new file mode 100644 index 00000000..928db480 --- /dev/null +++ b/src/main/resources/assets/ebwizardry/spells/fangs.json @@ -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 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/ebwizardry/textures/spells/fangs.png b/src/main/resources/assets/ebwizardry/textures/spells/fangs.png new file mode 100644 index 0000000000000000000000000000000000000000..80bdea4ae3a83498fbf3c782f19b423bd2bd89a9 GIT binary patch literal 4611 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANM^$ErdiN`ey06$*;-(=u~X z6-p`#QWa7wGSe6sDsHWvkvU1*oUi5oXOUu-bqtj<>jaCNE&tUlSar2~{@abVYhO${ zl2mxoN5x_1-}&|O-}V1Z(!cj~QRu9W=la|4Bt3Wjx_JLBT-pAMEef%4}yZU~I ziR!(}uUEfWUcY>AjopHunez8<&pnqu=NHeHJ3k~0Zk{o_eR;hd^U@z#{O8NB&wF0= zZ`0i8_Aj&5<>%Jdo#&ERePPC;ZtK=3JG;(Kiu*se{-IRxX1_hZ_9p9oy?$fo_v7*p z_S*kFaPIqZ+uHU+m6cW}_-yq#*P-WU?&qy}v-|(A@2tCv!)(*{mtEi7 zFl9%2uzd8+`7bOQj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