From 98f9a58849d3a7618f9a54cbd590419b01e1e60f Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 23 Jun 2017 14:12:36 +0100 Subject: [PATCH 1/9] Fix light arrows being able to damage yourself --- .../arcade/game/games/moba/kit/rowena/SkillLightArrows.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/rowena/SkillLightArrows.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/rowena/SkillLightArrows.java index 4756d65eb..31111ba47 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/rowena/SkillLightArrows.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/rowena/SkillLightArrows.java @@ -140,7 +140,7 @@ public class SkillLightArrows extends HeroSkill for (LivingEntity entity : UtilEnt.getInRadius(lineParticle.getLastLocation(), 1.5).keySet()) { - if (Recharge.Instance.use(player, GetName() + entity.getUniqueId(), 500, false, false)) + if (!isTeamDamage(entity, player) && Recharge.Instance.use(player, GetName() + entity.getUniqueId(), 500, false, false)) { player.playSound(player.getLocation(), Sound.SUCCESSFUL_HIT, 1, 0.8F); Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, damage, true, true, false, player.getName(), GetName()); From 3c031c70a1986d599ce9f90a8505d142be8b3920 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 24 Jun 2017 10:09:52 +0100 Subject: [PATCH 2/9] Fix training lobby bugs --- .../nautilus/game/arcade/game/games/moba/Moba.java | 2 +- .../game/arcade/game/games/moba/kit/HeroSkill.java | 6 ++++-- .../game/games/moba/training/MobaTraining.java | 14 ++++++++++++-- .../game/games/moba/training/SelectKitMenu.java | 5 +++++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java index 66274c97e..b5241e7b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java @@ -75,7 +75,7 @@ public class Moba extends TeamGame private final HeroKit[] _kits; - private final Set _playerData = new HashSet<>(); + protected final Set _playerData = new HashSet<>(); private final Set _listeners = new HashSet<>(); protected final MobaShop _shop; 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 4668d565d..131714e73 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 @@ -107,13 +107,15 @@ public class HeroSkill extends Perk _item = new ItemBuilder(_item) .setTitle((action != null ? C.cYellowB + action + C.cGray + " - " : "") + C.cGreenB + GetName()) - .setLore(GetDesc()) + .setLore() + .addLore(GetDesc()) .setUnbreakable(true) .build(); _cooldownItem = new ItemBuilder(Material.INK_SACK, (byte) 8) .setTitle(C.cRed + GetName()) - .setLore(GetDesc()) + .setLore() + .addLore(GetDesc()) .setUnbreakable(true) .build(); } 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 1b68e0af7..49f0d3d91 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 @@ -34,6 +34,7 @@ import org.bukkit.entity.Villager; import org.bukkit.entity.Villager.Profession; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractAtEntityEvent; +import org.bukkit.event.player.PlayerJoinEvent; import java.util.HashMap; import java.util.List; @@ -119,7 +120,7 @@ public class MobaTraining extends Moba DamageTeamSelf = true; DamageFall = false; DeathOut = false; - DeathSpectateSecs = 0; + DeathSpectateSecs = 2; PrepareTime = 500; GiveClock = false; HideTeamSheep = true; @@ -171,7 +172,7 @@ public class MobaTraining extends Moba { suffix = C.cYellow + " Unknown"; } - else if (mobaPlayer.getKit() == null) + else if (mobaPlayer == null || mobaPlayer.getKit() == null) { suffix = C.cYellow + " Selecting"; } @@ -333,6 +334,15 @@ public class MobaTraining extends Moba } } + @EventHandler + public void plaeyrJoin(PlayerJoinEvent event) + { + if (InProgress()) + { + _playerData.add(new MobaPlayer(event.getPlayer())); + } + } + @EventHandler public void spawnTutorial(GameStateChangeEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/training/SelectKitMenu.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/training/SelectKitMenu.java index 6b1287d6e..2c2efadf3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/training/SelectKitMenu.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/training/SelectKitMenu.java @@ -31,6 +31,11 @@ public class SelectKitMenu extends Menu for (int slot : slots) { HeroKit kit = (HeroKit) moba.GetKits()[i++]; + + if (!kit.isVisible()) + { + continue; + } ItemBuilder builder = new ItemBuilder(kit.getSkinData().getSkull()); builder.setTitle(C.cGreen + kit.GetName()); From a79c79bc998216eec307fc5cd58ed2c01801fffd Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 27 Jun 2017 12:38:43 +0100 Subject: [PATCH 3/9] Add wither overtime --- .../game/arcade/game/games/moba/Moba.java | 15 ++++- .../arcade/game/games/moba/ai/MobaAI.java | 4 +- .../games/moba/boss/wither/WitherBoss.java | 23 +++++++ .../boss/wither/WitherBossOvertimeAI.java | 48 +++++++++++++++ .../game/games/moba/minion/MinionManager.java | 13 ++++ .../games/moba/overtime/OvertimeManager.java | 60 +++++++++++++++++++ 6 files changed, 159 insertions(+), 4 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/wither/WitherBossOvertimeAI.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/overtime/OvertimeManager.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java index b5241e7b7..f1db74bae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java @@ -41,8 +41,7 @@ import nautilus.game.arcade.game.games.moba.kit.hp.HPManager; import nautilus.game.arcade.game.games.moba.kit.larissa.HeroLarissa; import nautilus.game.arcade.game.games.moba.kit.rowena.HeroRowena; import nautilus.game.arcade.game.games.moba.minion.MinionManager; -import nautilus.game.arcade.game.games.moba.prepare.PrepareManager; -import nautilus.game.arcade.game.games.moba.prepare.PrepareSelection; +import nautilus.game.arcade.game.games.moba.overtime.OvertimeManager; import nautilus.game.arcade.game.games.moba.shop.MobaShop; import nautilus.game.arcade.game.games.moba.structure.point.CapturePointManager; import nautilus.game.arcade.game.games.moba.structure.tower.TowerManager; @@ -81,6 +80,7 @@ public class Moba extends TeamGame protected final MobaShop _shop; protected final GoldManager _goldManager; protected final BossManager _boss; + protected final OvertimeManager _overtimeManager; protected final BuffManager _buffs; protected final ArrowKBManager _arrowKb; protected final TowerManager _tower; @@ -116,6 +116,7 @@ public class Moba extends TeamGame _shop = registerManager(new MobaShop(this)); _goldManager = registerManager(new GoldManager(this)); _boss = registerManager(new BossManager(this)); + _overtimeManager = registerManager(new OvertimeManager(this)); _buffs = registerManager(new BuffManager()); _arrowKb = registerManager(new ArrowKBManager(this)); _minion = registerManager(new MinionManager(this)); @@ -496,6 +497,11 @@ public class Moba extends TeamGame return _goldManager; } + public OvertimeManager getOvertimeManager() + { + return _overtimeManager; + } + public BuffManager getBuffManager() { return _buffs; @@ -520,4 +526,9 @@ public class Moba extends TeamGame { return _arrowKb; } + + public MinionManager getMinionManager() + { + return _minion; + } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/ai/MobaAI.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/ai/MobaAI.java index 5b89b9884..1ad97af9e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/ai/MobaAI.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/ai/MobaAI.java @@ -23,11 +23,11 @@ public class MobaAI private final float _speedHome; private final Polygon2D _boundaries; - private LivingEntity _entity; + protected LivingEntity _entity; private LivingEntity _target; private Location _home; - private MobaAIMethod _aiMethod; + protected MobaAIMethod _aiMethod; public MobaAI(Moba host, GameTeam owner, LivingEntity entity, Location home, float speedTarget, float speedHome, MobaAIMethod aiMethod) { 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 8d80c7f5e..d8595853a 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 @@ -46,6 +46,7 @@ public class WitherBoss extends MobaBoss private final GameTeam _team; private MobaAI _ai; + private MobaAI _aiOvertime; private DisguiseWither _disguise; private boolean _damageable; private long _lastInform; @@ -70,6 +71,7 @@ public class WitherBoss extends MobaBoss stand.setHealth(INITIAL_HEALTH * 0.1); stand.setGravity(false); + MobaUtil.setTeamEntity(stand, _team); UtilEnt.setBoundingBox(stand, 3, 5); _disguise = new DisguiseWither(stand); @@ -87,10 +89,31 @@ public class WitherBoss extends MobaBoss { _ai = new MobaAI(_host, _team, _entity, _location, SPEED_TARGET, SPEED_HOME, AI_METHOD); } + else if (_host.getOvertimeManager().isOvertime()) + { + if (_aiOvertime == null) + { + _aiOvertime = new WitherBossOvertimeAI(_host, _team, _entity, _location, SPEED_TARGET, SPEED_HOME, AI_METHOD); + } + + return _aiOvertime; + } return _ai; } + @Override + @EventHandler + public void updateMovement(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK || !_host.IsLive()) + { + return; + } + + getAi().updateTarget(); + } + @Override public String getName() { 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 new file mode 100644 index 000000000..9a710aaab --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/wither/WitherBossOvertimeAI.java @@ -0,0 +1,48 @@ +package nautilus.game.arcade.game.games.moba.boss.wither; + +import mineplex.core.common.util.UtilMath; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.moba.Moba; +import nautilus.game.arcade.game.games.moba.ai.MobaAI; +import nautilus.game.arcade.game.games.moba.ai.goal.MobaAIMethod; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.entity.LivingEntity; + +import java.util.List; + +public class WitherBossOvertimeAI extends MobaAI +{ + + private List _path; + private Location _target; + private int _targetIndex; + + public WitherBossOvertimeAI(Moba host, GameTeam owner, LivingEntity entity, Location home, float speedTarget, float speedHome, MobaAIMethod aiMethod) + { + super(host, owner, entity, home, speedTarget, speedHome, aiMethod); + + _path = host.getMinionManager().getPath(owner.GetColor() == ChatColor.RED); + _path = _path.subList(0, (int) (_path.size() / 2D)); + } + + @Override + public void updateTarget() + { + if (_target == null) + { + _target = _path.get(0); + _targetIndex = 0; + } + + double dist = UtilMath.offsetSquared(_target, _entity.getLocation()); + + if (dist < 16 && _targetIndex < _path.size() - 1) + { + _targetIndex++; + _target = _path.get(_targetIndex); + } + + _aiMethod.updateMovement(_entity, _target, 3); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/minion/MinionManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/minion/MinionManager.java index 9e3790713..efdb7356b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/minion/MinionManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/minion/MinionManager.java @@ -22,6 +22,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -181,4 +182,16 @@ public class MinionManager implements Listener // sign.update(); // } } + + public List getPath(boolean redTeam) + { + List path = new ArrayList<>(_path); + + if (redTeam) + { + Collections.reverse(path); + } + + return path; + } } 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 new file mode 100644 index 000000000..9e72823d5 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/overtime/OvertimeManager.java @@ -0,0 +1,60 @@ +package nautilus.game.arcade.game.games.moba.overtime; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilTextMiddle; +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 org.bukkit.Bukkit; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +import java.util.concurrent.TimeUnit; + +public class OvertimeManager implements Listener +{ + + private static final long OVERTIME = TimeUnit.MINUTES.toMillis(1); + + private final Moba _host; + private boolean _enabled; + private boolean _overtime; + + public OvertimeManager(Moba host) + { + _host = host; + _enabled = true; + } + + public void disableOvertime() + { + _enabled = false; + } + + @EventHandler + public void updateOvertime(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST || !_host.IsLive() || !UtilTime.elapsed(_host.GetStateTime(), OVERTIME) || _overtime || !_enabled) + { + return; + } + + _overtime = true; + 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 (Player player : Bukkit.getOnlinePlayers()) + { + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 1.2F); + } + } + + public boolean isOvertime() + { + return _enabled && _overtime; + } +} From b9a72312a80f43694337a964e616e486a6e6f66b Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 28 Jun 2017 00:21:47 +0100 Subject: [PATCH 4/9] 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(); From 82182c5d50ef1a5dca42461391ca1981f3db1939 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 28 Jun 2017 15:34:56 +0100 Subject: [PATCH 5/9] Balance changes --- .../arcade/game/games/moba/kit/HeroSkill.java | 17 +++++++++++++---- .../games/moba/kit/bardolf/HeroBardolf.java | 2 +- .../games/moba/kit/bardolf/SkillSummonWolf.java | 2 +- .../game/games/moba/kit/biff/SkillWarHorse.java | 2 +- .../game/games/moba/kit/dana/SkillDanaDash.java | 4 ++-- .../games/moba/kit/dana/SkillPulseHeal.java | 4 ++-- .../game/games/moba/kit/dana/SkillRally.java | 2 +- .../games/moba/shop/hunter/MobaHunterShop.java | 13 +++++++++++++ .../moba/structure/tower/TowerManager.java | 4 +++- .../game/games/moba/training/MobaTraining.java | 4 ++-- 10 files changed, 39 insertions(+), 15 deletions(-) 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 9a6a9eaf8..48b6529c9 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 @@ -6,9 +6,9 @@ import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTime; import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.events.PlayerKitGiveEvent; @@ -316,12 +316,11 @@ public class HeroSkill extends Perk public void useActiveSkill(Runnable complete, Player player, long time) { + long now = System.currentTimeMillis(); long ticks = (long) (time / 1000D); ItemStack itemStack = player.getInventory().getItem(getSlot()); itemStack.setAmount((int) (ticks / 20D)); UtilInv.addDullEnchantment(itemStack); - Recharge.Instance.useForce(player, GetName(), time, true); - Recharge.Instance.setDisplayForce(player, GetName(), true); Manager.runSyncTimer(new BukkitRunnable() { @@ -329,7 +328,17 @@ public class HeroSkill extends Perk @Override public void run() { - double percentage = + long timeLeft = System.currentTimeMillis() + time - now; + double percentage = (double) timeLeft / (double) time; + + if (percentage >= 1) + { + UtilTextBottom.display(C.cRedB + GetName(), player); + cancel(); + return; + } + + UtilTextBottom.displayProgress(GetName(), percentage, player); } }, 0, 1); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/bardolf/HeroBardolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/bardolf/HeroBardolf.java index d28975e95..7ac660d7f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/bardolf/HeroBardolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/bardolf/HeroBardolf.java @@ -96,7 +96,7 @@ public class HeroBardolf extends HeroKit if (UtilMath.offsetSquared(wolf.getTarget(), wolf) < 9 && Recharge.Instance.use(data.getOwner(), "Wolf" + wolf.getTarget().getUniqueId(), 500, false, false)) { - Manager.GetDamage().NewDamageEvent(wolf.getTarget(), data.getOwner(), null, DamageCause.CUSTOM, 2, true, true, false, data.getOwner().getName(), "Wolf"); + Manager.GetDamage().NewDamageEvent(wolf.getTarget(), data.getOwner(), null, DamageCause.CUSTOM, 1, true, true, false, data.getOwner().getName(), "Wolf"); } } else if (ownerOffset > MAX_DIST_SQUARED) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/bardolf/SkillSummonWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/bardolf/SkillSummonWolf.java index d0e43367b..29dbd295f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/bardolf/SkillSummonWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/bardolf/SkillSummonWolf.java @@ -32,7 +32,7 @@ public class SkillSummonWolf extends HeroSkill }; private static final ItemStack SKILL_ITEM = new ItemStack(Material.BONE); private static final int MAX_WOLVES = 5; - private static final int HEALTH = 6; + private static final int HEALTH = 8; public SkillSummonWolf(int slot) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/biff/SkillWarHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/biff/SkillWarHorse.java index 9a45a201d..d6997e5e3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/biff/SkillWarHorse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/biff/SkillWarHorse.java @@ -133,7 +133,7 @@ public class SkillWarHorse extends HeroSkill } owner.sendMessage(F.main("Game", "You hit " + F.name(player.getName()) + ".")); - Manager.GetDamage().NewDamageEvent(player, owner, null, DamageCause.CUSTOM, 10, false, true, false, UtilEnt.getName(owner), GetName()); + Manager.GetDamage().NewDamageEvent(player, owner, null, DamageCause.CUSTOM, 4, false, true, false, UtilEnt.getName(owner), GetName()); buffManager.apply(new BuffRooting(game, player, 1000)); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/dana/SkillDanaDash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/dana/SkillDanaDash.java index 8fcb89839..cd2398103 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/dana/SkillDanaDash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/dana/SkillDanaDash.java @@ -60,12 +60,12 @@ public class SkillDanaDash extends DashSkill if (entity instanceof Player) { - damage = 10; + damage = 12; UtilAction.velocity(entity, new Vector(Math.random() / 2 - 0.25, 1, Math.random() / 2 - 0.25)); } else { - damage = 6; + damage = 8; UtilAction.velocity(entity, new Vector(Math.random() - 0.5, 0.5, Math.random() - 0.5)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/dana/SkillPulseHeal.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/dana/SkillPulseHeal.java index 6d26e4cc3..4908fdf41 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/dana/SkillPulseHeal.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/dana/SkillPulseHeal.java @@ -43,7 +43,7 @@ public class SkillPulseHeal extends HeroSkill Player player = event.getPlayer(); useSkill(player); - for (LivingEntity entity : UtilEnt.getInRadius(player.getLocation(), 5).keySet()) + for (LivingEntity entity : UtilEnt.getInRadius(player.getLocation(), 7).keySet()) { // Don't heal enemies if (!isTeamDamage(entity, player)) @@ -68,7 +68,7 @@ public class SkillPulseHeal extends HeroSkill @Override public void run() { - if (radius > 5) + if (radius > 7) { cancel(); return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/dana/SkillRally.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/dana/SkillRally.java index ec5ac4cc9..19922f0e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/dana/SkillRally.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/dana/SkillRally.java @@ -151,7 +151,7 @@ public class SkillRally extends HeroSkill for (LivingEntity nearby : UtilEnt.getInRadius(player.getLocation(), 3).keySet()) { - Manager.GetDamage().NewDamageEvent(nearby, player, null, DamageCause.CUSTOM, 5, true, true, false, UtilEnt.getName(player), GetName()); + Manager.GetDamage().NewDamageEvent(nearby, player, null, DamageCause.CUSTOM, 7, true, true, false, UtilEnt.getName(player), GetName()); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/hunter/MobaHunterShop.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/hunter/MobaHunterShop.java index 2c9b75b86..2429e6819 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/hunter/MobaHunterShop.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/hunter/MobaHunterShop.java @@ -10,6 +10,7 @@ import nautilus.game.arcade.game.games.moba.shop.MobaShop; import nautilus.game.arcade.game.games.moba.shop.MobaShopCategory; import nautilus.game.arcade.game.games.moba.shop.MobaShopMenu; import nautilus.game.arcade.game.games.moba.shop.effects.*; +import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; @@ -74,18 +75,21 @@ public class MobaHunterShop extends MobaShopMenu ), new MobaItem(new ItemBuilder(Material.LEATHER_HELMET) .setTitle(C.cGreen + "Leather Cap of Nimble Fingers") + .setColor(Color.GREEN) .build(), 400) .addEffects( new MobaCDRAmmoEffect(0.05) ), new MobaItem(new ItemBuilder(Material.LEATHER_HELMET) .setTitle(C.cGreen + "Focused Cap") + .setColor(Color.PURPLE) .build(), 500) .addEffects( new MobaCDREffect(0.05) ), new MobaItem(new ItemBuilder(Material.LEATHER_HELMET) .setTitle(C.cGreen + "Vampiric Helmet") + .setColor(Color.RED) .build(), 500) .addEffects( new MobaHPRegenEffect(0.2) @@ -101,18 +105,21 @@ public class MobaHunterShop extends MobaShopMenu .build(), 250), new MobaItem(new ItemBuilder(Material.LEATHER_CHESTPLATE) .setTitle(C.cGreen + "Leather Chestplate of Nimble Fingers") + .setColor(Color.GREEN) .build(), 750) .addEffects( new MobaCDRAmmoEffect(0.15) ), new MobaItem(new ItemBuilder(Material.LEATHER_CHESTPLATE) .setTitle(C.cGreen + "Focused Chestplate") + .setColor(Color.PURPLE) .build(), 750) .addEffects( new MobaCDREffect(0.1) ), new MobaItem(new ItemBuilder(Material.LEATHER_CHESTPLATE) .setTitle(C.cGreen + "Vampiric Chestplate") + .setColor(Color.RED) .build(), 750) .addEffects( new MobaKillHealEffect(3) @@ -128,18 +135,21 @@ public class MobaHunterShop extends MobaShopMenu .build(), 250), new MobaItem(new ItemBuilder(Material.LEATHER_LEGGINGS) .setTitle(C.cGreen + "Leather Leggings of Nimble Fingers") + .setColor(Color.GREEN) .build(), 750) .addEffects( new MobaCDRAmmoEffect(0.1) ), new MobaItem(new ItemBuilder(Material.LEATHER_LEGGINGS) .setTitle(C.cGreen + "Focused Leggings") + .setColor(Color.PURPLE) .build(), 750) .addEffects( new MobaCDREffect(0.1) ), new MobaItem(new ItemBuilder(Material.LEATHER_LEGGINGS) .setTitle(C.cGreen + "Vampiric Leggings") + .setColor(Color.RED) .build(), 700) .addEffects( new MobaKillHealEffect(3) @@ -155,18 +165,21 @@ public class MobaHunterShop extends MobaShopMenu .build(), 250), new MobaItem(new ItemBuilder(Material.LEATHER_BOOTS) .setTitle(C.cGreen + "Leather Boots of Nimble Fingers") + .setColor(Color.GREEN) .build(), 400) .addEffects( new MobaCDRAmmoEffect(0.05) ), new MobaItem(new ItemBuilder(Material.LEATHER_BOOTS) .setTitle(C.cGreen + "Focused Boots") + .setColor(Color.PURPLE) .build(), 600) .addEffects( new MobaCDREffect(0.05) ), new MobaItem(new ItemBuilder(Material.LEATHER_BOOTS) .setTitle(C.cGreen + "Vampiric Boots") + .setColor(Color.RED) .build(), 500) .addEffects( new MobaKillHealEffect(1) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/tower/TowerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/tower/TowerManager.java index a7c9d4d54..eaa2f4626 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/tower/TowerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/structure/tower/TowerManager.java @@ -281,7 +281,9 @@ public class TowerManager implements Listener for (Tower tower : _towers) { - if (tower.isDead() || tower.getOwner().equals(team) || UtilMath.offsetSquared(tower.getCrystal().getLocation(), location) > PROJECTILE_RANGE_SQUARED) + Location crystalLocation = tower.getCrystal().getLocation(); + + if (tower.isDead() || tower.getOwner().equals(team) || UtilMath.offsetSquared(crystalLocation, location) > PROJECTILE_RANGE_SQUARED || shouldCancelDamage(tower, shooter)) { continue; } 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 af7f68465..439390385 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 @@ -76,7 +76,7 @@ public class MobaTraining extends Moba C.cYellow + "of " + C.cGold + "Gold" + C.cYellow + " your team earns." }, { - C.cYellow + "The is the " + C.cDRedB + "Pumpkin King", + C.cYellow + "This is the " + C.cDRedB + "Pumpkin King", C.cYellow + "He spawns at " + C.cGreen + "10 minutes" + C.cYellow + " into the game.", C.cYellow + "The team that kills him will be given increased", C.cYellow + "regeneration and damage." @@ -92,7 +92,7 @@ public class MobaTraining extends Moba C.cYellow + "They will fight each other and help destroy enemy Towers." }, { - C.cYellow + "With the " + C.cGold + "Gold" + C.cYellow + "you earn you can", + C.cYellow + "With the " + C.cGold + "Gold" + C.cYellow + " you earn you can", C.cYellow + "spend it on upgrades for your weapons and armor.", C.cYellow + "You can do this via the gold ingot in your inventory", C.cYellow + "during the game or by clicking on the Villager." From 85007820d2e35ac7bf989a0b9fce4b725add472f Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 28 Jun 2017 23:38:50 +0100 Subject: [PATCH 6/9] Add a go-back button to kit selection --- .../core/common/entity/ClientArmorStand.java | 22 +++++--- .../games/moba/boss/wither/WitherBoss.java | 44 +++++++-------- .../boss/wither/WitherBossOvertimeAI.java | 7 +++ .../arcade/game/games/moba/kit/HeroSkill.java | 7 ++- .../games/moba/prepare/PrepareSelection.java | 56 ++++++++++++++----- .../arcade/game/games/moba/util/MobaUtil.java | 5 ++ 6 files changed, 95 insertions(+), 46 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 385c9c3ce..1c49ca731 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,12 +79,6 @@ 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; @@ -182,7 +176,7 @@ public class ClientArmorStand implements ArmorStand @Override public Location getLocation() { - return new Location(getWorld(), _armorStand.locX, _armorStand.locY, _armorStand.locZ); + return new Location(getWorld(), _armorStand.locX, _armorStand.locY, _armorStand.locZ, _armorStand.yaw, _armorStand.pitch); } @Override @@ -246,6 +240,20 @@ public class ClientArmorStand implements ArmorStand return false; } + public boolean teleport(Location location, Player player) + { + double pX = _armorStand.locX; + double pY = _armorStand.locY; + double pZ = _armorStand.locZ; + float pYaw = _armorStand.yaw; + float pPitch = _armorStand.pitch; + + _armorStand.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + UtilPlayer.sendPacket(player, new PacketPlayOutEntityTeleport(_armorStand)); + _armorStand.setPositionRotation(pX, pY, pZ, pYaw, pPitch); + return false; + } + @Override public boolean teleport(Location loc) { 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 22b4597d1..6e190779b 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 @@ -40,7 +40,7 @@ public class WitherBoss extends MobaBoss private static final String NAME = "Wither Boss"; private static final float SPEED_TARGET = 4F; private static final float SPEED_HOME = 6F; - private static final int INITIAL_HEALTH = 125; + private static final int INITIAL_HEALTH = 275; private static final MobaAIMethod AI_METHOD = new MobaDirectAIMethod(); private static final int MIN_INFORM_TIME = (int) TimeUnit.SECONDS.toMillis(30); @@ -66,9 +66,8 @@ public class WitherBoss extends MobaBoss { ArmorStand stand = _location.getWorld().spawn(_location, ArmorStand.class); - // Reducing the wither's health to 10% gives a shield like effect. stand.setMaxHealth(INITIAL_HEALTH); - stand.setHealth(INITIAL_HEALTH * 0.1); + stand.setHealth(INITIAL_HEALTH); stand.setGravity(false); MobaUtil.setTeamEntity(stand, _team); @@ -148,20 +147,6 @@ public class WitherBoss extends MobaBoss return; } - // If not damageable - if (!_damageable) - { - Player damager = event.GetDamagerPlayer(true); - - if (damager != null) - { - damager.sendMessage(F.main("Game", "You must destroy both towers before attacking the Wither!")); - damager.playSound(damager.getLocation(), Sound.NOTE_BASS, 1, 0.8F); - } - - return; - } - LivingEntity damagee = event.GetDamageeEntity(); Player damager = event.GetDamagerPlayer(true); @@ -175,6 +160,18 @@ public class WitherBoss extends MobaBoss } } + // If not damageable + if (!_damageable) + { + if (damager != null) + { + damager.sendMessage(F.main("Game", "You must destroy both towers before attacking the Wither!")); + damager.playSound(damager.getLocation(), Sound.NOTE_BASS, 1, 0.8F); + } + + return; + } + // Inform the team if (UtilTime.elapsed(_lastInform, MIN_INFORM_TIME)) { @@ -214,11 +211,14 @@ public class WitherBoss extends MobaBoss return; } - // Here we can remove the shield effect, as the wither is no longer invincible - if (!tower.isFirstTower()) + if (tower.isFirstTower()) { + _entity.setHealth(_entity.getHealth() - 50); + } + else + { + _entity.setHealth(_entity.getHealth() - 100); _damageable = true; - _entity.setHealth(INITIAL_HEALTH); updateDisplay(); } } @@ -235,13 +235,13 @@ public class WitherBoss extends MobaBoss for (Player player : _team.GetPlayers(true)) { - UtilTextTop.displayTextBar(player, percent, _team.GetColor() + "Your Wither"); + UtilTextTop.displayTextBar(player, percent, _team.GetColor() + "Your Wither"); } } public double getHealthPercentage() { - return _damageable ? (_entity.getHealth() / _entity.getMaxHealth()) : 1; + return _entity.getHealth() / _entity.getMaxHealth(); } private void updateDisplay() 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 ea389a6a6..67bd868be 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 @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.moba.boss.wither; +import mineplex.core.common.geom.Polygon2D; import mineplex.core.common.util.UtilMath; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.moba.Moba; @@ -45,4 +46,10 @@ public class WitherBossOvertimeAI extends MobaAI _aiMethod.updateMovement(_entity, _target, 2); } + + @Override + public Polygon2D getBoundaries() + { + return null; + } } 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 48b6529c9..2a19d34cd 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 @@ -328,17 +328,17 @@ public class HeroSkill extends Perk @Override public void run() { - long timeLeft = System.currentTimeMillis() + time - now; + long timeLeft = now + time - System.currentTimeMillis(); double percentage = (double) timeLeft / (double) time; - if (percentage >= 1) + if (percentage <= 0) { UtilTextBottom.display(C.cRedB + GetName(), player); cancel(); return; } - UtilTextBottom.displayProgress(GetName(), percentage, player); + UtilTextBottom.displayProgress(C.cWhiteB + GetName(), percentage, UtilTime.MakeStr(timeLeft), player); } }, 0, 1); @@ -356,6 +356,7 @@ public class HeroSkill extends Perk complete.run(); } useSkill(player); + Kit.GiveItems(player); cancel(); return; } 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 a7c4b4e99..4480e761f 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 @@ -22,7 +22,6 @@ import nautilus.game.arcade.game.games.moba.MobaRole; 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; @@ -91,18 +90,24 @@ public class PrepareSelection implements Listener, IPacketHandler location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, average))); - MobaRole role = MobaRole.valueOf(entry.getKey().split(" ")[2]); - ClientArmorStand stand = ClientArmorStand.spawn(prepareLocation(location), players); + try + { + MobaRole role = MobaRole.valueOf(entry.getKey().split(" ")[2]); + ClientArmorStand stand = ClientArmorStand.spawn(prepareLocation(location), players); - stand.setCustomNameVisible(true); - stand.setCustomName(C.cGreenB + role.getName() + C.cGray + " - " + C.cGreenB + "AVAILABLE"); - stand.setArms(true); - stand.setHelmet(head); - stand.setChestplate(buildColouredStack(Material.LEATHER_CHESTPLATE, role)); - stand.setLeggings(buildColouredStack(Material.LEATHER_LEGGINGS, role)); - stand.setBoots(buildColouredStack(Material.LEATHER_BOOTS, role)); + stand.setCustomNameVisible(true); + stand.setCustomName(C.cGreenB + role.getName() + C.cGray + " - " + C.cGreenB + "AVAILABLE"); + stand.setArms(true); + stand.setHelmet(head); + stand.setChestplate(buildColouredStack(Material.LEATHER_CHESTPLATE, role)); + stand.setLeggings(buildColouredStack(Material.LEATHER_LEGGINGS, role)); + stand.setBoots(buildColouredStack(Material.LEATHER_BOOTS, role)); - _roleStands.put(stand, role); + _roleStands.put(stand, role); + } + catch (IllegalArgumentException e) + { + } } // Only spawn the NPCs once all players have been loaded into the world. }, _host.GetPlayers(true).size() * _host.TickPerTeleport + 10); @@ -124,7 +129,7 @@ public class PrepareSelection implements Listener, IPacketHandler goBackStand.setCustomNameVisible(true); goBackStand.setCustomName(C.cGreenB + "Go Back"); goBackStand.setArms(true); - goBackStand.setHelmet(new ItemStack(Material.SKULL_ITEM, (byte) 2)); + goBackStand.setHelmet(new ItemStack(Material.SKULL_ITEM)); 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()); @@ -190,11 +195,21 @@ public class PrepareSelection implements Listener, IPacketHandler ClientArmorStand goBackStand = _goBackStands.get(player); - if (goBackStand != null) + if (goBackStand != null && goBackStand.getEntityId() == entityId) { packetInfo.setCancelled(true); _host.getMobaData(player).setRole(null); _goBackStands.remove(player).remove(); + + for (ClientArmorStand stand2 : _kitStands.keySet()) + { + stand2.remove(player); + } + + for (ClientArmorStand stand2 : _roleStands.keySet()) + { + stand2.teleport(stand2.getLocation(), player); + } return; } @@ -218,7 +233,7 @@ public class PrepareSelection implements Listener, IPacketHandler for (ClientArmorStand stand2 : _roleStands.keySet()) { - stand2.remove(player); + stand2.teleport(stand2.getLocation().add(0, 100, 0), player); } GameTeam team = _host.GetTeam(player); @@ -243,6 +258,11 @@ public class PrepareSelection implements Listener, IPacketHandler HeroKit kit = _kitStands.get(stand); + if (goBackStand != null) + { + _goBackStands.remove(player).remove(); + } + for (ClientArmorStand stand2 : _kitStands.keySet()) { stand2.remove(player); @@ -287,6 +307,14 @@ public class PrepareSelection implements Listener, IPacketHandler stand.remove(); } + for (ClientArmorStand stand : _goBackStands.values()) + { + stand.remove(); + } + + _roleStands.clear(); + _kitStands.clear(); + _goBackStands.clear(); removePodiums(); _host.getArcadeManager().getPacketHandler().removePacketHandler(this); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/util/MobaUtil.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/util/MobaUtil.java index b4efa6382..76721ad08 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/util/MobaUtil.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/util/MobaUtil.java @@ -72,6 +72,11 @@ public class MobaUtil public static boolean isInBoundary(GameTeam owner, LivingEntity source, Location center, Polygon2D boundaries, LivingEntity target) { + if (boundaries == null) + { + return true; + } + return getEntitiesInBoundary(owner, source, center, boundaries).contains(target); } From 67d8e0863d22f9708d5d46d1c5d8af25aa10ad5b Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 29 Jun 2017 00:13:06 +0100 Subject: [PATCH 7/9] Fix overtime being at 1 minute --- .../game/arcade/game/games/moba/kit/HeroKit.java | 3 +++ .../game/games/moba/overtime/OvertimeManager.java | 2 +- .../game/arcade/game/games/moba/shop/MobaShop.java | 13 ++++++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/HeroKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/HeroKit.java index 707bc435f..4758aefcd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/HeroKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/kit/HeroKit.java @@ -166,6 +166,9 @@ public class HeroKit extends Kit { PlayerInventory inventory = player.getInventory(); + // This is important + inventory.clear(); + // Give standard items inventory.setItem(AMMO_SLOT, _ammo); inventory.setItem(SHOP_SLOT, SHOP_ITEM); 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 9c2989fb4..f22986f4c 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 @@ -20,7 +20,7 @@ import java.util.concurrent.TimeUnit; public class OvertimeManager implements Listener { - private static final long OVERTIME = TimeUnit.MINUTES.toMillis(1); + private static final long OVERTIME = TimeUnit.MINUTES.toMillis(15); private final Moba _host; private boolean _enabled; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java index 0fca426e2..efd64d2c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java @@ -4,6 +4,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -42,6 +43,7 @@ import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractAtEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.inventory.ItemStack; import java.util.ArrayList; import java.util.HashMap; @@ -296,11 +298,16 @@ public class MobaShop implements Listener Remove empty potions */ @EventHandler - public void removeEmptyPotions(PlayerItemConsumeEvent event) + public void removeEmptyPotions(UpdateEvent event) { - if (event.getItem().getType() == Material.POTION) + if (event.getType() != UpdateType.FAST) { - _host.getArcadeManager().runSyncLater(() -> event.getPlayer().setItemInHand(null), 1); + return; + } + + for (Player player : _host.GetPlayers(true)) + { + player.getInventory().remove(Material.GLASS_BOTTLE); } } From b8bb25b04dd506fb442a206959c8fbd1272ffa3e Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 29 Jun 2017 00:35:18 +0100 Subject: [PATCH 8/9] Only reset player health upon actual respawn --- .../game/arcade/game/games/moba/minion/MinionWave.java | 2 +- .../game/arcade/game/games/moba/shop/MobaItemEffect.java | 2 +- .../game/arcade/game/games/moba/shop/MobaShop.java | 4 ++-- .../game/games/moba/shop/effects/MobaSpeedEffect.java | 2 +- .../games/moba/shop/effects/MobaTotalHealthEffect.java | 8 ++++++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/minion/MinionWave.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/minion/MinionWave.java index 6339d7ed0..2ec589c7e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/minion/MinionWave.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/minion/MinionWave.java @@ -359,7 +359,7 @@ public class MinionWave implements Listener for (MobaBoss boss : bosses) { // Dead, not close enough - if (boss.isDead() || UtilMath.offsetSquared(minion.getEntity(), boss.getEntity()) > DAMAGE_RANGE_SQUARED) + if (boss.isDead() || MobaUtil.isTeamEntity(boss.getEntity(), _owner) || UtilMath.offsetSquared(minion.getEntity(), boss.getEntity()) > DAMAGE_RANGE_SQUARED) { continue; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaItemEffect.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaItemEffect.java index 3e37e1cc4..73b0d1b86 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaItemEffect.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaItemEffect.java @@ -54,7 +54,7 @@ public abstract class MobaItemEffect { } - protected void onRespawn(PlayerGameRespawnEvent event) + protected void onRespawn(PlayerGameRespawnEvent event, boolean fake) { } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java index efd64d2c9..55c40f2af 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/MobaShop.java @@ -221,7 +221,7 @@ public class MobaShop implements Listener { if (ownedItem.getEffects() != null) { - ownedItem.getEffects().forEach(effect -> effect.onRespawn(fakeEvent)); + ownedItem.getEffects().forEach(effect -> effect.onRespawn(fakeEvent, true)); } } @@ -530,7 +530,7 @@ public class MobaShop implements Listener for (MobaItemEffect effect : item.getEffects()) { - effect.onRespawn(event); + effect.onRespawn(event, false); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/effects/MobaSpeedEffect.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/effects/MobaSpeedEffect.java index 15d7d7196..8505a6eb0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/effects/MobaSpeedEffect.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/effects/MobaSpeedEffect.java @@ -16,7 +16,7 @@ public class MobaSpeedEffect extends MobaItemEffect } @Override - public void onRespawn(PlayerGameRespawnEvent event) + public void onRespawn(PlayerGameRespawnEvent event, boolean fake) { Player player = event.GetPlayer(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/effects/MobaTotalHealthEffect.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/effects/MobaTotalHealthEffect.java index 80af5c495..7867ce364 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/effects/MobaTotalHealthEffect.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/shop/effects/MobaTotalHealthEffect.java @@ -17,12 +17,16 @@ public class MobaTotalHealthEffect extends MobaItemEffect } @Override - public void onRespawn(PlayerGameRespawnEvent event) + public void onRespawn(PlayerGameRespawnEvent event, boolean fake) { Player player = event.GetPlayer(); player.setMaxHealth(player.getMaxHealth() + _health); - player.setHealth(player.getMaxHealth()); + + if (!fake) + { + player.setHealth(player.getMaxHealth()); + } } @Override From 7bd5d65823b92dfd9fefecf7fa8e4b54369f91c6 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 29 Jun 2017 00:37:42 +0100 Subject: [PATCH 9/9] Reduce the amount of gems given for gold earned --- .../nautilus/game/arcade/game/games/moba/gold/GoldManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/gold/GoldManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/gold/GoldManager.java index 312aebec7..4ce28a71d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/gold/GoldManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/gold/GoldManager.java @@ -148,7 +148,7 @@ public class GoldManager implements Listener if (amount > 20 && reason != null) { - _host.AddGems(player, (double) amount / 2D, reason, true, true); + _host.AddGems(player, (double) amount / 3D, reason, true, true); player.sendMessage(F.main("Game", C.cGold + "+" + amount + " gold (" + reason + ")" + C.cGray + ".")); } }