Payload (OITQ)

This commit is contained in:
Sam 2016-08-29 23:08:04 +01:00
parent 9454e1f409
commit 7a3ce9813c
10 changed files with 296 additions and 141 deletions

View File

@ -0,0 +1,111 @@
package mineplex.core.common.util.particles.effects;
import java.util.Set;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
/**
* Creates a line of particles with customise able traits.
*
* Most noticeable with Blink skills.
*/
public class LineParticle
{
private Location _start;
private Vector _direction;
private Location _lastLocation;
private double _curRange;
private double _incrementedRange;
private double _maxRange;
private double _actualRange;
private Set<Material> _ignoredTypes;
private ParticleType _particleType;
private Player[] _toDisplay;
public LineParticle(Location start, Vector direction, double incrementedRange, double maxRange, Set<Material> ignoredTypes, ParticleType particleType, Player... toDisplay)
{
this(start, null, direction, incrementedRange, maxRange, ignoredTypes, particleType, toDisplay);
}
public LineParticle(Location start, Location end, Vector direction, double incrementedRange, double maxRange, Set<Material> ignoredTypes, ParticleType particleType, Player... toDisplay)
{
_start = start;
_direction = direction;
_lastLocation = start;
_curRange = 0;
_incrementedRange = incrementedRange;
_maxRange = maxRange;
_ignoredTypes = ignoredTypes;
_particleType = particleType;
_toDisplay = toDisplay;
if (_direction == null)
{
direction = UtilAlg.getTrajectory(start, end).normalize();
}
}
/**
* Advances the line.
*
* @return true when the line has reached its target or has collided with a
* block with a type contained in _ignoredTypes.
*/
public boolean update()
{
boolean done = _curRange > _maxRange;
Location newTarget = _start.clone().add(new Vector(0, 0.2, 0)).add(_direction.clone().multiply(_curRange));
_lastLocation = newTarget;
if (!UtilBlock.airFoliage(newTarget.getBlock()) || !UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP)))
{
if (_ignoredTypes == null)
{
done = true;
}
if (!_ignoredTypes.contains(newTarget.getBlock().getType()))
{
done = true;
}
}
_curRange += _incrementedRange;
UtilParticle.PlayParticle(_particleType, newTarget, 0, 0, 0, 0.001F, 1, ViewDist.LONG, _toDisplay);
if (done)
{
_actualRange = _curRange;
}
return done;
}
public Location getLastLocation()
{
return _lastLocation;
}
public Location getDestination()
{
return _start.add(_direction.multiply(Math.max(0, _actualRange - 0.4)).add(new Vector(0, 0.4, 0)));
}
}

View File

@ -1,20 +1,28 @@
package mineplex.core.common.util; package mineplex.core.common.util.particles.effects;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
/**
* Creates a particle curve that bends towards a location.
*
* Most noticeable in Gladiators and TOITQ.
*/
public class ObjectiveParticle public class ObjectiveParticle
{ {
private Location _current; private Location _current;
private Location _target; private Location _target;
private Vector _direction; private Vector _direction;
private float _turnMultipler; private float _turnMultipler;
private float _blocksToAdvance; private float _blocksToAdvance;
private float _particleOffset; private float _particleOffset;
@ -22,17 +30,18 @@ public class ObjectiveParticle
private float _soundVolume; private float _soundVolume;
private float _soundPitch; private float _soundPitch;
private double _stopAtDistance; private double _stopAtDistance;
private Sound _sound; private Sound _sound;
private ParticleType _particleType; private ParticleType _particleType;
private Player[] _toDisplay; private Player[] _toDisplay;
public ObjectiveParticle(Location start, Vector startVector, Location target, Player... toDisplay) public ObjectiveParticle(Location start, Vector startVector, Location target, Player... toDisplay)
{ {
this(start, startVector, target, 0.15F, 0.5F, 0.03F, 3, ParticleType.HAPPY_VILLAGER, 0.2F, 3F, Sound.FIZZ, 4, toDisplay); this(start, startVector, target, 0.15F, 0.5F, 0.03F, 3, ParticleType.HAPPY_VILLAGER, 0.2F, 3F, Sound.FIZZ, 4, toDisplay);
} }
public ObjectiveParticle(Location start, Vector startVector, Location target, float turnMutlipler, float blocksToAdvance, float particleOffset, int particleCount, ParticleType particleType, float soundVolume, float soundPitch, Sound sound, double stopAtDistance, Player... toDisplay) public ObjectiveParticle(Location start, Vector startVector, Location target, float turnMutlipler, float blocksToAdvance, float particleOffset, int particleCount, ParticleType particleType,
float soundVolume, float soundPitch, Sound sound, double stopAtDistance, Player... toDisplay)
{ {
_current = start; _current = start;
_target = target; _target = target;
@ -45,29 +54,38 @@ public class ObjectiveParticle
_soundPitch = soundPitch; _soundPitch = soundPitch;
_sound = sound; _sound = sound;
_stopAtDistance = stopAtDistance; _stopAtDistance = stopAtDistance;
_toDisplay = toDisplay; _toDisplay = toDisplay;
_direction = startVector; _direction = startVector;
if (_direction.getY() < 0) if (_direction.getY() < 0)
{ {
_direction.setY(0); _direction.setY(0);
} }
_direction.normalize(); _direction.normalize();
} }
/**
* Advances the curve.
*
* @return true when the curve is within _stopAtDistance blocks of the
* target.
*/
public boolean update() public boolean update()
{ {
_direction.add(UtilAlg.getTrajectory(_current, _target).multiply(_turnMultipler)); _direction.add(UtilAlg.getTrajectory(_current, _target).multiply(_turnMultipler));
_direction.normalize(); _direction.normalize();
_current.add(_direction.clone().multiply(_blocksToAdvance)); _current.add(_direction.clone().multiply(_blocksToAdvance));
UtilParticle.PlayParticle(_particleType, _current, _particleOffset, _particleOffset, _particleOffset, 0, _particleCount, ViewDist.LONG, _toDisplay); UtilParticle.PlayParticle(_particleType, _current, _particleOffset, _particleOffset, _particleOffset, 0, _particleCount, ViewDist.LONG, _toDisplay);
_current.getWorld().playSound(_current, _sound, _soundVolume, _soundPitch); for (Player player : _toDisplay)
{
player.playSound(_current, _sound, _soundVolume, _soundPitch);
}
return UtilMath.offset(_current, _target) < _stopAtDistance; return UtilMath.offset(_current, _target) < _stopAtDistance;
} }
} }

View File

@ -38,7 +38,6 @@ import org.bukkit.util.Vector;
import mineplex.core.common.MinecraftVersion; import mineplex.core.common.MinecraftVersion;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.ObjectiveParticle;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilItem;
@ -52,7 +51,7 @@ import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTextTop; import mineplex.core.common.util.UtilTextTop;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.hologram.Hologram; import mineplex.core.common.util.particles.effects.ObjectiveParticle;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.CombatComponent;
@ -99,7 +98,7 @@ public class QuiverPayload extends TeamGame
private static final long POWERUP_SPAWN_DELAY = 20000; private static final long POWERUP_SPAWN_DELAY = 20000;
private static final int RESPAWN_INITAL_SECONDS = 5; private static final int RESPAWN_INITAL_SECONDS = 2;
private static final int RESPAWN_ARROW_GIVE_DELAY = 20; private static final int RESPAWN_ARROW_GIVE_DELAY = 20;
private static final int END_EFFECT_DELAY = 100; private static final int END_EFFECT_DELAY = 100;
@ -109,6 +108,7 @@ public class QuiverPayload extends TeamGame
private static final long KILLSTREAK_TIME_PERIOD = 1500; private static final long KILLSTREAK_TIME_PERIOD = 1500;
private static final long TEAM_KILL_MINIMUM_DELAY = 20000; private static final long TEAM_KILL_MINIMUM_DELAY = 20000;
private static final int TEAM_KILL_MINIMUM_PLAYERS = 6;
private static final long OBJECTIVE_PARTICLES_TIME = 10000; private static final long OBJECTIVE_PARTICLES_TIME = 10000;
@ -121,7 +121,6 @@ public class QuiverPayload extends TeamGame
public static final String DATA_POINT_KIT_BLUE = "LIGHT_BLUE"; public static final String DATA_POINT_KIT_BLUE = "LIGHT_BLUE";
private Minecart _minecart; private Minecart _minecart;
private Hologram _hologram;
private GameTeam _teamDirection; private GameTeam _teamDirection;
private int _targetIndex; private int _targetIndex;
private boolean _hasMoved; private boolean _hasMoved;
@ -223,7 +222,7 @@ public class QuiverPayload extends TeamGame
for (GameTeam gameTeam : _teamScore.keySet()) for (GameTeam gameTeam : _teamScore.keySet())
{ {
int score = _teamScore.get(gameTeam); int score = Math.min(_teamScore.get(gameTeam), MAX_SCORE);
Scoreboard.write(gameTeam.GetColor() + C.Bold + "Team " + gameTeam.getDisplayName()); Scoreboard.write(gameTeam.GetColor() + C.Bold + "Team " + gameTeam.getDisplayName());
Scoreboard.write(score + " Point" + (score == 1 ? "" : "s") + " (" + (MAX_SCORE - score) + ")"); Scoreboard.write(score + " Point" + (score == 1 ? "" : "s") + " (" + (MAX_SCORE - score) + ")");
@ -269,12 +268,9 @@ public class QuiverPayload extends TeamGame
Location location = WorldData.GetDataLocs(DATA_POINT_PAYLOAD).get(0); Location location = WorldData.GetDataLocs(DATA_POINT_PAYLOAD).get(0);
_minecart = location.getWorld().spawn(location, Minecart.class); _minecart = location.getWorld().spawn(location, Minecart.class);
_hologram = new Hologram(Manager.getHologramManager(), location.add(0, 1, 0), "None");
_minecart.spigot().forceGlowing(true); _minecart.spigot().forceGlowing(true);
_minecart.setDisplayBlock(new MaterialData(Material.TNT)); _minecart.setDisplayBlock(new MaterialData(Material.TNT));
_hologram.setFollowEntity(_minecart);
_hologram.start();
_payloadTeam.addEntry(_minecart.getUniqueId().toString()); _payloadTeam.addEntry(_minecart.getUniqueId().toString());
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
@ -389,7 +385,7 @@ public class QuiverPayload extends TeamGame
return; return;
} }
if (event.getType() == UpdateType.MIN_01) if (event.getType() == UpdateType.MIN_02)
{ {
this.DeathSpectateSecs++; this.DeathSpectateSecs++;
} }
@ -553,32 +549,35 @@ public class QuiverPayload extends TeamGame
} }
if (event.getType() == UpdateType.FAST) if (event.getType() == UpdateType.FAST)
{ {
for (GameTeam gameTeam : GetTeamList()) if (GetPlayers(true).size() >= TEAM_KILL_MINIMUM_PLAYERS)
{ {
if (!UtilTime.elapsed(_lastTeamKill, TEAM_KILL_MINIMUM_DELAY)) for (GameTeam gameTeam : GetTeamList())
{ {
break; if (!UtilTime.elapsed(_lastTeamKill, TEAM_KILL_MINIMUM_DELAY))
}
boolean gameTeamKill = true;
for (Player player : gameTeam.GetPlayers(false))
{
if (!UtilPlayer.isSpectator(player))
{ {
gameTeamKill = false; break;
} }
}
if (gameTeamKill) boolean gameTeamKill = true;
{
String message = gameTeam.GetColor() + C.Bold + "TEAM KILL";
UtilTextMiddle.display(message, "", 10, 30, 10); for (Player player : gameTeam.GetPlayers(false))
UtilServer.broadcast(message); {
if (!UtilPlayer.isSpectator(player))
{
gameTeamKill = false;
}
}
_lastTeamKill = System.currentTimeMillis(); if (gameTeamKill)
{
String message = gameTeam.GetColor() + C.Bold + "TEAM KILL";
UtilTextMiddle.display(message, "", 10, 30, 10);
UtilServer.broadcast(message);
_lastTeamKill = System.currentTimeMillis();
}
} }
} }
@ -695,12 +694,10 @@ public class QuiverPayload extends TeamGame
if (gameTeamACount > 0 && gameTeamBCount > 0) if (gameTeamACount > 0 && gameTeamBCount > 0)
{ {
_payloadState = PayloadState.CONTESTED; _payloadState = PayloadState.CONTESTED;
_hologram.setText(C.cDPurpleB + "Contested");
} }
else else
{ {
_payloadState = PayloadState.NONE; _payloadState = PayloadState.NONE;
_hologram.setText("None");
} }
setMinecartTeam(_payloadState); setMinecartTeam(_payloadState);
@ -746,7 +743,6 @@ public class QuiverPayload extends TeamGame
_minecart.setVelocity(UtilAlg.getTrajectory(_minecart.getLocation(), _pathMarkers.get(_targetIndex)).normalize().multiply(PAYLOAD_VELOCITY)); _minecart.setVelocity(UtilAlg.getTrajectory(_minecart.getLocation(), _pathMarkers.get(_targetIndex)).normalize().multiply(PAYLOAD_VELOCITY));
_hasMoved = true; _hasMoved = true;
_hologram.setText(_teamDirection.GetFormattedName());
} }
if (event.getType() == UpdateType.FASTER && _payloadState.equals(PayloadState.RESTARTING)) if (event.getType() == UpdateType.FASTER && _payloadState.equals(PayloadState.RESTARTING))
@ -884,11 +880,13 @@ public class QuiverPayload extends TeamGame
_recentlyChanged = false; _recentlyChanged = false;
UtilAction.zeroVelocity(_minecart); UtilAction.zeroVelocity(_minecart);
String message = WinnerTeam.GetFormattedName() + " scored a point! Payload respawning..."; if (_teamScore.get(_teamDirection) < MAX_SCORE)
{
UtilTextMiddle.display("", message, 10, 20, 10); String message = WinnerTeam.GetFormattedName() + " scored a point! Payload respawning...";
UtilServer.broadcast(message);
UtilTextMiddle.display("", message, 10, 20, 10);
UtilServer.broadcast(message);
}
displayPointScoreEffect(); displayPointScoreEffect();
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
@ -1073,7 +1071,7 @@ public class QuiverPayload extends TeamGame
} }
Player player = event.getPlayer(); Player player = event.getPlayer();
Kit kit = GetKit(player); ProgressingKit kit = (ProgressingKit) GetKit(player);
if (!event.isSneaking()) if (!event.isSneaking())
{ {
@ -1090,23 +1088,26 @@ public class QuiverPayload extends TeamGame
return; return;
} }
for (Perk perk : kit.GetPerks()) for (Perk perk : kit.getPerks()[kit.getUpgradeLevel(player.getUniqueId())])
{ {
if (perk instanceof Ultimate) if (perk instanceof Ultimate)
{ {
Ultimate ultimate = (Ultimate) perk; Ultimate ultimate = (Ultimate) perk;
ultimate.activate(player); if (ultimate.isUsable(player))
resetUltimate(player, false); {
ultimate.activate(player);
resetUltimate(player, false);
}
} }
} }
} }
public void incrementUltimate(Player player, double percentage) public void incrementUltimate(Player player, double percentage)
{ {
Kit kit = GetKit(player); ProgressingKit kit = (ProgressingKit) GetKit(player);
for (Perk perk : kit.GetPerks()) for (Perk perk : kit.getPerks()[kit.getUpgradeLevel(player.getUniqueId())])
{ {
if (perk instanceof Ultimate) if (perk instanceof Ultimate)
{ {

View File

@ -38,32 +38,32 @@ public class KitNecromancer extends ProgressingKit
private static final Perk[][] PERKS = { private static final Perk[][] PERKS = {
{ {
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkLifestealArrows(4), new PerkLifestealArrows(8),
new UltimateNecromancer(10000, 3) new UltimateNecromancer(10000, 3)
}, },
{ {
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkLifestealArrows(4), new PerkLifestealArrows(8),
new UltimateNecromancer(10500, 3) new UltimateNecromancer(10500, 3)
}, },
{ {
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkLifestealArrows(4), new PerkLifestealArrows(8),
new UltimateNecromancer(11000, 3) new UltimateNecromancer(11000, 3)
}, },
{ {
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkLifestealArrows(4), new PerkLifestealArrows(8),
new UltimateNecromancer(11500, 3) new UltimateNecromancer(11500, 3)
}, },
{ {
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkLifestealArrows(4), new PerkLifestealArrows(8),
new UltimateNecromancer(12000, 3) new UltimateNecromancer(12000, 3)
}, },
{ {
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkLifestealArrows(4), new PerkLifestealArrows(8),
new UltimateNecromancer(12500, 3) new UltimateNecromancer(12500, 3)
} }
}; };

View File

@ -1,4 +1,4 @@
package nautilus.game.arcade.game.games.quiver.kits; package nautilus.game.arcade.game.games.quiver.kits;
import java.util.UUID; import java.util.UUID;
@ -52,33 +52,33 @@ public class KitSkyWarrior extends ProgressingKit
private static final Perk[][] PERKS = { private static final Perk[][] PERKS = {
{ {
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkSpeed(1), new PerkSpeed(0),
new UltimateSkyWarrior(2, 10, 10, 5, 30) new UltimateSkyWarrior(5, 10, 10, 5, 30)
}, },
{ {
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkSpeed(1), new PerkSpeed(0),
new UltimateSkyWarrior(2, 10, 10, 5, 30) new UltimateSkyWarrior(5, 10, 10, 5, 30)
}, },
{ {
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkSpeed(1), new PerkSpeed(0),
new UltimateSkyWarrior(2, 10, 10, 5, 30) new UltimateSkyWarrior(5, 10, 10, 5, 30)
}, },
{ {
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkSpeed(1), new PerkSpeed(0),
new UltimateSkyWarrior(2, 10, 10, 5, 30) new UltimateSkyWarrior(5, 10, 10, 5, 30)
}, },
{ {
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkSpeed(1), new PerkSpeed(0),
new UltimateSkyWarrior(2, 10, 10, 5, 30) new UltimateSkyWarrior(5, 10, 10, 5, 30)
}, },
{ {
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkSpeed(1), new PerkSpeed(0),
new UltimateSkyWarrior(2, 10, 10, 5, 30) new UltimateSkyWarrior(5, 10, 10, 5, 30)
} }
}; };

View File

@ -57,6 +57,11 @@ public abstract class Ultimate extends Perk
player.sendMessage(F.main("Game", "Deactivated " + F.skill(GetName()))); player.sendMessage(F.main("Game", "Deactivated " + F.skill(GetName())));
player.playSound(player.getLocation(), Sound.BLAZE_DEATH, 1, 0); player.playSound(player.getLocation(), Sound.BLAZE_DEATH, 1, 0);
} }
public boolean isUsable(Player player)
{
return true;
}
public abstract double getChargeIncreasePerSecond(); public abstract double getChargeIncreasePerSecond();

View File

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

View File

@ -17,13 +17,13 @@ public class UltimateNinja extends Ultimate
{ {
private static final double CHARGE_PER_SECOND = 0.4; private static final double CHARGE_PER_SECOND = 0.4;
private static final int SPEED_AMPLIFiER = 1; private static final int SPEED_AMPLIFIER = 1;
private long _length; private long _length;
public UltimateNinja(long length) public UltimateNinja(long length)
{ {
super("Blood Forge", new String[] {}); super("Ancient Blade", new String[] {});
_length = length; _length = length;
} }
@ -49,7 +49,7 @@ public class UltimateNinja extends Ultimate
super.activate(player); super.activate(player);
player.getInventory().setItem(0, new ItemStack(Material.DIAMOND_SWORD)); player.getInventory().setItem(0, new ItemStack(Material.DIAMOND_SWORD));
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, (int) ((_length / 1000) * 20), SPEED_AMPLIFiER)); player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, (int) ((_length / 1000) * 20), SPEED_AMPLIFIER));
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, player.getEyeLocation(), 0, 0, 0, 1F, 100, ViewDist.NORMAL); UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, player.getEyeLocation(), 0, 0, 0, 1F, 100, ViewDist.NORMAL);
} }

View File

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

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.Color;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -17,16 +16,20 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import com.google.common.collect.Sets;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilParticle; 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.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.particles.effects.LineParticle;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -38,7 +41,9 @@ public class UltimateSkyWarrior extends Ultimate
{ {
private static final double CHARGE_PER_SECOND = 0.4; private static final double CHARGE_PER_SECOND = 0.4;
private static final long LAUNCHER_FIRE_DELAY = 1000; private static final long LAUNCHER_FIRE_DELAY = 500;
private static final long LAUNCHER_MAX_TIME = 15000;
private static final int Y_INCREASE = 10;
private double _damageTeleport; private double _damageTeleport;
private double _radiusTeleport; private double _radiusTeleport;
@ -50,7 +55,7 @@ public class UltimateSkyWarrior extends Ultimate
public UltimateSkyWarrior(double damageTeleport, double radiusTeleport, double damageLauncher, double radiusLauncher, int rangeLauncher) public UltimateSkyWarrior(double damageTeleport, double radiusTeleport, double damageLauncher, double radiusLauncher, int rangeLauncher)
{ {
super("Astral Arrows", new String[] {}); super("Bombardment", new String[] {});
_damageTeleport = damageTeleport; _damageTeleport = damageTeleport;
_radiusTeleport = radiusTeleport; _radiusTeleport = radiusTeleport;
@ -67,7 +72,7 @@ public class UltimateSkyWarrior extends Ultimate
Location playerLocation = player.getLocation(); Location playerLocation = player.getLocation();
// This is to stop the players getting killed by the border if they were // This is to stop the players getting killed by the border if they were
// teleported above it. // teleported above it.
Location toTeleport = new Location(player.getWorld(), playerLocation.getX(), Math.min(Manager.GetGame().WorldData.MaxY - 3, playerLocation.getY() + 10), playerLocation.getZ()); Location toTeleport = new Location(player.getWorld(), playerLocation.getX(), Math.min(Manager.GetGame().WorldData.MaxY - 3, playerLocation.getY() + Y_INCREASE), playerLocation.getZ());
toTeleport.setYaw(playerLocation.getYaw()); toTeleport.setYaw(playerLocation.getYaw());
toTeleport.setPitch(playerLocation.getPitch()); toTeleport.setPitch(playerLocation.getPitch());
@ -79,7 +84,7 @@ public class UltimateSkyWarrior extends Ultimate
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, -10)); player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, -10));
player.teleport(toTeleport); player.teleport(toTeleport);
_data.add(new SkyWarriorData(player, block, 3)); _data.add(new SkyWarriorData(player, block, 3, UtilInv.getAmount(player, Material.ARROW), System.currentTimeMillis()));
player.getInventory().clear(); player.getInventory().clear();
@ -90,21 +95,31 @@ public class UltimateSkyWarrior extends Ultimate
player.getInventory().addItem(itemStack); player.getInventory().addItem(itemStack);
} }
UtilFirework.playFirework(playerLocation, Type.BALL_LARGE, Color.WHITE, false, false); Game game = Manager.GetGame();
UtilFirework.playFirework(toTeleport, Type.BALL_LARGE, Color.WHITE, false, false);
UtilFirework.playFirework(playerLocation, Type.BALL, game.GetTeam(player).GetColorBase(), false, false);
UtilFirework.playFirework(toTeleport, Type.BALL, game.GetTeam(player).GetColorBase(), false, false);
} }
@EventHandler @EventHandler
public void onUpdate(UpdateEvent event) public void onUpdate(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) 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);
}
} }
else if (event.getType() == UpdateType.FAST)
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); for (SkyWarriorData data : _data)
{
if (UtilTime.elapsed(data.getStartTimeStamp(), LAUNCHER_MAX_TIME))
{
cancel(data.getPlayer());
}
}
} }
} }
@ -124,53 +139,25 @@ public class UltimateSkyWarrior extends Ultimate
return; return;
} }
if (!Recharge.Instance.use(player, "Sky Launcher", LAUNCHER_FIRE_DELAY, true, false)) if (!Recharge.Instance.use(player, GetName(), LAUNCHER_FIRE_DELAY, true, false))
{ {
return; return;
} }
player.getWorld().playSound(player.getLocation(), Sound.FIREWORK_BLAST, 5, 1); player.getWorld().playSound(player.getLocation(), Sound.FIREWORK_BLAST, 5, 1);
// Particle Trail LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), 0.5, _rangeLauncher, Sets.newHashSet(Material.BARRIER), ParticleType.FIREWORKS_SPARK, UtilServer.getPlayers());
Block lastParticle = player.getLocation().getBlock();
while (!lineParticle.update())
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 Location location = lineParticle.getDestination();
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 // Damage Players
for (Player other : UtilPlayer.getNearby(location, _radiusLauncher)) for (Player other : UtilPlayer.getNearby(location, _radiusLauncher))
{ {
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damageLauncher, true, true, false, player.getName(), GetName() + " Launcher"); Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damageLauncher, true, true, false, player.getName(), GetName());
} }
UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 1F, 1, ViewDist.LONG); UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 1F, 1, ViewDist.LONG);
@ -190,7 +177,6 @@ public class UltimateSkyWarrior extends Ultimate
player.getInventory().clear(); player.getInventory().clear();
Kit.GiveItems(player); Kit.GiveItems(player);
player.getInventory().addItem(Quiver.SUPER_ARROW);
player.setWalkSpeed(0.2F); player.setWalkSpeed(0.2F);
player.removePotionEffect(PotionEffectType.JUMP); player.removePotionEffect(PotionEffectType.JUMP);
@ -200,6 +186,11 @@ public class UltimateSkyWarrior extends Ultimate
data.getBlock().setType(Material.AIR); data.getBlock().setType(Material.AIR);
for (int i = 0; i < data.getPreviousArrows(); i++)
{
player.getInventory().addItem(Quiver.SUPER_ARROW);
}
boolean found = false; boolean found = false;
for (Player other : game.GetPlayers(true)) for (Player other : game.GetPlayers(true))
@ -211,11 +202,11 @@ public class UltimateSkyWarrior extends Ultimate
if (game.GetTeam(player).equals(game.GetTeam(other))) if (game.GetTeam(player).equals(game.GetTeam(other)))
{ {
UtilParticle.PlayParticleToAll(ParticleType.FLAME, player.getEyeLocation(), 0.5F, 0.5F, 0.5F, 1F, 20, ViewDist.LONG); player.sendMessage(F.main("Game", "You were teleported to " + F.elem(other.getName()) + "."));
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); player.teleport(other);
other.getWorld().strikeLightningEffect(other.getLocation());
UtilFirework.playFirework(other.getLocation(), Type.STAR, game.GetTeam(player).GetColorBase(), false, false);
for (Player toDamage : UtilPlayer.getNearby(other.getEyeLocation(), _radiusTeleport)) for (Player toDamage : UtilPlayer.getNearby(other.getEyeLocation(), _radiusTeleport))
{ {
Manager.GetDamage().NewDamageEvent(toDamage, player, null, DamageCause.CUSTOM, _damageTeleport, false, true, false, player.getName(), GetName() + " Teleportation"); Manager.GetDamage().NewDamageEvent(toDamage, player, null, DamageCause.CUSTOM, _damageTeleport, false, true, false, player.getName(), GetName() + " Teleportation");
@ -233,6 +224,21 @@ public class UltimateSkyWarrior extends Ultimate
_data.remove(data); _data.remove(data);
} }
@Override
public boolean isUsable(Player player)
{
for (int i = 2; i <= Y_INCREASE; i++)
{
if (player.getLocation().add(0, i, 0).getBlock().getType() != Material.AIR)
{
player.sendMessage(F.main("Game", "You do not have enough room to use this!"));;
return false;
}
}
return true;
}
@Override @Override
public double getChargeIncreasePerSecond() public double getChargeIncreasePerSecond()
@ -265,12 +271,16 @@ public class UltimateSkyWarrior extends Ultimate
private Player _player; private Player _player;
private Block _block; private Block _block;
private int _shotsLeft; private int _shotsLeft;
private int _previousArrows;
private long _startTimeStamp;
public SkyWarriorData(Player player, Block block, int shots) public SkyWarriorData(Player player, Block block, int shots, int previousArrows, long startTimeStamp)
{ {
_player = player; _player = player;
_block = block; _block = block;
_shotsLeft = shots; _shotsLeft = shots;
_previousArrows = previousArrows;
_startTimeStamp = startTimeStamp;
} }
public void setShotsLeft(int slotsLeft) public void setShotsLeft(int slotsLeft)
@ -292,6 +302,16 @@ public class UltimateSkyWarrior extends Ultimate
{ {
return _shotsLeft; return _shotsLeft;
} }
public int getPreviousArrows()
{
return _previousArrows;
}
public long getStartTimeStamp()
{
return _startTimeStamp;
}
} }
} }