Name the ultimates

This commit is contained in:
Sam 2016-08-28 09:05:31 +01:00
parent 54e8f8e5e8
commit ccd855da84
7 changed files with 302 additions and 87 deletions

View File

@ -17,7 +17,7 @@ public class UltimateBarrage extends Ultimate
public UltimateBarrage(int arrows) public UltimateBarrage(int arrows)
{ {
super("Barrage Ultimate", new String[] {}); super("Arrow Barrage", new String[] {});
_arrows = arrows; _arrows = arrows;
} }

View File

@ -22,7 +22,7 @@ public class UltimateBeserker extends Ultimate
public UltimateBeserker(long length) public UltimateBeserker(long length)
{ {
super("Beserker Ultimate", new String[] {}); super("Berserker Shield", new String[] {});
_length = length; _length = length;
} }

View File

@ -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;
}
}

View File

@ -37,7 +37,7 @@ public class UltimateNecromancer extends Ultimate
public UltimateNecromancer(long length, int skeletons) public UltimateNecromancer(long length, int skeletons)
{ {
super("Necromancer Ultimate", new String[] {}); super("Undead Minions", new String[] {});
_length = length; _length = length;
_skeletons = skeletons; _skeletons = skeletons;

View File

@ -23,7 +23,7 @@ public class UltimateNinja extends Ultimate
public UltimateNinja(long length) public UltimateNinja(long length)
{ {
super("Ultimate Ninja", new String[] {}); super("Blood Forge", new String[] {});
_length = length; _length = length;
} }

View File

@ -25,7 +25,7 @@ public class UltimatePyromancer extends Ultimate
public UltimatePyromancer() public UltimatePyromancer()
{ {
super("Pyromancer Ultimate", new String[] {}); super("Flare Blitz", new String[] {});
} }
@Override @Override

View File

@ -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<SkyWarriorData> _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;
}
}
}