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.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scoreboard.NameTagVisibility;
|
||||
import org.bukkit.scoreboard.Score;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.MinecraftVersion;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
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.KitPyromancer;
|
||||
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.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
@ -74,7 +78,7 @@ public class QuiverPayload extends TeamGame
|
||||
// Define all our constants.
|
||||
private static final long GAME_TIMEOUT = 600000;
|
||||
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 long PAYLOAD_VELOCITY_INCREASE_TIME = 120000;
|
||||
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_TNT_AMOUNT = 8;
|
||||
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_RED = "RED";
|
||||
@ -113,6 +118,9 @@ public class QuiverPayload extends TeamGame
|
||||
private List<Location> _pathMarkers = new ArrayList<>();
|
||||
private boolean _hasAnnouncedGameEnd;
|
||||
private boolean _isEnding;
|
||||
|
||||
private int teamAScore;
|
||||
private int teamBScore;
|
||||
|
||||
private List<PowerupGenerator> _powerupGenerators = new ArrayList<>();
|
||||
|
||||
@ -143,7 +151,7 @@ public class QuiverPayload extends TeamGame
|
||||
this.TeamArmorHotbar = true;
|
||||
this.HungerSet = 20;
|
||||
|
||||
new Quiver1_9(this);
|
||||
registerModule(new VersionModule(MinecraftVersion.Version1_9, "One in the Quiver Payload requires minecraft 1.9!"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -183,9 +191,17 @@ public class QuiverPayload extends TeamGame
|
||||
{
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Scoreboard.Write(C.cGreenB + "Next Speed Increase");
|
||||
Scoreboard.Write(UtilTime.MakeStr(PAYLOAD_VELOCITY_INCREASE_TIME - (System.currentTimeMillis() - _lastSpeedIncrease)));
|
||||
// Scoreboard.Write(C.cGreenB + "Next Speed Increase");
|
||||
// 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.Write(C.cRedB + "Game End");
|
||||
@ -447,21 +463,21 @@ public class QuiverPayload extends TeamGame
|
||||
|
||||
if (event.getType() == UpdateType.FAST && _minecart != null && IsLive())
|
||||
{
|
||||
if (UtilTime.elapsed(_lastSpeedIncrease, PAYLOAD_VELOCITY_INCREASE_TIME))
|
||||
{
|
||||
_lastSpeedIncrease = System.currentTimeMillis();
|
||||
_payloadVelocity *= PAYLOAD_VELOCITY_INCREASE_FACTOR;
|
||||
|
||||
String message = C.cGreenB + "The payload\'s speed has been increased!";
|
||||
|
||||
UtilTextMiddle.display("", message, 10, 20, 10);
|
||||
UtilServer.broadcast(message);
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 0);
|
||||
}
|
||||
}
|
||||
// if (UtilTime.elapsed(_lastSpeedIncrease, PAYLOAD_VELOCITY_INCREASE_TIME))
|
||||
// {
|
||||
// _lastSpeedIncrease = System.currentTimeMillis();
|
||||
// _payloadVelocity *= PAYLOAD_VELOCITY_INCREASE_FACTOR;
|
||||
//
|
||||
// String message = C.cGreenB + "The payload\'s speed has been increased!";
|
||||
//
|
||||
// UtilTextMiddle.display("", message, 10, 20, 10);
|
||||
// UtilServer.broadcast(message);
|
||||
//
|
||||
// for (Player player : UtilServer.getPlayers())
|
||||
// {
|
||||
// player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 0);
|
||||
// }
|
||||
// }
|
||||
|
||||
/*
|
||||
* 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
|
||||
* destination of it's current direction.
|
||||
*/
|
||||
if (UtilTime.elapsed(_lastAnnoucement, PAYLOAD_APPROACHING_TIME) && isMinecartNearMarker(getDestination(_teamDirection), PAYLOAD_APPROACHING_DISTANCE))
|
||||
{
|
||||
_lastAnnoucement = System.currentTimeMillis();
|
||||
|
||||
String message = _teamDirection.GetColor() + C.Bold + "The payload is approaching its destination!";
|
||||
|
||||
UtilTextMiddle.display("", message, 10, 20, 10);
|
||||
UtilServer.broadcast(message);
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 0);
|
||||
}
|
||||
}
|
||||
// if (UtilTime.elapsed(_lastAnnoucement, PAYLOAD_APPROACHING_TIME) && isMinecartNearMarker(getDestination(_teamDirection), PAYLOAD_APPROACHING_DISTANCE))
|
||||
// {
|
||||
// _lastAnnoucement = System.currentTimeMillis();
|
||||
//
|
||||
// String message = _teamDirection.GetColor() + C.Bold + "The payload is approaching its destination!";
|
||||
//
|
||||
// UtilTextMiddle.display("", message, 10, 20, 10);
|
||||
// UtilServer.broadcast(message);
|
||||
//
|
||||
// for (Player player : UtilServer.getPlayers())
|
||||
// {
|
||||
// player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 0);
|
||||
// }
|
||||
// }
|
||||
|
||||
/*
|
||||
* The minecart's velocity is set to the vector between the the
|
||||
* minecart's current location and the next data point it will
|
||||
* reach.
|
||||
*
|
||||
* This is when multiplied by the _payloadVelocity which increase
|
||||
* the game progresses.
|
||||
* This is when multiplied by the _payloadVelocity which increases
|
||||
* as the game progresses.
|
||||
*/
|
||||
_minecart.setVelocity(UtilAlg.getTrajectory(_minecart.getLocation(), _pathMarkers.get(_targetIndex)).normalize().multiply(_payloadVelocity));
|
||||
_lastDirection = _minecart.getVelocity();
|
||||
@ -616,12 +632,30 @@ public class QuiverPayload extends TeamGame
|
||||
if (isMinecartNearMarker(_pathMarkers.get(_pathMarkers.size() - 1)) && _teamDirection.equals(GetTeamList().get(0)))
|
||||
{
|
||||
WinnerTeam = GetTeamList().get(0);
|
||||
end = true;
|
||||
teamAScore++;
|
||||
|
||||
if (teamAScore == MAX_SCORE)
|
||||
{
|
||||
end = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
resetMinecart(WinnerTeam);
|
||||
}
|
||||
}
|
||||
else if (isMinecartNearMarker(_pathMarkers.get(0)) && _teamDirection.equals(GetTeamList().get(1)))
|
||||
{
|
||||
WinnerTeam = GetTeamList().get(1);
|
||||
end = true;
|
||||
teamBScore++;
|
||||
|
||||
if (teamBScore == MAX_SCORE)
|
||||
{
|
||||
end = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
resetMinecart(WinnerTeam);
|
||||
}
|
||||
}
|
||||
|
||||
if (end)
|
||||
@ -629,7 +663,7 @@ public class QuiverPayload extends TeamGame
|
||||
displayEndEffect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean isMinecartNearMarker(Location marker)
|
||||
{
|
||||
return isMinecartNearMarker(marker, PAYLOAD_MARKER_MAX_DISTANCE);
|
||||
@ -716,6 +750,25 @@ public class QuiverPayload extends TeamGame
|
||||
|
||||
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()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user