diff --git a/README.md b/README.md index 78aff3f..9940e66 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,9 @@ name) contains instructions for how to use it. |------|--------|-----| |💥 **Explosive Arrow** | Causes a small explosion on impact. | | |🔥 **Forest Fire Arrow** | Starts a medium sized fire on impact. | | +|🧟 **Horde Arrow** | Temporarily spawn several baby zombies. *NEW in v1.11.0!* | Example image not yet available | |⛓ **Jail Arrow** | Surrounds a hit enemy with iron bars. *NEW in v1.8.0!* | ![Jail Arrow Example](https://user-images.githubusercontent.com/47901316/126048412-2e14253c-e66d-4263-928d-c38c6a9b981c.png) | -|⚡ **Lightning Arrow** | Summons a bolt of lightning at the site of impact. | Example image not yet available | +|⚡ **Lightning Arrow** | Summons a bolt of lightning at the site of impact. *NEW in v1.10.0!* | Example image not yet available | |🕸 **Net Arrow** | Places cobwebs on impact to drastically slow down your enemies. | | |🎯 **Sniper Arrow** | Ignores gravity and flies extra fast to directly hit targets in your crosshairs. | Example image not yet available | |👥 **Swap Arrow** | Causes you and a hit enemy to trade locations on the map. | Example image not yet available | diff --git a/src/main/java/dev/jhale/powerprojectiles/powerarrow/HordeArrow.java b/src/main/java/dev/jhale/powerprojectiles/powerarrow/HordeArrow.java new file mode 100644 index 0000000..49a8bb3 --- /dev/null +++ b/src/main/java/dev/jhale/powerprojectiles/powerarrow/HordeArrow.java @@ -0,0 +1,87 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package dev.jhale.powerprojectiles.powerarrow; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Particle; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Zombie; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.inventory.Recipe; +import org.bukkit.inventory.ShapedRecipe; +import org.bukkit.scheduler.BukkitRunnable; + +import dev.jhale.powerprojectiles.PowerProjectilePlugin; +import dev.jhale.powerprojectiles.util.EventTools; + +public class HordeArrow extends PowerArrow { + + /** + * The number of baby zombies to spawn. + */ + private static final int HORDE_SIZE = 7; + + /** + * How many ticks to keep the horde. + */ + private static final int TIMEOUT_DELAY = HORDE_SIZE * 20; + + public HordeArrow() { + super(); + } + + public HordeArrow(int count) { + super(count); + } + + @Override + public String getName() { + return "horde_arrow"; + } + + @Override + public String[] getUsageInstructions() { + return new String[] { "Summons baby zombies", "around its victim." }; + } + + @Override + public Recipe getRecipe() { + ShapedRecipe recipe = new ShapedRecipe( + this.getRecipeKey(), + new HordeArrow()); + recipe.shape("FZF", "FSF", "FFF"); + recipe.setIngredient('Z', Material.ZOMBIE_HEAD); + recipe.setIngredient('S', Material.STICK); + recipe.setIngredient('F', Material.ROTTEN_FLESH); + return recipe; + } + + @Override + public Particle getTrailParticle() { + return Particle.SQUID_INK; + } + + @Override + protected void onThisProjectileHit(ProjectileHitEvent event) { + Location impactLocation = EventTools.getImpactLocation(event); + if (impactLocation != null) { + for (int i = 0; i < HORDE_SIZE; i++) { + Zombie zombie = (Zombie) event.getEntity().getWorld().spawnEntity(impactLocation, EntityType.ZOMBIE); + zombie.setBaby(); + new BukkitRunnable() { + @Override + public void run() { + zombie.remove(); + zombie.getWorld().spawnParticle(Particle.FLAME, zombie.getLocation(), 5); + } + }.runTaskLater(PowerProjectilePlugin.instance, TIMEOUT_DELAY); + } + } + } + +} diff --git a/src/main/java/dev/jhale/powerprojectiles/powerarrow/PowerArrowRegistry.java b/src/main/java/dev/jhale/powerprojectiles/powerarrow/PowerArrowRegistry.java index 5ccfd04..60f1d1f 100644 --- a/src/main/java/dev/jhale/powerprojectiles/powerarrow/PowerArrowRegistry.java +++ b/src/main/java/dev/jhale/powerprojectiles/powerarrow/PowerArrowRegistry.java @@ -13,6 +13,7 @@ public class PowerArrowRegistry { private static PowerArrow[] powerArrows = { new ExplosiveArrow(), new ForestFireArrow(), + new HordeArrow(), new JailArrow(), new LightningArrow(), new NetArrow(), diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 5dfe167..66d8cfb 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ --- # Denotes the start of this YAML document. https://yaml.org/spec/1.2/spec.html#id2760395 name: PowerProjectile main: dev.jhale.powerprojectiles.PowerProjectilePlugin -version: 1.10.0 +version: 1.11.0 api-version: 1.19 ... # Denotes the end of this YAML document. https://yaml.org/spec/1.2/spec.html#id2760395 \ No newline at end of file