OITQP no longer in Beta (#210)
* Convert OITQP into a module based system. * More magic modules * Achievements and Stats * Achievement menu update * Removed some Util methods I added that were never used. * Missed a few things * To Alex, Love Sam * Gem and achievement kits
This commit is contained in:
parent
c1c46aceb8
commit
ac967f6b18
|
@ -997,8 +997,39 @@ public enum Achievement
|
|||
new String[]{"Perfect a build in less than 10 seconds"},
|
||||
new int[]{1},
|
||||
AchievementCategory.SPEED_BUILDERS),
|
||||
|
||||
//Dkyfall
|
||||
|
||||
// OITQP
|
||||
QUIVER_PAYLOAD_BLOSSOM("Flowering Blossom", 2000,
|
||||
new String[]{"One in the Quiver Payload.Blossom"},
|
||||
new String[]{"Get 4 kills with a single Pyromancer ultimate."},
|
||||
new int[]{1},
|
||||
AchievementCategory.ONE_IN_THE_QUIVER_PAYLOAD),
|
||||
|
||||
QUIVER_PAYLOAD_STEADY_HANDS("Steady Hands", 2000,
|
||||
new String[]{"One in the Quiver Payload.SteadyHands"},
|
||||
new String[]{"Get 10 triple kills."},
|
||||
new int[]{10},
|
||||
AchievementCategory.ONE_IN_THE_QUIVER_PAYLOAD),
|
||||
|
||||
QUIVER_PAYLOAD_ASSASSIN("Way of the Assassin", 2000,
|
||||
new String[]{"One in the Quiver Payload.Assassin"},
|
||||
new String[]{"Get 5 kills with a single use of Ancient Blade."},
|
||||
new int[]{1},
|
||||
AchievementCategory.ONE_IN_THE_QUIVER_PAYLOAD),
|
||||
|
||||
QUIVER_PAYLOAD_UNSTOPPABLE("Unstoppable", 2000,
|
||||
new String[]{"One in the Quiver Payload.Unstoppable"},
|
||||
new String[]{"Get shot by 100 arrows while using the Berserker ultimate."},
|
||||
new int[]{100},
|
||||
AchievementCategory.ONE_IN_THE_QUIVER_PAYLOAD),
|
||||
|
||||
QUIVER_PAYLOAD_BOW("What bow?", 2000,
|
||||
new String[]{"One in the Quiver Payload.Bow"},
|
||||
new String[]{"Get 10 kills in a single game without firing an arrow."},
|
||||
new int[]{1},
|
||||
AchievementCategory.ONE_IN_THE_QUIVER_PAYLOAD),
|
||||
|
||||
// Skyfall
|
||||
SKYFALL_GAMES_WINS("Skyfaller", 600,
|
||||
new String[]{"Skyfall.Wins"},
|
||||
new String[]{"Win 30 games of Skyfall"},
|
||||
|
@ -1016,13 +1047,13 @@ public enum Achievement
|
|||
new String[]{"Kill 3 other players in the first minute"},
|
||||
new int[]{1},
|
||||
AchievementCategory.SKYFALL),
|
||||
|
||||
|
||||
SKYFALL_KILLS_IN_AIR("Aeronaught", 1200,
|
||||
new String[]{"Skyfall.Aeronaught"},
|
||||
new String[]{"Get 10 kills while flying"},
|
||||
new int[]{10},
|
||||
AchievementCategory.SKYFALL),
|
||||
|
||||
|
||||
SKYFALL_RINGS("I love Booster Rings <3", 1200,
|
||||
new String[]{"Skyfall.Rings"},
|
||||
new String[]{"Fly through 1000 Booster Rings"},
|
||||
|
|
|
@ -171,11 +171,14 @@ public enum AchievementCategory
|
|||
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED, null, new StatDisplay("Perfect Builds", "PerfectBuild")},
|
||||
Material.QUARTZ_BLOCK, 0, GameCategory.CLASSICS, null, false, GameDisplay.SpeedBuilders.getGameId()),
|
||||
|
||||
ONE_IN_THE_QUIVER_PAYLOAD("One in the Quiver Payload", null,
|
||||
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED},
|
||||
Material.EXPLOSIVE_MINECART, 0, GameCategory.CLASSICS, "Sky Warrior Kit", false, GameDisplay.QuiverPayload.getGameId()),
|
||||
|
||||
SKYFALL("Skyfall", null,
|
||||
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED, null, new StatDisplay("Booster Rings", "Rings")},
|
||||
Material.BOW, 0, GameCategory.SURVIVAL, null, false, GameDisplay.Skyfall.getGameId());
|
||||
|
||||
|
||||
|
||||
private String _name;
|
||||
private String[] _statsToPull;
|
||||
private StatDisplay[] _statDisplays;
|
||||
|
|
|
@ -32,7 +32,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
|||
|
||||
public AchievementMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, String targetName, PlayerStats targetStats)
|
||||
{
|
||||
this(plugin, statsManager, shop, clientManager, donationManager, name, player, 9 * 4, targetName, targetStats);
|
||||
this(plugin, statsManager, shop, clientManager, donationManager, name, player, 9 * 5, targetName, targetStats);
|
||||
}
|
||||
|
||||
public AchievementMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, int size, String targetName, PlayerStats targetStats)
|
||||
|
@ -53,6 +53,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
|||
"XXOXOXOXO",
|
||||
"OXOXOXOXO",
|
||||
"OXOXOXOXO",
|
||||
"OXOXOXOXO",
|
||||
"OXOXOXOXO").getItemSlots();
|
||||
int listSlot = 0;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ import nautilus.game.arcade.game.games.monstermaze.MonsterMaze;
|
|||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.paintball.Paintball;
|
||||
import nautilus.game.arcade.game.games.quiver.Quiver;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverPayload;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeams;
|
||||
import nautilus.game.arcade.game.games.quiver.modes.BunnyHop;
|
||||
import nautilus.game.arcade.game.games.rings.ElytraRings;
|
||||
|
@ -159,7 +159,7 @@ public enum GameType
|
|||
OldMineWare(OldMineWare.class, GameDisplay.OldMineWare),
|
||||
Paintball(Paintball.class, GameDisplay.Paintball),
|
||||
Quiver(Quiver.class, GameDisplay.Quiver),
|
||||
QuiverPayload(QuiverPayload.class, GameDisplay.QuiverPayload),
|
||||
QuiverPayload(QuiverTeamBase.class, GameDisplay.QuiverPayload),
|
||||
QuiverTeams(QuiverTeams.class, GameDisplay.QuiverTeams),
|
||||
Runner(Runner.class, GameDisplay.Runner),
|
||||
SearchAndDestroy(SearchAndDestroy.class, GameDisplay.SearchAndDestroy),
|
||||
|
|
|
@ -23,10 +23,8 @@ import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
|||
import nautilus.game.arcade.game.games.minestrike.items.guns.GunStats;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Shotgun;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
|
@ -324,4 +322,4 @@ public class ShopManager
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,208 @@
|
|||
package nautilus.game.arcade.game.games.quiver;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
|
||||
import mineplex.core.common.MinecraftVersion;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.quiver.kits.KitBarrage;
|
||||
import nautilus.game.arcade.game.games.quiver.kits.KitBeserker;
|
||||
import nautilus.game.arcade.game.games.quiver.kits.KitNecromancer;
|
||||
import nautilus.game.arcade.game.games.quiver.kits.KitNewNinja;
|
||||
import nautilus.game.arcade.game.games.quiver.kits.KitPyromancer;
|
||||
import nautilus.game.arcade.game.games.quiver.kits.KitSkyWarrior;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModuleKillstreak;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModuleKitNPCS;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModulePowerup;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModuleSpawnBarrier;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModuleSuperArrow;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModuleUltimate;
|
||||
import nautilus.game.arcade.game.games.quiver.module.QuiverTeamModule;
|
||||
import nautilus.game.arcade.game.games.quiver.module.game.QuiverPayload;
|
||||
import nautilus.game.arcade.game.modules.VersionModule;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.stats.WinWithoutBowStatTracker;
|
||||
|
||||
public class QuiverTeamBase extends TeamGame
|
||||
{
|
||||
|
||||
//private static final String CUSTOM_LOCATION_GAME_KOTH = "KOTH";
|
||||
|
||||
public static final String OVERTIME = C.cGold + "!!! " + C.cDRedB + "OVERTIME" + C.cGold + " !!!";
|
||||
|
||||
private Map<Class<? extends QuiverTeamModule>, QuiverTeamModule> _modules = new HashMap<>();
|
||||
|
||||
public QuiverTeamBase(ArcadeManager manager)
|
||||
{
|
||||
this(manager, new Kit[] {
|
||||
|
||||
new KitBeserker(manager), new KitNewNinja(manager), new KitBarrage(manager), new KitSkyWarrior(manager), new KitPyromancer(manager), new KitNecromancer(manager),
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public QuiverTeamBase(ArcadeManager manager, Kit[] kits)
|
||||
{
|
||||
super(manager, GameType.QuiverPayload, kits, new String[] {});
|
||||
|
||||
this.PlayersPerTeam = 5;
|
||||
this.DeathOut = false;
|
||||
this.DamageSelf = false;
|
||||
this.DamageTeamSelf = false;
|
||||
this.DamageFall = false;
|
||||
this.TeamArmor = true;
|
||||
this.TeamArmorHotbar = true;
|
||||
this.HungerSet = 20;
|
||||
|
||||
registerStatTrackers(new WinWithoutBowStatTracker(this, "Bow"));
|
||||
|
||||
registerChatStats(
|
||||
Kills,
|
||||
Deaths,
|
||||
KDRatio,
|
||||
BlankLine,
|
||||
Assists,
|
||||
DamageTaken,
|
||||
DamageDealt
|
||||
);
|
||||
|
||||
getQuiverTeamModule(ModuleSuperArrow.class);
|
||||
getQuiverTeamModule(ModuleKitNPCS.class);
|
||||
getQuiverTeamModule(ModulePowerup.class);
|
||||
getQuiverTeamModule(ModuleUltimate.class);
|
||||
getQuiverTeamModule(ModuleSpawnBarrier.class);
|
||||
getQuiverTeamModule(ModuleKillstreak.class);
|
||||
|
||||
registerModule(new VersionModule(MinecraftVersion.Version1_9, "One in the Quiver Payload requires Minecraft 1.9!"));
|
||||
|
||||
// if (WorldData.GetCustomLocs(CUSTOM_LOCATION_GAME_KOTH) != null)
|
||||
// {
|
||||
// getQuiverTeamModule(QuiverKOTH.class);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// There was no game identifier in the map. Use Payload as the default
|
||||
getQuiverTeamModule(QuiverPayload.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (QuiverTeamModule module : _modules.values())
|
||||
{
|
||||
module.updateScoreboard();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onGameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() == GameState.Prepare)
|
||||
{
|
||||
for (QuiverTeamModule module : _modules.values())
|
||||
{
|
||||
module.setup();
|
||||
}
|
||||
}
|
||||
else if (event.GetState() == GameState.End)
|
||||
{
|
||||
for (QuiverTeamModule module : _modules.values())
|
||||
{
|
||||
module.finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (QuiverTeamModule module : _modules.values())
|
||||
{
|
||||
module.update(event.getType());
|
||||
}
|
||||
}
|
||||
|
||||
public double getGems(GemAwardReason reason)
|
||||
{
|
||||
return 0.5;
|
||||
}
|
||||
|
||||
public <T extends QuiverTeamModule> T getQuiverTeamModule(Class<T> clazz)
|
||||
{
|
||||
if (!_modules.containsKey(clazz))
|
||||
{
|
||||
try
|
||||
{
|
||||
_modules.put(clazz, clazz.getConstructor(QuiverTeamBase.class).newInstance(this));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return clazz.cast(_modules.get(clazz));
|
||||
}
|
||||
|
||||
public static enum GemAwardReason
|
||||
{
|
||||
KILL, ASSIST, KILLSTEAK, WIN
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (!UtilServer.isTestServer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String cmd = event.getMessage();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (cmd.startsWith("/max"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
getQuiverTeamModule(ModuleUltimate.class).incrementUltimate(player, 100);
|
||||
}
|
||||
else if (cmd.startsWith("/win"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
WinnerTeam = GetTeam(event.getPlayer());
|
||||
AnnounceEnd(WinnerTeam);
|
||||
SetState(GameState.End);
|
||||
}
|
||||
else if (cmd.startsWith("/ks"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
ModuleKillstreak killstreak = getQuiverTeamModule(ModuleKillstreak.class);
|
||||
|
||||
killstreak.getKillstreakAmount().put(player.getUniqueId(), Integer.parseInt(cmd.split(" ")[1]));
|
||||
killstreak.getKillstreakTime().put(player.getUniqueId(), System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
package nautilus.game.arcade.game.games.quiver.data;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.quiver.Quiver;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverPayload;
|
||||
|
||||
public class PowerupGenerator
|
||||
{
|
||||
|
||||
private static final int ARROWS_TO_GIVE = 1;
|
||||
private static final int FIREWORK_VIEW_DISTANCE = 10;
|
||||
|
||||
private QuiverPayload _game;
|
||||
|
||||
private Location _location;
|
||||
private Item _item;
|
||||
private long _lastPickup;
|
||||
private long _respawnDelay;
|
||||
|
||||
public PowerupGenerator(QuiverPayload game, Location location, long respawnDelay)
|
||||
{
|
||||
_game = game;
|
||||
_location = location;
|
||||
_lastPickup = System.currentTimeMillis();
|
||||
_respawnDelay = respawnDelay;
|
||||
|
||||
_location.getBlock().getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK);
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
if (_item != null)
|
||||
{
|
||||
if (!_item.isValid())
|
||||
{
|
||||
_item.remove();
|
||||
_item = null;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (UtilTime.elapsed(_lastPickup, _respawnDelay))
|
||||
{
|
||||
_item = _location.getWorld().dropItem(_location, new ItemStack(Material.ARROW));
|
||||
|
||||
_item.setVelocity(new Vector(0, 1, 0));
|
||||
_item.getLocation().getBlock().getRelative(BlockFace.DOWN).setType(Material.GOLD_BLOCK);
|
||||
|
||||
playFirework();
|
||||
}
|
||||
}
|
||||
|
||||
public void pickup(Player player, Item item)
|
||||
{
|
||||
if (_item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_item.equals(item))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_game.IsAlive(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GameTeam gameTeam = _game.GetTeam(player);
|
||||
|
||||
if (gameTeam == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_item.remove();
|
||||
_item = null;
|
||||
|
||||
_lastPickup = System.currentTimeMillis();
|
||||
|
||||
_location.getBlock().getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK);
|
||||
|
||||
player.sendMessage(F.main("Game", "You collected the resupply powerup."));
|
||||
|
||||
playFirework();
|
||||
|
||||
ItemStack itemStack = Quiver.SUPER_ARROW.clone();
|
||||
|
||||
itemStack.setAmount(ARROWS_TO_GIVE);
|
||||
|
||||
player.getInventory().addItem(itemStack);
|
||||
}
|
||||
|
||||
private void playFirework()
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (UtilMath.offset(_location, player.getLocation()) < FIREWORK_VIEW_DISTANCE)
|
||||
{
|
||||
UtilFirework.packetPlayFirework(player, _location, Type.BALL_LARGE, Color.YELLOW, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
package nautilus.game.arcade.game.games.quiver.data;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
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 nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
|
||||
public class SpawnBarrier
|
||||
{
|
||||
|
||||
private Game _game;
|
||||
private GameTeam _gameTeam;
|
||||
private Set<Location> _barriers;
|
||||
|
||||
public SpawnBarrier(Game game, GameTeam gameTeam, Set<Location> barriers)
|
||||
{
|
||||
_game = game;
|
||||
_gameTeam = gameTeam;
|
||||
_barriers = barriers;
|
||||
|
||||
for (Location location : _barriers)
|
||||
{
|
||||
location.getBlock().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
for (Player player : _game.GetPlayers(true))
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_game.GetTeam(player).equals(_gameTeam))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (Location location : _gameTeam.GetSpawns())
|
||||
{
|
||||
if (UtilMath.offset(player.getLocation(), location) < 5)
|
||||
{
|
||||
_game.Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.VOID, 9001, false, true, true, _game.GetName(), "Spawn Shield");
|
||||
}
|
||||
}
|
||||
|
||||
for (Location location : _barriers)
|
||||
{
|
||||
if (UtilMath.offset(player.getLocation(), location) < 4)
|
||||
{
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory(location, player.getLocation()).normalize().setY(0.4));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void playParticles()
|
||||
{
|
||||
for (Player player : _game.GetPlayers(true))
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_game.GetTeam(player).equals(_gameTeam))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (Location location : _barriers)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.BARRIER, location.clone().add(0, 0.5, 0), 0, 0, 0, 0.1F, 1, ViewDist.SHORT, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GameTeam getGameTeam()
|
||||
{
|
||||
return _gameTeam;
|
||||
}
|
||||
|
||||
public Set<Location> getBlocks()
|
||||
{
|
||||
return _barriers;
|
||||
}
|
||||
}
|
|
@ -15,7 +15,8 @@ import mineplex.core.itemstack.ItemBuilder;
|
|||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.quiver.Quiver;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverPayload;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModuleUltimate;
|
||||
import nautilus.game.arcade.game.games.quiver.ultimates.UltimateBarrage;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
@ -131,9 +132,9 @@ public class KitBarrage extends ProgressingKit
|
|||
return;
|
||||
}
|
||||
|
||||
QuiverPayload quiverPayload = (QuiverPayload) Manager.GetGame();
|
||||
QuiverTeamBase game = (QuiverTeamBase) Manager.GetGame();
|
||||
|
||||
quiverPayload.resetUltimate(Bukkit.getPlayer(player), true);
|
||||
game.getQuiverTeamModule(ModuleUltimate.class).resetUltimate(Bukkit.getPlayer(player), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,7 +15,8 @@ import mineplex.core.itemstack.ItemBuilder;
|
|||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.quiver.Quiver;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverPayload;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModuleUltimate;
|
||||
import nautilus.game.arcade.game.games.quiver.ultimates.UltimateBeserker;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
@ -100,7 +101,7 @@ public class KitBeserker extends ProgressingKit
|
|||
|
||||
public KitBeserker(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Berserker", "quiverbeserker", KitAvailability.Free, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
super(manager, "Berserker", "quiverbeserker", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -126,9 +127,9 @@ public class KitBeserker extends ProgressingKit
|
|||
return;
|
||||
}
|
||||
|
||||
QuiverPayload quiverPayload = (QuiverPayload) Manager.GetGame();
|
||||
QuiverTeamBase game = (QuiverTeamBase) Manager.GetGame();
|
||||
|
||||
quiverPayload.resetUltimate(Bukkit.getPlayer(player), true);
|
||||
game.getQuiverTeamModule(ModuleUltimate.class).resetUltimate(Bukkit.getPlayer(player), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,7 +15,8 @@ import mineplex.core.itemstack.ItemBuilder;
|
|||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.quiver.Quiver;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverPayload;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModuleUltimate;
|
||||
import nautilus.game.arcade.game.games.quiver.ultimates.UltimateNecromancer;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
@ -99,7 +100,7 @@ public class KitNecromancer extends ProgressingKit
|
|||
|
||||
public KitNecromancer(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Necromancer", "quivernecromancer", KitAvailability.Free, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
super(manager, "Necromancer", "quivernecromancer", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
|
||||
}
|
||||
|
||||
|
@ -126,9 +127,9 @@ public class KitNecromancer extends ProgressingKit
|
|||
return;
|
||||
}
|
||||
|
||||
QuiverPayload quiverPayload = (QuiverPayload) Manager.GetGame();
|
||||
QuiverTeamBase game = (QuiverTeamBase) Manager.GetGame();
|
||||
|
||||
quiverPayload.resetUltimate(Bukkit.getPlayer(player), true);
|
||||
game.getQuiverTeamModule(ModuleUltimate.class).resetUltimate(Bukkit.getPlayer(player), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,7 +11,8 @@ import org.bukkit.inventory.ItemStack;
|
|||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverPayload;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModuleUltimate;
|
||||
import nautilus.game.arcade.game.games.quiver.ultimates.UltimateNinja;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
@ -98,7 +99,7 @@ public class KitNewNinja extends ProgressingKit
|
|||
|
||||
public KitNewNinja(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Ninja", "quivernewninja", KitAvailability.Free, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
super(manager, "Ninja", "quivernewninja", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -117,9 +118,9 @@ public class KitNewNinja extends ProgressingKit
|
|||
return;
|
||||
}
|
||||
|
||||
QuiverPayload quiverPayload = (QuiverPayload) Manager.GetGame();
|
||||
QuiverTeamBase game = (QuiverTeamBase) Manager.GetGame();
|
||||
|
||||
quiverPayload.resetUltimate(Bukkit.getPlayer(player), true);
|
||||
game.getQuiverTeamModule(ModuleUltimate.class).resetUltimate(Bukkit.getPlayer(player), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,7 +15,8 @@ import mineplex.core.itemstack.ItemBuilder;
|
|||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.quiver.Quiver;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverPayload;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModuleUltimate;
|
||||
import nautilus.game.arcade.game.games.quiver.ultimates.UltimatePyromancer;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
@ -102,7 +103,7 @@ public class KitPyromancer extends ProgressingKit
|
|||
|
||||
public KitPyromancer(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Pyromancer", "quiverpyromancer", KitAvailability.Free, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
super(manager, "Pyromancer", "quiverpyromancer", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
|
||||
}
|
||||
|
||||
|
@ -129,9 +130,9 @@ public class KitPyromancer extends ProgressingKit
|
|||
return;
|
||||
}
|
||||
|
||||
QuiverPayload quiverPayload = (QuiverPayload) Manager.GetGame();
|
||||
QuiverTeamBase game = (QuiverTeamBase) Manager.GetGame();
|
||||
|
||||
quiverPayload.resetUltimate(Bukkit.getPlayer(player), true);
|
||||
game.getQuiverTeamModule(ModuleUltimate.class).resetUltimate(Bukkit.getPlayer(player), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package nautilus.game.arcade.game.games.quiver.kits;
|
||||
package nautilus.game.arcade.game.games.quiver.kits;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.entity.EntityType;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.achievement.Achievement;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
|
@ -15,7 +16,8 @@ import mineplex.core.itemstack.ItemBuilder;
|
|||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.quiver.Quiver;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverPayload;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModuleUltimate;
|
||||
import nautilus.game.arcade.game.games.quiver.ultimates.UltimateSkyWarrior;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
@ -112,10 +114,21 @@ public class KitSkyWarrior extends ProgressingKit
|
|||
new ItemBuilder(Material.IRON_AXE).setUnbreakable(true).build(),
|
||||
new ItemBuilder(Material.BOW).setUnbreakable(true).build(),
|
||||
};
|
||||
|
||||
private static final Achievement[] ACHIEVEMENTS =
|
||||
{
|
||||
Achievement.QUIVER_PAYLOAD_ASSASSIN,
|
||||
Achievement.QUIVER_PAYLOAD_BLOSSOM,
|
||||
Achievement.QUIVER_PAYLOAD_BOW,
|
||||
Achievement.QUIVER_PAYLOAD_STEADY_HANDS,
|
||||
Achievement.QUIVER_PAYLOAD_UNSTOPPABLE
|
||||
};
|
||||
|
||||
public KitSkyWarrior(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Sky Warrior", "quiverskywarrior", KitAvailability.Free, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
super(manager, "Sky Warrior", "quiverskywarrior", KitAvailability.Achievement, 5000, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
|
||||
setAchievementRequirements(ACHIEVEMENTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -141,9 +154,9 @@ public class KitSkyWarrior extends ProgressingKit
|
|||
return;
|
||||
}
|
||||
|
||||
QuiverPayload quiverPayload = (QuiverPayload) Manager.GetGame();
|
||||
QuiverTeamBase game = (QuiverTeamBase) Manager.GetGame();
|
||||
|
||||
quiverPayload.resetUltimate(Bukkit.getPlayer(player), true);
|
||||
game.getQuiverTeamModule(ModuleUltimate.class).resetUltimate(Bukkit.getPlayer(player), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,264 @@
|
|||
package nautilus.game.arcade.game.games.quiver.module;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
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.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextTop;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
|
||||
public class ModuleCapturePoint extends QuiverTeamModule
|
||||
{
|
||||
|
||||
private static final String DATA_POINT_CENTER = "BLACK";
|
||||
private static final String DATA_POINT_CICRLE = "GRAY";
|
||||
|
||||
private static final double CIRCLE_INCREMENTATION = Math.PI / 40;
|
||||
|
||||
private static final int TO_CAPTURE = 25;
|
||||
|
||||
private static final float ULTIMATE_PERCENTAGE_CAPTURE = 0.2F;
|
||||
|
||||
private Location _centre;
|
||||
private Location _circlePoint;
|
||||
private Block _beaconColour;
|
||||
private double _radius;
|
||||
|
||||
private int _redPlayers;
|
||||
private int _bluePlayers;
|
||||
|
||||
// The amount a team has captured is represented as an integer with -25
|
||||
// being Team A and 25 being Team B has captured.
|
||||
private int _capture;
|
||||
private int _captureToReturn;
|
||||
|
||||
private GameTeam _capturedTeam;
|
||||
|
||||
private CaptureState _captureState;
|
||||
|
||||
public ModuleCapturePoint(QuiverTeamBase base)
|
||||
{
|
||||
super(base);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
_centre = getBase().WorldData.GetDataLocs(DATA_POINT_CENTER).get(0);
|
||||
_circlePoint = getBase().WorldData.GetDataLocs(DATA_POINT_CICRLE).get(0);
|
||||
_beaconColour = _centre.getBlock().getRelative(BlockFace.DOWN);
|
||||
|
||||
_beaconColour.setType(Material.STAINED_GLASS);
|
||||
|
||||
_radius = UtilMath.offset2d(_centre, _circlePoint);
|
||||
_capture = 0;
|
||||
_captureToReturn = 0;
|
||||
_captureState = CaptureState.NONE;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void update(UpdateType updateType)
|
||||
{
|
||||
if (updateType != UpdateType.FAST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.broadcastMessage(_captureState.name() + " " + _capture);
|
||||
|
||||
GameTeam gameTeamA = getBase().GetTeam(ChatColor.RED), gameTeamB = getBase().GetTeam(ChatColor.AQUA);
|
||||
int gameTeamACount = 0, gameTeamBCount = 0;
|
||||
|
||||
for (Player player : UtilPlayer.getNearby(_centre, _radius))
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
GameTeam gameTeam = getBase().GetTeam(player);
|
||||
|
||||
if (gameTeamA.equals(gameTeam))
|
||||
{
|
||||
gameTeamACount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
gameTeamBCount++;
|
||||
}
|
||||
|
||||
getBase().getQuiverTeamModule(ModuleUltimate.class).incrementUltimate(player, ULTIMATE_PERCENTAGE_CAPTURE);
|
||||
}
|
||||
|
||||
_redPlayers = gameTeamACount;
|
||||
_bluePlayers = gameTeamBCount;
|
||||
|
||||
displayParticles();
|
||||
|
||||
if (gameTeamACount > gameTeamBCount && gameTeamBCount == 0)
|
||||
{
|
||||
if (!gameTeamA.equals(_capturedTeam))
|
||||
{
|
||||
_capture += gameTeamACount;
|
||||
_captureState = CaptureState.CAPTURING;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnTo();
|
||||
}
|
||||
}
|
||||
else if (gameTeamACount < gameTeamBCount && gameTeamACount == 0)
|
||||
{
|
||||
if (!gameTeamB.equals(_capturedTeam))
|
||||
{
|
||||
_capture -= gameTeamBCount;
|
||||
_captureState = CaptureState.CAPTURING;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnTo();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gameTeamACount > 0 && gameTeamBCount > 0)
|
||||
{
|
||||
_captureState = CaptureState.CONTESTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnTo();
|
||||
}
|
||||
|
||||
displayProgress();
|
||||
return;
|
||||
}
|
||||
|
||||
displayProgress();
|
||||
|
||||
GameTeam mostPlayers = null;
|
||||
|
||||
if (_capture == TO_CAPTURE)
|
||||
{
|
||||
mostPlayers = gameTeamA;
|
||||
_captureToReturn = TO_CAPTURE;
|
||||
}
|
||||
else if (_capture == -TO_CAPTURE)
|
||||
{
|
||||
mostPlayers = gameTeamB;
|
||||
_captureToReturn = -TO_CAPTURE;
|
||||
}
|
||||
|
||||
if (mostPlayers != null && _captureState != CaptureState.CAPTURED)
|
||||
{
|
||||
_capturedTeam = mostPlayers;
|
||||
_captureState = CaptureState.CAPTURED;
|
||||
_beaconColour.setData(_capturedTeam.GetColorData());
|
||||
UtilFirework.playFirework(_centre, Type.BALL_LARGE, _capturedTeam.GetColorBase(), false, false);
|
||||
UtilServer.broadcast(mostPlayers.GetFormattedName() + " Captured The Point!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish()
|
||||
{
|
||||
}
|
||||
|
||||
public static enum CaptureState
|
||||
{
|
||||
NONE, CONTESTED, CAPTURING, CAPTURED;
|
||||
}
|
||||
|
||||
private void returnTo()
|
||||
{
|
||||
if (_capture == _captureToReturn)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_capture > _captureToReturn)
|
||||
{
|
||||
_capture--;
|
||||
}
|
||||
else
|
||||
{
|
||||
_capture++;
|
||||
}
|
||||
|
||||
_captureState = _capturedTeam == null ? CaptureState.NONE : CaptureState.CAPTURED;
|
||||
}
|
||||
|
||||
private void displayParticles()
|
||||
{
|
||||
for (double t = 0; t < 2 * Math.PI; t += CIRCLE_INCREMENTATION)
|
||||
{
|
||||
double x = _radius * Math.cos(t);
|
||||
double z = _radius * Math.sin(t);
|
||||
|
||||
_centre.add(x, 0.5, z);
|
||||
|
||||
if (UtilBlock.airFoliage(_centre.getBlock()))
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, _centre, 0.05F, 0.05F, 0.05F, 0.001F, 1, ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
_centre.subtract(x, 0.5, z);
|
||||
}
|
||||
}
|
||||
|
||||
private void displayProgress()
|
||||
{
|
||||
String progress;
|
||||
|
||||
if (_capture == 0)
|
||||
{
|
||||
progress = C.cWhite;
|
||||
}
|
||||
else if (_capture > 0)
|
||||
{
|
||||
progress = C.cRed;
|
||||
}
|
||||
else
|
||||
{
|
||||
progress = C.cAqua;
|
||||
}
|
||||
|
||||
for (int i = 0; i < TO_CAPTURE; i++)
|
||||
{
|
||||
if (i == Math.abs(_capture))
|
||||
{
|
||||
progress += _captureState == CaptureState.CONTESTED ? C.cPurple : C.cWhite;
|
||||
}
|
||||
|
||||
progress += "▌";
|
||||
}
|
||||
|
||||
UtilTextTop.display(C.cRed + _redPlayers + " " + progress + " " + C.cAqua + _bluePlayers, UtilServer.getPlayers());
|
||||
}
|
||||
|
||||
public GameTeam getCapturedTeam()
|
||||
{
|
||||
return _capturedTeam;
|
||||
}
|
||||
|
||||
public CaptureState getState()
|
||||
{
|
||||
return _captureState;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,159 @@
|
|||
package nautilus.game.arcade.game.games.quiver.module;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase.GemAwardReason;
|
||||
|
||||
public class ModuleKillstreak extends QuiverTeamModule
|
||||
{
|
||||
|
||||
private static final long KILLSTREAK_TIME_PERIOD = 1500;
|
||||
private static final long TEAM_KILL_MINIMUM_DELAY = 20000;
|
||||
private static final int TEAM_KILL_MINIMUM_PLAYERS = 6;
|
||||
|
||||
private Map<UUID, Integer> _killstreakAmount = new HashMap<>();
|
||||
private Map<UUID, Long> _killstreamLast = new HashMap<>();
|
||||
private long _lastTeamKill;
|
||||
|
||||
public ModuleKillstreak(QuiverTeamBase base)
|
||||
{
|
||||
super(base);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(UpdateType updateType)
|
||||
{
|
||||
if (updateType != UpdateType.FAST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (getBase().GetPlayers(true).size() >= TEAM_KILL_MINIMUM_PLAYERS)
|
||||
{
|
||||
for (GameTeam gameTeam : getBase().GetTeamList())
|
||||
{
|
||||
if (!UtilTime.elapsed(_lastTeamKill, TEAM_KILL_MINIMUM_DELAY))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
boolean gameTeamKill = true;
|
||||
|
||||
for (Player player : gameTeam.GetPlayers(false))
|
||||
{
|
||||
if (!UtilPlayer.isSpectator(player))
|
||||
{
|
||||
gameTeamKill = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (gameTeamKill)
|
||||
{
|
||||
String message = gameTeam.GetColor() + C.Bold + "DOMINATION";
|
||||
|
||||
UtilTextMiddle.display(message, "", 10, 30, 10);
|
||||
UtilServer.broadcast(message);
|
||||
|
||||
_lastTeamKill = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Player player : getBase().GetPlayers(true))
|
||||
{
|
||||
if (_killstreamLast.containsKey(player.getUniqueId()) && _killstreakAmount.containsKey(player.getUniqueId()))
|
||||
{
|
||||
long lastKill = _killstreamLast.get(player.getUniqueId());
|
||||
int kills = _killstreakAmount.get(player.getUniqueId());
|
||||
|
||||
if (UtilTime.elapsed(lastKill, KILLSTREAK_TIME_PERIOD))
|
||||
{
|
||||
if (kills > 1)
|
||||
{
|
||||
String name = null;
|
||||
|
||||
switch (kills)
|
||||
{
|
||||
case 3:
|
||||
name = "TRIPLE";
|
||||
break;
|
||||
case 4:
|
||||
name = "QUADRA";
|
||||
break;
|
||||
case 5:
|
||||
name = "PENTA";
|
||||
break;
|
||||
case 6:
|
||||
name = "HEXA";
|
||||
break;
|
||||
case 7:
|
||||
name = "SEPTA";
|
||||
break;
|
||||
case 8:
|
||||
name = "OCTA";
|
||||
break;
|
||||
case 9:
|
||||
name = "NONA";
|
||||
break;
|
||||
case 10:
|
||||
name = "DECA";
|
||||
break;
|
||||
}
|
||||
|
||||
if (kills >= 3)
|
||||
{
|
||||
getBase().AddStat(player, "SteadyHands", 1, false, false);
|
||||
}
|
||||
|
||||
if (name != null)
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
other.playSound(other.getLocation(), Sound.ENDERDRAGON_GROWL, 1F + kills, 1f + kills);
|
||||
}
|
||||
|
||||
getBase().AddGems(player, getBase().getGems(GemAwardReason.KILLSTEAK) * kills, name + " Killstreak", true, true);
|
||||
UtilServer.broadcast(C.cGreenB + player.getName() + C.cWhite + " got a " + C.cGreenB + name + " KILL" + C.cWhite + "!");
|
||||
}
|
||||
}
|
||||
|
||||
_killstreakAmount.put(player.getUniqueId(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish()
|
||||
{
|
||||
}
|
||||
|
||||
public Map<UUID, Integer> getKillstreakAmount()
|
||||
{
|
||||
return _killstreakAmount;
|
||||
}
|
||||
|
||||
public Map<UUID, Long> getKillstreakTime()
|
||||
{
|
||||
return _killstreamLast;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
package nautilus.game.arcade.game.games.quiver.module;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
|
||||
public class ModuleKitNPCS extends QuiverTeamModule implements Listener
|
||||
{
|
||||
|
||||
private static final String DATA_POINT_KIT_RED = "ORANGE";
|
||||
private static final String DATA_POINT_KIT_BLUE = "LIGHT_BLUE";
|
||||
|
||||
private Map<Entity, ProgressingKit> _kitNPC = new HashMap<>();
|
||||
|
||||
public ModuleKitNPCS(QuiverTeamBase base)
|
||||
{
|
||||
super(base);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
getBase().Manager.registerEvents(this);
|
||||
|
||||
getBase().CreatureAllowOverride = true;
|
||||
|
||||
spawnKitNPCs(getBase().WorldData.GetDataLocs(DATA_POINT_KIT_RED), getBase().GetTeam(ChatColor.RED));
|
||||
spawnKitNPCs(getBase().WorldData.GetDataLocs(DATA_POINT_KIT_BLUE), getBase().GetTeam(ChatColor.AQUA));
|
||||
|
||||
getBase().CreatureAllowOverride = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(UpdateType updateType)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish()
|
||||
{
|
||||
UtilServer.Unregister(this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityCombust(EntityCombustEvent event)
|
||||
{
|
||||
if (isKitNPC(event.getEntity()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (isKitNPC(event.getRightClicked()) && !UtilPlayer.isSpectator(event.getPlayer()))
|
||||
{
|
||||
ProgressingKit progressingKit = _kitNPC.get(event.getRightClicked());
|
||||
|
||||
getBase().Manager.getProgressionKitManager().entityClick(event.getPlayer(), progressingKit);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCustomDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (isKitNPC(event.GetDamageeEntity()))
|
||||
{
|
||||
event.SetCancelled("Kit NPC");
|
||||
}
|
||||
}
|
||||
|
||||
private void spawnKitNPCs(List<Location> locations, GameTeam gameTeam)
|
||||
{
|
||||
int i = 0;
|
||||
Location spawnsAverage = UtilAlg.getAverageLocation(gameTeam.GetSpawns()).subtract(0, 1, 0);
|
||||
|
||||
for (Location location : locations)
|
||||
{
|
||||
if (i >= getBase().GetKits().length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Entity entity = getBase().GetKits()[i].SpawnEntity(location);
|
||||
ProgressingKit progressingKit = (ProgressingKit) getBase().GetKits()[i++];
|
||||
|
||||
UtilEnt.CreatureLook(entity, spawnsAverage);
|
||||
|
||||
_kitNPC.put(entity, progressingKit);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isKitNPC(Entity entity)
|
||||
{
|
||||
return _kitNPC.containsKey(entity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,507 @@
|
|||
package nautilus.game.arcade.game.games.quiver.module;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
import org.bukkit.event.vehicle.VehicleEnterEvent;
|
||||
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
||||
import org.bukkit.event.vehicle.VehicleMoveEvent;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextTop;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
|
||||
public class ModulePayload extends QuiverTeamModule implements Listener
|
||||
{
|
||||
|
||||
private static final double PAYLOAD_CAPTURE_RANGE = 4;
|
||||
private static final float PAYLOAD_VELOCITY = 0.2F;
|
||||
private static final int PAYLOAD_MARKER_MAX_DISTANCE = 2;
|
||||
private static final int PAYLOAD_RENGERATION_DURATION = 3 * 20;
|
||||
private static final int PAYLOAD_RENGERATION_AMPLIFIER = 1;
|
||||
|
||||
private static final float ULTIMATE_PERCENTAGE_PAYLOAD = 0.2F;
|
||||
|
||||
private static final String DATA_POINT_MARKER_START = "PINK";
|
||||
public static final String DATA_POINT_RED = "RED";
|
||||
public static final String DATA_POINT_BLUE = "BLUE";
|
||||
public static final String DATA_POINT_PAYLOAD = "BLACK";
|
||||
|
||||
private Minecart _minecart;
|
||||
|
||||
private GameTeam _teamDirection;
|
||||
|
||||
private int _targetIndex;
|
||||
|
||||
private boolean _hasMoved;
|
||||
private boolean _recentlyChanged;
|
||||
|
||||
private double _totalDistance;
|
||||
|
||||
private List<Location> _pathMarkers = new ArrayList<>();
|
||||
|
||||
private PayloadState _payloadState;
|
||||
private Team _payloadTeam;
|
||||
|
||||
public ModulePayload(QuiverTeamBase base)
|
||||
{
|
||||
super(base);
|
||||
|
||||
_payloadState = PayloadState.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
getBase().Manager.registerEvents(this);
|
||||
|
||||
_payloadTeam = getBase().GetScoreboard().getHandle().registerNewTeam("payloadTeam");
|
||||
_minecart = getBase().WorldData.World.spawn(getBase().WorldData.GetDataLocs(DATA_POINT_PAYLOAD).get(0), Minecart.class);
|
||||
|
||||
_minecart.spigot().forceGlowing(true);
|
||||
_minecart.setDisplayBlock(new MaterialData(Material.TNT));
|
||||
_payloadTeam.addEntry(_minecart.getUniqueId().toString());
|
||||
|
||||
/*
|
||||
* The payload which is represented as a minecart follows a linear path
|
||||
* connecting the two gameTeam's bases. The logic used to calculate the
|
||||
* path that the minecart takes is done below.
|
||||
*
|
||||
* Initially we need to get a constant point we will use to start our
|
||||
* calculations. This is a DATA_POINT_MARKER_START coloured data point.
|
||||
* This is placed at the red gameTeam's base, at the end of the track.
|
||||
*/
|
||||
|
||||
Location start = getBase().WorldData.GetDataLocs(DATA_POINT_MARKER_START).get(0);
|
||||
Location last = start;
|
||||
ArrayList<Location> dataPoints = new ArrayList<>();
|
||||
|
||||
/*
|
||||
* The dataPoints ArrayList is an unordered list of all the data points.
|
||||
* We add the start location and all red and blue data points.
|
||||
*
|
||||
* We use red and blue data points so that it is easier for the builders
|
||||
* to see which direction the minecart would move when a certain
|
||||
* gameTeam moved the minecart.
|
||||
*
|
||||
* Data points are placed above the track, they should be placed at
|
||||
* intervals along the track where it is ensured that the next data
|
||||
* point along the track is the closest relative to all other data
|
||||
* points in the map as well on any point where the track curves.
|
||||
*
|
||||
*/
|
||||
|
||||
dataPoints.add(start);
|
||||
dataPoints.addAll(getBase().WorldData.GetDataLocs(DATA_POINT_RED));
|
||||
dataPoints.addAll(getBase().WorldData.GetDataLocs(DATA_POINT_BLUE));
|
||||
|
||||
/*
|
||||
* While there are locations still left in the list, we search for the
|
||||
* nearest different data point and add it to a new list, this list
|
||||
* contains all the data points sorted in the correct order of the
|
||||
* track's path.
|
||||
*/
|
||||
|
||||
while (!dataPoints.isEmpty())
|
||||
{
|
||||
Location dataPoint = UtilAlg.findClosest(last, dataPoints);
|
||||
|
||||
_pathMarkers.add(dataPoint);
|
||||
dataPoints.remove(dataPoint);
|
||||
last = dataPoint;
|
||||
}
|
||||
|
||||
/*
|
||||
* We need to calculate the total linear distance between all the stored
|
||||
* data points. This is used later when displaying the Dragon/Wither
|
||||
* progression bar.
|
||||
*/
|
||||
for (int i = 1; i < _pathMarkers.size(); i++)
|
||||
{
|
||||
_totalDistance += UtilMath.offset(_pathMarkers.get(i - 1), _pathMarkers.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(UpdateType updateType)
|
||||
{
|
||||
if (updateType != UpdateType.FAST || _minecart == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_payloadState.equals(PayloadState.RESTARTING))
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, _minecart.getLocation().add(0, 1, 0), 0.5F, 0.5F, 0.5F, 1, 10, ViewDist.LONG);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* In order to determine which direction the payload will move we
|
||||
* calculate how many players are within PAYLOAD_CAPURE_RANGE blocks of
|
||||
* the payload.
|
||||
*/
|
||||
|
||||
int gameTeamACount = 0, gameTeamBCount = 0;
|
||||
|
||||
for (Player player : UtilPlayer.getNearby(_minecart.getLocation(), PAYLOAD_CAPTURE_RANGE))
|
||||
{
|
||||
GameTeam gameTeam = getBase().GetTeam(player);
|
||||
|
||||
if (getBase().GetTeamList().get(0).equals(gameTeam))
|
||||
{
|
||||
gameTeamACount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
gameTeamBCount++;
|
||||
}
|
||||
|
||||
player.removePotionEffect(PotionEffectType.REGENERATION);
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, PAYLOAD_RENGERATION_DURATION, PAYLOAD_RENGERATION_AMPLIFIER));
|
||||
getBase().getQuiverTeamModule(ModuleUltimate.class).incrementUltimate(player, ULTIMATE_PERCENTAGE_PAYLOAD);
|
||||
}
|
||||
|
||||
UtilTextTop.display(getTopBar(), UtilServer.getPlayers());
|
||||
|
||||
/*
|
||||
* _recentlyChanged is used to show that on the targetIndex needs to be
|
||||
* updated as the payload's direction has changed.
|
||||
*/
|
||||
|
||||
if (gameTeamACount > gameTeamBCount && gameTeamBCount == 0)
|
||||
{
|
||||
if (_teamDirection != null)
|
||||
{
|
||||
if (!_teamDirection.equals(getBase().GetTeamList().get(0)))
|
||||
{
|
||||
setMinecartTeam(getBase().GetTeamList().get(0));
|
||||
_recentlyChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
_teamDirection = getBase().GetTeamList().get(0);
|
||||
}
|
||||
else if (gameTeamACount < gameTeamBCount && gameTeamACount == 0)
|
||||
{
|
||||
if (_teamDirection != null)
|
||||
{
|
||||
if (!_teamDirection.equals(getBase().GetTeamList().get(1)))
|
||||
{
|
||||
setMinecartTeam(getBase().GetTeamList().get(1));
|
||||
_recentlyChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
_teamDirection = getBase().GetTeamList().get(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gameTeamACount > 0 && gameTeamBCount > 0)
|
||||
{
|
||||
_payloadState = PayloadState.CONTESTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
_payloadState = PayloadState.NONE;
|
||||
}
|
||||
|
||||
setMinecartTeam(_payloadState);
|
||||
UtilAction.zeroVelocity(_minecart);
|
||||
return;
|
||||
}
|
||||
|
||||
setMinecartTeam(_teamDirection);
|
||||
_payloadState = PayloadState.MOVING;
|
||||
|
||||
if (_teamDirection.equals(getBase().GetTeamList().get(0)))
|
||||
{
|
||||
// If the minecart has never moved
|
||||
if (!_hasMoved)
|
||||
{
|
||||
_targetIndex = _pathMarkers.size() / 2;
|
||||
}
|
||||
else if (isMinecartNearMarker(_pathMarkers.get(_targetIndex)) || _recentlyChanged)
|
||||
{
|
||||
_targetIndex++;
|
||||
_recentlyChanged = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the minecart has never moved
|
||||
if (!_hasMoved)
|
||||
{
|
||||
_targetIndex = _pathMarkers.size() / 2 - 2;
|
||||
}
|
||||
else if (isMinecartNearMarker(_pathMarkers.get(_targetIndex)) || _recentlyChanged)
|
||||
{
|
||||
_targetIndex--;
|
||||
_recentlyChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The minecart's velocity is set to the vector between the the
|
||||
* minecart's current location and the next data point it will reach.
|
||||
*/
|
||||
|
||||
_minecart.setVelocity(UtilAlg.getTrajectory(_minecart.getLocation(), _pathMarkers.get(_targetIndex)).normalize().multiply(PAYLOAD_VELOCITY));
|
||||
_hasMoved = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish()
|
||||
{
|
||||
UtilServer.Unregister(this);
|
||||
}
|
||||
|
||||
public boolean isMinecartNearMarker(Location marker)
|
||||
{
|
||||
return isMinecartNearMarker(marker, PAYLOAD_MARKER_MAX_DISTANCE);
|
||||
}
|
||||
|
||||
public boolean isMinecartNearMarker(Location marker, double distance)
|
||||
{
|
||||
return UtilMath.offset(_minecart.getLocation(), marker) < distance;
|
||||
}
|
||||
|
||||
public double getTrackDistanceToMarker(Location marker)
|
||||
{
|
||||
return getTrackDistanceToMarker(marker, _teamDirection);
|
||||
}
|
||||
|
||||
public double getTrackDistanceToMarker(Location marker, GameTeam gameTeam)
|
||||
{
|
||||
double distance = 0;
|
||||
|
||||
if (_minecart == null)
|
||||
{
|
||||
return distance;
|
||||
}
|
||||
|
||||
if (gameTeam == null)
|
||||
{
|
||||
return _totalDistance / 2;
|
||||
}
|
||||
|
||||
if (_targetIndex > _pathMarkers.size() - 1 || _targetIndex < 0)
|
||||
{
|
||||
return distance;
|
||||
}
|
||||
|
||||
if (gameTeam.equals(_teamDirection))
|
||||
{
|
||||
distance += UtilMath.offset(_minecart.getLocation(), _pathMarkers.get(_targetIndex));
|
||||
}
|
||||
|
||||
if (getBase().GetTeamList().get(0).equals(gameTeam))
|
||||
{
|
||||
if (!gameTeam.equals(_teamDirection))
|
||||
{
|
||||
if (_targetIndex < _pathMarkers.size() - 1)
|
||||
{
|
||||
distance += UtilMath.offset(_minecart.getLocation(), _pathMarkers.get(_targetIndex + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
distance += UtilMath.offset(_minecart.getLocation(), _pathMarkers.get(_pathMarkers.size() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = _targetIndex + 1; i < _pathMarkers.size(); i++)
|
||||
{
|
||||
distance += UtilMath.offset(_pathMarkers.get(i - 1), _pathMarkers.get(i));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gameTeam.equals(_teamDirection))
|
||||
{
|
||||
if (_targetIndex > 0)
|
||||
{
|
||||
distance += UtilMath.offset(_minecart.getLocation(), _pathMarkers.get(_targetIndex - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
// distance += UtilMath.offset(_minecart.getLocation(),
|
||||
// _pathMarkers.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = _targetIndex - 1; i >= 0; i--)
|
||||
{
|
||||
distance += UtilMath.offset(_pathMarkers.get(i + 1), _pathMarkers.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
return distance;
|
||||
}
|
||||
|
||||
public Location getDestination(GameTeam gameTeam)
|
||||
{
|
||||
if (getBase().GetTeamList().get(0).equals(gameTeam))
|
||||
{
|
||||
return _pathMarkers.get(_pathMarkers.size() - 1);
|
||||
}
|
||||
|
||||
return _pathMarkers.get(0);
|
||||
}
|
||||
|
||||
public void resetMinecart()
|
||||
{
|
||||
_payloadState = PayloadState.RESTARTING;
|
||||
setMinecartTeam(_payloadState);
|
||||
_hasMoved = false;
|
||||
_recentlyChanged = false;
|
||||
UtilAction.zeroVelocity(_minecart);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onVehicleEntityCollision(VehicleEntityCollisionEvent event)
|
||||
{
|
||||
if (event.getVehicle() instanceof Minecart)
|
||||
{
|
||||
event.setCollisionCancelled(true);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onVehicleDamage(VehicleDamageEvent event)
|
||||
{
|
||||
if (event.getVehicle() instanceof Minecart)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onVehicleEnter(VehicleEnterEvent event)
|
||||
{
|
||||
if (event.getVehicle() instanceof Minecart)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onVehicleMove(VehicleMoveEvent event)
|
||||
{
|
||||
Vehicle vehicle = event.getVehicle();
|
||||
|
||||
if (vehicle instanceof Minecart && vehicle.getVelocity().lengthSquared() > (PAYLOAD_VELOCITY * PAYLOAD_VELOCITY))
|
||||
{
|
||||
vehicle.setVelocity(vehicle.getVelocity().normalize().multiply(PAYLOAD_VELOCITY));
|
||||
}
|
||||
}
|
||||
|
||||
public void setMinecartTeam(GameTeam gameTeam)
|
||||
{
|
||||
_payloadTeam.setPrefix(gameTeam.GetColor().toString());
|
||||
}
|
||||
|
||||
public void setMinecartTeam(PayloadState payloadState)
|
||||
{
|
||||
switch (payloadState)
|
||||
{
|
||||
case RESTARTING:
|
||||
_payloadTeam.setPrefix(C.cGreen);
|
||||
break;
|
||||
case CONTESTED:
|
||||
_payloadTeam.setPrefix(C.cPurple);
|
||||
break;
|
||||
case NONE:
|
||||
_payloadTeam.setPrefix(C.cWhite);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public String getTopBar()
|
||||
{
|
||||
String progress = C.cAqua;
|
||||
GameTeam gameTeamA = getBase().GetTeamList().get(0);
|
||||
|
||||
int percentage = (int) (((int) getTrackDistanceToMarker(getDestination(gameTeamA), gameTeamA) / _totalDistance) * 100);
|
||||
boolean switched = false;
|
||||
|
||||
if (_teamDirection == null)
|
||||
{
|
||||
percentage = 50;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 25; i++)
|
||||
{
|
||||
if (percentage / 4 == i)
|
||||
{
|
||||
switched = true;
|
||||
progress += C.cWhite + "•" + C.cRed;
|
||||
}
|
||||
else if (switched)
|
||||
{
|
||||
progress += "<";
|
||||
}
|
||||
else
|
||||
{
|
||||
progress += ">";
|
||||
}
|
||||
}
|
||||
|
||||
return C.cAqua + "♚ " + C.cWhite + "[ " + progress + C.cWhite + " ]" + C.cRed + " ♚";
|
||||
}
|
||||
|
||||
public void setState(PayloadState payloadState)
|
||||
{
|
||||
_payloadState = payloadState;
|
||||
}
|
||||
|
||||
public Minecart getMinecart()
|
||||
{
|
||||
return _minecart;
|
||||
}
|
||||
|
||||
public PayloadState getState()
|
||||
{
|
||||
return _payloadState;
|
||||
}
|
||||
|
||||
public GameTeam getTeamDirection()
|
||||
{
|
||||
return _teamDirection;
|
||||
}
|
||||
|
||||
public List<Location> getPathMarkers()
|
||||
{
|
||||
return _pathMarkers;
|
||||
}
|
||||
|
||||
public static enum PayloadState
|
||||
{
|
||||
NONE, MOVING, CONTESTED, RESTARTING;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,184 @@
|
|||
package nautilus.game.arcade.game.games.quiver.module;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.quiver.Quiver;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
|
||||
public class ModulePowerup extends QuiverTeamModule implements Listener
|
||||
{
|
||||
|
||||
private static final int ARROWS_TO_GIVE = 1;
|
||||
private static final int FIREWORK_VIEW_DISTANCE = 10;
|
||||
private static final String DATA_POINT_POWERUP = "YELLOW";
|
||||
|
||||
private Set<PowerupData> _data = new HashSet<>();
|
||||
|
||||
private long _respawnDelay;
|
||||
|
||||
public ModulePowerup(QuiverTeamBase base)
|
||||
{
|
||||
super(base);
|
||||
|
||||
_respawnDelay = 20000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
getBase().Manager.registerEvents(this);
|
||||
|
||||
for (Location location : getBase().WorldData.GetDataLocs(DATA_POINT_POWERUP))
|
||||
{
|
||||
_data.add(new PowerupData(location));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(UpdateType updateType)
|
||||
{
|
||||
if (updateType != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (PowerupData data : _data)
|
||||
{
|
||||
data.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish()
|
||||
{
|
||||
UtilServer.Unregister(this);
|
||||
}
|
||||
|
||||
public void setRespawnDelay(long respawnDelay)
|
||||
{
|
||||
_respawnDelay = respawnDelay;
|
||||
}
|
||||
|
||||
private void playFirework(Location location)
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (UtilMath.offset(location, player.getLocation()) < FIREWORK_VIEW_DISTANCE)
|
||||
{
|
||||
UtilFirework.packetPlayFirework(player, location, Type.BALL_LARGE, Color.YELLOW, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerPickupItem(PlayerPickupItemEvent event)
|
||||
{
|
||||
for (PowerupData data : _data)
|
||||
{
|
||||
data.pickup(event.getPlayer(), event.getItem());
|
||||
}
|
||||
}
|
||||
|
||||
private class PowerupData
|
||||
{
|
||||
private Location _location;
|
||||
private Item _item;
|
||||
private long _lastPickup;
|
||||
|
||||
public PowerupData(Location location)
|
||||
{
|
||||
_location = location;
|
||||
_lastPickup = System.currentTimeMillis();
|
||||
|
||||
location.getBlock().getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK);
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
if (_item != null)
|
||||
{
|
||||
if (!_item.isValid())
|
||||
{
|
||||
_item.remove();
|
||||
_item = null;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (UtilTime.elapsed(_lastPickup, _respawnDelay))
|
||||
{
|
||||
_item = _location.getWorld().dropItem(_location, new ItemStack(Material.ARROW));
|
||||
|
||||
_item.setVelocity(new Vector(0, 1, 0));
|
||||
_item.getLocation().getBlock().getRelative(BlockFace.DOWN).setType(Material.GOLD_BLOCK);
|
||||
|
||||
playFirework(_location);
|
||||
}
|
||||
}
|
||||
|
||||
public void pickup(Player player, Item item)
|
||||
{
|
||||
if (_item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_item.equals(item))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GameTeam gameTeam = getBase().GetTeam(player);
|
||||
|
||||
if (gameTeam == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_item.remove();
|
||||
_item = null;
|
||||
|
||||
_lastPickup = System.currentTimeMillis();
|
||||
|
||||
_location.getBlock().getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK);
|
||||
|
||||
player.sendMessage(F.main("Game", "You collected the resupply powerup."));
|
||||
|
||||
playFirework(_location);
|
||||
|
||||
ItemStack itemStack = Quiver.SUPER_ARROW.clone();
|
||||
itemStack.setAmount(ARROWS_TO_GIVE);
|
||||
|
||||
player.getInventory().addItem(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
package nautilus.game.arcade.game.games.quiver.module;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
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.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
|
||||
public class ModuleSpawnBarrier extends QuiverTeamModule implements Listener
|
||||
{
|
||||
|
||||
private static final int DAMAGE_RADIUS = 5;
|
||||
private static final int VELOCITY_RADIUS = 4;
|
||||
|
||||
private static final String CUSTOM_LOCATION_BARRIER_RED = "73";
|
||||
private static final String CUSTOM_LOCATION_BARRIER_BLUE = "21";
|
||||
|
||||
private Map<GameTeam, List<Location>> _barriers = new HashMap<>();
|
||||
|
||||
public ModuleSpawnBarrier(QuiverTeamBase base)
|
||||
{
|
||||
super(base);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
getBase().Manager.registerEvents(this);
|
||||
|
||||
_barriers.put(getBase().GetTeam(ChatColor.RED), getBase().WorldData.GetCustomLocs(CUSTOM_LOCATION_BARRIER_RED));
|
||||
_barriers.put(getBase().GetTeam(ChatColor.AQUA), getBase().WorldData.GetCustomLocs(CUSTOM_LOCATION_BARRIER_BLUE));
|
||||
|
||||
for (List<Location> list : _barriers.values())
|
||||
{
|
||||
for (Location location : list)
|
||||
{
|
||||
location.getBlock().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(UpdateType updateType)
|
||||
{
|
||||
if (updateType == UpdateType.FAST)
|
||||
{
|
||||
for (GameTeam gameTeam : _barriers.keySet())
|
||||
{
|
||||
for (Player player : getBase().GetPlayers(true))
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getBase().GetTeam(player).equals(gameTeam))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (Location location : gameTeam.GetSpawns())
|
||||
{
|
||||
if (UtilMath.offset(player.getLocation(), location) < DAMAGE_RADIUS)
|
||||
{
|
||||
getBase().Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.VOID, 9001, false, true, true, getBase().GetName(), "Spawn Shield");
|
||||
}
|
||||
}
|
||||
|
||||
for (Location location : _barriers.get(gameTeam))
|
||||
{
|
||||
if (UtilMath.offset(player.getLocation(), location) < VELOCITY_RADIUS)
|
||||
{
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory(location, player.getLocation()).normalize().setY(0.4));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (updateType == UpdateType.SEC)
|
||||
{
|
||||
for (GameTeam gameTeam : _barriers.keySet())
|
||||
{
|
||||
for (Player player : getBase().GetPlayers(true))
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getBase().GetTeam(player).equals(gameTeam))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (Location location : _barriers.get(gameTeam))
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.BARRIER, location.clone().add(0, 0.5, 0), 0, 0, 0, 0.1F, 1, ViewDist.SHORT, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish()
|
||||
{
|
||||
UtilServer.Unregister(this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCustomDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetDamageeEntity() instanceof Player)
|
||||
{
|
||||
Player player = event.GetDamageePlayer();
|
||||
|
||||
if (UtilMath.offset(player.getLocation(), UtilAlg.findClosest(player.getLocation(), getBase().GetTeam(player).GetSpawns())) < DAMAGE_RADIUS)
|
||||
{
|
||||
event.SetCancelled("Spawn Shield");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
package nautilus.game.arcade.game.games.quiver.module;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.quiver.Quiver;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
import nautilus.game.arcade.game.games.quiver.kits.KitNewNinja;
|
||||
|
||||
public class ModuleSuperArrow extends QuiverTeamModule implements Listener
|
||||
{
|
||||
private static final String SUPER_ARROW_DAMAGE_SOURCE = "Projectile";
|
||||
public static final String SUPER_ARROW_DAMAGE_REASON = "Instagib";
|
||||
private static final double SUPER_ARROW_DAMAGE_MOD = 9001;
|
||||
private static final int RESPAWN_ARROW_GIVE_DELAY = 20;
|
||||
|
||||
public ModuleSuperArrow(QuiverTeamBase base)
|
||||
{
|
||||
super(base);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
getBase().Manager.registerEvents(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(UpdateType updateType)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish()
|
||||
{
|
||||
UtilServer.Unregister(this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCustomDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetDamageeEntity() instanceof Player)
|
||||
{
|
||||
if (event.GetProjectile() != null)
|
||||
{
|
||||
if (event.GetProjectile() instanceof Arrow)
|
||||
{
|
||||
event.AddMod(SUPER_ARROW_DAMAGE_SOURCE, SUPER_ARROW_DAMAGE_REASON, SUPER_ARROW_DAMAGE_MOD, false);
|
||||
|
||||
event.SetKnockback(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (event.GetEvent().getEntity() == null || !event.GetLog().GetKiller().IsPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(event.GetEvent().getEntity() instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||
Player killed = (Player) event.GetEvent().getEntity();
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.getInventory().addItem(Quiver.SUPER_ARROW);
|
||||
|
||||
if (getBase().GetKit(killed) instanceof KitNewNinja)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!killed.getInventory().contains(Material.ARROW))
|
||||
{
|
||||
killed.getInventory().addItem(Quiver.SUPER_ARROW);
|
||||
}
|
||||
}
|
||||
}.runTaskLater(getBase().Manager.getPlugin(), (long) (getBase().DeathSpectateSecs * 20 + RESPAWN_ARROW_GIVE_DELAY));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onProjectileHit(ProjectileHitEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Arrow)
|
||||
{
|
||||
event.getEntity().remove();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,243 @@
|
|||
package nautilus.game.arcade.game.games.quiver.module;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.minecraft.game.core.combat.CombatComponent;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
import nautilus.game.arcade.game.games.quiver.ultimates.UltimatePerk;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
|
||||
public class ModuleUltimate extends QuiverTeamModule implements Listener
|
||||
{
|
||||
|
||||
private static final int ULTIMATE_PERCENTAGE_INCREASE_KILL = 5;
|
||||
private static final int ULTIMATE_PERCENTAGE_INCREASE_ASSIST = 2;
|
||||
|
||||
private Map<UUID, Float> _ultimatePercentage = new HashMap<>();
|
||||
|
||||
private boolean _colouredMessage;
|
||||
|
||||
public ModuleUltimate(QuiverTeamBase base)
|
||||
{
|
||||
super(base);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
getBase().Manager.registerEvents(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(UpdateType updateType)
|
||||
{
|
||||
if (updateType != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_colouredMessage = !_colouredMessage;
|
||||
|
||||
for (Player player : getBase().GetPlayers(true))
|
||||
{
|
||||
Kit kit = getBase().GetKit(player);
|
||||
|
||||
if (kit == null || UtilPlayer.isSpectator(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_ultimatePercentage.containsKey(player.getUniqueId()))
|
||||
{
|
||||
_ultimatePercentage.put(player.getUniqueId(), 0F);
|
||||
}
|
||||
|
||||
double percentage = _ultimatePercentage.get(player.getUniqueId());
|
||||
|
||||
if (percentage >= 100)
|
||||
{
|
||||
UtilTextBottom.display((_colouredMessage ? C.cWhiteB : C.cAquaB) + "ULTIMATE READY (PRESS SNEAK)", player);
|
||||
player.setExp(0.999F);
|
||||
player.setLevel(100);
|
||||
continue;
|
||||
}
|
||||
|
||||
String percentageFormatted = new DecimalFormat("0.0").format(percentage);
|
||||
|
||||
UtilTextBottom.displayProgress("Ultimate", percentage / 100, percentageFormatted + "%", player);
|
||||
player.setExp((float) percentage / 100);
|
||||
player.setLevel((int) percentage);
|
||||
|
||||
for (Perk perk : kit.GetPerks())
|
||||
{
|
||||
if (perk instanceof UltimatePerk)
|
||||
{
|
||||
UltimatePerk ultimate = (UltimatePerk) perk;
|
||||
|
||||
if (ultimate.isUsingUltimate(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
incrementUltimate(player, ultimate.getChargePassive());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish()
|
||||
{
|
||||
UtilServer.Unregister(this);
|
||||
|
||||
for (UUID uuid : _ultimatePercentage.keySet())
|
||||
{
|
||||
Player player = UtilPlayer.searchExact(uuid);
|
||||
|
||||
for (Perk perk : getBase().GetKit(player).GetPerks())
|
||||
{
|
||||
if (!(perk instanceof UltimatePerk))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
UltimatePerk ultimate = (UltimatePerk) perk;
|
||||
|
||||
if (ultimate.isUsingUltimate(player))
|
||||
{
|
||||
ultimate.cancel(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (event.GetEvent().getEntity() == null || event.GetLog().GetKiller() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(event.GetEvent().getEntity() instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
incrementUltimate(player, ULTIMATE_PERCENTAGE_INCREASE_KILL);
|
||||
|
||||
for (CombatComponent combatComponent : event.GetLog().GetAttackers())
|
||||
{
|
||||
if (event.GetLog().GetKiller() != null && combatComponent.equals(event.GetLog().GetKiller()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (combatComponent.IsPlayer())
|
||||
{
|
||||
Player assitedPlayer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||
|
||||
if (assitedPlayer != null)
|
||||
{
|
||||
incrementUltimate(assitedPlayer, ULTIMATE_PERCENTAGE_INCREASE_ASSIST);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void incrementUltimate(Player player, float percentage)
|
||||
{
|
||||
ProgressingKit kit = (ProgressingKit) getBase().GetKit(player);
|
||||
|
||||
for (Perk perk : kit.getPerks()[kit.getUpgradeLevel(player.getUniqueId())])
|
||||
{
|
||||
if (perk instanceof UltimatePerk)
|
||||
{
|
||||
UltimatePerk ultimate = (UltimatePerk) perk;
|
||||
|
||||
if (ultimate.isUsingUltimate(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_ultimatePercentage.put(player.getUniqueId(), _ultimatePercentage.get(player.getUniqueId()) + percentage);
|
||||
}
|
||||
|
||||
public void resetUltimate(Player player, boolean inform)
|
||||
{
|
||||
if (inform)
|
||||
{
|
||||
player.sendMessage(F.main("Game", "Your Ultimate charge has been reset!"));
|
||||
}
|
||||
|
||||
_ultimatePercentage.put(player.getUniqueId(), 0F);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerToggleSneak(PlayerToggleSneakEvent event)
|
||||
{
|
||||
if (!getBase().IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
ProgressingKit kit = (ProgressingKit) getBase().GetKit(player);
|
||||
|
||||
if (!event.isSneaking())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (kit == null || UtilPlayer.isSpectator(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_ultimatePercentage.get(player.getUniqueId()) < 100)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Perk perk : kit.getPerks()[kit.getUpgradeLevel(player.getUniqueId())])
|
||||
{
|
||||
if (perk instanceof UltimatePerk)
|
||||
{
|
||||
UltimatePerk ultimate = (UltimatePerk) perk;
|
||||
|
||||
if (ultimate.isUsable(player))
|
||||
{
|
||||
ultimate.activate(player);
|
||||
resetUltimate(player, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package nautilus.game.arcade.game.games.quiver.module;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
|
||||
public abstract class QuiverTeamModule
|
||||
{
|
||||
|
||||
private QuiverTeamBase _base;
|
||||
|
||||
public QuiverTeamModule(QuiverTeamBase base)
|
||||
{
|
||||
_base = base;
|
||||
}
|
||||
|
||||
public abstract void setup();
|
||||
|
||||
public abstract void update(UpdateType updateType);
|
||||
|
||||
public abstract void finish();
|
||||
|
||||
public void updateScoreboard()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public QuiverTeamBase getBase()
|
||||
{
|
||||
return _base;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
package nautilus.game.arcade.game.games.quiver.module.game;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModuleCapturePoint;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModuleCapturePoint.CaptureState;
|
||||
import nautilus.game.arcade.game.games.quiver.module.QuiverTeamModule;
|
||||
import nautilus.game.arcade.scoreboard.GameScoreboard;
|
||||
|
||||
public class QuiverKOTH extends QuiverTeamModule
|
||||
{
|
||||
|
||||
private static final long OVERTIME_TIME_INITIAL = 3000;
|
||||
private static final long OVERTIME_TIME_DECREASE = 10;
|
||||
|
||||
private ModuleCapturePoint _capturePoint;
|
||||
|
||||
private boolean _isOvertime;
|
||||
private long _lastNotCaptured;
|
||||
private long _overtimeTime;
|
||||
|
||||
private Map<GameTeam, Float> _teamScore = new HashMap<>();
|
||||
|
||||
public QuiverKOTH(QuiverTeamBase base)
|
||||
{
|
||||
super(base);
|
||||
|
||||
_capturePoint = getBase().getQuiverTeamModule(ModuleCapturePoint.class);
|
||||
_overtimeTime = OVERTIME_TIME_INITIAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScoreboard()
|
||||
{
|
||||
GameScoreboard scoreboard = getBase().GetScoreboard();
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
scoreboard.write(C.cGoldB + "Capture Point");
|
||||
|
||||
if (_capturePoint.getCapturedTeam() == null)
|
||||
{
|
||||
scoreboard.write("None");
|
||||
}
|
||||
else
|
||||
{
|
||||
scoreboard.write(_capturePoint.getCapturedTeam().GetFormattedName() + "");
|
||||
}
|
||||
|
||||
if (getBase().IsLive())
|
||||
{
|
||||
|
||||
for (GameTeam gameTeam : _teamScore.keySet())
|
||||
{
|
||||
float percentage = Math.min(_teamScore.get(gameTeam), 100);
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
scoreboard.write(gameTeam.GetColor() + C.Bold + "Team " + gameTeam.getDisplayName());
|
||||
scoreboard.write(percentage + "%");
|
||||
}
|
||||
}
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
scoreboard.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
for (GameTeam gameTeam : getBase().GetTeamList())
|
||||
{
|
||||
_teamScore.put(gameTeam, 0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(UpdateType updateType)
|
||||
{
|
||||
if (updateType != UpdateType.FAST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_capturePoint.getCapturedTeam() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_teamScore.put(_capturePoint.getCapturedTeam(), _teamScore.get(_capturePoint.getCapturedTeam()) + 0.5F);
|
||||
|
||||
if (_capturePoint.getState() != CaptureState.CAPTURED)
|
||||
{
|
||||
_lastNotCaptured = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
if (_isOvertime)
|
||||
{
|
||||
_overtimeTime -= OVERTIME_TIME_DECREASE;
|
||||
}
|
||||
|
||||
for (GameTeam gameTeam : _teamScore.keySet())
|
||||
{
|
||||
float percentage = _teamScore.get(gameTeam);
|
||||
|
||||
if (percentage >= 100)
|
||||
{
|
||||
CaptureState state = _capturePoint.getState();
|
||||
|
||||
if (_isOvertime && !UtilTime.elapsed(_lastNotCaptured, _overtimeTime))
|
||||
{
|
||||
Bukkit.broadcastMessage(UtilTime.MakeStr(_overtimeTime - (System.currentTimeMillis() - _lastNotCaptured)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_isOvertime && state != CaptureState.CAPTURED)
|
||||
{
|
||||
_isOvertime = true;
|
||||
|
||||
String message = QuiverTeamBase.OVERTIME;
|
||||
|
||||
UtilTextMiddle.display(message, "", 10, 30, 10);
|
||||
UtilServer.broadcast(message);
|
||||
|
||||
_teamScore.put(gameTeam, 99.9F);
|
||||
return;
|
||||
}
|
||||
|
||||
getBase().AnnounceEnd(gameTeam);
|
||||
getBase().SetState(GameState.End);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,438 @@
|
|||
package nautilus.game.arcade.game.games.quiver.module.game;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
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.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase.GemAwardReason;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModulePayload;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModulePayload.PayloadState;
|
||||
import nautilus.game.arcade.game.games.quiver.module.QuiverTeamModule;
|
||||
import nautilus.game.arcade.scoreboard.GameScoreboard;
|
||||
|
||||
public class QuiverPayload extends QuiverTeamModule implements Listener
|
||||
{
|
||||
|
||||
private static final long GAME_TIMEOUT = 600000;
|
||||
|
||||
private static final int END_EFFECT_DELAY = 100;
|
||||
private static final int END_EFFECT_TNT_AMOUNT = 8;
|
||||
private static final int END_EFFECT_EXPLOSION_RADIUS = 5;
|
||||
private static final int MAX_SCORE = 5;
|
||||
|
||||
private static final int PAYLOAD_RESPAWN_DELAY_TICKS = 7 * 20;
|
||||
|
||||
private ModulePayload _payload;
|
||||
|
||||
private Set<Block> _lastOvertimeTrack = new HashSet<>();
|
||||
private Map<GameTeam, Integer> _teamScore = new HashMap<>();
|
||||
|
||||
private boolean _isEnding;
|
||||
private boolean _isOvertime;
|
||||
|
||||
public QuiverPayload(QuiverTeamBase base)
|
||||
{
|
||||
super(base);
|
||||
|
||||
base.DeathSpectateSecs = 5;
|
||||
|
||||
_payload = getBase().getQuiverTeamModule(ModulePayload.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScoreboard()
|
||||
{
|
||||
GameScoreboard scoreboard = getBase().GetScoreboard();
|
||||
|
||||
scoreboard.reset();
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
scoreboard.write(C.cGoldB + "Payload");
|
||||
|
||||
GameTeam teamDirection = _payload.getTeamDirection();
|
||||
PayloadState payloadState = _payload.getState();
|
||||
|
||||
if (payloadState.equals(PayloadState.CONTESTED))
|
||||
{
|
||||
scoreboard.write(C.cDPurpleB + "Contested");
|
||||
}
|
||||
else if (payloadState.equals(PayloadState.RESTARTING))
|
||||
{
|
||||
scoreboard.write("Respawning...");
|
||||
}
|
||||
else if (payloadState.equals(PayloadState.NONE))
|
||||
{
|
||||
scoreboard.write("None");
|
||||
}
|
||||
else if (teamDirection != null)
|
||||
{
|
||||
String distance = new DecimalFormat("0.0").format(_payload.getTrackDistanceToMarker(_payload.getDestination(teamDirection)));
|
||||
scoreboard.write(teamDirection.GetFormattedName() + ChatColor.RESET + teamDirection.GetColor() + " (" + teamDirection.GetColor() + distance + "m)");
|
||||
}
|
||||
else
|
||||
{
|
||||
scoreboard.write("Loading...");
|
||||
}
|
||||
|
||||
if (getBase().IsLive())
|
||||
{
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
if (_isOvertime)
|
||||
{
|
||||
for (GameTeam gameTeam : _teamScore.keySet())
|
||||
{
|
||||
scoreboard.write(gameTeam.GetColor() + C.Bold + "Team " + gameTeam.getDisplayName());
|
||||
|
||||
int alivePlayers = 0;
|
||||
|
||||
for (Player player : gameTeam.GetPlayers(true))
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
alivePlayers++;
|
||||
}
|
||||
|
||||
scoreboard.write(alivePlayers + "/" + gameTeam.GetPlayers(true).size() + " Alive");
|
||||
scoreboard.writeNewLine();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (GameTeam gameTeam : _teamScore.keySet())
|
||||
{
|
||||
int score = Math.min(_teamScore.get(gameTeam), MAX_SCORE);
|
||||
|
||||
scoreboard.write(gameTeam.GetColor() + C.Bold + "Team " + gameTeam.getDisplayName());
|
||||
scoreboard.write(score + " Point" + (score == 1 ? "" : "s") + " (" + (MAX_SCORE - score) + ")");
|
||||
scoreboard.writeNewLine();
|
||||
}
|
||||
}
|
||||
|
||||
scoreboard.write(C.cRedB + "Game End");
|
||||
|
||||
if (_isOvertime)
|
||||
{
|
||||
scoreboard.write(QuiverTeamBase.OVERTIME);
|
||||
}
|
||||
else
|
||||
{
|
||||
scoreboard.write(UtilTime.MakeStr(GAME_TIMEOUT - (System.currentTimeMillis() - getBase().GetStateTime())));
|
||||
}
|
||||
}
|
||||
else if (getBase().WinnerTeam != null)
|
||||
{
|
||||
scoreboard.writeNewLine();
|
||||
scoreboard.write(getBase().WinnerTeam.GetFormattedName() + " Won!");
|
||||
}
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
scoreboard.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
getBase().Manager.registerEvents(this);
|
||||
|
||||
for (GameTeam gameTeam : getBase().GetTeamList())
|
||||
{
|
||||
_teamScore.put(gameTeam, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(UpdateType updateType)
|
||||
{
|
||||
if (updateType != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (GameTeam gameTeam : _teamScore.keySet())
|
||||
{
|
||||
if (gameTeam.GetPlayers(true).isEmpty())
|
||||
{
|
||||
for (GameTeam otherTeam : _teamScore.keySet())
|
||||
{
|
||||
if (gameTeam.equals(otherTeam))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
getBase().WinnerTeam = otherTeam;
|
||||
awardWinGems();
|
||||
displayEndEffect();
|
||||
}
|
||||
}
|
||||
|
||||
if (_payload.isMinecartNearMarker(_payload.getDestination(gameTeam)) && _payload.getTeamDirection().equals(gameTeam) && _payload.getState() != PayloadState.RESTARTING)
|
||||
{
|
||||
int score = _teamScore.get(gameTeam);
|
||||
|
||||
getBase().WinnerTeam = gameTeam;
|
||||
_teamScore.put(gameTeam, ++score);
|
||||
|
||||
if (score == MAX_SCORE)
|
||||
{
|
||||
awardWinGems();
|
||||
displayEndEffect();
|
||||
}
|
||||
else
|
||||
{
|
||||
String message = gameTeam.GetFormattedName() + " scored! Payload Respawning...";
|
||||
|
||||
UtilTextMiddle.display("", message, 10, 30, 10);
|
||||
UtilServer.broadcast(message);
|
||||
|
||||
_payload.resetMinecart();
|
||||
displayPointScoreEffect();
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
|
||||
Location toTeleport = getBase().WorldData.GetDataLocs(ModulePayload.DATA_POINT_PAYLOAD).get(0);
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, _payload.getMinecart().getLocation().add(0, 1, 0), 0, 0, 0, 1, 1, ViewDist.LONG);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, toTeleport, 0, 0, 0, 1, 1, ViewDist.LONG);
|
||||
_payload.getMinecart().teleport(toTeleport);
|
||||
_payload.setState(PayloadState.NONE);
|
||||
_payload.setMinecartTeam(_payload.getState());
|
||||
}
|
||||
}.runTaskLater(getBase().Manager.getPlugin(), PAYLOAD_RESPAWN_DELAY_TICKS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_isOvertime)
|
||||
{
|
||||
List<Location> pathMarkers = _payload.getPathMarkers();
|
||||
|
||||
if (_lastOvertimeTrack.isEmpty())
|
||||
{
|
||||
_lastOvertimeTrack.add(pathMarkers.get(0).getBlock().getRelative(BlockFace.DOWN));
|
||||
_lastOvertimeTrack.add(pathMarkers.get(pathMarkers.size() - 1).getBlock().getRelative(BlockFace.DOWN));
|
||||
}
|
||||
|
||||
Set<Block> newTracks = new HashSet<>();
|
||||
Minecart _minecart = _payload.getMinecart();
|
||||
|
||||
for (Block block : _lastOvertimeTrack)
|
||||
{
|
||||
if (_payload.isMinecartNearMarker(block.getLocation()))
|
||||
{
|
||||
Location locationA = UtilAlg.findClosest(_minecart.getLocation(), getBase().WorldData.GetDataLocs(ModulePayload.DATA_POINT_RED));
|
||||
Location locationB = UtilAlg.findClosest(_minecart.getLocation(), getBase().WorldData.GetDataLocs(ModulePayload.DATA_POINT_BLUE));
|
||||
|
||||
if (UtilMath.offset(_minecart.getLocation(), locationA) < UtilMath.offset(_minecart.getLocation(), locationB))
|
||||
{
|
||||
getBase().WinnerTeam = getBase().GetTeam(ChatColor.AQUA);
|
||||
}
|
||||
else
|
||||
{
|
||||
getBase().WinnerTeam = getBase().GetTeam(ChatColor.RED);
|
||||
}
|
||||
|
||||
_payload.setState(PayloadState.RESTARTING);
|
||||
awardWinGems();
|
||||
displayEndEffect();
|
||||
return;
|
||||
}
|
||||
|
||||
for (Block other : UtilBlock.getInRadius(block, 1.5).keySet())
|
||||
{
|
||||
if (other.getType() == Material.RAILS)
|
||||
{
|
||||
block.setType(Material.AIR);
|
||||
newTracks.add(other);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.05F, 12, ViewDist.NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_lastOvertimeTrack = newTracks;
|
||||
}
|
||||
|
||||
if (UtilTime.elapsed(getBase().GetStateTime(), GAME_TIMEOUT) && !_isOvertime)
|
||||
{
|
||||
/*
|
||||
* If a particular gameTeam has scored the most points they are the
|
||||
* winners otherwise if all gameTeam's scores are the same, the game
|
||||
* goes into overtime and after OVERTIME milliseconds the distance
|
||||
* from the minecart and that gameTeams destination is used to
|
||||
* determine the winner.
|
||||
*/
|
||||
|
||||
int lastScore = -1;
|
||||
boolean same = false;
|
||||
|
||||
for (GameTeam gameTeam : _teamScore.keySet())
|
||||
{
|
||||
int score = _teamScore.get(gameTeam);
|
||||
|
||||
if (lastScore == -1)
|
||||
{
|
||||
lastScore = score;
|
||||
getBase().WinnerTeam = gameTeam;
|
||||
}
|
||||
else if (score > lastScore)
|
||||
{
|
||||
getBase().WinnerTeam = gameTeam;
|
||||
}
|
||||
else if (score == lastScore)
|
||||
{
|
||||
same = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (same)
|
||||
{
|
||||
String subTitle = C.cRed + "The track will now shrink over time!";
|
||||
|
||||
UtilTextMiddle.display(QuiverTeamBase.OVERTIME, subTitle, 10, 30, 10);
|
||||
UtilServer.broadcast(QuiverTeamBase.OVERTIME + " " + subTitle);
|
||||
|
||||
_isOvertime = true;
|
||||
return;
|
||||
}
|
||||
|
||||
getBase().AnnounceEnd(getBase().WinnerTeam);
|
||||
getBase().SetState(GameState.End);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish()
|
||||
{
|
||||
UtilServer.Unregister(this);
|
||||
}
|
||||
|
||||
public void displayPointScoreEffect()
|
||||
{
|
||||
if (_isEnding)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Minecart minecart = _payload.getMinecart();
|
||||
Location location = minecart.getLocation().add(0, 1, 0);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 1, 1, ViewDist.LONG);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, location, 0, 0, 0, 1, 200, ViewDist.LONG);
|
||||
|
||||
for (Player player : UtilPlayer.getNearby(minecart.getLocation(), 15))
|
||||
{
|
||||
if (!getBase().IsAlive(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory(location, player.getLocation()).normalize().multiply(UtilMath.offset(location, player.getLocation())).setY(1.5));
|
||||
}
|
||||
}
|
||||
|
||||
public void displayEndEffect()
|
||||
{
|
||||
if (_isEnding)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Random random = new Random();
|
||||
Minecart minecart = _payload.getMinecart();
|
||||
|
||||
_isEnding = true;
|
||||
minecart.setDisplayBlock(null);
|
||||
|
||||
for (int i = 0; i < END_EFFECT_TNT_AMOUNT; i++)
|
||||
{
|
||||
TNTPrimed tntPrimed = minecart.getWorld().spawn(minecart.getLocation().add(0, 1, 0), TNTPrimed.class);
|
||||
|
||||
tntPrimed.setVelocity(new Vector(random.nextDouble() - 0.5, random.nextDouble() / 2, random.nextDouble() - 0.5));
|
||||
tntPrimed.setFuseTicks((int) (END_EFFECT_DELAY / 2));
|
||||
tntPrimed.setYield(END_EFFECT_EXPLOSION_RADIUS);
|
||||
}
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
getBase().AnnounceEnd(getBase().WinnerTeam);
|
||||
getBase().SetState(GameState.End);
|
||||
}
|
||||
}.runTaskLater(getBase().Manager.getPlugin(), END_EFFECT_DELAY);
|
||||
}
|
||||
|
||||
private void awardWinGems()
|
||||
{
|
||||
for (Player player : getBase().GetPlayers(true))
|
||||
{
|
||||
if (!getBase().GetTeam(player).equals(getBase().WinnerTeam))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
getBase().AddGems(player, getGems(GemAwardReason.WIN), "Winning Team", false, false);
|
||||
}
|
||||
}
|
||||
|
||||
public double getGems(GemAwardReason reason)
|
||||
{
|
||||
switch (reason)
|
||||
{
|
||||
case KILL:
|
||||
return 1;
|
||||
case ASSIST:
|
||||
return 0.5;
|
||||
case KILLSTEAK:
|
||||
return 2;
|
||||
case WIN:
|
||||
return 10;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -7,17 +7,21 @@ import org.bukkit.event.EventHandler;
|
|||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class UltimateBarrage extends Ultimate
|
||||
public class UltimateBarrage extends UltimatePerk
|
||||
{
|
||||
|
||||
private static final double CHARGE_PER_SECOND = 0.8;
|
||||
private static final float CHARGE_PASSIVE = 0.8F;
|
||||
private static final float CHARGE_PAYLOAD = 0.4F;
|
||||
private static final float CHARGE_KILL = 5F;
|
||||
private static final float CHARGE_ASSIST = 2F;
|
||||
|
||||
private static final float VELOCITY_MULTIPLIER = 3;
|
||||
|
||||
private int _arrows;
|
||||
|
||||
public UltimateBarrage(int arrows)
|
||||
{
|
||||
super("Arrow Barrage", new String[] {});
|
||||
super("Arrow Barrage", new String[] {}, 0, CHARGE_PASSIVE, CHARGE_PAYLOAD, CHARGE_KILL, CHARGE_ASSIST);
|
||||
|
||||
_arrows = arrows;
|
||||
}
|
||||
|
@ -32,7 +36,7 @@ public class UltimateBarrage extends Ultimate
|
|||
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
if (getLastUltimate().containsKey(player.getUniqueId()))
|
||||
if (isUsingUltimate(player))
|
||||
{
|
||||
for (int i = 0; i < _arrows; i++)
|
||||
{
|
||||
|
@ -48,16 +52,4 @@ public class UltimateBarrage extends Ultimate
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getChargeIncreasePerSecond()
|
||||
{
|
||||
return CHARGE_PER_SECOND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLength()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,19 +12,19 @@ import org.bukkit.inventory.ItemStack;
|
|||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.minecraft.game.core.damage.DamageChange;
|
||||
import nautilus.game.arcade.game.games.quiver.module.ModuleSuperArrow;
|
||||
|
||||
public class UltimateBeserker extends Ultimate
|
||||
public class UltimateBeserker extends UltimatePerk
|
||||
{
|
||||
|
||||
private static final double CHARGE_PER_SECOND = 0.4;
|
||||
|
||||
private long _length;
|
||||
private static final float CHARGE_PASSIVE = 0.4F;
|
||||
private static final float CHARGE_PAYLOAD = 0.4F;
|
||||
private static final float CHARGE_KILL = 5F;
|
||||
private static final float CHARGE_ASSIST = 2F;
|
||||
|
||||
public UltimateBeserker(long length)
|
||||
{
|
||||
super("Berserker Shield", new String[] {});
|
||||
|
||||
_length = length;
|
||||
super("Berserker Shield", new String[] {}, length, CHARGE_PASSIVE, CHARGE_PAYLOAD, CHARGE_KILL, CHARGE_ASSIST);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
|
@ -34,13 +34,15 @@ public class UltimateBeserker extends Ultimate
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (event.GetDamageePlayer() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!getLastUltimate().containsKey(event.GetDamageePlayer().getUniqueId()))
|
||||
Player player = event.GetDamageePlayer();
|
||||
|
||||
if (!isUsingUltimate(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -51,8 +53,10 @@ public class UltimateBeserker extends Ultimate
|
|||
{
|
||||
DamageChange damageChange = iterator.next();
|
||||
|
||||
if (damageChange.GetReason().equals("Instagib"))
|
||||
if (damageChange.GetReason().equals(ModuleSuperArrow.SUPER_ARROW_DAMAGE_REASON))
|
||||
{
|
||||
Manager.GetGame().AddStat(player, "Unstoppable", 1, false, false);
|
||||
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
@ -80,16 +84,4 @@ public class UltimateBeserker extends Ultimate
|
|||
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(color).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getChargeIncreasePerSecond()
|
||||
{
|
||||
return CHARGE_PER_SECOND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLength()
|
||||
{
|
||||
return _length;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,21 +25,22 @@ import mineplex.core.common.util.UtilPlayer;
|
|||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
|
||||
public class UltimateNecromancer extends Ultimate
|
||||
public class UltimateNecromancer extends UltimatePerk
|
||||
{
|
||||
|
||||
private static final double CHARGE_PER_SECOND = 0.4;
|
||||
|
||||
private long _length;
|
||||
private static final float CHARGE_PASSIVE = 0.4F;
|
||||
private static final float CHARGE_PAYLOAD = 0.4F;
|
||||
private static final float CHARGE_KILL = 5F;
|
||||
private static final float CHARGE_ASSIST = 2F;
|
||||
|
||||
private int _skeletons;
|
||||
|
||||
private Map<UUID, Set<LivingEntity>> _entities = new HashMap<>();
|
||||
|
||||
public UltimateNecromancer(long length, int skeletons)
|
||||
{
|
||||
super("Summon Undead", new String[] {});
|
||||
super("Summon Undead", new String[] {}, length, CHARGE_PASSIVE, CHARGE_PAYLOAD, CHARGE_KILL, CHARGE_ASSIST);
|
||||
|
||||
_length = length;
|
||||
_skeletons = skeletons;
|
||||
}
|
||||
|
||||
|
@ -161,16 +162,4 @@ public class UltimateNecromancer extends Ultimate
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getChargeIncreasePerSecond()
|
||||
{
|
||||
return CHARGE_PER_SECOND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLength()
|
||||
{
|
||||
return _length;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package nautilus.game.arcade.game.games.quiver.ultimates;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -11,21 +15,27 @@ import org.bukkit.potion.PotionEffectType;
|
|||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
public class UltimateNinja extends Ultimate
|
||||
public class UltimateNinja extends UltimatePerk
|
||||
{
|
||||
|
||||
private static final double CHARGE_PER_SECOND = 0.4;
|
||||
private static final float CHARGE_PASSIVE = 0.4F;
|
||||
private static final float CHARGE_PAYLOAD = 0.4F;
|
||||
private static final float CHARGE_KILL = 5F;
|
||||
private static final float CHARGE_ASSIST = 2F;
|
||||
|
||||
private static final int SPEED_AMPLIFIER = 1;
|
||||
|
||||
private long _length;
|
||||
|
||||
private Map<UUID, Integer> _kills = new HashMap<>();
|
||||
|
||||
public UltimateNinja(long length)
|
||||
{
|
||||
super("Ancient Blade", new String[] {});
|
||||
|
||||
_length = length;
|
||||
super("Ancient Blade", new String[] {}, length, CHARGE_PASSIVE, CHARGE_PAYLOAD, CHARGE_KILL, CHARGE_ASSIST);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -36,7 +46,7 @@ public class UltimateNinja extends Ultimate
|
|||
return;
|
||||
}
|
||||
|
||||
if (getLastUltimate().containsKey(event.GetDamagerPlayer(false).getUniqueId()) && event.GetDamagerPlayer(false).getItemInHand().getType() == Material.DIAMOND_SWORD)
|
||||
if (isUsingUltimate(event.GetDamagerPlayer(false)) && event.GetDamagerPlayer(false).getItemInHand().getType() == Material.DIAMOND_SWORD)
|
||||
{
|
||||
event.AddMod(event.GetDamagerPlayer(false).getName(), GetName(), 9001, true);
|
||||
}
|
||||
|
@ -58,19 +68,46 @@ public class UltimateNinja extends Ultimate
|
|||
{
|
||||
super.cancel(player);
|
||||
|
||||
if (_kills.containsKey(player.getUniqueId()))
|
||||
{
|
||||
int kills = _kills.get(player.getUniqueId());
|
||||
|
||||
if (kills >= 5)
|
||||
{
|
||||
Manager.GetGame().AddStat(player, "Assassin", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
_kills.remove(player.getUniqueId());
|
||||
player.getInventory().setItem(0, new ItemStack(Material.GOLD_SWORD));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getChargeIncreasePerSecond()
|
||||
{
|
||||
return CHARGE_PER_SECOND;
|
||||
}
|
||||
@EventHandler
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (event.GetEvent().getEntity() == null || event.GetLog().GetKiller() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLength()
|
||||
{
|
||||
return _length;
|
||||
}
|
||||
if (!(event.GetEvent().getEntity() instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (isUsingUltimate(player))
|
||||
{
|
||||
UUID uuid = player.getUniqueId();
|
||||
|
||||
_kills.putIfAbsent(uuid, 0);
|
||||
_kills.put(uuid, _kills.get(uuid) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,28 +19,37 @@ import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
|||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.quiver.Quiver;
|
||||
import nautilus.game.arcade.game.games.quiver.kits.KitNewNinja;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public abstract class Ultimate extends Perk
|
||||
public abstract class UltimatePerk extends Perk
|
||||
{
|
||||
|
||||
private Map<UUID, Long> _lastUltimate = new HashMap<>();
|
||||
|
||||
private long _length;
|
||||
|
||||
private float _chargePassive;
|
||||
private float _chargePayload;
|
||||
private float _chargeKill;
|
||||
private float _chargeAssist;
|
||||
|
||||
public Ultimate(String name, String[] perkDesc)
|
||||
public UltimatePerk(String name, String[] perkDesc, long length, float chargePassive, float chargePayload, float chargeKill, float chargeAssist)
|
||||
{
|
||||
super(name, perkDesc);
|
||||
|
||||
_length = length;
|
||||
_chargePassive = chargePassive;
|
||||
_chargePayload = chargePayload;
|
||||
_chargeKill = chargeKill;
|
||||
_chargeAssist = chargeAssist;
|
||||
}
|
||||
|
||||
public void activate(Player player)
|
||||
{
|
||||
_lastUltimate.put(player.getUniqueId(), System.currentTimeMillis());
|
||||
|
||||
if (!(Manager.GetGame().GetKit(player) instanceof KitNewNinja))
|
||||
{
|
||||
player.getInventory().addItem(Quiver.SUPER_ARROW);
|
||||
}
|
||||
|
||||
player.getInventory().addItem(Quiver.SUPER_ARROW);
|
||||
|
||||
ChatColor teamColor = Manager.GetGame().GetTeam(player).GetColor();
|
||||
|
||||
UtilServer.broadcast(teamColor + C.Bold + player.getName() + C.cWhiteB + " activated their " + teamColor + C.Bold + GetName() + C.cWhiteB + ".");
|
||||
|
@ -63,26 +72,24 @@ public abstract class Ultimate extends Perk
|
|||
return true;
|
||||
}
|
||||
|
||||
public abstract double getChargeIncreasePerSecond();
|
||||
|
||||
public abstract long getLength();
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST || getLength() == 0)
|
||||
if (event.getType() != UpdateType.FAST || _length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!_lastUltimate.containsKey(player.getUniqueId()))
|
||||
|
||||
for (UUID uuid : _lastUltimate.keySet())
|
||||
{
|
||||
Player player = UtilPlayer.searchExact(uuid);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UtilTime.elapsed(_lastUltimate.get(player.getUniqueId()), getLength()))
|
||||
|
||||
if (UtilTime.elapsed(_lastUltimate.get(uuid), _length))
|
||||
{
|
||||
cancel(player);
|
||||
}
|
||||
|
@ -99,7 +106,7 @@ public abstract class Ultimate extends Perk
|
|||
|
||||
Player player = (Player) event.GetEvent().getEntity();
|
||||
|
||||
if (!_lastUltimate.containsKey(player.getUniqueId()))
|
||||
if (!isUsingUltimate(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -118,9 +125,44 @@ public abstract class Ultimate extends Perk
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isUsingUltimate(Player player)
|
||||
{
|
||||
return isUsingUltimate(player.getUniqueId());
|
||||
}
|
||||
|
||||
public boolean isUsingUltimate(UUID uuid)
|
||||
{
|
||||
return _lastUltimate.containsKey(uuid);
|
||||
}
|
||||
|
||||
public Map<UUID, Long> getLastUltimate()
|
||||
{
|
||||
return _lastUltimate;
|
||||
}
|
||||
|
||||
public long getLength()
|
||||
{
|
||||
return _length;
|
||||
}
|
||||
|
||||
public float getChargePassive()
|
||||
{
|
||||
return _chargePassive;
|
||||
}
|
||||
|
||||
public float getChargePayload()
|
||||
{
|
||||
return _chargePayload;
|
||||
}
|
||||
|
||||
public float getChargeKill()
|
||||
{
|
||||
return _chargeKill;
|
||||
}
|
||||
|
||||
public float getChargeAssist()
|
||||
{
|
||||
return _chargeAssist;
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import java.util.UUID;
|
|||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
@ -15,21 +16,23 @@ import org.bukkit.util.Vector;
|
|||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
|
||||
public class UltimatePyromancer extends Ultimate
|
||||
public class UltimatePyromancer extends UltimatePerk
|
||||
{
|
||||
|
||||
private static final double CHARGE_PER_SECOND = 0.4;
|
||||
|
||||
private long _length;
|
||||
|
||||
private static final float CHARGE_PASSIVE = 0.4F;
|
||||
private static final float CHARGE_PAYLOAD = 0.4F;
|
||||
private static final float CHARGE_KILL = 5F;
|
||||
private static final float CHARGE_ASSIST = 2F;
|
||||
|
||||
private Map<UUID, Integer> _tasks = new HashMap<>();
|
||||
private Map<UUID, Integer> _kills = new HashMap<>();
|
||||
|
||||
public UltimatePyromancer(long length)
|
||||
{
|
||||
super("Fire Blossom", new String[] {});
|
||||
|
||||
_length = length;
|
||||
super("Fire Blossom", new String[] {}, length, CHARGE_PASSIVE, CHARGE_PAYLOAD, CHARGE_KILL, CHARGE_ASSIST);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,20 +64,48 @@ public class UltimatePyromancer extends Ultimate
|
|||
{
|
||||
super.cancel(player);
|
||||
|
||||
if (_kills.containsKey(player.getUniqueId()))
|
||||
{
|
||||
int kills = _kills.get(player.getUniqueId());
|
||||
|
||||
if (kills >= 4)
|
||||
{
|
||||
Manager.GetGame().AddStat(player, "Blossom", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
_kills.remove(player.getUniqueId());
|
||||
player.setWalkSpeed(0.2F);
|
||||
Bukkit.getScheduler().cancelTask(_tasks.get(player.getUniqueId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getChargeIncreasePerSecond()
|
||||
@EventHandler
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
return CHARGE_PER_SECOND;
|
||||
}
|
||||
if (event.GetEvent().getEntity() == null || event.GetLog().GetKiller() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLength()
|
||||
{
|
||||
return _length;
|
||||
}
|
||||
if (!(event.GetEvent().getEntity() instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (isUsingUltimate(player))
|
||||
{
|
||||
UUID uuid = player.getUniqueId();
|
||||
|
||||
_kills.putIfAbsent(uuid, 0);
|
||||
_kills.put(uuid, _kills.get(uuid) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,10 +38,15 @@ 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
|
||||
public class UltimateSkyWarrior extends UltimatePerk
|
||||
{
|
||||
|
||||
private static final double CHARGE_PER_SECOND = 0.4;
|
||||
private static final float CHARGE_PASSIVE = 0.4F;
|
||||
private static final float CHARGE_PAYLOAD = 0.4F;
|
||||
private static final float CHARGE_KILL = 5F;
|
||||
private static final float CHARGE_ASSIST = 2F;
|
||||
|
||||
private static final int SHOTS = 3;
|
||||
private static final long LAUNCHER_FIRE_DELAY = 500;
|
||||
private static final long LAUNCHER_MAX_TIME = 15000;
|
||||
private static final int Y_INCREASE = 10;
|
||||
|
@ -56,7 +61,7 @@ public class UltimateSkyWarrior extends Ultimate
|
|||
|
||||
public UltimateSkyWarrior(double damageTeleport, double radiusTeleport, double damageLauncher, double radiusLauncher, int rangeLauncher)
|
||||
{
|
||||
super("Bombardment", new String[] {});
|
||||
super("Bombardment", new String[] {}, 0, CHARGE_PASSIVE, CHARGE_PAYLOAD, CHARGE_KILL, CHARGE_ASSIST);
|
||||
|
||||
_damageTeleport = damageTeleport;
|
||||
_radiusTeleport = radiusTeleport;
|
||||
|
@ -85,7 +90,7 @@ public class UltimateSkyWarrior extends Ultimate
|
|||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, -10));
|
||||
player.teleport(toTeleport);
|
||||
|
||||
_data.add(new SkyWarriorData(player, block, 3, UtilInv.getAmount(player, Material.ARROW), System.currentTimeMillis()));
|
||||
_data.add(new SkyWarriorData(player, block, SHOTS, UtilInv.getAmount(player, Material.ARROW), System.currentTimeMillis()));
|
||||
|
||||
player.getInventory().clear();
|
||||
|
||||
|
@ -179,7 +184,7 @@ public class UltimateSkyWarrior extends Ultimate
|
|||
@EventHandler
|
||||
public void onPlayerMove(PlayerMoveEvent event)
|
||||
{
|
||||
if (!getLastUltimate().containsKey(event.getPlayer().getUniqueId()))
|
||||
if (!isUsingUltimate(event.getPlayer().getUniqueId()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -265,18 +270,6 @@ public class UltimateSkyWarrior extends Ultimate
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getChargeIncreasePerSecond()
|
||||
{
|
||||
return CHARGE_PER_SECOND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLength()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
private SkyWarriorData getData(Player player)
|
||||
{
|
||||
for (SkyWarriorData data : _data)
|
||||
|
|
|
@ -95,7 +95,7 @@ public class KitEarth extends ProgressingKit
|
|||
|
||||
public KitEarth(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Earth", "skywarsearth", KitAvailability.Achievement, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
super(manager, "Earth", "skywarsearth", KitAvailability.Achievement, 5000, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
|
||||
|
||||
setAchievementRequirements(ACHIEVEMENTS);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue