From 1a5b2539a24f7061e716708f430fbb9832ca1046 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 6 Dec 2017 16:17:21 +0000 Subject: [PATCH] Cleanup and improvements --- .../core/particleeffects/ObjectiveEffect.java | 2 +- .../game/games/christmas/ChristmasCommon.java | 44 ++++++++++++++----- .../games/christmasnew/present/Present.java | 1 + .../section/five/SnowmenKong.java | 13 ++++-- .../christmasnew/section/four/MobDefense.java | 22 ++++++++-- .../christmasnew/section/four/Section4.java | 4 +- .../christmasnew/section/six/BossFight.java | 19 ++------ .../six/attack/AttackArmouredMobs.java | 8 ++-- .../section/six/attack/AttackFire.java | 24 +++++++++- .../section/six/attack/AttackFlame.java | 12 +++-- .../section/six/attack/AttackSeismicWave.java | 21 +++++---- .../section/six/attack/AttackShootArrows.java | 2 +- .../section/six/phase/BossPhase.java | 8 ++++ .../section/six/phase/Phase1.java | 6 ++- .../section/six/phase/Phase2.java | 34 +++++++++----- .../christmasnew/section/two/RockParkour.java | 2 +- 16 files changed, 155 insertions(+), 67 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ObjectiveEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ObjectiveEffect.java index 506ab161c..b5656b7ea 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ObjectiveEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ObjectiveEffect.java @@ -24,7 +24,7 @@ public class ObjectiveEffect extends Effect public ObjectiveEffect(Location start, Vector startVector, Location target, float turnMultiplier, float blocksToAdvance, ParticleType particleType) { - super(200, new EffectLocation(start)); + super(120, new EffectLocation(start)); _current = start; _target = target; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/ChristmasCommon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/ChristmasCommon.java index 9f7474aff..77e9a32a7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/ChristmasCommon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/ChristmasCommon.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.christmas; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.concurrent.TimeUnit; import net.minecraft.server.v1_8_R3.Entity; import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity; @@ -15,6 +16,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHorse; +import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Arrow; import org.bukkit.entity.Player; import org.bukkit.entity.Villager; @@ -24,6 +26,7 @@ import org.bukkit.event.block.BlockFadeEvent; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.player.PlayerArmorStandManipulateEvent; @@ -38,7 +41,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.explosion.ExplosionEvent; +import mineplex.core.common.util.UtilTime; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketInfo; import mineplex.core.updater.UpdateType; @@ -148,6 +151,7 @@ public class ChristmasCommon extends SoloGame InventoryClick = true; WorldTimeSet = 4000; FixSpawnFacing = false; + GameTimeout = TimeUnit.MINUTES.toMillis(20); manager.GetCreature().SetDisableCustomDrops(true); @@ -199,7 +203,7 @@ public class ChristmasCommon extends SoloGame Scoreboard.write(C.cYellowB + "Players"); List alive = GetPlayers(true); - if (alive.size() > 9) + if (alive.size() > 6) { Scoreboard.write(alive.size() + " Alive"); } @@ -208,11 +212,17 @@ public class ChristmasCommon extends SoloGame alive.forEach(player -> Scoreboard.write(player.getName())); } - if (_currentSection != null) + if (IsLive() && _currentSection != null) { Scoreboard.writeNewLine(); + Scoreboard.write(C.cYellowB + "Objective"); Scoreboard.write(_currentSection.getObjectiveText()); + + Scoreboard.writeNewLine(); + + Scoreboard.write(C.cYellowB + "Time Left"); + Scoreboard.write(UtilTime.MakeStr(GetStateTime() + GameTimeout - System.currentTimeMillis())); } Scoreboard.writeNewLine(); @@ -352,17 +362,18 @@ public class ChristmasCommon extends SoloGame @EventHandler(priority = EventPriority.LOWEST) public void damageCancel(CustomDamageEvent event) { - if (!InProgress()) - { - return; - } - if (_sleigh != null) { _sleigh.onDamage(event); } - if (event.GetDamageePlayer() != null) + if (event.GetDamageeEntity() instanceof ArmorStand) + { + event.SetCancelled("Armour Stand"); + return; + } + + if (InProgress() && event.GetDamageePlayer() != null) { switch (event.GetCause()) { @@ -453,6 +464,11 @@ public class ChristmasCommon extends SoloGame { WorldTimeSet += 5; } + + if (UtilTime.elapsed(GetStateTime(), GameTimeout)) + { + endGame(false, "You couldn't save Christmas in time!"); + } } @EventHandler @@ -495,9 +511,9 @@ public class ChristmasCommon extends SoloGame } @EventHandler(priority = EventPriority.LOWEST) - public void explosion(ExplosionEvent event) + public void entityExplode(EntityExplodeEvent event) { - event.GetBlocks().clear(); + event.blockList().clear(); } @Override @@ -541,6 +557,12 @@ public class ChristmasCommon extends SoloGame public void endGame(boolean victory, String customLine) { + if (victory) + { + WorldTimeSet = 18000; + sendSantaMessage("Well done everyone! You saved Christmas!", null); + } + SetCustomWinLine(customLine); AnnounceEnd(victory ? getPlayersTeam() : _badGuys); SetState(GameState.End); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/present/Present.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/present/Present.java index f13178758..23f732dcf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/present/Present.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/present/Present.java @@ -91,6 +91,7 @@ public class Present implements Component public void setCollected() { + deactivate(); _collected = true; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/five/SnowmenKong.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/five/SnowmenKong.java index ab66aa663..f73014e02 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/five/SnowmenKong.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/five/SnowmenKong.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.christmasnew.section.five; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.TimeUnit; import org.bukkit.Location; import org.bukkit.Material; @@ -18,6 +19,7 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -32,11 +34,13 @@ class SnowmenKong extends SectionChallenge private static final int SEARCH_DISTANCE_SQUARED = 100; private static final int MIN_TICKS_BEFORE_HIT = 8; private static final Vector HIT_VELOCITY = new Vector(-1.5, 0.7, 0); - private static final int MAX_TICKS = 300; - private static final int MAX_MOBS = 100; + private static final int MAX_TICKS = 200; + private static final int MAX_MOBS = 120; + private static final long WAVE_FREQUENCY = TimeUnit.SECONDS.toMillis(3); private final List _waves; + private long _lastWave; private boolean _spawn; SnowmenKong(ChristmasNew host, Location present, Section section) @@ -99,11 +103,13 @@ class SnowmenKong extends SectionChallenge @EventHandler public void updateWaveSpawn(UpdateEvent event) { - if (event.getType() != UpdateType.SLOW || !_spawn || _entities.size() > MAX_MOBS) + if (event.getType() != UpdateType.FAST || !_spawn || _entities.size() > MAX_MOBS || !UtilTime.elapsed(_lastWave, WAVE_FREQUENCY)) { return; } + _lastWave = System.currentTimeMillis(); + for (SnowmanWave wave : _waves) { int index = UtilMath.r(wave.Spawns.size() - 1) + 1; @@ -117,7 +123,6 @@ class SnowmenKong extends SectionChallenge } Location location = wave.Spawns.get(i); - Snowman snowman = spawn(location, Snowman.class); UtilEnt.vegetate(snowman); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/MobDefense.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/MobDefense.java index 74b68b4d3..b2bdf8cfb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/MobDefense.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/MobDefense.java @@ -3,9 +3,12 @@ package nautilus.game.arcade.game.games.christmasnew.section.four; import java.util.ArrayList; import java.util.List; +import net.minecraft.server.v1_8_R3.EntityLargeFireball; + import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLargeFireball; import org.bukkit.entity.Blaze; import org.bukkit.entity.Creature; import org.bukkit.entity.Creeper; @@ -20,6 +23,7 @@ import org.bukkit.entity.Skeleton; import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAlg; @@ -143,7 +147,7 @@ class MobDefense extends SectionChallenge for (Entity entity : _entities) { - if (!(entity instanceof Creature)) + if (!(entity instanceof Creature) || !entity.isValid()) { continue; } @@ -179,6 +183,8 @@ class MobDefense extends SectionChallenge if (_generatorHealth == 0) { _host.sendSantaMessage("Oh no one of the generators has been destroyed! If we lose both we'll never save Christmas in time!", null); + _healthHolograms.forEach(Hologram::stop); + _generator.getWorld().createExplosion(_generator.clone().add(0, 2.5, 0), 6); } } @@ -197,7 +203,12 @@ class MobDefense extends SectionChallenge Location location = _ghast.getLocation().add(0, 0.5, 0); Fireball fireball = _ghast.launchProjectile(LargeFireball.class); fireball.setBounce(false); - fireball.setDirection(UtilAlg.getTrajectory(location, _generator).multiply(0.01)); + + EntityLargeFireball eFireball = ((CraftLargeFireball) fireball).getHandle(); + Vector direction = UtilAlg.getTrajectory(location, _generator).multiply(0.1); + eFireball.dirX = direction.getX(); + eFireball.dirY = direction.getY() - 0.005; + eFireball.dirZ = direction.getZ(); } @EventHandler @@ -219,7 +230,7 @@ class MobDefense extends SectionChallenge @EventHandler public void updateHolograms(UpdateEvent event) { - if (event.getType() != UpdateType.SEC || _wave == 0) + if (event.getType() != UpdateType.SEC || _wave == 0 || isDead()) { return; } @@ -242,10 +253,13 @@ class MobDefense extends SectionChallenge } } - public void spawnGhast() + public void spawnGhast(int players) { _ghast = spawn(_ghastSpawn, Ghast.class); + int health = players * 15; + _ghast.setMaxHealth(health); + _ghast.setHealth(_ghast.getMaxHealth()); UtilEnt.vegetate(_ghast); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/Section4.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/Section4.java index 6bb35df81..3880ecf37 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/Section4.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/Section4.java @@ -95,11 +95,13 @@ public class Section4 extends Section case 2: _host.sendSantaMessage("Ahh! Look it's some ghasts and ghouls!", null); + int players = _host.GetPlayers(true).size(); + for (Component component : _components) { if (component instanceof MobDefense) { - ((MobDefense) component).spawnGhast(); + ((MobDefense) component).spawnGhast(players); } } break; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/BossFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/BossFight.java index 7f6b01c93..eb93fb32c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/BossFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/BossFight.java @@ -3,12 +3,9 @@ package nautilus.game.arcade.game.games.christmasnew.section.six; import java.util.ArrayList; import java.util.List; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment; - import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; import org.bukkit.event.EventHandler; @@ -18,8 +15,6 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -42,6 +37,7 @@ class BossFight extends SectionChallenge private final Location _bossSpawn; private final List _lightning; private final List _playerSpawns; + private final List _outerGate; private final List _innerGate; private final List _phases; @@ -66,6 +62,7 @@ class BossFight extends SectionChallenge _lightning = _worldData.GetCustomLocs("LIGHTNING"); _playerSpawns = _worldData.GetCustomLocs("PLAYER SPAWN"); + _outerGate = _worldData.GetCustomLocs(String.valueOf(Material.ENDER_STONE.getId())); _innerGate = _worldData.GetCustomLocs(String.valueOf(Material.IRON_ORE.getId())); _phases = new ArrayList<>(3); @@ -76,7 +73,7 @@ class BossFight extends SectionChallenge @Override public void onPresentCollect() { - + _outerGate.forEach(location -> MapUtil.QuickChangeBlockAt(location, Material.NETHER_FENCE)); } @Override @@ -199,16 +196,6 @@ class BossFight extends SectionChallenge _boss.getWorld().strikeLightningEffect(_bossSpawn); - _host.getArcadeManager().runSyncLater(() -> - { - PacketPlayOutEntityEquipment packet = new PacketPlayOutEntityEquipment(_boss.getEntityId(), 4, CraftItemStack.asNMSCopy(HELMET), true); - - for (Player player : UtilServer.getPlayersCollection()) - { - UtilPlayer.sendPacket(player, packet); - } - }, 5); - _host.CreatureAllowOverride = false; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackArmouredMobs.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackArmouredMobs.java index a8a18fcba..83b0ba1f5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackArmouredMobs.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackArmouredMobs.java @@ -28,10 +28,10 @@ public class AttackArmouredMobs extends BossAttack private static final long DURATION = TimeUnit.SECONDS.toMillis(10); private static final ItemStack[] ARMOUR = { - new ItemStack(Material.IRON_BOOTS), - new ItemStack(Material.IRON_LEGGINGS), - new ItemStack(Material.IRON_CHESTPLATE), - new ItemStack(Material.IRON_HELMET) + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_HELMET) }; private static final ItemStack[] IN_HAND = { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackFire.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackFire.java index f0b12b0e1..226ea9a96 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackFire.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackFire.java @@ -35,13 +35,25 @@ public class AttackFire extends BossAttack private final int _max; private final int _radius; + private final Location _location; public AttackFire(BossPhase phase, int max, int radius) + { + this(phase, max, radius, null); + } + + public AttackFire(BossPhase phase, int radius, Location location) + { + this(phase, 1, radius, location); + } + + private AttackFire(BossPhase phase, int max, int radius, Location location) { super(phase); _max = max; _radius = radius; + _location = location; } @Override @@ -63,7 +75,17 @@ public class AttackFire extends BossAttack @Override public void run() { - Location location = UtilAlg.getRandomLocation(_phase.getBossSpawn(), 25, 0, 15); + Location location; + + if (_location == null) + { + location = UtilAlg.getRandomLocation(_phase.getBossSpawn(), 25, 0, 15); + } + else + { + location = _location; + } + Set fireBlocks = new HashSet<>(); for (Block block : UtilBlock.getInRadius(location, _radius).keySet()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackFlame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackFlame.java index 8c3482ccf..6f9d70628 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackFlame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackFlame.java @@ -8,6 +8,7 @@ import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; @@ -42,6 +43,8 @@ public class AttackFlame extends BossAttack @Override public void onRegister() { + _phase.getHost().sendSantaMessage("Move, quick! Dodge those flame fairies.", null); + DamageManager manager = _phase.getHost().getArcadeManager().GetDamage(); Location location = _boss.getEyeLocation(); List nearby = UtilPlayer.getNearby(location, 50); @@ -55,9 +58,12 @@ public class AttackFlame extends BossAttack { Location playerLocation = player.getLocation().add(0, 1, 0); - manager.NewDamageEvent(player, _boss, null, DamageCause.CUSTOM, 5, true, true, true, _boss.getCustomName(), "Flame Fairy"); - UtilParticle.PlayParticleToAll(ParticleType.LAVA, playerLocation, 0.5F, 0.1F, 0.5F, 0.1F, 5, ViewDist.NORMAL); - player.getWorld().playSound(playerLocation, Sound.EXPLODE, 1, 1.2F); + if (UtilMath.offset2dSquared(data.getEffectLocation().getLocation(), playerLocation) < 16) + { + manager.NewDamageEvent(player, _boss, null, DamageCause.CUSTOM, 5, true, true, true, _boss.getCustomName(), "Flame Fairy"); + UtilParticle.PlayParticleToAll(ParticleType.LAVA, playerLocation, 0.8F, 0.4F, 0.8F, 0.1F, 15, ViewDist.NORMAL); + player.getWorld().playSound(playerLocation, Sound.EXPLODE, 1, 1.2F); + } }); effect.start(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackSeismicWave.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackSeismicWave.java index f5c302e4f..73c5fb42f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackSeismicWave.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackSeismicWave.java @@ -1,6 +1,9 @@ package nautilus.game.arcade.game.games.christmasnew.section.six.attack; +import java.util.concurrent.TimeUnit; + import org.bukkit.Location; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.scheduler.BukkitRunnable; @@ -10,6 +13,7 @@ import mineplex.core.common.util.UtilMath; 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.UtilTime; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.ArcadeManager; @@ -18,14 +22,13 @@ import nautilus.game.arcade.game.games.christmasnew.section.six.phase.BossPhase; public class AttackSeismicWave extends BossAttack { + private static final long DURATION = TimeUnit.SECONDS.toMillis(6); private static final int MAX_RADIUS = 14; private static final String HIT_KEY = "Wave Hit"; private final int _delay; private final int _max; - private boolean _complete; - public AttackSeismicWave(BossPhase phase, int delay, int max) { super(phase); @@ -39,7 +42,7 @@ public class AttackSeismicWave extends BossAttack @Override public boolean isComplete() { - return _complete; + return UtilTime.elapsed(_start, DURATION); } @Override @@ -47,6 +50,8 @@ public class AttackSeismicWave extends BossAttack { ArcadeManager manager = _phase.getHost().getArcadeManager(); + _phase.getHost().sendSantaMessage("Watch out for that magic aura. Jump over the purple waves!", null); + manager.runSyncTimer(new BukkitRunnable() { int waves = 0; @@ -55,6 +60,7 @@ public class AttackSeismicWave extends BossAttack public void run() { Location center = _boss.getLocation().add(0, 0.3, 0); + center.getWorld().playSound(center, Sound.NOTE_PLING, 2, 0.3F); manager.runSyncTimer(new BukkitRunnable() { @@ -72,7 +78,7 @@ public class AttackSeismicWave extends BossAttack center.add(x, 0, z); - UtilParticle.PlayParticleToAll(ParticleType.CLOUD, center, null, 0, 1, ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, center, null, 0, 1, ViewDist.NORMAL); center.subtract(x, 0, z); } @@ -91,8 +97,8 @@ public class AttackSeismicWave extends BossAttack continue; } - Recharge.Instance.useForce(player, HIT_KEY, 500); - manager.GetDamage().NewDamageEvent(player, _boss, null, DamageCause.CUSTOM, 8, true, true, true, _boss.getCustomName(), "Seismic Wave"); + Recharge.Instance.useForce(player, HIT_KEY, 800); + manager.GetDamage().NewDamageEvent(player, _boss, null, DamageCause.CUSTOM, 8, true, true, true, _boss.getCustomName(), "Magic"); } if ((radius += 0.4) >= MAX_RADIUS) @@ -105,10 +111,9 @@ public class AttackSeismicWave extends BossAttack if (++waves == _max) { cancel(); - _complete = true; } } - }, 10, _delay); + }, 30, _delay); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackShootArrows.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackShootArrows.java index 81d0fafb1..98697cc6d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackShootArrows.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/attack/AttackShootArrows.java @@ -46,7 +46,7 @@ public class AttackShootArrows extends BossAttack implements IThrown arrow.setCritical(true); arrow.setVelocity(new Vector((Math.random() - 0.5) / 1.5D, (Math.random() / 3) + 1, (Math.random() - 0.5) / 1.5D)); - _phase.getHost().getArcadeManager().GetProjectile().AddThrow(arrow, _boss, this, -1, true, true, false, false, 2); + _phase.getHost().getArcadeManager().GetProjectile().AddThrow(arrow, _boss, this, -1, true, true, false, false, 3); }, 1, 1); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/phase/BossPhase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/phase/BossPhase.java index 9c111f970..de49514ec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/phase/BossPhase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/phase/BossPhase.java @@ -8,6 +8,8 @@ import java.util.concurrent.TimeUnit; import org.bukkit.Location; import org.bukkit.entity.LivingEntity; import org.bukkit.event.EventHandler; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilTime; @@ -23,6 +25,7 @@ public abstract class BossPhase extends SectionChallenge { private static final long DEFAULT_ATTACK_DELAY = TimeUnit.SECONDS.toMillis(2); + private static final PotionEffect SLOW = new PotionEffect(PotionEffectType.SLOW, 120, 6, false, false); private final List _attacks; private BossAttack _currentAttack; @@ -108,6 +111,11 @@ public abstract class BossPhase extends SectionChallenge } } + protected void stopBossMovement() + { + _boss.addPotionEffect(SLOW); + } + public void setBoss(LivingEntity boss) { _boss = boss; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/phase/Phase1.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/phase/Phase1.java index 355162df1..50a3a9132 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/phase/Phase1.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/phase/Phase1.java @@ -14,6 +14,8 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; import mineplex.core.common.util.UtilAction; @@ -199,7 +201,7 @@ public class Phase1 extends BossPhase if (!_completing) { clearAttacks(); - UtilEnt.CreatureMoveFast(_boss, _boss.getLocation().add(0, 0.2, 0), 1); + stopBossMovement(); _host.CreatureAllowOverride = true; _animation = new GWENAnimation(_host.getArcadeManager(), _boss.getLocation(), 4, (int) GWEN_DURATION); _host.CreatureAllowOverride = false; @@ -227,7 +229,7 @@ public class Phase1 extends BossPhase _shield.forEach(stand -> { stand.setGravity(true); - UtilAction.velocity(stand, new Vector(Math.random() - 0.5, 0.8, Math.random() - 0.5)); + UtilAction.velocity(stand, new Vector(Math.random() - 0.5, 1.8, Math.random() - 0.5)); }); _host.getArcadeManager().runSyncLater(() -> diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/phase/Phase2.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/phase/Phase2.java index 982fba4b1..9d216ac5d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/phase/Phase2.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/six/phase/Phase2.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.christmasnew.section.six.phase; import java.util.HashMap; import java.util.Map; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -10,6 +11,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; @@ -20,6 +22,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -187,20 +190,31 @@ public class Phase2 extends BossPhase return; } - if (event.GetProjectile() != null) - { - event.SetCancelled("Phase 2 Projectile Damage"); - return; - } - event.SetKnockback(false); - Player damager = event.GetDamagerPlayer(false); + Player damager = event.GetDamagerPlayer(true); if (damager != null) { - damager.playSound(damagee.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 0.8F); - UtilAction.velocity(damager, UtilAlg.getTrajectory(damagee, damager), 0.7, false, 0, 0.4, 0.6, true); + if (event.GetProjectile() == null) + { + damager.playSound(damagee.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 0.8F); + UtilAction.velocity(damager, UtilAlg.getTrajectory(damagee, damager), 0.7, false, 0, 0.4, 0.5, true); + } + else if (Math.random() < 0.4 && Recharge.Instance.use(damager, "Fire Attack", 1000, false, false)) + { + AttackFire attackFire = new AttackFire(this, 3, damager.getLocation()); + attackFire.onRegister(); + } + } + } + + @EventHandler + public void entityDamage(EntityDamageEvent event) + { + if (event.getEntity().equals(_boss)) + { + Bukkit.broadcastMessage(event.getEventName()); } } @@ -216,7 +230,7 @@ public class Phase2 extends BossPhase { clearAttacks(); _completing = true; - _host.sendSantaMessage("At this point Phase 2 should end", null); + _host.sendBossMessage("No!!!!!! I can't believe you defeated me!", null); _host.endGame(true, "The Pumpkin King was Defeated!"); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/two/RockParkour.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/two/RockParkour.java index f4a47d72e..39b6cc8a1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/two/RockParkour.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/two/RockParkour.java @@ -21,7 +21,7 @@ class RockParkour extends SectionChallenge { private static final int MAX_MOBS = 25; - private static final PotionEffect SPEED = new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 0, false, false); + private static final PotionEffect SPEED = new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 1, false, false); private final List _mobSpawns;