From 4e94bcfd98bf18a83b4b649e0e7f1d76b74222d3 Mon Sep 17 00:00:00 2001 From: Chiss Date: Fri, 5 Sep 2014 17:29:23 +1000 Subject: [PATCH] Block Hunt winners fix (team/solo) --- .../game/arcade/addons/CompassAddon.java | 2 +- .../nautilus/game/arcade/game/GameTeam.java | 45 ++++++++++--------- .../arcade/game/games/hideseek/HideSeek.java | 27 +++++++++-- .../game/games/minestrike/MineStrike.java | 7 +-- 4 files changed, 51 insertions(+), 30 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/CompassAddon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/CompassAddon.java index cb7145d74..90115084d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/CompassAddon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/CompassAddon.java @@ -109,7 +109,7 @@ public class CompassAddon extends MiniPlugin " " + C.cWhite + C.Bold + "Distance: " + targetTeam.GetColor() + UtilMath.trim(1, bestDist) + " " + C.cWhite + C.Bold + "Height: " + targetTeam.GetColor() + UtilMath.trim(1, heightDiff)); stack.setItemMeta(itemMeta); - + player.getInventory().setItem(i, stack); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java index 69ef05849..83c431d4f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -24,9 +24,9 @@ import org.bukkit.entity.Player; public class GameTeam { private Game Host; - + private double _respawnTime = 0; - + public enum PlayerState { IN("In", ChatColor.GREEN), @@ -66,14 +66,14 @@ public class GameTeam private int _spawnDistance = 0; private boolean _visible = true; - + //Records order players go out in protected ArrayList _places = new ArrayList(); public GameTeam(Game host, String name, ChatColor color, ArrayList spawns) { Host = host; - + _name = name; _color = color; _spawns = spawns; @@ -96,7 +96,7 @@ public class GameTeam public Location GetSpawn() { -// ArrayList valid = new ArrayList(); + // ArrayList valid = new ArrayList(); Location best = null; double bestDist = 0; @@ -119,14 +119,14 @@ public class GameTeam bestDist = closestPlayer; } -// if (closestPlayer > _spawnDistance * _spawnDistance) -// { -// valid.add(loc); -// } + // if (closestPlayer > _spawnDistance * _spawnDistance) + // { + // valid.add(loc); + // } } -// if (valid.size() > 0) -// valid.get(UtilMath.r(valid.size())); + // if (valid.size() > 0) + // valid.get(UtilMath.r(valid.size())); if (best != null) return best; @@ -228,7 +228,7 @@ public class GameTeam { SpawnTeleport(true); } - + public void SpawnTeleport(boolean aliveOnly) { for (Player player : GetPlayers(aliveOnly)) @@ -342,7 +342,7 @@ public class GameTeam { _respawnTime = i; } - + public double GetRespawnTime() { return _respawnTime; @@ -351,32 +351,33 @@ public class GameTeam public void SetPlacement(Player player, PlayerState state) { if (state == PlayerState.OUT) + { if (!_places.contains(player)) - _places.add(0, player); - - else - _places.remove(player); + _places.add(0, player); + } + else + _places.remove(player); } - + public ArrayList GetPlacements(boolean includeAlivePlayers) { if (includeAlivePlayers) { ArrayList placesClone = new ArrayList(); - + for (Player player : _places) { placesClone.add(player); } - + for (Player player : GetPlayers(true)) { placesClone.add(0, player); } - + return placesClone; } - + return _places; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index 49e5724de..293e15230 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -73,6 +73,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.games.hideseek.forms.BlockForm; import nautilus.game.arcade.game.games.hideseek.forms.CreatureForm; import nautilus.game.arcade.game.games.hideseek.forms.Form; @@ -958,6 +959,10 @@ public class HideSeek extends TeamGame public void SetSeeker(Player player, boolean forced) { + GameTeam pastTeam = GetTeam(player); + if (pastTeam != null && pastTeam.equals(_hiders)) + pastTeam.SetPlacement(player, PlayerState.OUT); + SetPlayerTeam(player, _seekers, true); Manager.GetDisguise().undisguise(player); @@ -1011,12 +1016,25 @@ public class HideSeek extends TeamGame if (_hiders.GetPlayers(true).isEmpty()) { - SetState(GameState.End); - AnnounceEnd(_seekers); + ArrayList places = _hiders.GetPlacements(true); + + AnnounceEnd(_hiders.GetPlacements(true)); + //Gems + if (places.size() >= 1) + AddGems(places.get(0), 20, "1st Place", false); + + if (places.size() >= 2) + AddGems(places.get(1), 15, "2nd Place", false); + + if (places.size() >= 3) + AddGems(places.get(2), 10, "3rd Place", false); + for (Player player : GetPlayers(false)) if (player.isOnline()) AddGems(player, 10, "Participation", false); + + SetState(GameState.End); } } @@ -1084,8 +1102,7 @@ public class HideSeek extends TeamGame if (timeLeft <= 0) { WriteScoreboard(); - - SetState(GameState.End); + AnnounceEnd(_hiders); for (Player player : _hiders.GetPlayers(true)) @@ -1094,6 +1111,8 @@ public class HideSeek extends TeamGame for (Player player : GetPlayers(false)) if (player.isOnline()) AddGems(player, 10, "Participation", false); + + SetState(GameState.End); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index 0f3a1b47e..03143cbd1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -108,7 +108,7 @@ public class MineStrike extends TeamGame private int _roundsToWin = 10; private long _roundTime = 120000; - private boolean _debug = true; + private boolean _debug = false; private int _bulletInstant = 2; //0 = Slow, 1 = Instant, 2 = Mix private boolean _customHitbox = true; private boolean _bulletAlternate = false; @@ -185,12 +185,13 @@ public class MineStrike extends TeamGame this._help = new String[] { //"Tap Crouch when close to an ally to Boost", + "Open Inventory at spawn to buy guns", + "Hold Right-Click to Plant Bomb", + "Hold Right-Click with knife to Defuse Bomb", "Moving decreases accuracy", "Sprinting heavily decreases accuracy", "Jumping massively decreases accuracy", "Crouching increases accuracy", - "Hold Right-Click to Plant Bomb", - "Hold Right-Click with knife to Defuse Bomb", "Left-Click to roll Grenades", "Right-Click to throw Grenades", "Burst Fire for greater accuracy",