From b9a72312a80f43694337a964e616e486a6e6f66b Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 28 Jun 2017 00:21:47 +0100 Subject: [PATCH] Add a go back button on kit selection --- .../core/common/entity/ClientArmorStand.java | 6 +++ .../games/moba/boss/wither/WitherBoss.java | 5 +++ .../boss/wither/WitherBossOvertimeAI.java | 2 +- .../arcade/game/games/moba/kit/HeroSkill.java | 10 +++++ .../games/moba/overtime/OvertimeManager.java | 10 +++++ .../games/moba/prepare/PrepareSelection.java | 43 ++++++++++++++----- .../games/moba/training/MobaTraining.java | 1 + 7 files changed, 65 insertions(+), 12 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/entity/ClientArmorStand.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/entity/ClientArmorStand.java index 239f0af5c..385c9c3ce 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/entity/ClientArmorStand.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/entity/ClientArmorStand.java @@ -79,6 +79,12 @@ public class ClientArmorStand implements ArmorStand _observers = players; } + public void sendSpawnPacket(Player player) + { + Packet packet = new PacketPlayOutSpawnEntityLiving(_armorStand); + UtilPlayer.sendPacket(player, packet); + } + public EntityArmorStand getHandle() { return _armorStand; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/wither/WitherBoss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/wither/WitherBoss.java index d8595853a..22b4597d1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/wither/WitherBoss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/wither/WitherBoss.java @@ -253,4 +253,9 @@ public class WitherBoss extends MobaBoss { return _team; } + + public void setDamageable(boolean damageable) + { + _damageable = damageable; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/wither/WitherBossOvertimeAI.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/wither/WitherBossOvertimeAI.java index 9a710aaab..ea389a6a6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/wither/WitherBossOvertimeAI.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/wither/WitherBossOvertimeAI.java @@ -43,6 +43,6 @@ public class WitherBossOvertimeAI extends MobaAI _target = _path.get(_targetIndex); } - _aiMethod.updateMovement(_entity, _target, 3); + _aiMethod.updateMovement(_entity, _target, 2); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/HeroSkill.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/HeroSkill.java index 131714e73..9a6a9eaf8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/HeroSkill.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/HeroSkill.java @@ -323,6 +323,16 @@ public class HeroSkill extends Perk Recharge.Instance.useForce(player, GetName(), time, true); Recharge.Instance.setDisplayForce(player, GetName(), true); + Manager.runSyncTimer(new BukkitRunnable() + { + + @Override + public void run() + { + double percentage = + } + }, 0, 1); + Manager.runSyncTimer(new BukkitRunnable() { int iterations = 0; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/overtime/OvertimeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/overtime/OvertimeManager.java index 9e72823d5..9c2989fb4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/overtime/OvertimeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/overtime/OvertimeManager.java @@ -7,6 +7,8 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.moba.Moba; +import nautilus.game.arcade.game.games.moba.boss.MobaBoss; +import nautilus.game.arcade.game.games.moba.boss.wither.WitherBoss; import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -47,6 +49,14 @@ public class OvertimeManager implements Listener UtilTextMiddle.display(C.cRedB + "OVERTIME", "Victory or Death, Withers are moving to the center!"); _host.Announce(F.main("Game", "Victory or Death, Withers are moving to the center!"), false); + for (MobaBoss boss : _host.getBossManager().getBosses()) + { + if (boss instanceof WitherBoss) + { + ((WitherBoss) boss).setDamageable(true); + } + } + for (Player player : Bukkit.getOnlinePlayers()) { player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 1.2F); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/prepare/PrepareSelection.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/prepare/PrepareSelection.java index bad2ee430..a7c4b4e99 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/prepare/PrepareSelection.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/prepare/PrepareSelection.java @@ -1,9 +1,14 @@ package nautilus.game.arcade.game.games.moba.prepare; import mineplex.core.common.entity.ClientArmorStand; -import mineplex.core.common.util.*; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketHandler.ListenerPriority; @@ -18,6 +23,7 @@ import nautilus.game.arcade.game.games.moba.kit.HeroKit; import nautilus.game.arcade.game.games.moba.kit.RoleSelectEvent; import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; import org.bukkit.ChatColor; +import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -40,6 +46,7 @@ public class PrepareSelection implements Listener, IPacketHandler private final Moba _host; private final Map _roleStands = new HashMap<>(); private final Map _kitStands = new HashMap<>(); + private final Map _goBackStands = new HashMap<>(); public PrepareSelection(Moba host) { @@ -109,9 +116,21 @@ public class PrepareSelection implements Listener, IPacketHandler Location average = UtilAlg.getAverageLocation(team.GetSpawns()); MobaPlayer mobaPlayer = _host.getMobaData(player); - List heroKits = _host.getKits(mobaPlayer.getRole()); + Location goBack = spawns.remove("KIT " + team.GetName().toUpperCase() + " GO_BACK"); + ClientArmorStand goBackStand = ClientArmorStand.spawn(goBack.clone().add(0, 1, 0), player); + + goBackStand.setCustomNameVisible(true); + goBackStand.setCustomName(C.cGreenB + "Go Back"); + goBackStand.setArms(true); + goBackStand.setHelmet(new ItemStack(Material.SKULL_ITEM, (byte) 2)); + goBackStand.setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.MAROON).build()); + goBackStand.setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.MAROON).build()); + goBackStand.setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.MAROON).build()); + + _goBackStands.put(player, goBackStand); + UtilServer.runSyncLater(() -> { for (Location location : spawns.values()) @@ -169,6 +188,16 @@ public class PrepareSelection implements Listener, IPacketHandler Player player = packetInfo.getPlayer(); int entityId = packet.a; + ClientArmorStand goBackStand = _goBackStands.get(player); + + if (goBackStand != null) + { + packetInfo.setCancelled(true); + _host.getMobaData(player).setRole(null); + _goBackStands.remove(player).remove(); + return; + } + for (ClientArmorStand stand : _roleStands.keySet()) { if (stand.getEntityId() != entityId) @@ -199,15 +228,7 @@ public class PrepareSelection implements Listener, IPacketHandler return; } - if (team.GetColor() == ChatColor.RED) - { - spawnKitUI(player); - } - else - { - spawnKitUI(player); - } - + spawnKitUI(player); displayKitInformation(player, role); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/training/MobaTraining.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/training/MobaTraining.java index 49f0d3d91..af7f68465 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/training/MobaTraining.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/training/MobaTraining.java @@ -128,6 +128,7 @@ public class MobaTraining extends Moba // Prevent the wither from being damaged as well as to not spawn the pumpkin king _boss.setDummyBosses(true); + _overtimeManager.disableOvertime(); // Disable minions _minion.disableMinions();