Changed game logic to try out multiple round concept
This commit is contained in:
parent
09741d4d2a
commit
df606d5e07
@ -31,10 +31,13 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.scoreboard.NameTagVisibility;
|
import org.bukkit.scoreboard.NameTagVisibility;
|
||||||
|
import org.bukkit.scoreboard.Score;
|
||||||
import org.bukkit.scoreboard.Team;
|
import org.bukkit.scoreboard.Team;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mineplex.core.common.MinecraftVersion;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilItem;
|
import mineplex.core.common.util.UtilItem;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
@ -63,6 +66,7 @@ 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.KitNewNinja;
|
||||||
import nautilus.game.arcade.game.games.quiver.kits.KitPyromancer;
|
import nautilus.game.arcade.game.games.quiver.kits.KitPyromancer;
|
||||||
import nautilus.game.arcade.game.games.quiver.ultimates.Ultimate;
|
import nautilus.game.arcade.game.games.quiver.ultimates.Ultimate;
|
||||||
|
import nautilus.game.arcade.game.modules.VersionModule;
|
||||||
import nautilus.game.arcade.kit.Kit;
|
import nautilus.game.arcade.kit.Kit;
|
||||||
import nautilus.game.arcade.kit.Perk;
|
import nautilus.game.arcade.kit.Perk;
|
||||||
import nautilus.game.arcade.kit.ProgressingKit;
|
import nautilus.game.arcade.kit.ProgressingKit;
|
||||||
@ -74,7 +78,7 @@ public class QuiverPayload extends TeamGame
|
|||||||
// Define all our constants.
|
// Define all our constants.
|
||||||
private static final long GAME_TIMEOUT = 600000;
|
private static final long GAME_TIMEOUT = 600000;
|
||||||
private static final double PAYLOAD_CAPTURE_RANGE = 4;
|
private static final double PAYLOAD_CAPTURE_RANGE = 4;
|
||||||
private static final double PAYLOAD_INITIAL_VELOCITY = 0.1;
|
private static final double PAYLOAD_INITIAL_VELOCITY = 0.2;
|
||||||
private static final double PAYLOAD_VELOCITY_INCREASE_FACTOR = 1.5;
|
private static final double PAYLOAD_VELOCITY_INCREASE_FACTOR = 1.5;
|
||||||
private static final long PAYLOAD_VELOCITY_INCREASE_TIME = 120000;
|
private static final long PAYLOAD_VELOCITY_INCREASE_TIME = 120000;
|
||||||
private static final long PAYLOAD_APPROACHING_TIME = 20000;
|
private static final long PAYLOAD_APPROACHING_TIME = 20000;
|
||||||
@ -92,6 +96,7 @@ public class QuiverPayload extends TeamGame
|
|||||||
private static final int END_EFFECT_DELAY = 100;
|
private static final int END_EFFECT_DELAY = 100;
|
||||||
private static final int END_EFFECT_TNT_AMOUNT = 8;
|
private static final int END_EFFECT_TNT_AMOUNT = 8;
|
||||||
private static final int END_EFFECT_EXPLOSION_RADIUS = 5;
|
private static final int END_EFFECT_EXPLOSION_RADIUS = 5;
|
||||||
|
private static final int MAX_SCORE = 5;
|
||||||
|
|
||||||
public static final String DATA_POINT_MARKER_START = "PINK";
|
public static final String DATA_POINT_MARKER_START = "PINK";
|
||||||
public static final String DATA_POINT_RED = "RED";
|
public static final String DATA_POINT_RED = "RED";
|
||||||
@ -114,6 +119,9 @@ public class QuiverPayload extends TeamGame
|
|||||||
private boolean _hasAnnouncedGameEnd;
|
private boolean _hasAnnouncedGameEnd;
|
||||||
private boolean _isEnding;
|
private boolean _isEnding;
|
||||||
|
|
||||||
|
private int teamAScore;
|
||||||
|
private int teamBScore;
|
||||||
|
|
||||||
private List<PowerupGenerator> _powerupGenerators = new ArrayList<>();
|
private List<PowerupGenerator> _powerupGenerators = new ArrayList<>();
|
||||||
|
|
||||||
private Map<UUID, Double> _ultimatePercentage = new HashMap<>();
|
private Map<UUID, Double> _ultimatePercentage = new HashMap<>();
|
||||||
@ -143,7 +151,7 @@ public class QuiverPayload extends TeamGame
|
|||||||
this.TeamArmorHotbar = true;
|
this.TeamArmorHotbar = true;
|
||||||
this.HungerSet = 20;
|
this.HungerSet = 20;
|
||||||
|
|
||||||
new Quiver1_9(this);
|
registerModule(new VersionModule(MinecraftVersion.Version1_9, "One in the Quiver Payload requires minecraft 1.9!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -183,8 +191,16 @@ public class QuiverPayload extends TeamGame
|
|||||||
{
|
{
|
||||||
Scoreboard.WriteBlank();
|
Scoreboard.WriteBlank();
|
||||||
|
|
||||||
Scoreboard.Write(C.cGreenB + "Next Speed Increase");
|
// Scoreboard.Write(C.cGreenB + "Next Speed Increase");
|
||||||
Scoreboard.Write(UtilTime.MakeStr(PAYLOAD_VELOCITY_INCREASE_TIME - (System.currentTimeMillis() - _lastSpeedIncrease)));
|
// Scoreboard.Write(UtilTime.MakeStr(PAYLOAD_VELOCITY_INCREASE_TIME - (System.currentTimeMillis() - _lastSpeedIncrease)));
|
||||||
|
|
||||||
|
Scoreboard.Write(C.cRedB + "Team Red");
|
||||||
|
Scoreboard.Write(String.valueOf(teamAScore));
|
||||||
|
|
||||||
|
Scoreboard.WriteBlank();
|
||||||
|
|
||||||
|
Scoreboard.Write(C.cAquaB + "Team Blue");
|
||||||
|
Scoreboard.Write(String.valueOf(teamBScore));
|
||||||
|
|
||||||
Scoreboard.WriteBlank();
|
Scoreboard.WriteBlank();
|
||||||
|
|
||||||
@ -447,21 +463,21 @@ public class QuiverPayload extends TeamGame
|
|||||||
|
|
||||||
if (event.getType() == UpdateType.FAST && _minecart != null && IsLive())
|
if (event.getType() == UpdateType.FAST && _minecart != null && IsLive())
|
||||||
{
|
{
|
||||||
if (UtilTime.elapsed(_lastSpeedIncrease, PAYLOAD_VELOCITY_INCREASE_TIME))
|
// if (UtilTime.elapsed(_lastSpeedIncrease, PAYLOAD_VELOCITY_INCREASE_TIME))
|
||||||
{
|
// {
|
||||||
_lastSpeedIncrease = System.currentTimeMillis();
|
// _lastSpeedIncrease = System.currentTimeMillis();
|
||||||
_payloadVelocity *= PAYLOAD_VELOCITY_INCREASE_FACTOR;
|
// _payloadVelocity *= PAYLOAD_VELOCITY_INCREASE_FACTOR;
|
||||||
|
//
|
||||||
String message = C.cGreenB + "The payload\'s speed has been increased!";
|
// String message = C.cGreenB + "The payload\'s speed has been increased!";
|
||||||
|
//
|
||||||
UtilTextMiddle.display("", message, 10, 20, 10);
|
// UtilTextMiddle.display("", message, 10, 20, 10);
|
||||||
UtilServer.broadcast(message);
|
// UtilServer.broadcast(message);
|
||||||
|
//
|
||||||
for (Player player : UtilServer.getPlayers())
|
// for (Player player : UtilServer.getPlayers())
|
||||||
{
|
// {
|
||||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 0);
|
// player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 0);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In order to determine which direction the payload will move we
|
* In order to determine which direction the payload will move we
|
||||||
@ -570,32 +586,32 @@ public class QuiverPayload extends TeamGame
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If PAYLOAD_APPROACHING_TIME milliseconds has pasted and the
|
* If PAYLOAD_APPROACHING_TIME milliseconds has past and the
|
||||||
* minecart is within PAYLOAD_APPOACHING_DISTANCE blocks of the
|
* minecart is within PAYLOAD_APPOACHING_DISTANCE blocks of the
|
||||||
* destination of it's current direction.
|
* destination of it's current direction.
|
||||||
*/
|
*/
|
||||||
if (UtilTime.elapsed(_lastAnnoucement, PAYLOAD_APPROACHING_TIME) && isMinecartNearMarker(getDestination(_teamDirection), PAYLOAD_APPROACHING_DISTANCE))
|
// if (UtilTime.elapsed(_lastAnnoucement, PAYLOAD_APPROACHING_TIME) && isMinecartNearMarker(getDestination(_teamDirection), PAYLOAD_APPROACHING_DISTANCE))
|
||||||
{
|
// {
|
||||||
_lastAnnoucement = System.currentTimeMillis();
|
// _lastAnnoucement = System.currentTimeMillis();
|
||||||
|
//
|
||||||
String message = _teamDirection.GetColor() + C.Bold + "The payload is approaching its destination!";
|
// String message = _teamDirection.GetColor() + C.Bold + "The payload is approaching its destination!";
|
||||||
|
//
|
||||||
UtilTextMiddle.display("", message, 10, 20, 10);
|
// UtilTextMiddle.display("", message, 10, 20, 10);
|
||||||
UtilServer.broadcast(message);
|
// UtilServer.broadcast(message);
|
||||||
|
//
|
||||||
for (Player player : UtilServer.getPlayers())
|
// for (Player player : UtilServer.getPlayers())
|
||||||
{
|
// {
|
||||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 0);
|
// player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 0);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The minecart's velocity is set to the vector between the the
|
* The minecart's velocity is set to the vector between the the
|
||||||
* minecart's current location and the next data point it will
|
* minecart's current location and the next data point it will
|
||||||
* reach.
|
* reach.
|
||||||
*
|
*
|
||||||
* This is when multiplied by the _payloadVelocity which increase
|
* This is when multiplied by the _payloadVelocity which increases
|
||||||
* the game progresses.
|
* as the game progresses.
|
||||||
*/
|
*/
|
||||||
_minecart.setVelocity(UtilAlg.getTrajectory(_minecart.getLocation(), _pathMarkers.get(_targetIndex)).normalize().multiply(_payloadVelocity));
|
_minecart.setVelocity(UtilAlg.getTrajectory(_minecart.getLocation(), _pathMarkers.get(_targetIndex)).normalize().multiply(_payloadVelocity));
|
||||||
_lastDirection = _minecart.getVelocity();
|
_lastDirection = _minecart.getVelocity();
|
||||||
@ -616,13 +632,31 @@ public class QuiverPayload extends TeamGame
|
|||||||
if (isMinecartNearMarker(_pathMarkers.get(_pathMarkers.size() - 1)) && _teamDirection.equals(GetTeamList().get(0)))
|
if (isMinecartNearMarker(_pathMarkers.get(_pathMarkers.size() - 1)) && _teamDirection.equals(GetTeamList().get(0)))
|
||||||
{
|
{
|
||||||
WinnerTeam = GetTeamList().get(0);
|
WinnerTeam = GetTeamList().get(0);
|
||||||
|
teamAScore++;
|
||||||
|
|
||||||
|
if (teamAScore == MAX_SCORE)
|
||||||
|
{
|
||||||
end = true;
|
end = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resetMinecart(WinnerTeam);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (isMinecartNearMarker(_pathMarkers.get(0)) && _teamDirection.equals(GetTeamList().get(1)))
|
else if (isMinecartNearMarker(_pathMarkers.get(0)) && _teamDirection.equals(GetTeamList().get(1)))
|
||||||
{
|
{
|
||||||
WinnerTeam = GetTeamList().get(1);
|
WinnerTeam = GetTeamList().get(1);
|
||||||
|
teamBScore++;
|
||||||
|
|
||||||
|
if (teamBScore == MAX_SCORE)
|
||||||
|
{
|
||||||
end = true;
|
end = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resetMinecart(WinnerTeam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (end)
|
if (end)
|
||||||
{
|
{
|
||||||
@ -717,6 +751,25 @@ public class QuiverPayload extends TeamGame
|
|||||||
return _pathMarkers.get(0);
|
return _pathMarkers.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void resetMinecart(GameTeam gameTeam)
|
||||||
|
{
|
||||||
|
setMinecartTeam(null);
|
||||||
|
_lastDirection = null;
|
||||||
|
_teamDirection = null;
|
||||||
|
UtilAction.zeroVelocity(_minecart);
|
||||||
|
_minecart.teleport(WorldData.GetDataLocs(DATA_POINT_PAYLOAD).get(0));
|
||||||
|
|
||||||
|
String message = gameTeam.GetFormattedName() + " scored a point! Payload reset";
|
||||||
|
|
||||||
|
UtilTextMiddle.display("", message, 10, 20, 10);
|
||||||
|
UtilServer.broadcast(message);
|
||||||
|
|
||||||
|
for (Player player : UtilServer.getPlayers())
|
||||||
|
{
|
||||||
|
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void displayEndEffect()
|
private void displayEndEffect()
|
||||||
{
|
{
|
||||||
if (_isEnding)
|
if (_isEnding)
|
||||||
|
Loading…
Reference in New Issue
Block a user