From ccd855da84ca32c32abf3b6693bb7a34d278263f Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 28 Aug 2016 09:05:31 +0100 Subject: [PATCH] Name the ultimates --- .../quiver/ultimates/UltimateBarrage.java | 2 +- .../quiver/ultimates/UltimateBeserker.java | 2 +- .../quiver/ultimates/UltimateHeadHunter.java | 82 ----- .../quiver/ultimates/UltimateNecromancer.java | 2 +- .../games/quiver/ultimates/UltimateNinja.java | 2 +- .../quiver/ultimates/UltimatePyromancer.java | 2 +- .../quiver/ultimates/UltimateSkyWarrior.java | 297 ++++++++++++++++++ 7 files changed, 302 insertions(+), 87 deletions(-) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateHeadHunter.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateSkyWarrior.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateBarrage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateBarrage.java index 9fc523840..6fa5f5e22 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateBarrage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateBarrage.java @@ -17,7 +17,7 @@ public class UltimateBarrage extends Ultimate public UltimateBarrage(int arrows) { - super("Barrage Ultimate", new String[] {}); + super("Arrow Barrage", new String[] {}); _arrows = arrows; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateBeserker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateBeserker.java index 4c96c94f9..3bf418769 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateBeserker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateBeserker.java @@ -22,7 +22,7 @@ public class UltimateBeserker extends Ultimate public UltimateBeserker(long length) { - super("Beserker Ultimate", new String[] {}); + super("Berserker Shield", new String[] {}); _length = length; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateHeadHunter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateHeadHunter.java deleted file mode 100644 index 4325bb3d7..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateHeadHunter.java +++ /dev/null @@ -1,82 +0,0 @@ -package nautilus.game.arcade.game.games.quiver.ultimates; - -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; - -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import nautilus.game.arcade.game.Game; - -public class UltimateHeadHunter extends Ultimate -{ - - private static boolean IS_ACTIVE = false; - private static final double CHARGE_PER_SECOND = 0.4; - - private long _length; - - public UltimateHeadHunter(long length) - { - super("Head Hunter Ultimate", new String[] {}); - - _length = length; - } - - @Override - public void activate(Player player) - { - if (IS_ACTIVE) - { - player.sendMessage(F.main("Game", "Someone else is currently using " + GetName())); - return; - } - - IS_ACTIVE = true; - super.activate(player); - - UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getEyeLocation(), 0, 0, 0, 0.1F, 40, ViewDist.NORMAL); - - Game game = Manager.GetGame(); - - for (Player other : game.GetPlayers(true)) - { - if (!game.GetTeam(player).equals(game.GetTeam(other))) - { - other.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, (int) ((_length / 1000) * 20), 0)); - } - } - } - - @Override - public void cancel(Player player) - { - IS_ACTIVE = false; - super.cancel(player); - - Game game = Manager.GetGame(); - - for (Player other : game.GetPlayers(true)) - { - if (!game.GetTeam(player).equals(game.GetTeam(other))) - { - other.removePotionEffect(PotionEffectType.GLOWING); - } - } - } - - @Override - public double getChargeIncreasePerSecond() - { - return CHARGE_PER_SECOND; - } - - @Override - public long getLength() - { - return _length; - } - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateNecromancer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateNecromancer.java index 774f4070e..20edce0a4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateNecromancer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateNecromancer.java @@ -37,7 +37,7 @@ public class UltimateNecromancer extends Ultimate public UltimateNecromancer(long length, int skeletons) { - super("Necromancer Ultimate", new String[] {}); + super("Undead Minions", new String[] {}); _length = length; _skeletons = skeletons; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateNinja.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateNinja.java index c638715f9..3563e0505 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateNinja.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateNinja.java @@ -23,7 +23,7 @@ public class UltimateNinja extends Ultimate public UltimateNinja(long length) { - super("Ultimate Ninja", new String[] {}); + super("Blood Forge", new String[] {}); _length = length; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimatePyromancer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimatePyromancer.java index 9c40a37f0..c4494c875 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimatePyromancer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimatePyromancer.java @@ -25,7 +25,7 @@ public class UltimatePyromancer extends Ultimate public UltimatePyromancer() { - super("Pyromancer Ultimate", new String[] {}); + super("Flare Blitz", new String[] {}); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateSkyWarrior.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateSkyWarrior.java new file mode 100644 index 000000000..7cdc87d35 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/ultimates/UltimateSkyWarrior.java @@ -0,0 +1,297 @@ +package nautilus.game.arcade.game.games.quiver.ultimates; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.quiver.Quiver; + +public class UltimateSkyWarrior extends Ultimate +{ + + private static final double CHARGE_PER_SECOND = 0.4; + private static final long LAUNCHER_FIRE_DELAY = 1000; + + private double _damageTeleport; + private double _radiusTeleport; + private double _damageLauncher; + private double _radiusLauncher; + private int _rangeLauncher; + + private List _data = new ArrayList<>(); + + public UltimateSkyWarrior(double damageTeleport, double radiusTeleport, double damageLauncher, double radiusLauncher, int rangeLauncher) + { + super("Astral Arrows", new String[] {}); + + _damageTeleport = damageTeleport; + _radiusTeleport = radiusTeleport; + _damageLauncher = damageLauncher; + _radiusLauncher = radiusLauncher; + _rangeLauncher = rangeLauncher; + } + + @Override + public void activate(Player player) + { + super.activate(player); + + Location playerLocation = player.getLocation(); + // This is to stop the players getting killed by the border if they were + // teleported above it. + Location toTeleport = new Location(player.getWorld(), playerLocation.getX(), Math.min(Manager.GetGame().WorldData.MaxY - 3, playerLocation.getY() + 10), playerLocation.getZ()); + + toTeleport.setYaw(playerLocation.getYaw()); + toTeleport.setPitch(playerLocation.getPitch()); + + Block block = toTeleport.getBlock().getRelative(BlockFace.DOWN); + + block.setType(Material.BARRIER); + player.setWalkSpeed(0); + player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, -10)); + player.teleport(toTeleport); + + _data.add(new SkyWarriorData(player, block, 3)); + + player.getInventory().clear(); + + ItemStack itemStack = new ItemBuilder(Material.IRON_HOE).setTitle(C.cGreenB + GetName() + C.cDGreenB + " Click To Fire!").build(); + + for (int i = 0; i < 9; i++) + { + player.getInventory().addItem(itemStack); + } + + UtilFirework.playFirework(playerLocation, Type.BALL_LARGE, Color.WHITE, false, false); + UtilFirework.playFirework(toTeleport, Type.BALL_LARGE, Color.WHITE, false, false); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (SkyWarriorData data : _data) + { + UtilParticle.PlayParticleToAll(ParticleType.CLOUD, data.getPlayer().getLocation().subtract(0, 0.5, 0), 0.5F, 0.25F, 0.5F, 0.01F, 6, ViewDist.MAX); + } + } + + @EventHandler + public void onPlayerInteract(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + SkyWarriorData data = getData(player); + + if (data == null) + { + return; + } + + if (player.getItemInHand().getType() != Material.IRON_HOE) + { + return; + } + + if (!Recharge.Instance.use(player, "Sky Launcher", LAUNCHER_FIRE_DELAY, true, false)) + { + return; + } + + player.getWorld().playSound(player.getLocation(), Sound.FIREWORK_BLAST, 5, 1); + + // Particle Trail + Block lastParticle = player.getLocation().getBlock(); + + double curRange = 0; + while (curRange <= _rangeLauncher) + { + Location newTarget = player.getLocation().add(new Vector(0, 0.2, 0)).add(player.getLocation().getDirection().multiply(curRange)); + + if (!UtilBlock.airFoliage(newTarget.getBlock()) || !UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP))) + { + if (newTarget.getBlock().getType() != Material.BARRIER) + { + break; + } + } + + // Progress Forwards + curRange += 0.2; + + // Particles + if (!lastParticle.equals(newTarget.getBlock())) + { + UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, lastParticle.getLocation(), 0, 0, 0, 0.001F, 1, ViewDist.LONG); + } + + lastParticle = newTarget.getBlock(); + } + + // Modify Range + curRange -= 0.4; + if (curRange < 0) + curRange = 0; + + // Destination + Location location = player.getLocation().add(player.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0))); + + // Damage Players + for (Player other : UtilPlayer.getNearby(location, _radiusLauncher)) + { + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damageLauncher, true, true, false, player.getName(), GetName() + " Launcher"); + } + + UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 1F, 1, ViewDist.LONG); + + data.setShotsLeft(data.getShotsLeft() - 1); + + if (data.getShotsLeft() == 0) + { + cancel(player); + } + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + player.getInventory().clear(); + Kit.GiveItems(player); + player.getInventory().addItem(Quiver.SUPER_ARROW); + + player.setWalkSpeed(0.2F); + player.removePotionEffect(PotionEffectType.JUMP); + + SkyWarriorData data = getData(player); + Game game = Manager.GetGame(); + + data.getBlock().setType(Material.AIR); + + boolean found = false; + + for (Player other : game.GetPlayers(true)) + { + if (UtilPlayer.isSpectator(other) || player.equals(other)) + { + continue; + } + + if (game.GetTeam(player).equals(game.GetTeam(other))) + { + UtilParticle.PlayParticleToAll(ParticleType.FLAME, player.getEyeLocation(), 0.5F, 0.5F, 0.5F, 1F, 20, ViewDist.LONG); + UtilParticle.PlayParticleToAll(ParticleType.FLAME, other.getEyeLocation(), 0.5F, 0.5F, 0.5F, 1F, 20, ViewDist.LONG); + player.sendMessage(F.main("Game", "You were teleported to " + other.getName())); + player.teleport(other); + + for (Player toDamage : UtilPlayer.getNearby(other.getEyeLocation(), _radiusTeleport)) + { + Manager.GetDamage().NewDamageEvent(toDamage, player, null, DamageCause.CUSTOM, _damageTeleport, false, true, false, player.getName(), GetName() + " Teleportation"); + } + + found = true; + break; + } + } + + if (!found) + { + player.sendMessage(F.main("Game", "A player could not be found!")); + } + + _data.remove(data); + } + + @Override + public double getChargeIncreasePerSecond() + { + return CHARGE_PER_SECOND; + } + + @Override + public long getLength() + { + return 0; + } + + private SkyWarriorData getData(Player player) + { + for (SkyWarriorData data : _data) + { + if (data.getPlayer().equals(player)) + { + return data; + } + } + + return null; + } + + private final class SkyWarriorData + { + + private Player _player; + private Block _block; + private int _shotsLeft; + + public SkyWarriorData(Player player, Block block, int shots) + { + _player = player; + _block = block; + _shotsLeft = shots; + } + + public void setShotsLeft(int slotsLeft) + { + _shotsLeft = slotsLeft; + } + + public Player getPlayer() + { + return _player; + } + + public Block getBlock() + { + return _block; + } + + public int getShotsLeft() + { + return _shotsLeft; + } + + } +}