From b9ad85dd1ec0b1807b9366e7aa92139c2ebbfcb0 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 27 May 2017 18:19:14 +0100 Subject: [PATCH] Pumpkin King boss --- .../arcade/game/games/moba/ai/MobaAI.java | 2 +- .../games/moba/boss/pumpkin/PumpkinBoss.java | 78 +++++++++++++++++++ .../moba/boss/pumpkin/PumpkinBossAI.java | 22 ++++++ 3 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/pumpkin/PumpkinBoss.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/pumpkin/PumpkinBossAI.java 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 712b31aa9..199273682 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 @@ -84,7 +84,7 @@ public class MobaAI return _target; } - private String getBoundaryKey() + public String getBoundaryKey() { return _owner.GetColor() == ChatColor.RED ? "ORANGE" : "LIGHT_BLUE"; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/pumpkin/PumpkinBoss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/pumpkin/PumpkinBoss.java new file mode 100644 index 000000000..42ae0099c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/pumpkin/PumpkinBoss.java @@ -0,0 +1,78 @@ +package nautilus.game.arcade.game.games.moba.boss.pumpkin; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.utils.UtilVariant; +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 nautilus.game.arcade.game.games.moba.ai.goal.MobaDirectAIMethod; +import nautilus.game.arcade.game.games.moba.boss.MobaBoss; +import org.bukkit.Location; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; + +import java.util.concurrent.TimeUnit; + +public class PumpkinBoss extends MobaBoss +{ + + private static final int SPAWN_TIME = (int) TimeUnit.MINUTES.toMillis(10); + private static final int RESPAWN_TIME = (int) TimeUnit.MINUTES.toMillis(5); + private static final MobaAIMethod AI_METHOD = new MobaDirectAIMethod(); + + private MobaAI _ai; + + public PumpkinBoss(Moba host, Location location) + { + super(host, location, RESPAWN_TIME); + } + + @Override + public void setup() + { + // Override this so that the entity isn't spawned as soon as the game starts. + UtilServer.RegisterEvents(this); + } + + @Override + public LivingEntity spawnEntity() + { + Skeleton skeleton = UtilVariant.spawnWitherSkeleton(_location); + + skeleton.setCustomName(C.cDRedB + "Pumpkin King"); + skeleton.setCustomNameVisible(true); + + skeleton.getWorld().strikeLightningEffect(skeleton.getLocation()); + + UtilTextMiddle.display(C.cDRedB + "The Pumpkin King", "Has Awoken!", 10, 40, 10); + _host.Announce("The Pumpkin King Has Awoken!", false); + + return skeleton; + } + + @Override + public MobaAI getAi() + { + if (_ai == null) + { + _ai = new PumpkinBossAI(_host, _entity, _location, AI_METHOD); + } + + return _ai; + } + + @EventHandler + public void updateSpawn(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC || !_host.IsLive() || !UtilTime.elapsed(_host.GetStateTime(), SPAWN_TIME)) + { + return; + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/pumpkin/PumpkinBossAI.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/pumpkin/PumpkinBossAI.java new file mode 100644 index 000000000..6237de968 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/boss/pumpkin/PumpkinBossAI.java @@ -0,0 +1,22 @@ +package nautilus.game.arcade.game.games.moba.boss.pumpkin; + +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.Location; +import org.bukkit.entity.LivingEntity; + +public class PumpkinBossAI extends MobaAI +{ + + public PumpkinBossAI(Moba host, LivingEntity entity, Location home, MobaAIMethod aiMethod) + { + super(host, null, entity, home, aiMethod); + } + + @Override + public String getBoundaryKey() + { + return "GRAY"; + } +}