Only allow kills to damage king/crystals if tnt has spawned at least once
This commit is contained in:
parent
eb0e9c0504
commit
f69203884c
@ -135,6 +135,8 @@ public class CastleAssault extends TeamGame
|
||||
|
||||
private boolean _writeScoreboard = true;
|
||||
|
||||
private boolean _killsAreObjective = false;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public CastleAssault(ArcadeManager manager)
|
||||
{
|
||||
@ -636,6 +638,13 @@ public class CastleAssault extends TeamGame
|
||||
}
|
||||
|
||||
_tntSpawner.update();
|
||||
if (!_killsAreObjective)
|
||||
{
|
||||
if (_tntSpawner.isSpawned())
|
||||
{
|
||||
_killsAreObjective = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (InProgress())
|
||||
{
|
||||
@ -864,53 +873,56 @@ public class CastleAssault extends TeamGame
|
||||
}
|
||||
|
||||
AddStat(player, GetKit(player).GetName() + "KitKills", 1, false, false);
|
||||
_teamKills.merge(GetTeam(player), 1, Integer::sum);
|
||||
if (GetTeam(player).GetColor() == ChatColor.RED)
|
||||
if (_killsAreObjective)
|
||||
{
|
||||
GameTeam enemy = GetTeam(ChatColor.AQUA);
|
||||
TeamCrystal[] crystals = _crystals.get(enemy).stream().filter(TeamCrystal::isActive).toArray(size -> new TeamCrystal[size]);
|
||||
if (crystals.length > 0)
|
||||
_teamKills.merge(GetTeam(player), 1, Integer::sum);
|
||||
if (GetTeam(player).GetColor() == ChatColor.RED)
|
||||
{
|
||||
if (_teamKills.getOrDefault(GetTeam(player), 0) % 20 == 0)
|
||||
GameTeam enemy = GetTeam(ChatColor.AQUA);
|
||||
TeamCrystal[] crystals = _crystals.get(enemy).stream().filter(TeamCrystal::isActive).toArray(size -> new TeamCrystal[size]);
|
||||
if (crystals.length > 0)
|
||||
{
|
||||
crystals[UtilMath.r(crystals.length)].destroy();
|
||||
if (crystals.length > 1)
|
||||
if (_teamKills.getOrDefault(GetTeam(player), 0) % 20 == 0)
|
||||
{
|
||||
Bukkit.broadcastMessage(F.main("Game", "One of " + F.elem(enemy.GetFormattedName() + "'s Crystals") + " has been destroyed!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Bukkit.broadcastMessage(F.main("Game", "All of " + F.elem(enemy.GetFormattedName() + "'s Crystals") + " have been destroyed and " + F.elem(_kings.get(enemy).getName(false)) + " is now vulnerable!"));
|
||||
crystals[UtilMath.r(crystals.length)].destroy();
|
||||
if (crystals.length > 1)
|
||||
{
|
||||
Bukkit.broadcastMessage(F.main("Game", "One of " + F.elem(enemy.GetFormattedName() + "'s Crystals") + " has been destroyed!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Bukkit.broadcastMessage(F.main("Game", "All of " + F.elem(enemy.GetFormattedName() + "'s Crystals") + " have been destroyed and " + F.elem(_kings.get(enemy).getName(false)) + " is now vulnerable!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_kings.get(enemy).handleDamage(player.getName(), 10, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_kings.get(enemy).handleDamage(player.getName(), 10, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GameTeam enemy = GetTeam(ChatColor.RED);
|
||||
TeamCrystal[] crystals = _crystals.get(enemy).stream().filter(TeamCrystal::isActive).toArray(size -> new TeamCrystal[size]);
|
||||
if (crystals.length > 0)
|
||||
{
|
||||
if (_teamKills.getOrDefault(GetTeam(player), 0) % 20 == 0)
|
||||
GameTeam enemy = GetTeam(ChatColor.RED);
|
||||
TeamCrystal[] crystals = _crystals.get(enemy).stream().filter(TeamCrystal::isActive).toArray(size -> new TeamCrystal[size]);
|
||||
if (crystals.length > 0)
|
||||
{
|
||||
crystals[UtilMath.r(crystals.length)].destroy();
|
||||
if (crystals.length > 1)
|
||||
if (_teamKills.getOrDefault(GetTeam(player), 0) % 20 == 0)
|
||||
{
|
||||
Bukkit.broadcastMessage(F.main("Game", "One of " + F.elem(enemy.GetFormattedName() + "'s Crystals") + " has been destroyed!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Bukkit.broadcastMessage(F.main("Game", "All of " + F.elem(enemy.GetFormattedName() + "'s Crystals") + " have been destroyed and " + F.elem(_kings.get(enemy).getName(false)) + " is now vulnerable!"));
|
||||
crystals[UtilMath.r(crystals.length)].destroy();
|
||||
if (crystals.length > 1)
|
||||
{
|
||||
Bukkit.broadcastMessage(F.main("Game", "One of " + F.elem(enemy.GetFormattedName() + "'s Crystals") + " has been destroyed!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Bukkit.broadcastMessage(F.main("Game", "All of " + F.elem(enemy.GetFormattedName() + "'s Crystals") + " have been destroyed and " + F.elem(_kings.get(enemy).getName(false)) + " is now vulnerable!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_kings.get(enemy).handleDamage(player.getName(), 10, true);
|
||||
else
|
||||
{
|
||||
_kings.get(enemy).handleDamage(player.getName(), 10, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user