Champs update
This commit is contained in:
parent
52ac670f3f
commit
ae4bf75485
@ -5,20 +5,25 @@ import java.util.ArrayList;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.entity.ItemDespawnEvent;
|
import org.bukkit.event.entity.ItemDespawnEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.minecraft.game.classcombat.shop.ClassCombatCustomBuildShop;
|
import mineplex.minecraft.game.classcombat.shop.ClassCombatCustomBuildShop;
|
||||||
|
import mineplex.minecraft.game.core.combat.CombatComponent;
|
||||||
|
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.GameType;
|
import nautilus.game.arcade.GameType;
|
||||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||||
|
import nautilus.game.arcade.game.Game;
|
||||||
import nautilus.game.arcade.game.GameTeam;
|
import nautilus.game.arcade.game.GameTeam;
|
||||||
import nautilus.game.arcade.game.TeamGame;
|
import nautilus.game.arcade.game.TeamGame;
|
||||||
import nautilus.game.arcade.game.games.champions.kits.*;
|
|
||||||
import nautilus.game.arcade.game.games.champions.map.*;
|
import nautilus.game.arcade.game.games.champions.map.*;
|
||||||
import nautilus.game.arcade.game.games.smash.kits.*;
|
import nautilus.game.arcade.game.games.smash.kits.*;
|
||||||
import nautilus.game.arcade.kit.Kit;
|
import nautilus.game.arcade.kit.Kit;
|
||||||
@ -37,6 +42,7 @@ public class Champions extends TeamGame
|
|||||||
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
|
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
|
||||||
|
|
||||||
//Scores
|
//Scores
|
||||||
|
private int _victoryScore = 15000;
|
||||||
private int _redScore = 0;
|
private int _redScore = 0;
|
||||||
private int _blueScore = 0;
|
private int _blueScore = 0;
|
||||||
|
|
||||||
@ -56,9 +62,10 @@ public class Champions extends TeamGame
|
|||||||
|
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
"DOMMA DOMMA DOMMA",
|
"Capture Beacons for Points",
|
||||||
"...?",
|
"+500 Points for Emerald Powerups",
|
||||||
"DOMMA!"
|
"+200 Point for Kills",
|
||||||
|
"First team to 15000 Points wins"
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -87,6 +94,25 @@ public class Champions extends TeamGame
|
|||||||
{
|
{
|
||||||
_emerald.add(new Emerald(this, loc));
|
_emerald.add(new Emerald(this, loc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* NPCs
|
||||||
|
|
||||||
|
for (Location loc : WorldData.GetDataLocs("GRAY")) //Knight
|
||||||
|
SpawnNPC(Knight, loc);
|
||||||
|
|
||||||
|
for (Location loc : WorldData.GetDataLocs("GREEN")) //Ranger
|
||||||
|
SpawnNPC(Ranger, loc);
|
||||||
|
|
||||||
|
for (Location loc : WorldData.GetDataLocs("BLUE")) //Brute
|
||||||
|
SpawnNPC(Brute, loc);
|
||||||
|
|
||||||
|
for (Location loc : WorldData.GetDataLocs("BLACK")) //Assassin
|
||||||
|
SpawnNPC(Assasin, loc);
|
||||||
|
|
||||||
|
for (Location loc : WorldData.GetDataLocs("ORANGE")) //Mage
|
||||||
|
SpawnNPC(Mage, loc);
|
||||||
|
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -99,12 +125,15 @@ public class Champions extends TeamGame
|
|||||||
for (GameTeam team : GetTeamList())
|
for (GameTeam team : GetTeamList())
|
||||||
if (team.GetColor() == ChatColor.AQUA)
|
if (team.GetColor() == ChatColor.AQUA)
|
||||||
team.SetColor(ChatColor.BLUE);
|
team.SetColor(ChatColor.BLUE);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void Updates(UpdateEvent event)
|
public void Updates(UpdateEvent event)
|
||||||
{
|
{
|
||||||
|
if (!IsLive())
|
||||||
|
return;
|
||||||
|
|
||||||
if (event.getType() == UpdateType.FAST)
|
if (event.getType() == UpdateType.FAST)
|
||||||
for (CapturePoint cur : _points)
|
for (CapturePoint cur : _points)
|
||||||
cur.Update();
|
cur.Update();
|
||||||
@ -112,6 +141,10 @@ public class Champions extends TeamGame
|
|||||||
if (event.getType() == UpdateType.FAST)
|
if (event.getType() == UpdateType.FAST)
|
||||||
for (Emerald cur : _emerald)
|
for (Emerald cur : _emerald)
|
||||||
cur.Update();
|
cur.Update();
|
||||||
|
|
||||||
|
if (event.getType() == UpdateType.FAST)
|
||||||
|
for (Resupply cur : _resupply)
|
||||||
|
cur.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -119,14 +152,51 @@ public class Champions extends TeamGame
|
|||||||
{
|
{
|
||||||
for (Emerald cur : _emerald)
|
for (Emerald cur : _emerald)
|
||||||
cur.Pickup(event.getPlayer(), event.getItem());
|
cur.Pickup(event.getPlayer(), event.getItem());
|
||||||
|
|
||||||
|
for (Resupply cur : _resupply)
|
||||||
|
cur.Pickup(event.getPlayer(), event.getItem());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void KillScore(CombatDeathEvent event)
|
||||||
|
{
|
||||||
|
if (!(event.GetEvent().getEntity() instanceof Player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player killed = (Player)event.GetEvent().getEntity();
|
||||||
|
|
||||||
|
GameTeam killedTeam = GetTeam(killed);
|
||||||
|
if (killedTeam == null) return;
|
||||||
|
|
||||||
|
if (event.GetLog().GetKiller() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||||
|
|
||||||
|
if (killer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
GameTeam killerTeam = GetTeam(killer);
|
||||||
|
if (killerTeam == null) return;
|
||||||
|
|
||||||
|
if (killerTeam.equals(killedTeam))
|
||||||
|
return;
|
||||||
|
|
||||||
|
AddScore(killerTeam, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddScore(GameTeam team, int score)
|
public void AddScore(GameTeam team, int score)
|
||||||
{
|
{
|
||||||
if (team.GetColor() == ChatColor.RED)
|
if (team.GetColor() == ChatColor.RED)
|
||||||
_redScore += score;
|
{
|
||||||
|
_redScore = Math.min(_victoryScore, _redScore + score);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_blueScore += score;
|
{
|
||||||
|
_blueScore = Math.min(_victoryScore, _blueScore + score);
|
||||||
|
}
|
||||||
|
|
||||||
|
EndCheckScore();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Dont allow powerups to despawn
|
//Dont allow powerups to despawn
|
||||||
@ -143,6 +213,12 @@ public class Champions extends TeamGame
|
|||||||
if (event.getType() != UpdateType.FAST)
|
if (event.getType() != UpdateType.FAST)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ScoreboardWrite();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ScoreboardWrite()
|
||||||
|
{
|
||||||
if (!InProgress())
|
if (!InProgress())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -180,5 +256,43 @@ public class Champions extends TeamGame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void EndCheckScore()
|
||||||
|
{
|
||||||
|
GameTeam winner = null;
|
||||||
|
|
||||||
|
if (_redScore == _victoryScore)
|
||||||
|
winner = GetTeam(ChatColor.RED);
|
||||||
|
else if (_blueScore == _victoryScore)
|
||||||
|
winner = GetTeam(ChatColor.AQUA);
|
||||||
|
|
||||||
|
if (winner == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ScoreboardWrite();
|
||||||
|
|
||||||
|
//Announce
|
||||||
|
AnnounceEnd(winner);
|
||||||
|
|
||||||
|
for (GameTeam team : GetTeamList())
|
||||||
|
{
|
||||||
|
if (WinnerTeam != null && team.equals(WinnerTeam))
|
||||||
|
{
|
||||||
|
for (Player player : team.GetPlayers(false))
|
||||||
|
AddGems(player, 10, "Winning Team", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Player player : team.GetPlayers(false))
|
||||||
|
if (player.isOnline())
|
||||||
|
AddGems(player, 10, "Participation", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//End
|
||||||
|
SetState(GameState.End);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double GetKillsGems(Player killer, Player killed, boolean assist)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package nautilus.game.arcade.game.games.champions.map;
|
package nautilus.game.arcade.game.games.champions.map;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
@ -96,10 +97,10 @@ public class CapturePoint
|
|||||||
{
|
{
|
||||||
//Who's on the CP?
|
//Who's on the CP?
|
||||||
GameTeam teamA = null;
|
GameTeam teamA = null;
|
||||||
int countA = 0;
|
ArrayList<Player> playersA = new ArrayList<Player>();
|
||||||
|
|
||||||
GameTeam teamB = null;
|
GameTeam teamB = null;
|
||||||
int countB = 0;
|
ArrayList<Player> playersB = new ArrayList<Player>();
|
||||||
|
|
||||||
for (GameTeam team : Host.GetTeamList())
|
for (GameTeam team : Host.GetTeamList())
|
||||||
{
|
{
|
||||||
@ -120,12 +121,12 @@ public class CapturePoint
|
|||||||
if (teamA == null || teamA.equals(team))
|
if (teamA == null || teamA.equals(team))
|
||||||
{
|
{
|
||||||
teamA = team;
|
teamA = team;
|
||||||
countA += 1;
|
playersA.add(player);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
teamB = team;
|
teamB = team;
|
||||||
countB += 1;
|
playersB.add(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,13 +143,13 @@ public class CapturePoint
|
|||||||
|
|
||||||
//Capture
|
//Capture
|
||||||
if (teamB == null)
|
if (teamB == null)
|
||||||
Capture(teamA, countA);
|
Capture(teamA, playersA.size(), playersA);
|
||||||
|
|
||||||
else if (countA > countB)
|
else if (playersA.size() > playersB.size())
|
||||||
Capture(teamA, countA-countB);
|
Capture(teamA, playersA.size()-playersB.size(), playersA);
|
||||||
|
|
||||||
else if (countB > countA)
|
else if (playersB.size() > playersA.size())
|
||||||
Capture(teamB, countB-countA);
|
Capture(teamB, playersB.size()-playersA.size(), playersB);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegenDegen()
|
private void RegenDegen()
|
||||||
@ -216,14 +217,14 @@ public class CapturePoint
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Capture(GameTeam team, int count)
|
public void Capture(GameTeam team, int count, Collection<Player> capturers)
|
||||||
{
|
{
|
||||||
//Decay Delay
|
//Decay Delay
|
||||||
_decayDelay = System.currentTimeMillis();
|
_decayDelay = System.currentTimeMillis();
|
||||||
|
|
||||||
//Defend Score
|
//Defend Score
|
||||||
if (_captured)
|
//if (_captured)
|
||||||
Host.AddScore(_owner, count);
|
// Host.AddScore(_owner, count);
|
||||||
|
|
||||||
//Color
|
//Color
|
||||||
Color color = Color.RED;
|
Color color = Color.RED;
|
||||||
@ -266,6 +267,15 @@ public class CapturePoint
|
|||||||
if (team.GetColor() == ChatColor.RED) block.setData((byte)14);
|
if (team.GetColor() == ChatColor.RED) block.setData((byte)14);
|
||||||
else block.setData((byte)11);
|
else block.setData((byte)11);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Reward Gems
|
||||||
|
if (capturers != null)
|
||||||
|
{
|
||||||
|
for (Player player : capturers)
|
||||||
|
{
|
||||||
|
Host.AddGems(player, 3, "Control Point Capture", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Count Down
|
//Count Down
|
||||||
|
@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.champions.map;
|
|||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilFirework;
|
import mineplex.core.common.util.UtilFirework;
|
||||||
import mineplex.core.common.util.UtilMath;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import nautilus.game.arcade.game.GameTeam;
|
import nautilus.game.arcade.game.GameTeam;
|
||||||
@ -15,7 +14,6 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.FireworkEffect.Type;
|
import org.bukkit.FireworkEffect.Type;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -100,5 +98,8 @@ public class Emerald
|
|||||||
|
|
||||||
//Firework
|
//Firework
|
||||||
UtilFirework.playFirework(_loc, FireworkEffect.builder().flicker(false).withColor(Color.GREEN).with(Type.BALL_LARGE).trail(true).build());
|
UtilFirework.playFirework(_loc, FireworkEffect.builder().flicker(false).withColor(Color.GREEN).with(Type.BALL_LARGE).trail(true).build());
|
||||||
|
|
||||||
|
//Gems
|
||||||
|
Host.AddGems(player, 3, "Emerald Powerup", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.champions.map;
|
|||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilFirework;
|
import mineplex.core.common.util.UtilFirework;
|
||||||
import mineplex.core.common.util.UtilMath;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import nautilus.game.arcade.game.GameTeam;
|
import nautilus.game.arcade.game.GameTeam;
|
||||||
@ -15,7 +14,6 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.FireworkEffect.Type;
|
import org.bukkit.FireworkEffect.Type;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -92,9 +90,6 @@ public class Resupply
|
|||||||
_time = System.currentTimeMillis();
|
_time = System.currentTimeMillis();
|
||||||
_loc.getBlock().getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK);
|
_loc.getBlock().getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK);
|
||||||
|
|
||||||
//Give Points
|
|
||||||
Host.AddScore(team, 500);
|
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(player, C.cYellow + C.Bold + "Your inventory was restocked!");
|
UtilPlayer.message(player, C.cYellow + C.Bold + "Your inventory was restocked!");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user