From 0b7789328a2159b09b17b7460d380a7b48ef8a56 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Sat, 6 May 2017 17:01:31 -0400 Subject: [PATCH] Add game tips and remove medals from initial release --- .../games/castlesiege/ShockCastleSiege.java | 184 +----------------- .../castlesiege/data/ObjectiveTNTSpawner.java | 5 +- 2 files changed, 11 insertions(+), 178 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/ShockCastleSiege.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/ShockCastleSiege.java index b6e357c3b..5c6cb8966 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/ShockCastleSiege.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/ShockCastleSiege.java @@ -6,7 +6,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.WeakHashMap; import org.bukkit.Bukkit; @@ -89,9 +88,6 @@ import nautilus.game.arcade.game.games.castlesiege.data.KillStreakData; import nautilus.game.arcade.game.games.castlesiege.data.ObjectiveTNTSpawner; import nautilus.game.arcade.game.games.castlesiege.data.TeamBeacon; import nautilus.game.arcade.game.games.castlesiege.data.TeamKing; -import nautilus.game.arcade.game.games.castlesiege.data.medals.MedalData; -import nautilus.game.arcade.game.games.castlesiege.data.medals.MedalData.MedalLevel; -import nautilus.game.arcade.game.games.castlesiege.data.medals.MedalType; import nautilus.game.arcade.game.games.castlesiege.shockkits.KitArcher; import nautilus.game.arcade.game.games.castlesiege.shockkits.KitDemolitionist; import nautilus.game.arcade.game.games.castlesiege.shockkits.KitFighter; @@ -112,7 +108,6 @@ public class ShockCastleSiege extends TeamGame private ItemBuilder _wearableTnt; private Map _streakData = new WeakHashMap<>(); - private Map _medalData = new WeakHashMap<>(); private Map> _beacons = new HashMap<>(); private Map _kings = new HashMap<>(); private List _tntCarry = new ArrayList<>(); @@ -127,7 +122,6 @@ public class ShockCastleSiege extends TeamGame private ChestLoot _rodsAndGaps = new ChestLoot(true); private ChestLoot _potionGearCommon = new ChestLoot(true); private ChestLoot _potionGearRare = new ChestLoot(true); - //private ChestLoot _blockGear = new ChestLoot(); private ChestLoot _enchantGearCommon = new ChestLoot(true); private ChestLoot _enchantGearRare = new ChestLoot(true); private ChestLoot _miscGear = new ChestLoot(); @@ -153,6 +147,14 @@ public class ShockCastleSiege extends TeamGame }, new String[] {"AlexTheCoder is awesome!"}); + _help = new String[] + { + "Use the TNT spawning platforms to run TNT to the enemy beacons to destroy them!", + "The enemy king is invulnerable until you destroy the two sentry beacons on each sentry tower", + "Go on Kill Streaks to earn Kill Streak Rewards to obtain better armor & weapons!", + "Chests refill every 2 minutes with potions, golden applegates, fishing rods, and other useful PvP items!" + }; + this.StrictAntiHack = true; this.HungerSet = 20; this.DeathOut = false; @@ -183,60 +185,6 @@ public class ShockCastleSiege extends TeamGame generateLoot(); } - private Player[] getMedalOwners(MedalType type) - { - Player gold = null; - Double goldScore = 0D; - Player silver = null; - Double silverScore = 0D; - Player bronze = null; - Double bronzeScore = 0D; - - //GOLD - for (Entry scores : _medalData.entrySet()) - { - if (scores.getValue().getScore(type) > goldScore) - { - gold = scores.getKey(); - goldScore = scores.getValue().getScore(type); - } - } - - //SILVER - for (Entry scores : _medalData.entrySet()) - { - if (gold != null && gold.getName().equals(scores.getKey().getName())) - { - continue; - } - if (scores.getValue().getScore(type) > silverScore) - { - silver = scores.getKey(); - silverScore = scores.getValue().getScore(type); - } - } - - //BRONZE - for (Entry scores : _medalData.entrySet()) - { - if (gold != null && gold.getName().equals(scores.getKey().getName())) - { - continue; - } - if (silver != null && silver.getName().equals(scores.getKey().getName())) - { - continue; - } - if (scores.getValue().getScore(type) > bronzeScore) - { - bronze = scores.getKey(); - bronzeScore = scores.getValue().getScore(type); - } - } - - return new Player[] {gold, silver, bronze}; - } - private void generateLoot() { { @@ -286,10 +234,6 @@ public class ShockCastleSiege extends TeamGame _potionGearRare.addLoot(new ItemBuilder(Material.POTION).setData((short)8193).build(), 2); _potionGearRare.addLoot(new ItemBuilder(Material.POTION).setData((short)8195).build(), 2); } - /*{ - _blockGear.addLoot(new ItemStack(Material.STONE, 64), 2); - _blockGear.addLoot(new ItemStack(Material.WOOD, 64), 2); - }*/ { _enchantGearCommon.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 2); _enchantGearCommon.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.DAMAGE_ALL, 1).build(), 2); @@ -301,7 +245,6 @@ public class ShockCastleSiege extends TeamGame } { _miscGear.addLoot(new ItemStack(Material.ENDER_PEARL), 2); - _miscGear.addLoot(new ItemBuilder(Material.TNT, 4).setTitle(F.item("Throwing TNT")).build(), 2); _miscGear.addLoot(new ItemStack(Material.WATER_BUCKET), 2); _miscGear.addLoot(_flintAndSteel.build(), 2); _miscGear.addLoot(new ItemStack(Material.SNOW_BALL, 16), 3); @@ -340,23 +283,7 @@ public class ShockCastleSiege extends TeamGame if (chance <= 0.3) { loot = _rangedGear; - }/* - if (chance <= 0.4) - { - loot = _weaponGearCommon; - if (subChance <= 0.4) - { - loot = _weaponGearRare; - } } - if (chance <= 0.3) - { - loot = _diamondGearCommon; - if (subChance <= 0.3) - { - loot = _diamondGearRare; - } - }*/ chest.getBlockInventory().setItem(slot, loot.getLoot()); } } @@ -500,34 +427,6 @@ public class ShockCastleSiege extends TeamGame TeamKing dead = _kings.values().stream().filter(k -> k.getOwner().GetColor() != king.getOwner().GetColor()).findFirst().get(); AnnounceEnd(winner); writeFinalScoreboard(dead.getName(false), king.getName(false), dead.getOwner().GetColor() + "Quitters"); - boolean announcedMedalStart = false; - for (MedalType type : MedalType.values()) - { - Player[] rewarding = getMedalOwners(type); - if (rewarding[0] != null) - { - if (!announcedMedalStart) - { - announcedMedalStart = true; - Bukkit.broadcastMessage(C.cGoldB + "-==Match Medal Recipients==-"); - } - AddGems(rewarding[0], 50, MedalLevel.GOLD.getName() + " " + type.getName(), false, false); - AddStat(rewarding[0], "Medalist", 1, false, false); - Bukkit.broadcastMessage(MedalLevel.GOLD.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.GOLD.getColor() + rewarding[0].getName()); - } - if (rewarding[1] != null) - { - AddGems(rewarding[1], 30, MedalLevel.SILVER.getName() + " " + type.getName(), false, false); - AddStat(rewarding[1], "Medalist", 1, false, false); - Bukkit.broadcastMessage(MedalLevel.SILVER.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.SILVER.getColor() + rewarding[1].getName()); - } - if (rewarding[2] != null) - { - AddGems(rewarding[2], 20, MedalLevel.BRONZE.getName() + " " + type.getName(), false, false); - AddStat(rewarding[2], "Medalist", 1, false, false); - Bukkit.broadcastMessage(MedalLevel.BRONZE.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.BRONZE.getColor() + rewarding[2].getName()); - } - } for (GameTeam team : GetTeamList()) { for (Player player : team.GetPlayers(true)) @@ -603,34 +502,6 @@ public class ShockCastleSiege extends TeamGame { AnnounceEnd(blue); writeFinalScoreboard(redKing.getName(false), blueKing.getName(false), blue.GetColor() + redKing.getLastDamager()); - boolean announcedMedalStart = false; - for (MedalType type : MedalType.values()) - { - Player[] rewarding = getMedalOwners(type); - if (rewarding[0] != null) - { - if (!announcedMedalStart) - { - announcedMedalStart = true; - Bukkit.broadcastMessage(C.cGoldB + "-==Match Medal Recipients==-"); - } - AddGems(rewarding[0], 50, MedalLevel.GOLD.getName() + " " + type.getName(), false, false); - AddStat(rewarding[0], "Medalist", 1, false, false); - Bukkit.broadcastMessage(MedalLevel.GOLD.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.GOLD.getColor() + rewarding[0].getName()); - } - if (rewarding[1] != null) - { - AddGems(rewarding[1], 30, MedalLevel.SILVER.getName() + " " + type.getName(), false, false); - AddStat(rewarding[1], "Medalist", 1, false, false); - Bukkit.broadcastMessage(MedalLevel.SILVER.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.SILVER.getColor() + rewarding[1].getName()); - } - if (rewarding[2] != null) - { - AddGems(rewarding[2], 20, MedalLevel.BRONZE.getName() + " " + type.getName(), false, false); - AddStat(rewarding[2], "Medalist", 1, false, false); - Bukkit.broadcastMessage(MedalLevel.BRONZE.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.BRONZE.getColor() + rewarding[2].getName()); - } - } for (GameTeam team : GetTeamList()) { for (Player player : team.GetPlayers(true)) @@ -680,34 +551,6 @@ public class ShockCastleSiege extends TeamGame { AnnounceEnd(red); writeFinalScoreboard(blueKing.getName(false), redKing.getName(false), red.GetColor() + blueKing.getLastDamager()); - boolean announcedMedalStart = false; - for (MedalType type : MedalType.values()) - { - Player[] rewarding = getMedalOwners(type); - if (rewarding[0] != null) - { - if (!announcedMedalStart) - { - announcedMedalStart = true; - Bukkit.broadcastMessage(C.cGoldB + "-==Match Medal Recipients==-"); - } - AddGems(rewarding[0], 50, MedalLevel.GOLD.getName() + " " + type.getName(), false, false); - AddStat(rewarding[0], "Medalist", 1, false, false); - Bukkit.broadcastMessage(MedalLevel.GOLD.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.GOLD.getColor() + rewarding[0].getName()); - } - if (rewarding[1] != null) - { - AddGems(rewarding[1], 30, MedalLevel.SILVER.getName() + " " + type.getName(), false, false); - AddStat(rewarding[1], "Medalist", 1, false, false); - Bukkit.broadcastMessage(MedalLevel.SILVER.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.SILVER.getColor() + rewarding[1].getName()); - } - if (rewarding[2] != null) - { - AddGems(rewarding[2], 20, MedalLevel.BRONZE.getName() + " " + type.getName(), false, false); - AddStat(rewarding[2], "Medalist", 1, false, false); - Bukkit.broadcastMessage(MedalLevel.BRONZE.getName() + " " + type.getName() + C.cGray + ": " + MedalLevel.BRONZE.getColor() + rewarding[2].getName()); - } - } for (GameTeam team : GetTeamList()) { for (Player player : team.GetPlayers(true)) @@ -957,16 +800,6 @@ public class ShockCastleSiege extends TeamGame } AddStat(player, GetKit(player).GetName() + "KitKills", 1, false, false); - _medalData.computeIfAbsent(player, key -> new MedalData()).addScore(MedalType.ELIM, 1D); - - for (TeamKing king : _kings.values()) - { - if (UtilMath.offsetSquared(player.getLocation(), king.getLocation()) <= 25) - { - _medalData.computeIfAbsent(player, key -> new MedalData()).addScore(MedalType.OBJECTIVE_KILL, 1D); - break; - } - } if (UtilPlayer.isSpectator(player)) { @@ -1215,7 +1048,6 @@ public class ShockCastleSiege extends TeamGame TeamKing king = _kings.get(owner); if (king.handleDamage(p.getName(), e.getDamage())) { - _medalData.computeIfAbsent(p, key -> new MedalData()).addScore(MedalType.KING_DMG, e.getDamage()); for (Player alert : owner.GetPlayers(true)) { if (Recharge.Instance.use(alert, "KingDamageAlert", 5000, false, false)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/ObjectiveTNTSpawner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/ObjectiveTNTSpawner.java index 648749147..70f9e2484 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/ObjectiveTNTSpawner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/ObjectiveTNTSpawner.java @@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilTime; public class ObjectiveTNTSpawner { + private static final long TNT_SPAWN_DELAY = 60000; private List _locs; private Location _lastSpawnLoc; private Item _entity; @@ -41,7 +42,7 @@ public class ObjectiveTNTSpawner public long getNextTNT() { - return (_lastPickedUp + 60000) - System.currentTimeMillis(); + return (_lastPickedUp + TNT_SPAWN_DELAY) - System.currentTimeMillis(); } public void spawn() @@ -64,7 +65,7 @@ public class ObjectiveTNTSpawner public void update() { - if (!isSpawned() && UtilTime.elapsed(_lastPickedUp, 60000)) + if (!isSpawned() && UtilTime.elapsed(_lastPickedUp, TNT_SPAWN_DELAY)) { spawn(); }