diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 33bb61aff..a6b7c6157 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -382,30 +382,105 @@ public enum Achievement AchievementCategory.MASTER_BUILDERS), //Castle Siege - CASTLE_SIEGE_WINS("FOR THE KING!", 600, + CASTLE_SIEGE_WINS("FOR THE KING!", 0, new String[]{"Castle Siege.ForTheKing"}, new String[]{"Win as Defenders 50 times"}, + new int[][]{ new int[]{0,0,10000}}, new int[]{50}, + "", + new String[0], AchievementCategory.CASTLE_SIEGE), - CASTLE_SIEGE_KINGSLAYER("Kingslayer", 800, + CASTLE_SIEGE_KINGSLAYER("Kingslayer", 0, new String[]{"Castle Siege.KingSlayer"}, new String[]{"Get the killing blow on the King"}, + new int[][]{ new int[]{0,0,4000}}, new int[]{1}, + "", + new String[0], AchievementCategory.CASTLE_SIEGE), - CASTLE_SIEGE_BLOOD_THIRSTY("Blood Thirsty", 1200, + CASTLE_SIEGE_BLOOD_THIRSTY("Blood Thirsty", 0, new String[]{"Castle Siege.BloodThirsty"}, new String[]{"Kill 50 Undead in a single game"}, + new int[][]{ new int[]{0,0,8000}}, new int[]{1}, + "", + new String[0], AchievementCategory.CASTLE_SIEGE), - CASTLE_SIEGE_ASSASSIN("Assassin", 1000, + CASTLE_SIEGE_ASSASSIN("Assassin", 0, new String[]{"Castle Siege.Assassin"}, new String[]{"Do 50% or more of the damage to the king"}, + new int[][]{ new int[]{0,0,8000}}, new int[]{1}, + "", + new String[0], AchievementCategory.CASTLE_SIEGE), - + + CASTLE_SIEGE_CLOSE_CALL("Slash or Burn", 0, + new String[]{"Castle Siege.CloseCall"}, + new String[]{"Win the Game as Undead within the last 70 seconds of the game"}, + new int[][]{ new int[]{0,0,8000}}, + new int[]{1}, + "", + new String[0], + AchievementCategory.CASTLE_SIEGE), + + CASTLE_SIEGE_WOLF_KILL("Canine Revenge", 0, + new String[]{"Castle Siege.WolfKill"}, + new String[]{"As a Castle Wolf, Kill 12 Undead in One Game"}, + new int[][]{ new int[]{0,0,7000}}, + new int[]{1}, + "", + new String[0], + AchievementCategory.CASTLE_SIEGE), + + CASTLE_SIEGE_KING_GUARD("Royal Guard", 0, + new String[]{"Castle Siege.KingGuard"}, + new String[]{"Kill 5 Undead within 8 blocks of the King in One Game"}, + new int[][]{ new int[]{0,0,8000}}, + new int[]{1}, + "", + new String[0], + AchievementCategory.CASTLE_SIEGE), + + CASTLE_SIEGE_KING_FULL("Not Even a Scratch", 0, + new String[]{"Castle Siege.KingFull"}, + new String[]{"Win the Game as Defense with the King at Full Health"}, + new int[][]{ new int[]{0,0,8000}}, + new int[]{1}, + "", + new String[0], + AchievementCategory.CASTLE_SIEGE), + + CASTLE_SIEGE_FIRST_BLOOD("Vigilante", 0, + new String[]{"Castle Siege.FirstBlood"}, + new String[]{"Get 5 First Bloods"}, + new int[][]{ new int[]{0,0,6000}}, + new int[]{5}, + "", + new String[0], + AchievementCategory.CASTLE_SIEGE), + + CASTLE_SIEGE_TNT_KILLER("Defusal Squadron", 0, + new String[]{"Castle Siege.TNTKiller"}, + new String[]{"Kill 5 TNT Carriers in One Game as Defense"}, + new int[][]{ new int[]{0,0,7000}}, + new int[]{1}, + "", + new String[0], + AchievementCategory.CASTLE_SIEGE), + + CASTLE_SIEGE_HORSE_KILLER("Equestrian Elimination", 0, + new String[]{"Castle Siege.HorseKiller"}, + new String[]{"Kill 25 Horses"}, + new int[][]{ new int[]{0,0,6000}}, + new int[]{25}, + "", + new String[0], + AchievementCategory.CASTLE_SIEGE), + //Castle Assault CASTLE_ASSAULT_KILL_STREAK("Kill Streak", 0, new String[]{"Castle Assault.KillStreak", "Castle Assault TDM.KillStreak"}, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index fd7adbe9b..67a7d1f5d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -90,9 +90,31 @@ public enum AchievementCategory Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null, false, GameDisplay.CastleAssault.getGameId(), GameDisplay.CastleAssaultTDM.getGameId()), CASTLE_SIEGE("Castle Siege", null, - new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Kills as Defenders"), new StatDisplay("Deaths as Defenders"), - new StatDisplay("Kills as Undead"), new StatDisplay("Deaths as Undead"), StatDisplay.GEMS_EARNED }, - Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null, false, GameDisplay.CastleSiege.getGameId()), + new StatDisplay[] + { + StatDisplay.WINS, + StatDisplay.GAMES_PLAYED, + null, + new StatDisplay(C.Bold + "Total", true), + StatDisplay.KILLS, + new StatDisplay("Assists", "Defender Assists", "Undead Assists"), + StatDisplay.DEATHS, + null, + new StatDisplay(C.Bold + "Defenders", true), + null, + StatDisplay.fromGame("Kills", GameDisplay.CastleSiege, "Defenders Kills"), + StatDisplay.fromGame("Assists", GameDisplay.CastleSiege, "Defenders Assists"), + StatDisplay.fromGame("Deaths", GameDisplay.CastleSiege, "Defenders Deaths"), + null, + new StatDisplay(C.Bold + "Undead", true), + null, + StatDisplay.fromGame("Kills", GameDisplay.CastleSiege, "Undead Kills"), + StatDisplay.fromGame("Assists", GameDisplay.CastleSiege, "Undead Assists"), + StatDisplay.fromGame("Deaths", GameDisplay.CastleSiege, "Undead Deaths"), + null, + StatDisplay.GEMS_EARNED, + }, + Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, "Undead Summoner & Castle Paladin Kit", false, GameDisplay.CastleSiege.getGameId()), BAWK_BAWK_BATTLES("Bawk Bawk Battles", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementPage.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementPage.java index d68117cf7..2bb1180d9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementPage.java @@ -57,14 +57,15 @@ public class AchievementPage extends ShopPageBase achievements = getAchievements(); + int currentIndex = ACHIEVEMENT_MIDDLE_INDEX - (achievements.size() / 2); boolean hasAllAchievements = true; int achievementCount = 0; + boolean overflow = false; - ArrayList masterAchievementLore = new ArrayList(); + ArrayList masterAchievementLore = new ArrayList<>(); masterAchievementLore.add(" "); - List achievements = getAchievements(); for (Achievement achievement : achievements) { AchievementData data = getPlugin().get(_targetStats, achievement); @@ -93,13 +94,12 @@ public class AchievementPage extends ShopPageBase lore = new ArrayList(); + ArrayList lore = new ArrayList<>(); lore.add(" "); for (String descLine : achievement.getDesc()) { lore.add(ChatColor.RESET + descLine); } - if (!hasUnlocked && achievement.isOngoing()) { @@ -107,11 +107,64 @@ public class AchievementPage extends ShopPageBase 0) { lore.add(" "); lore.add(C.cYellow + "Reward: " + C.cGreen + achievement.getGemReward() + " Gems"); } + + if (!hasUnlocked && achievement.getLevelUpRewards().length > 0) + { + int[][] rewards = achievement.getLevelUpRewards(); + + if (data.getLevel() < rewards.length) + { + int[] thisRewards = rewards[data.getLevel()]; + int greaterThanZero = 0; + + for (int reward : thisRewards) + { + if (reward > 0) + { + greaterThanZero++; + } + } + + lore.add(" "); + + if (greaterThanZero == 1) + { + String rewardString = C.cYellow + "Reward: "; + + for (int i = 0; i < thisRewards.length; i++) + { + int reward = thisRewards[i]; + + if (reward > 0) + { + rewardString += getFormattedReward(reward, i); + break; + } + } + + lore.add(rewardString); + } + else + { + lore.add(C.cYellow + "Rewards:"); + + for (int i = 0; i < thisRewards.length; i++) + { + int reward = thisRewards[i]; + + if (reward > 0) + { + lore.add(C.cWhite + " - " + getFormattedReward(reward, i)); + } + } + } + } + } if (hasUnlocked && data.getLevel() == achievement.getMaxLevel()) { @@ -126,23 +179,28 @@ public class AchievementPage extends ShopPageBase 0) { - String itemName = ChatColor.RESET + _category.getFriendlyName() + " Master Achievement"; + String itemName = C.Bold + _category.getFriendlyName() + " Master Achievement"; masterAchievementLore.add(" "); if (getPlayer().getName().equalsIgnoreCase(_targetName)) { if (_category.getReward() != null) - masterAchievementLore.add(C.cYellow + C.Bold + "Reward: " + ChatColor.RESET + _category.getReward()); + masterAchievementLore.add(C.cYellow + "Reward: " + ChatColor.RESET + _category.getReward()); else - masterAchievementLore.add(C.cYellow + C.Bold + "Reward: " + ChatColor.RESET + "Coming Soon..."); + masterAchievementLore.add(C.cYellow + "Reward: " + ChatColor.RESET + "Coming Soon..."); } - addItem(40, new ShopItem(hasAllAchievements ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, (byte) 0, itemName, masterAchievementLore.toArray(new String[0]), 1, false, true)); + addItem(overflow ? 49 : 40, new ShopItem(hasAllAchievements ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, (byte) 0, itemName, masterAchievementLore.toArray(new String[0]), 1, false, true)); } addBackButton(); @@ -161,7 +219,6 @@ public class AchievementPage extends ShopPageBase getDefenders().HasPlayer(player), player -> UtilMath.offsetSquared(player, getKing().getEntity()) < 8 * 8), + new BloodThirstyStatTracker(this, "WolfKill", 12, this::isWolf, player -> true), + new BloodThirstyStatTracker(this, "BloodThirsty", 50, player -> true, player -> GetTeam(player).equals(getUndead())), + new TeamKillsStatTracker(this), + new TeamDeathsStatTracker(this) + ); + registerChatStats( Kills, Deaths, @@ -356,6 +369,12 @@ public class CastleSiegeNew extends TeamGame if (WorldTimeSet > DEFENDER_WIN_TIME || _undead.GetPlayers(true).isEmpty()) { + // King at full health + if (king.getHealth() == king.getMaxHealth()) + { + _defenders.GetPlayers(true).forEach(player -> AddStat(player, "KingFull", 1, true, false)); + } + SetCustomWinLine(king.getCustomName() + C.Reset + " has survived the siege!"); AnnounceEnd(_defenders); } @@ -396,6 +415,20 @@ public class CastleSiegeNew extends TeamGame { winLine += "was killed by " + _undead.GetColor() + _king.getLastDamager().getName() + C.Reset + " while " + _undead.GetColor() + mostDamager.getName() + C.Reset + " dealt most of the damage!"; } + + // 50%+ damage to the king + if (mostDamage >= (king.getMaxHealth() - king.getHealth()) * 0.5) + { + AddStat(mostDamager, "Assassin", 1, true, false); + } + + // Player who killed the king + AddStat(_king.getLastDamager(), "KingSlayer", 1, true, false); + } + + if (WorldTimeSet > UNDEAD_BURN_TIME - 60 * 20) + { + _undead.GetPlayers(true).forEach(player -> AddStat(player, "CloseCall", 1, true, false)); } SetCustomWinLine(winLine); @@ -478,10 +511,13 @@ public class CastleSiegeNew extends TeamGame Kit kit = GetKit(event.getPlayer()); - if (kit == null || !(kit instanceof KitUndeadArcher)) - { - event.setCancelled(true); - } + event.setCancelled(kit == null || !(kit instanceof KitUndeadArcher)); + } + + @EventHandler + public void firstBlood(FirstBloodEvent event) + { + AddStat(event.getPlayer(), "FirstBlood", 1, true, false); } @EventHandler @@ -508,6 +544,11 @@ public class CastleSiegeNew extends TeamGame return _wolves.contains(player); } + public CastleSiegeKing getKing() + { + return _king; + } + public GameTeam getDefenders() { return _defenders; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/CastleSiegeTNTManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/CastleSiegeTNTManager.java index 3429631ba..72b0df01a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/CastleSiegeTNTManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/CastleSiegeTNTManager.java @@ -35,8 +35,10 @@ import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import java.util.Arrays; @@ -148,7 +150,7 @@ public class CastleSiegeTNTManager implements Listener MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); player.sendMessage(F.main("Game", "You picked up " + F.skill("TNT") + ".")); - player.sendMessage(F.main("Game", "Clicking will detonate yourself.")); + player.sendMessage(F.main("Game", F.elem("Click") + " to " + F.skill("Detonate") + " yourself.")); _tntCarrier.put(player, System.currentTimeMillis()); } @@ -211,7 +213,15 @@ public class CastleSiegeTNTManager implements Listener @EventHandler public void playerDeath(PlayerDeathEvent event) { - detonate(event.getEntity(), false); + Player killed = event.getEntity(); + Player killer = killed.getKiller(); + + if (killer != null && _tntCarrier.containsKey(killed)) + { + _host.AddStat(killer, "TNTKiller", 1, false, false); + } + + detonate(killed, false); } @EventHandler @@ -240,6 +250,7 @@ public class CastleSiegeTNTManager implements Listener else { _tntCarrier.remove(player); + player.getInventory().setHelmet(null); } return; @@ -302,4 +313,16 @@ public class CastleSiegeTNTManager implements Listener restore.add(block, Material.AIR.getId(), (byte) 0, (long) (REGENERATION_TIME + (block.getLocation().getBlockY() - lowestY) * 2000 + Math.random() * 1750)); } } + + @EventHandler + public void tntClick(InventoryClickEvent event) + { + Inventory inventory = event.getClickedInventory(); + ItemStack itemStack = event.getCurrentItem(); + + if (inventory != null && itemStack != null && itemStack.getType() == Material.TNT) + { + event.setCancelled(true); + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitCastleSiege.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitCastleSiege.java index 1898bfa0e..024978df7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitCastleSiege.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitCastleSiege.java @@ -5,12 +5,14 @@ import mineplex.core.disguise.disguises.DisguiseInsentient; import mineplex.core.disguise.disguises.DisguiseSkeleton; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.castlesiegenew.CastleSiegeNew; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.inventory.ItemStack; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanKnight.java index ae5f9b8fd..c46ddb126 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanKnight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanKnight.java @@ -32,44 +32,46 @@ public class KitHumanKnight extends KitCastleSiege }, { new PerkMammoth(), - new PerkConstructor("Constructor", 40, 2, Material.FENCE, "Castle Barricade", true) + new PerkConstructor("Constructor", 38, 2, Material.FENCE, "Castle Barricade", true) }, { new PerkMammoth(), - new PerkConstructor("Constructor", 40, 2, Material.FENCE, "Castle Barricade", true) + new PerkConstructor("Constructor", 36, 2, Material.FENCE, "Castle Barricade", true) }, { new PerkMammoth(), - new PerkConstructor("Constructor", 40, 3, Material.FENCE, "Castle Barricade", true) + new PerkConstructor("Constructor", 34, 3, Material.FENCE, "Castle Barricade", true) }, { new PerkMammoth(), - new PerkConstructor("Constructor", 40, 3, Material.FENCE, "Castle Barricade", true) + new PerkConstructor("Constructor", 30, 3, Material.FENCE, "Castle Barricade", true) }, { new PerkMammoth(), - new PerkConstructor("Constructor", 40, 3, Material.FENCE, "Castle Barricade", true) + new PerkConstructor("Constructor", 25, 3, Material.FENCE, "Castle Barricade", true) } }; - private static final String REDUCE_COOLDOWN = reduceCooldown("Constructor", 4); + private static final String REDUCE_COOLDOWN_2 = reduceCooldown("Constructor", 2); + private static final String REDUCE_COOLDOWN_4 = reduceCooldown("Constructor", 4); + private static final String REDUCE_COOLDOWN_5 = reduceCooldown("Constructor", 5); private static final String[][] UPGRADES = { { - REDUCE_COOLDOWN + REDUCE_COOLDOWN_2 }, { - REDUCE_COOLDOWN + REDUCE_COOLDOWN_2 }, { - REDUCE_COOLDOWN, + REDUCE_COOLDOWN_2, increaseNumber("Constructor", "Maximum Fences", 1, "Fences") }, { - REDUCE_COOLDOWN, + REDUCE_COOLDOWN_4, receiveItem("Diamond Helmet", 1) }, { - REDUCE_COOLDOWN, + REDUCE_COOLDOWN_5, receiveItem("Diamond Chestplate", 1) } }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanMarksman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanMarksman.java index eaca735a2..296068bf9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanMarksman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanMarksman.java @@ -32,40 +32,41 @@ public class KitHumanMarksman extends KitCastleSiege new PerkBarrage(5, 250, true, false), new PerkFletcher(2, 4, false), }, + { + new PerkBarrage(5, 250, true, false), + new PerkFletcher(1, 4, false), + }, + { + new PerkBarrage(6, 250, true, false), + new PerkFletcher(1, 4, false), + }, { new PerkBarrage(7, 250, true, false), - new PerkFletcher(2, 4, false), + new PerkFletcher(1, 4, false), }, { new PerkBarrage(9, 250, true, false), - new PerkFletcher(2, 4, false), - }, - { - new PerkBarrage(11, 250, true, false), - new PerkFletcher(2, 4, false), - }, - { - new PerkBarrage(11, 250, true, false), new PerkFletcher(1, 4, false), } }; - private static final String MORE_BARRAGE_ARROWS = increaseNumber("Barrage", "Arrows Fired", 2, "Arrows"); + private static final String MORE_BARRAGE_ARROWS_1 = increaseNumber("Barrage", "Arrows Fired", 2, "Arrows"); + private static final String MORE_BARRAGE_ARROWS_2 = increaseNumber("Barrage", "Arrows Fired", 2, "Arrows"); private static final String[][] UPGRADES = { { receiveItem("2 Extra Mushroom Stews", 1) }, - { - MORE_BARRAGE_ARROWS - }, - { - MORE_BARRAGE_ARROWS - }, - { - MORE_BARRAGE_ARROWS - }, { reduceCooldown("Fletched Arrows", 1) + }, + { + MORE_BARRAGE_ARROWS_1 + }, + { + MORE_BARRAGE_ARROWS_1 + }, + { + MORE_BARRAGE_ARROWS_2 } }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanPaladin.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanPaladin.java index d6d62075c..9c51df343 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanPaladin.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanPaladin.java @@ -25,57 +25,57 @@ public class KitHumanPaladin extends KitCastleSiege "", click(false, "your sword") + " to give buffs to nearby humans and wolves", "Wolves receive " + C.cGreen + "Speed I" + C.cWhite + " and Humans receive " + C.cGreen + "Resistance I", - "Take " + C.cGreen + "20%" + C.cWhite + " less damage from attacks", + "Take " + C.cGreen + "10%" + C.cWhite + " less damage from attacks", }; private static final String BOOST = C.cGreen + "Morale Royale" + C.cWhite; private static final int EIGHT_TICKS = 8 * 20; - private static final int TEN_TICKS = 8 * 20; - private static final int TWELEVE_TICKS = 8 * 20; + private static final int NINE_TICKS = 9 * 20; + private static final int TEN_TICKS = 10 * 20; private static final Perk[][] PERKS = { { - new PerkIronSkin(0.2, true), + new PerkIronSkin(0.1, true), new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(28), new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, EIGHT_TICKS, 0, false, false) ) }, { - new PerkIronSkin(0.2, true), + new PerkIronSkin(0.1, true), new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(28), - new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TEN_TICKS, 0, false, false), - new PotionEffect(PotionEffectType.REGENERATION, TEN_TICKS, 0, false, false) + new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, NINE_TICKS, 0, false, false), + new PotionEffect(PotionEffectType.REGENERATION, NINE_TICKS, 0, false, false) ) }, { - new PerkIronSkin(0.2, true), - new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(26), + new PerkIronSkin(0.1, true), + new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(27), + new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, NINE_TICKS, 0, false, false), + new PotionEffect(PotionEffectType.REGENERATION, NINE_TICKS, 0, false, false), + new PotionEffect(PotionEffectType.HEALTH_BOOST, NINE_TICKS, 0, false, false) + ) + }, + { + new PerkIronSkin(0.1, true), + new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(27), new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TEN_TICKS, 0, false, false), - new PotionEffect(PotionEffectType.REGENERATION, TEN_TICKS, 0, false, false), + new PotionEffect(PotionEffectType.REGENERATION, TEN_TICKS, 1, false, false), + new PotionEffect(PotionEffectType.HEALTH_BOOST, TEN_TICKS, 0, false, false) + ) + }, + { + new PerkIronSkin(0.1, true), + new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(26), + new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TEN_TICKS, 1, false, false), + new PotionEffect(PotionEffectType.REGENERATION, TEN_TICKS, 1, false, false), new PotionEffect(PotionEffectType.HEALTH_BOOST, TEN_TICKS, 0, false, false) ) }, - { - new PerkIronSkin(0.2, true), - new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(26), - new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TWELEVE_TICKS, 0, false, false), - new PotionEffect(PotionEffectType.REGENERATION, TWELEVE_TICKS, 1, false, false), - new PotionEffect(PotionEffectType.HEALTH_BOOST, TWELEVE_TICKS, 0, false, false) - ) - }, { new PerkIronSkin(0.2, true), new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(24), - new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TWELEVE_TICKS, 1, false, false), - new PotionEffect(PotionEffectType.REGENERATION, TWELEVE_TICKS, 1, false, false), - new PotionEffect(PotionEffectType.HEALTH_BOOST, TWELEVE_TICKS, 0, false, false) - ) - }, - { - new PerkIronSkin(0.4, true), - new PerkPaladinBoost(TimeUnit.SECONDS.toMillis(24), - new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TWELEVE_TICKS, 1, false, false), - new PotionEffect(PotionEffectType.REGENERATION, TWELEVE_TICKS, 1, false, false), - new PotionEffect(PotionEffectType.HEALTH_BOOST, TWELEVE_TICKS, 1, false, false) + new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, TEN_TICKS, 1, false, false), + new PotionEffect(PotionEffectType.REGENERATION, TEN_TICKS, 1, false, false), + new PotionEffect(PotionEffectType.HEALTH_BOOST, TEN_TICKS, 1, false, false) ) } }; @@ -85,8 +85,8 @@ public class KitHumanPaladin extends KitCastleSiege return BOOST + " gives " + C.cGreen + effect; } - private static final String REDUCE_COOLDOWN = reduceCooldown(BOOST, 2); - private static final String INCREASE_LENGTH = increaseNumber(BOOST, "Buff Length", 2, "seconds"); + private static final String REDUCE_COOLDOWN = reduceCooldown(BOOST, 1); + private static final String INCREASE_LENGTH = increaseNumber(BOOST, "Buff Length", 1, "seconds"); private static final String[][] UPGRADES = { { @@ -106,7 +106,7 @@ public class KitHumanPaladin extends KitCastleSiege giveEffect("Resistance II") }, { - C.cWhite + "Take " + C.cGreen + "40%" + C.cWhite + " less damage from attacks", + C.cWhite + "Take " + C.cGreen + "20%" + C.cWhite + " less damage from attacks", giveEffect("Health Boost II") } }; @@ -114,7 +114,7 @@ public class KitHumanPaladin extends KitCastleSiege private static final ItemStack[] PLAYER_ITEMS = { ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD), ItemStackFactory.Instance.CreateStack(Material.BOW), - ItemStackFactory.Instance.CreateStack(Material.ARROW, 64), + ItemStackFactory.Instance.CreateStack(Material.ARROW, 48), ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), @@ -122,9 +122,9 @@ public class KitHumanPaladin extends KitCastleSiege }; private static final ItemStack[] ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE), ItemStackFactory.Instance.CreateStack(Material.GOLD_HELMET) }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanWolf.java index 08913f669..30b72a660 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitHumanWolf.java @@ -106,7 +106,7 @@ public class KitHumanWolf extends KitCastleSiege disguise(player, DisguiseWolf.class); } - @EventHandler(priority = EventPriority.HIGH) + @EventHandler(priority = EventPriority.HIGHEST) public void damage(CustomDamageEvent event) { if (event.isCancelled() || !Manager.GetGame().IsLive()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitUndeadArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitUndeadArcher.java index 362955576..c1f53a18d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitUndeadArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitUndeadArcher.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.castlesiegenew.kits; import mineplex.core.common.util.C; import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.gadget.gadgets.particle.king.CastleManager; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; @@ -9,6 +10,7 @@ import nautilus.game.arcade.kit.perks.PerkFletcher; import nautilus.game.arcade.kit.perks.PerkIronSkin; import org.bukkit.Material; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitUndeadGhoul.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitUndeadGhoul.java index 0c104638f..3034eb8e6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitUndeadGhoul.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitUndeadGhoul.java @@ -9,6 +9,7 @@ import nautilus.game.arcade.kit.perks.PerkLeap; import nautilus.game.arcade.kit.perks.PerkSpeed; import org.bukkit.Material; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitUndeadSummoner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitUndeadSummoner.java index 1e6c51a83..587a2188a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitUndeadSummoner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/kits/KitUndeadSummoner.java @@ -10,6 +10,7 @@ import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/perks/PerkMobPotions.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/perks/PerkMobPotions.java index acc777ed5..98f4bd9db 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/perks/PerkMobPotions.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/perks/PerkMobPotions.java @@ -8,7 +8,9 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.castlesiegenew.CastleSiegeNew; import nautilus.game.arcade.kit.Perk; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -82,13 +84,18 @@ public class PerkMobPotions extends Perk } } - if (clickedPotion == null || !Recharge.Instance.use(player, ChatColor.stripColor(clickedPotion.getItemStack().getItemMeta().getDisplayName()), _cooldown, true, true)) + if (clickedPotion == null) { return; } event.setCancelled(true); + if (!Recharge.Instance.use(player, ChatColor.stripColor(clickedPotion.getItemStack().getItemMeta().getDisplayName()), _cooldown, true, true)) + { + return; + } + Manager.GetGame().CreatureAllowOverride = true; Location location = player.getEyeLocation(); @@ -97,15 +104,6 @@ public class PerkMobPotions extends Perk _thrownPotions.put(potion, Pair.create(player, clickedPotion)); -// if (itemStack.getAmount() > 1) -// { -// itemStack.setAmount(itemStack.getAmount() - 1); -// } -// else -// { -// player.setItemInHand(null); -// } - Manager.GetGame().CreatureAllowOverride = false; } @@ -180,7 +178,7 @@ public class PerkMobPotions extends Perk } @EventHandler - public void entityTarget(EntityDeathEvent event) + public void entityDeath(EntityDeathEvent event) { for (SummonedEntity entity : _entities) { @@ -195,6 +193,27 @@ public class PerkMobPotions extends Perk } } + @EventHandler + public void entityDamage(CustomDamageEvent event) + { + for (SummonedEntity entity : _entities) + { + if (entity.Summoned.equals(event.GetDamageeEntity())) + { + Player damager = event.GetDamagerPlayer(true); + CastleSiegeNew game = (CastleSiegeNew) Manager.GetGame(); + + if (damager == null || !game.getUndead().HasPlayer(damager)) + { + return; + } + + event.SetCancelled("Team Mob"); + return; + } + } + } + public MobPotion[] getMobPotions() { return _mobPotions; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/perks/PerkPaladinBoost.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/perks/PerkPaladinBoost.java index aaa19bacb..ea87c4796 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/perks/PerkPaladinBoost.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiegenew/perks/PerkPaladinBoost.java @@ -55,7 +55,7 @@ public class PerkPaladinBoost extends Perk CastleSiegeNew game = (CastleSiegeNew) Manager.GetGame(); GameTeam team = game.GetTeam(player); - player.sendMessage(F.main("Game", "You used " + F.name(GetName()) + ".")); + player.sendMessage(F.main("Game", "You used " + F.skill(GetName()) + ".")); for (Player nearby : UtilPlayer.getNearby(player.getLocation(), RADIUS)) { @@ -64,7 +64,7 @@ public class PerkPaladinBoost extends Perk continue; } - UtilParticle.PlayParticleToAll(ParticleType.HEART, nearby.getLocation().add(0, 1, 0), 1, 1, 1, 0.01F, 8, ViewDist.LONG); + UtilParticle.PlayParticleToAll(ParticleType.HEART, nearby.getLocation().add(0, 1.2, 0), 0.5F, 0.5F, 0.5F, 0.01F, 8, ViewDist.LONG); nearby.playSound(nearby.getLocation(), Sound.ZOMBIE_REMEDY, 1, 0.6F); nearby.sendMessage(F.main("Game", "Paladin " + F.name(player.getName()) + " has given you buffs!")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BloodThirstyStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BloodThirstyStatTracker.java index c6df42427..7d440d1bd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BloodThirstyStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BloodThirstyStatTracker.java @@ -1,64 +1,74 @@ package nautilus.game.arcade.stats; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.core.combat.CombatComponent; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.arcade.game.Game; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import mineplex.core.common.util.UtilPlayer; -import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.games.castlesiege.kits.KitUndead; -import nautilus.game.arcade.game.games.hideseek.kits.KitSeeker; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import java.util.function.Predicate; public class BloodThirstyStatTracker extends StatTracker { - private final Map _kills = new HashMap<>(); - public BloodThirstyStatTracker(Game game) + private final Map _kills = new HashMap<>(); + private final String _stat; + private final int _amount; + private final Predicate _validKiller; + private final Predicate _validKilled; + + public BloodThirstyStatTracker(Game game, String stat, int amount, Predicate validKiller, Predicate validKilled) { super(game); + + _stat = stat; + _amount = amount; + _validKiller = validKiller; + _validKilled = validKilled; } - @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.MONITOR) public void onCombatDeath(CombatDeathEvent event) { - if (getGame().GetState() != Game.GameState.Live) - return; + CombatComponent player = event.GetLog().GetPlayer(); + CombatComponent killer = event.GetLog().GetKiller(); - if (event.GetLog().GetKiller() == null) - return; - - if (!event.GetLog().GetKiller().IsPlayer()) - return; - - Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); - if (killer == null) - return; - - if (event.GetLog().GetPlayer() == null) - return; - - if (!event.GetLog().GetPlayer().IsPlayer()) - return; - - Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName()); - if (player == null) - return; - - if (getGame().GetKit(player) instanceof KitUndead) + if (!getGame().IsLive() || player == null || killer == null || !player.IsPlayer() || !killer.IsPlayer()) { - Integer kills = _kills.get(killer.getUniqueId()); + return; + } - kills = (kills == null ? 0 : kills) + 1; + Player killerPlayer = UtilPlayer.searchExact(killer.GetName()); - _kills.put(killer.getUniqueId(), kills); + if (killerPlayer == null) + { + return; + } - if (kills >= 50) - addStat(killer, "BloodThirsty", 1, true, false); + Player killedPlayer = UtilPlayer.searchExact(player.GetName()); + + if (killedPlayer == null) + { + return; + } + + if (_validKiller != null && !_validKiller.test(killerPlayer) || _validKilled != null && !_validKilled.test(killedPlayer)) + { + return; + } + + int newKills = _kills.getOrDefault(killerPlayer.getUniqueId(), 0) + 1; + + _kills.put(killerPlayer.getUniqueId(), newKills); + + if (newKills >= _amount) + { + addStat(killerPlayer, _stat, 1, true, false); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamDeathsStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamDeathsStatTracker.java index 9993278b3..29f94cbf2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamDeathsStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamDeathsStatTracker.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.stats; +import mineplex.minecraft.game.core.combat.CombatComponent; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -16,28 +17,26 @@ public class TeamDeathsStatTracker extends StatTracker super(game); } - @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.MONITOR) public void onCombatDeath(CombatDeathEvent event) { - if (getGame().GetState() != Game.GameState.Live) + CombatComponent component = event.GetLog().GetPlayer(); + + if (!getGame().IsLive() || getGame().GetTeamList().size() < 2 || component == null || !component.IsPlayer()) + { return; + } - if (getGame().GetTeamList().size() < 2) - return; + Player player = UtilPlayer.searchExact(component.GetName()); - if (event.GetLog().GetPlayer() == null) - return; + if (player != null) + { + GameTeam team = getGame().GetTeam(player); - if (!event.GetLog().GetPlayer().IsPlayer()) - return; - - Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName()); - if (player == null) - return; - - GameTeam team = getGame().GetTeam(player); - - if (team != null && team.GetName() != null) - addStat(player, team.GetName() + " Deaths", 1, false, false); + if (team != null && team.GetName() != null) + { + addStat(player, team.GetName() + " Deaths", 1, false, false); + } + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamKillsStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamKillsStatTracker.java index 1a8080ac5..2f804919a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamKillsStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TeamKillsStatTracker.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.stats; +import mineplex.minecraft.game.core.combat.CombatComponent; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -11,33 +12,54 @@ import nautilus.game.arcade.game.GameTeam; public class TeamKillsStatTracker extends StatTracker { + public TeamKillsStatTracker(Game game) { super(game); } - @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.MONITOR) public void onCombatDeath(CombatDeathEvent event) { - if (getGame().GetState() != Game.GameState.Live) + CombatComponent killer = event.GetLog().GetKiller(); + + if (!getGame().IsLive() || getGame().GetTeamList().size() < 2 || killer == null || !killer.IsPlayer()) + { return; + } - if (getGame().GetTeamList().size() < 2) - return; + Player player = UtilPlayer.searchExact(killer.GetName()); - if (event.GetLog().GetKiller() == null) - return; + if (player != null) + { + GameTeam team = getGame().GetTeam(player); - if (!event.GetLog().GetKiller().IsPlayer()) - return; + if (team != null && team.GetName() != null) + { + addStat(player, team.GetName() + " Kills", 1, false, false); + } + } - Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); - if (player == null) - return; + for (CombatComponent attacker : event.GetLog().GetAttackers()) + { + if (!attacker.IsPlayer() || killer.equals(attacker)) + { + continue; + } - GameTeam team = getGame().GetTeam(player); + Player assist = UtilPlayer.searchExact(attacker.GetName()); - if (team != null && team.GetName() != null) - addStat(player, team.GetName() + " Kills", 1, false, false); + if (assist == null) + { + continue; + } + + GameTeam team = getGame().GetTeam(assist); + + if (team != null && team.GetName() != null) + { + addStat(assist, team.GetName() + " Assists", 1, false, false); + } + } } }