From 9da5b367fd5ab13280080681020bcb9e8b62e23a Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Mon, 12 Jun 2017 01:06:33 -0400 Subject: [PATCH] Further improve raids --- .../clans/worldevent/WorldEventManager.java | 3 + .../clans/worldevent/api/EventCreature.java | 24 ++-- .../clans/worldevent/api/WorldEvent.java | 4 +- .../clans/worldevent/raid/RaidChallenge.java | 6 +- .../clans/worldevent/raid/RaidManager.java | 29 ++++- .../clans/worldevent/raid/RaidWorldEvent.java | 83 +++++++++--- .../clans/worldevent/raid/WorldData.java | 10 +- .../worldevent/raid/wither/WitherRaid.java | 24 +++- .../wither/challenge/five/ChallengeFive.java | 19 ++- .../raid/wither/challenge/five/IronGate.java | 15 +-- .../wither/challenge/four/ChallengeFour.java | 36 ++---- .../raid/wither/challenge/four/FakeBlock.java | 1 + .../wither/challenge/one/ChallengeOne.java | 2 +- .../challenge/seven/ChallengeSeven.java | 2 +- .../challenge/three/ChallengeThree.java | 10 ++ .../challenge/three/ChallengeTorch.java | 2 +- .../creature/archer/ArcherShooting.java | 3 +- .../creature/archer/DecayingArcher.java | 25 +++- .../creature/corpse/ReanimatedCorpse.java | 25 +++- .../raid/wither/creature/giant/Goliath.java | 25 +++- .../wither/creature/mage/KnightPassive.java | 4 +- .../raid/wither/creature/mage/MageBolt.java | 2 +- .../wither/creature/mage/MageBoneExplode.java | 76 +++++++++++ .../raid/wither/creature/mage/MageSummon.java | 2 +- .../wither/creature/mage/UndeadKnight.java | 25 +++- .../raid/wither/creature/mage/UndeadMage.java | 34 ++++- .../wither/creature/magma/BlazeMinion.java | 25 +++- .../raid/wither/creature/magma/Cataclysm.java | 7 +- .../raid/wither/creature/magma/HeatingUp.java | 2 + .../creature/magma/InfernalMinions.java | 3 +- .../raid/wither/creature/magma/Magmus.java | 64 +++++++-- ...agmusPassive.java => MagmusCataclysm.java} | 8 +- .../raid/wither/creature/magma/MagmusEat.java | 89 +++++++++++++ .../wither/creature/magma/MagmusMeteor.java | 122 ++++++++++++++++++ .../wither/creature/magma/MagmusSmash.java | 71 ++++++++++ .../creature/silverfish/PitSwarmer.java | 59 --------- .../creature/silverfish/SwarmerPassive.java | 49 ------- .../wither/creature/wither/BlackHole.java | 11 ++ .../wither/creature/wither/CharlesSkulls.java | 2 + .../creature/wither/CharlesWitherton.java | 96 +++++++++++++- .../wither/creature/wither/MiniCharles.java | 101 ++++++++++++++- .../wither/creature/wither/SummonCorpse.java | 1 + .../wither/creature/wither/SummonMinions.java | 3 +- .../wither/creature/wither/SummonUndead.java | 1 + .../wither/ai/PathfinderGoalCustomFloat.java | 33 +++++ 45 files changed, 1011 insertions(+), 227 deletions(-) create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/MageBoneExplode.java rename Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/{MagmusPassive.java => MagmusCataclysm.java} (87%) create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusEat.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusMeteor.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusSmash.java delete mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/silverfish/PitSwarmer.java delete mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/silverfish/SwarmerPassive.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/ai/PathfinderGoalCustomFloat.java diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java index a7c44b7a6..b235e1ba3 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java @@ -14,6 +14,7 @@ import com.google.common.collect.Lists; import mineplex.core.MiniPlugin; import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.blood.Blood; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilWorld; @@ -67,6 +68,8 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement _skillFactory = skillFactory; + new Blood(plugin); + _raidManager = new RaidManager(plugin); updateNextEventTime(); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/api/EventCreature.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/api/EventCreature.java index dd11c7b79..43326c031 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/api/EventCreature.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/api/EventCreature.java @@ -2,6 +2,15 @@ package mineplex.game.clans.clans.worldevent.api; import java.util.UUID; +import org.bukkit.Location; +import org.bukkit.entity.LivingEntity; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.world.ChunkUnloadEvent; + import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilMath; @@ -13,15 +22,6 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import org.bukkit.Location; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityCombustEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.world.ChunkUnloadEvent; - public abstract class EventCreature implements Listener { protected static final boolean DEBUG_MODE = true; @@ -75,7 +75,7 @@ public abstract class EventCreature implements Listener { return getEvent().getDifficulty(); } - + protected void spawnEntity() { Location spawnLocation = _entity == null ? _spawnLocation : _entity.getLocation(); @@ -352,7 +352,7 @@ public abstract class EventCreature implements Listener { return; } - + if (!event.GetDamageeEntity().equals(_entity)) { return; @@ -362,6 +362,8 @@ public abstract class EventCreature implements Listener applyDamage(event.GetDamage()); updateName(); + + _lastDamaged = System.currentTimeMillis(); _event.updateLastActive(); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/api/WorldEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/api/WorldEvent.java index a0e662bc4..1790cc269 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/api/WorldEvent.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/api/WorldEvent.java @@ -120,7 +120,7 @@ public abstract class WorldEvent implements Listener, ScoreboardElement public void registerCreature(EventCreature creature) { - UtilServer.getServer().getPluginManager().registerEvents(creature, UtilServer.getPlugin()); + UtilServer.RegisterEvents(creature); _creatures.add(creature); } @@ -223,7 +223,7 @@ public abstract class WorldEvent implements Listener, ScoreboardElement } setState(EventState.LIVE); customStart(); - Bukkit.getPluginManager().registerEvents(this, UtilServer.getPlugin()); + UtilServer.RegisterEvents(this); } public void announceStart() diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/RaidChallenge.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/RaidChallenge.java index 896440803..6f30d8744 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/RaidChallenge.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/RaidChallenge.java @@ -47,12 +47,12 @@ public abstract class RaidChallenge implements Listene public void complete() { - complete(false); + complete(true); } - public void complete(boolean onDisable) + public void complete(boolean allowCustom) { - if (!onDisable) + if (allowCustom) { customComplete(); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/RaidManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/RaidManager.java index a74b712a5..87ccfdfd4 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/RaidManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/RaidManager.java @@ -22,8 +22,10 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.DisguiseManager; import mineplex.core.projectile.ProjectileManager; import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import mineplex.core.utils.UtilScheduler; import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.worldevent.api.EventState; import mineplex.game.clans.clans.worldevent.raid.command.StartRaidCommand; import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.damage.DamageManager; @@ -108,8 +110,8 @@ public class RaidManager extends MiniPlugin inside.forEach(in -> UtilPlayer.message(in, F.main(type.getRaidName() + " Raid", "Summoning ancient power..."))); createNewRaid(type, raid -> inside.forEach(in -> { - raid.addPlayer(player); - player.getWorld().strikeLightningEffect(player.getLocation()); + raid.addPlayer(in); + in.getWorld().strikeLightningEffect(in.getLocation()); })); return true; } @@ -126,6 +128,7 @@ public class RaidManager extends MiniPlugin RaidWorldEvent event = type.getClazz().getConstructor(WorldData.class, RaidManager.class).newInstance(data, this); raidConsumer.accept(event); event.start(); + _raids.add(event); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { @@ -139,6 +142,28 @@ public class RaidManager extends MiniPlugin data.LoadChecker = task; } + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + { + UtilServer.getPlayersCollection() + .stream() + .filter(player -> isInRaid(player.getLocation())) + .forEach(player -> + { + ClansManager.getInstance().getItemMapManager().removeMap(player); + }); + return; + } + if (event.getType() != UpdateType.SEC) + { + return; + } + + _raids.removeIf(e -> e.getState() == EventState.STOPPED); + } + @EventHandler public void onInteract(PlayerInteractEvent event) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/RaidWorldEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/RaidWorldEvent.java index 09b0fefae..3705cef86 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/RaidWorldEvent.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/RaidWorldEvent.java @@ -9,10 +9,12 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.world.ChunkUnloadEvent; import mineplex.core.common.util.F; @@ -38,10 +40,12 @@ public abstract class RaidWorldEvent extends WorldEvent protected final int Id; - protected List Players = new ArrayList<>(); + private List _players = new ArrayList<>(); protected long _forceEnd = -1; + private boolean _cleanup = false; + public RaidWorldEvent(String name, WorldData data, RaidManager manager) { super(name, new Location(data.World, data.MinX + ((data.MaxX - data.MinX) / 2), data.MinY + ((data.MaxY - data.MinY) / 2), data.MinZ + ((data.MaxZ - data.MinZ) / 2)), UtilMath.getMax((data.MaxX - data.MinX) / 2, (data.MaxY - data.MinY) / 2, (data.MaxZ - data.MinZ) / 2), false, manager.getDisguiseManager(), manager.getProjectileManager(), manager.getDamageManager(), manager.getBlockRestore(), manager.getConditionManager()); @@ -81,7 +85,9 @@ public abstract class RaidWorldEvent extends WorldEvent public List getPlayers() { - return Players; + List players = new ArrayList<>(); + players.addAll(_players); + return players; } public int getId() @@ -95,7 +101,7 @@ public abstract class RaidWorldEvent extends WorldEvent _forceEnd = System.currentTimeMillis() + UtilTime.convert(90, TimeUnit.MINUTES, TimeUnit.MILLISECONDS); int spawnIndex = 0; List spawns = WorldData.SpawnLocs.get("Red"); - for (Player player : Players) + for (Player player : _players) { if (spawnIndex >= spawns.size()) { @@ -110,21 +116,28 @@ public abstract class RaidWorldEvent extends WorldEvent @Override public void customCleanup(boolean onDisable) { - Players.forEach(player -> player.teleport(Spawn.getNorthSpawn())); - Players.clear(); + _cleanup = true; + _players.forEach(player -> player.teleport(Spawn.getNorthSpawn())); + _players.clear(); + getCreatures().forEach(creature -> + { + HandlerList.unregisterAll(creature); + creature.getEntity().remove(); + }); + getCreatures().clear(); if (onDisable) { WorldData.uninitialize(); } else { - UtilServer.runSyncLater(WorldData::uninitialize, 120); + UtilServer.runSyncLater(WorldData::uninitialize, 20 * 10); } } public void addPlayer(Player player) { - Players.add(player); + _players.add(player); } public void setForceEnd(long end) @@ -143,7 +156,7 @@ public abstract class RaidWorldEvent extends WorldEvent { return; } - if (Players.isEmpty()) + if (_players.isEmpty()) { stop(); } @@ -178,7 +191,7 @@ public abstract class RaidWorldEvent extends WorldEvent @EventHandler public void onChunkUnload(ChunkUnloadEvent event) { - if (getState() == EventState.STOPPED || this.getState() == EventState.REMOVED) + if (getState() == EventState.STOPPED || getState() == EventState.REMOVED || _cleanup) { return; } @@ -229,10 +242,14 @@ public abstract class RaidWorldEvent extends WorldEvent UtilPlayer.message(player, F.main(getName(), "You cannot build here!")); } - @EventHandler(priority = EventPriority.LOWEST) + @EventHandler(priority = EventPriority.LOW) public void onQuit(PlayerQuitEvent event) { - if (Players.remove(event.getPlayer())) + if (_cleanup) + { + return; + } + if (_players.remove(event.getPlayer())) { event.getPlayer().teleport(Spawn.getNorthSpawn()); } @@ -241,22 +258,52 @@ public abstract class RaidWorldEvent extends WorldEvent @EventHandler(priority = EventPriority.LOWEST) public void onDie(PlayerDeathEvent event) { - if (Players.remove(event.getEntity())) + if (_cleanup) { - UtilServer.runSyncLater(() -> event.getEntity().teleport(Spawn.getNorthSpawn()), 5); + return; + } + if (_players.remove(event.getEntity())) + { + event.getEntity().setHealth(event.getEntity().getMaxHealth()); + getCondition().Clean(event.getEntity()); + event.getEntity().getActivePotionEffects().forEach(pe -> event.getEntity().removePotionEffect(pe.getType())); + event.getEntity().setExp(0); + event.getEntity().setLevel(0); + event.getEntity().teleport(Spawn.getNorthSpawn()); + } + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onTeleport(PlayerTeleportEvent event) + { + if (_cleanup) + { + return; + } + if (!event.getTo().getWorld().equals(WorldData.World)) + { + _players.remove(event.getPlayer()); } } @EventHandler public void onTpHome(ClansCommandExecutedEvent event) { + if (!_players.contains(event.getPlayer())) + { + return; + } if (event.getCommand().equalsIgnoreCase("tphome") || event.getCommand().equalsIgnoreCase("stuck")) { - if (Players.contains(event.getPlayer())) - { - event.setCancelled(true); - UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot teleport while in a raid!")); - } + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot teleport while in a raid!")); + return; + } + if (event.getCommand().equalsIgnoreCase("claim") || event.getCommand().equalsIgnoreCase("unclaim") || event.getCommand().equalsIgnoreCase("unclaimall") || event.getCommand().equalsIgnoreCase("homeset")) + { + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot manage your clan's territory while in a raid!")); + return; } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/WorldData.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/WorldData.java index 4eee372c0..a647f268c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/WorldData.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/WorldData.java @@ -16,6 +16,7 @@ import org.bukkit.Difficulty; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.WorldCreator; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.scheduler.BukkitTask; import mineplex.core.common.timing.TimingManager; @@ -26,8 +27,9 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.WorldUtil; import mineplex.core.common.util.ZipUtil; import mineplex.core.common.util.worldgen.WorldGenCleanRoom; +import mineplex.game.clans.spawn.Spawn; -public class WorldData +public class WorldData { public int Id = -1; @@ -56,10 +58,10 @@ public class WorldData public WorldData(String raidName) { + RaidName = raidName; initialize(); Id = getNewId(); - RaidName = raidName; } private List loadFiles() @@ -136,6 +138,8 @@ public class WorldData World.setDifficulty(Difficulty.HARD); World.setGameRuleValue("showDeathMessages", "false"); + ((CraftWorld)World).getHandle().allowAnimals = false; + ((CraftWorld)World).getHandle().allowMonsters = false; TimingManager.start("WorldData loading WorldConfig."); //Load World Data @@ -380,6 +384,8 @@ public class WorldData return; } + World.getPlayers().forEach(player -> player.teleport(Spawn.getNorthSpawn())); + //Wipe World MapUtil.UnloadWorld(UtilServer.getPlugin(), World); MapUtil.ClearWorldReferences(World.getName()); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/WitherRaid.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/WitherRaid.java index db88e0286..0a19b4fc6 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/WitherRaid.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/WitherRaid.java @@ -5,8 +5,8 @@ import java.util.LinkedList; import java.util.List; import org.bukkit.Location; +import org.bukkit.event.EventHandler; -import mineplex.game.clans.clans.worldevent.api.EventState; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; import mineplex.game.clans.clans.worldevent.raid.RaidManager; import mineplex.game.clans.clans.worldevent.raid.RaidType; @@ -18,10 +18,11 @@ import mineplex.game.clans.clans.worldevent.raid.wither.challenge.seven.Challeng import mineplex.game.clans.clans.worldevent.raid.wither.challenge.six.ChallengeSix; import mineplex.game.clans.clans.worldevent.raid.wither.challenge.three.ChallengeThree; import mineplex.game.clans.clans.worldevent.raid.wither.challenge.two.ChallengeTwo; +import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; public class WitherRaid extends RaidWorldEvent { - private final List>> _challenges = new LinkedList<>(); + private List>> _challenges; private RaidChallenge _currentChallenge; public WitherRaid(mineplex.game.clans.clans.worldevent.raid.WorldData data, RaidManager manager) @@ -53,7 +54,7 @@ public class WitherRaid extends RaidWorldEvent private void teleportToAltar() { Location altar = WorldData.getCustomLocs("MAIN_ALTAR").get(0); - Players.forEach(player -> player.teleport(altar)); + getPlayers().forEach(player -> player.teleport(altar)); } @Override @@ -61,6 +62,7 @@ public class WitherRaid extends RaidWorldEvent { WorldData.World.setGameRuleValue("doDaylightCycle", "false"); WorldData.World.setTime(14000); + _challenges = new LinkedList<>(); _challenges.add(ChallengeOne.class); _challenges.add(ChallengeTwo.class); _challenges.add(ChallengeThree.class); @@ -83,7 +85,10 @@ public class WitherRaid extends RaidWorldEvent { if (_currentChallenge.isComplete()) { - teleportToAltar(); + if (_challenges.size() < 6) + { + teleportToAltar(); + } nextChallenge(); } } @@ -94,7 +99,16 @@ public class WitherRaid extends RaidWorldEvent { if (_currentChallenge != null) { - _currentChallenge.complete(getState() == EventState.REMOVED); + _currentChallenge.complete(false); + } + } + + @EventHandler + public void onBlockToss(SkillTriggerEvent event) + { + if (event.GetSkillName().equals("Block Toss") && getPlayers().contains(event.GetPlayer())) + { + event.SetCancelled(true); } } } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/ChallengeFive.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/ChallengeFive.java index dab6871b4..b77f231be 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/ChallengeFive.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/ChallengeFive.java @@ -11,6 +11,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; @@ -19,6 +20,7 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.worldevent.api.EventCreature; +import mineplex.game.clans.clans.worldevent.api.EventCreatureDeathEvent; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid; import mineplex.game.clans.clans.worldevent.raid.wither.creature.archer.DecayingArcher; @@ -82,6 +84,8 @@ public class ChallengeFive extends RaidChallenge _gates.add(new IronGate(this, getRaid().getWorldData().getCustomLocs("C_FIVE_G" + i), creatures)); i++; } + _goliath = new Goliath(this, getRaid().getWorldData().getCustomLocs("C_FIVE_GIANT").get(0)); + getRaid().registerCreature(_goliath); getRaid().getPlayers().forEach(player -> UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "Use the third gate!"))); } @@ -99,6 +103,7 @@ public class ChallengeFive extends RaidChallenge gate.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE); gate.setType(Material.SKULL); gate.setData((byte)1); + _altar.getWorld().dropItem(_altar.clone().add(0, 2, 0), new ItemStack(Material.EMERALD, UtilMath.rRange(15, 17))); } @EventHandler @@ -124,7 +129,7 @@ public class ChallengeFive extends RaidChallenge { Location to = gate.getCenter().clone(); to.setY(_goliath.getEntity().getLocation().getY()); - _goliath.getEntity().setVelocity(UtilAlg.getTrajectory(_goliath.getEntity().getLocation(), to).normalize().multiply(0.5)); + _goliath.getEntity().setVelocity(UtilAlg.getTrajectory(_goliath.getEntity().getLocation(), to).normalize().multiply(0.15)); } if (gate.update()) { @@ -161,4 +166,16 @@ public class ChallengeFive extends RaidChallenge event.SetCancelled(true); } } + + @EventHandler + public void onDeath(EventCreatureDeathEvent event) + { + if (event.getCreature().getEvent() instanceof WitherRaid) + { + if (((WitherRaid)event.getCreature().getEvent()).getId() == getRaid().getId()) + { + _gates.forEach(gate -> gate.handleDeath(event.getCreature())); + } + } + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/IronGate.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/IronGate.java index d9940e37c..b0a0964d5 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/IronGate.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/five/IronGate.java @@ -64,19 +64,16 @@ public class IronGate public boolean update() { - int alive = 0; - for (EventCreature guardian : _guardians) - { - if (guardian.getHealth() > 0) - { - alive++; - } - } - if (alive < 0) + if (_guardians.size() < 1) { open(); return true; } return false; } + + public void handleDeath(EventCreature creature) + { + _guardians.remove(creature); + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/ChallengeFour.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/ChallengeFour.java index 7112c0885..bfb9cb879 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/ChallengeFour.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/ChallengeFour.java @@ -9,7 +9,9 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilMath; @@ -18,7 +20,6 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid; -import mineplex.game.clans.clans.worldevent.raid.wither.creature.silverfish.PitSwarmer; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; public class ChallengeFour extends RaidChallenge @@ -26,6 +27,7 @@ public class ChallengeFour extends RaidChallenge private Location _altar; private boolean _teleported = false; private List _blocks = new ArrayList<>(); + private double[] _damageYRange = new double[2]; public ChallengeFour(WitherRaid raid) { @@ -41,26 +43,6 @@ public class ChallengeFour extends RaidChallenge UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "Complete the parkour!")); player.teleport(getRaid().getWorldData().getCustomLocs("C_FOUR_ENTER").get(0)); }); - Location pos1 = getRaid().getWorldData().getCustomLocs("C_FOUR_SF").get(0); - Location pos2 = getRaid().getWorldData().getCustomLocs("C_FOUR_SF").get(1); - int minX = Math.min(pos1.getBlockX(), pos2.getBlockX()); - int maxX = Math.max(pos1.getBlockX(), pos2.getBlockX()); - int minY = Math.min(pos1.getBlockY(), pos2.getBlockY()); - int maxY = Math.max(pos1.getBlockY(), pos2.getBlockY()); - int minZ = Math.min(pos1.getBlockZ(), pos2.getBlockZ()); - int maxZ = Math.max(pos1.getBlockZ(), pos2.getBlockZ()); - - for (int x = minX; x <= maxX; x++) - { - for (int y = minY; y <= maxY; y++) - { - for (int z = minZ; z <= maxZ; z++) - { - Block block = getRaid().getWorldData().World.getBlockAt(x, y, z); - getRaid().registerCreature(new PitSwarmer(this, block.getLocation())); - } - } - } } @Override @@ -69,8 +51,13 @@ public class ChallengeFour extends RaidChallenge for (Location loc : getRaid().getWorldData().getCustomLocs("C_FOUR_FB")) { loc.getBlock().setType(Material.NETHER_BRICK); + _blocks.add(new FakeBlock(this, loc.getBlock())); } getRaid().getPlayers().forEach(player -> UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "Use the second gate!"))); + Location pos1 = getRaid().getWorldData().getCustomLocs("C_FOUR_SF").get(0); + Location pos2 = getRaid().getWorldData().getCustomLocs("C_FOUR_SF").get(1); + _damageYRange[0] = Math.min(pos1.getY(), pos2.getY()); + _damageYRange[1] = Math.max(pos1.getY(), pos2.getY()); } @SuppressWarnings("deprecation") @@ -87,12 +74,13 @@ public class ChallengeFour extends RaidChallenge gate.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE); gate.setType(Material.SKULL); gate.setData((byte)1); + _altar.getWorld().dropItem(_altar.clone().add(0, 2, 0), new ItemStack(Material.EMERALD, UtilMath.rRange(13, 17))); } @EventHandler public void onUpdate(UpdateEvent event) { - if (event.getType() == UpdateType.SEC) + if (event.getType() == UpdateType.SEC && _teleported) { for (Player player : getRaid().getPlayers()) { @@ -101,6 +89,10 @@ public class ChallengeFour extends RaidChallenge complete(); return; } + if (player.getLocation().getY() <= _damageYRange[1] && player.getLocation().getY() >= _damageYRange[0]) + { + getRaid().getDamageManager().NewDamageEvent(player, null, null, DamageCause.LAVA, 1, false, true, true, "Burning Cavern", "Hot Ground"); + } } } if (event.getType() == UpdateType.TICK) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/FakeBlock.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/FakeBlock.java index 371bec25e..55793d72d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/FakeBlock.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/four/FakeBlock.java @@ -26,6 +26,7 @@ public class FakeBlock { _block.setType(Material.AIR); aired = true; + break; } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/one/ChallengeOne.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/one/ChallengeOne.java index 1edc07d61..57c1fa0af 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/one/ChallengeOne.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/one/ChallengeOne.java @@ -92,7 +92,7 @@ public class ChallengeOne extends RaidChallenge { for (Player player : getRaid().getPlayers()) { - if (UtilMath.offset(player.getLocation(), _altar) <= 5) + if (UtilMath.offset(player.getLocation(), _altar) <= 10) { _trigger = player; complete(); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/seven/ChallengeSeven.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/seven/ChallengeSeven.java index 9fadaa068..f82e86ab0 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/seven/ChallengeSeven.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/seven/ChallengeSeven.java @@ -84,7 +84,7 @@ public class ChallengeSeven extends RaidChallenge UtilPlayer.message(player, F.main(getRaid().getName() + " Raid", "The evil reign of Charles Witherton is over! You will be returned to spawn in 2 minutes!")); player.teleport(_altar); }); - List anim = UtilShapes.getCircle(_altar.clone().add(0, 2, 0), true, 3); + List anim = UtilShapes.getPointsInCircle(_altar.clone().add(0, 2, 0), 5, 3); int emeralds = UtilMath.rRange((int)Math.ceil(45 / anim.size()), (int)Math.ceil(80 / anim.size())); for (Location drop : anim) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeThree.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeThree.java index 99daf36c0..260e59321 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeThree.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeThree.java @@ -9,8 +9,10 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; @@ -28,6 +30,7 @@ public class ChallengeThree extends RaidChallenge private List _torches = new ArrayList<>(); protected int LitTorches; private long _lastSpawn; + private int _spawnTotal; public ChallengeThree(WitherRaid raid) { @@ -72,6 +75,7 @@ public class ChallengeThree extends RaidChallenge gate.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE); gate.setType(Material.SKULL); gate.setData((byte)1); + _altar.getWorld().dropItem(_altar.clone().add(0, 2, 0), new ItemStack(Material.EMERALD, UtilMath.rRange(10, 15))); } @EventHandler @@ -90,12 +94,18 @@ public class ChallengeThree extends RaidChallenge if (UtilTime.elapsed(_lastSpawn, 7000) && _teleported) { _lastSpawn = System.currentTimeMillis(); + if (_spawnTotal > 100) + { + return; + } getRaid().getWorldData().getCustomLocs("C_THREE_RC").forEach(loc -> { + _spawnTotal++; getRaid().registerCreature(new ReanimatedCorpse(this, loc)); }); getRaid().getWorldData().getCustomLocs("C_THREE_DA").forEach(loc -> { + _spawnTotal++; getRaid().registerCreature(new DecayingArcher(this, loc)); }); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeTorch.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeTorch.java index 08482b694..90b6e0a4e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeTorch.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/challenge/three/ChallengeTorch.java @@ -19,7 +19,7 @@ public class ChallengeTorch public void handleInteract(Block block) { - if (block.equals(_block)) + if (block.equals(_block) && _extinguish == -1) { _challenge.LitTorches++; _extinguish = System.currentTimeMillis() + 3000; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/archer/ArcherShooting.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/archer/ArcherShooting.java index de8ded9ec..9bf61cb22 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/archer/ArcherShooting.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/archer/ArcherShooting.java @@ -2,6 +2,7 @@ package mineplex.game.clans.clans.worldevent.raid.wither.creature.archer; import org.bukkit.entity.Arrow; import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; @@ -28,7 +29,7 @@ public class ArcherShooting extends BossAbility @Override public void tick() { - if (getEntity().getTarget() != null) + if (getEntity().getTarget() != null && getEntity().getTarget() instanceof Player) { if (UtilTime.elapsed(_lastRope, 10000)) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/archer/DecayingArcher.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/archer/DecayingArcher.java index 13e5bfd46..e7215b1a3 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/archer/DecayingArcher.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/archer/DecayingArcher.java @@ -2,18 +2,23 @@ package mineplex.game.clans.clans.worldevent.raid.wither.creature.archer; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.game.clans.clans.worldevent.api.EventCreature; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; +import mineplex.game.clans.clans.worldevent.raid.RaidCreature; import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; -public class DecayingArcher extends EventCreature +public class DecayingArcher extends RaidCreature { private RaidChallenge _challenge; private ArcherShooting _passive; @@ -62,4 +67,20 @@ public class DecayingArcher extends EventCreature _passive.tick(); } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void allyDamage(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId()) + { + LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE); + if (damager != null && !(damager instanceof Player)) + { + event.SetCancelled("Allied Damage"); + } + } + } + + @Override + public void handleDeath(Location location) {} } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/corpse/ReanimatedCorpse.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/corpse/ReanimatedCorpse.java index debf12fa7..e09e61ea2 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/corpse/ReanimatedCorpse.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/corpse/ReanimatedCorpse.java @@ -2,19 +2,24 @@ package mineplex.game.clans.clans.worldevent.raid.wither.creature.corpse; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.UtilMath; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.game.clans.clans.worldevent.api.EventCreature; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; +import mineplex.game.clans.clans.worldevent.raid.RaidCreature; import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; -public class ReanimatedCorpse extends EventCreature +public class ReanimatedCorpse extends RaidCreature { private static final Material[] SWORDS = {Material.WOOD_SWORD, Material.STONE_SWORD, Material.GOLD_SWORD, Material.IRON_SWORD, Material.DIAMOND_SWORD}; private RaidChallenge _challenge; @@ -64,4 +69,20 @@ public class ReanimatedCorpse extends EventCreature _passive.tick(); } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void allyDamage(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId()) + { + LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE); + if (damager != null && !(damager instanceof Player)) + { + event.SetCancelled("Allied Damage"); + } + } + } + + @Override + public void handleDeath(Location location) {} } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/giant/Goliath.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/giant/Goliath.java index d5de7b8c2..1920ef4aa 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/giant/Goliath.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/giant/Goliath.java @@ -2,16 +2,21 @@ package mineplex.game.clans.clans.worldevent.raid.wither.creature.giant; import org.bukkit.Location; import org.bukkit.entity.Giant; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.game.clans.clans.worldevent.api.EventCreature; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; +import mineplex.game.clans.clans.worldevent.raid.RaidCreature; import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; -public class Goliath extends EventCreature +public class Goliath extends RaidCreature { private RaidChallenge _challenge; private GoliathPassive _passive; @@ -56,4 +61,20 @@ public class Goliath extends EventCreature _passive.tick(); } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void allyDamage(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId()) + { + LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE); + if (damager != null && !(damager instanceof Player)) + { + event.SetCancelled("Allied Damage"); + } + } + } + + @Override + public void handleDeath(Location location) {} } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/KnightPassive.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/KnightPassive.java index 207184797..825254c8b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/KnightPassive.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/KnightPassive.java @@ -46,12 +46,12 @@ public class KnightPassive extends BossPassive if (UtilTime.elapsed(_lastUsed, getCooldown() * 1000)) { _lastUsed = System.currentTimeMillis(); - event.AddMod("Hilt Smash", 1 - event.GetDamage()); + event.AddMod("Hilt Smash", 4 - event.GetDamage()); getBoss().getEvent().getCondition().Factory().Slow("Hilt Smash", event.GetDamageeEntity(), event.GetDamagerEntity(false), 2, 1, false, true, false, true); } else { - event.AddMod("Knight Attack", 1 - event.GetDamage()); + event.AddMod("Knight Attack", 4 - event.GetDamage()); } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/MageBolt.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/MageBolt.java index bff678973..71f6d6944 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/MageBolt.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/MageBolt.java @@ -54,7 +54,7 @@ public class MageBolt extends BossPassive if (canHit) { - getBoss().getEvent().getDamageManager().NewDamageEvent(target, getEntity(), null, DamageCause.CUSTOM, 2.5, true, true, false, getEntity().getName(), "Mystical Energy"); + getBoss().getEvent().getDamageManager().NewDamageEvent(target, getEntity(), null, DamageCause.CUSTOM, 5, true, true, false, getEntity().getName(), "Mystical Energy"); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/MageBoneExplode.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/MageBoneExplode.java new file mode 100644 index 000000000..87440c682 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/MageBoneExplode.java @@ -0,0 +1,76 @@ +package mineplex.game.clans.clans.worldevent.raid.wither.creature.mage; + +import java.util.Map; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.Managers; +import mineplex.core.blood.Blood; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.game.clans.clans.worldevent.api.BossPassive; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +public class MageBoneExplode extends BossPassive +{ + private long _lastUsed; + + public MageBoneExplode(UndeadMage creature) + { + super(creature); + _lastUsed = System.currentTimeMillis(); + } + + private void explode() + { + Map nearby = UtilPlayer.getInRadius(getLocation(), 4); + for (Player near : nearby.keySet()) + { + getBoss().getEvent().getDamageManager().NewDamageEvent(near, getEntity(), null, DamageCause.CUSTOM, 3, true, true, false, getEntity().getName(), "Bone Explosion"); + } + Managers.get(Blood.class).Effects(null, getLocation().add(0, 0.5, 0), 48, 0.8, Sound.SKELETON_HURT, 2f, 1.2f, Material.BONE, (byte) 0, 40, false); + } + + @Override + public int getCooldown() + { + return 8; + } + + @Override + public boolean isProgressing() + { + return false; + } + + @Override + public void tick() + { + if (UtilTime.elapsed(_lastUsed, getCooldown() * 1000)) + { + _lastUsed = System.currentTimeMillis(); + explode(); + } + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains("Bone Explosion")) + { + return; + } + + if (event.GetDamagerEntity(false) == null || event.GetDamagerEntity(false).getEntityId() != getEntity().getEntityId()) + { + return; + } + + event.AddKnockback("Bone Explosion", 5); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/MageSummon.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/MageSummon.java index 09bb949e9..3ee21f400 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/MageSummon.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/MageSummon.java @@ -25,7 +25,7 @@ public class MageSummon extends BossPassive super(creature); _lastUsed = System.currentTimeMillis(); - MAX_KNIGHTS = spawnLocations.size(); + MAX_KNIGHTS = spawnLocations == null ? 10 : spawnLocations.size(); _spawnLocations = spawnLocations; } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/UndeadKnight.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/UndeadKnight.java index 62456eda6..093d3afa5 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/UndeadKnight.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/UndeadKnight.java @@ -2,9 +2,13 @@ package mineplex.game.clans.clans.worldevent.raid.wither.creature.mage; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -12,11 +16,12 @@ import org.bukkit.potion.PotionEffectType; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.game.clans.clans.worldevent.api.EventCreature; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; +import mineplex.game.clans.clans.worldevent.raid.RaidCreature; import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; -public class UndeadKnight extends EventCreature +public class UndeadKnight extends RaidCreature { private RaidChallenge _challenge; private KnightPassive _passive; @@ -68,4 +73,20 @@ public class UndeadKnight extends EventCreature _passive.tick(); } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void allyDamage(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId()) + { + LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE); + if (damager != null && !(damager instanceof Player)) + { + event.SetCancelled("Allied Damage"); + } + } + } + + @Override + public void handleDeath(Location location) {} } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/UndeadMage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/UndeadMage.java index 428bfa30f..7a767fcdd 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/UndeadMage.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/mage/UndeadMage.java @@ -7,15 +7,16 @@ import java.util.Map; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.updater.UpdateType; @@ -34,7 +35,7 @@ public class UndeadMage extends RaidCreature public UndeadMage(RaidChallenge challenge, Location location, boolean invulnerable, List spawnLocations, List blinkLocations) { - super(challenge.getRaid(), location, "Undead Mage", true, 200, 5, true, Skeleton.class); + super(challenge.getRaid(), location, "Undead Mage", true, 500, 1500, true, Skeleton.class); _challenge = challenge; _invuln = invulnerable; @@ -43,12 +44,13 @@ public class UndeadMage extends RaidCreature _abilities.add(new MageSummon(this, spawnLocations)); _abilities.add(new MageBlink(this, blinkLocations)); _abilities.add(new MageBolt(this)); + _abilities.add(new MageBoneExplode(this)); } @Override protected void spawnCustom() { - UtilEnt.vegetate(getEntity()); + //UtilEnt.vegetate(getEntity()); getEntity().setSkeletonType(SkeletonType.WITHER); getEntity().getEquipment().setItemInHand(new ItemStack(Material.RECORD_6)); //Meridian Scepter getEntity().getEquipment().setItemInHandDropChance(0f); @@ -161,6 +163,32 @@ public class UndeadMage extends RaidCreature event.SetCancelled("Boss Invulnerability"); } } + + @EventHandler + public void buffDamage(CustomDamageEvent event) + { + if (event.GetDamagerEntity(false) == null) + { + return; + } + if (event.GetDamagerEntity(false).getEntityId() == getEntity().getEntityId() && event.GetCause() == DamageCause.ENTITY_ATTACK) + { + event.AddMod("Mage Attack", 7 - event.GetDamage()); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void ally(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId()) + { + LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE); + if (damager != null && !(damager instanceof Player)) + { + event.SetCancelled("Allied Damage"); + } + } + } @Override public void handleDeath(Location location) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/BlazeMinion.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/BlazeMinion.java index 63783d8de..0d8f9a19a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/BlazeMinion.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/BlazeMinion.java @@ -2,15 +2,20 @@ package mineplex.game.clans.clans.worldevent.raid.wither.creature.magma; import org.bukkit.Location; import org.bukkit.entity.Blaze; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.game.clans.clans.worldevent.api.EventCreature; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; +import mineplex.game.clans.clans.worldevent.raid.RaidCreature; import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; -public class BlazeMinion extends EventCreature +public class BlazeMinion extends RaidCreature { private RaidChallenge _challenge; @@ -42,4 +47,20 @@ public class BlazeMinion extends EventCreature return; } } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void allyDamage(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId()) + { + LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE); + if (damager != null && !(damager instanceof Player)) + { + event.SetCancelled("Allied Damage"); + } + } + } + + @Override + public void handleDeath(Location location) {} } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/Cataclysm.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/Cataclysm.java index 0ca7625e4..1a46b6b33 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/Cataclysm.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/Cataclysm.java @@ -7,6 +7,7 @@ import org.bukkit.event.Listener; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.worldevent.raid.wither.challenge.six.ChallengeSix; @@ -21,7 +22,11 @@ public abstract class Cataclysm implements Listener Challenge = challenge; Magmus = magmus; - challenge.getRaid().getPlayers().forEach(player -> UtilPlayer.message(player, F.main(challenge.getRaid().getName() + " Raid", getAnnouncement()))); + challenge.getRaid().getPlayers().forEach(player -> + { + UtilPlayer.message(player, F.main(challenge.getRaid().getName() + " Raid", getAnnouncement())); + UtilTextMiddle.display("", getAnnouncement(), player); + }); onStart(); UtilServer.RegisterEvents(this); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/HeatingUp.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/HeatingUp.java index 306b3e17b..78f955916 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/HeatingUp.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/HeatingUp.java @@ -29,6 +29,7 @@ public class HeatingUp extends Cataclysm @Override protected void onStart() { + ((MagmusMeteor)Magmus.Abilities.get(2)).Disabled = true; _center = Challenge.getRaid().getWorldData().getCustomLocs("C_SIX_C1S").get(0); for (int x = -1; x <= 1; x++) { @@ -49,6 +50,7 @@ public class HeatingUp extends Cataclysm _center.getBlock().getRelative(x, -1, z).setType(Material.STONE); } } + ((MagmusMeteor)Magmus.Abilities.get(2)).Disabled = false; } @Override diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/InfernalMinions.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/InfernalMinions.java index b892e1332..4255bc09f 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/InfernalMinions.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/InfernalMinions.java @@ -22,8 +22,9 @@ public class InfernalMinions extends Cataclysm @Override protected void onStart() { - for (Location loc : Challenge.getRaid().getWorldData().getCustomLocs("C_SIX_C2M")) + for (int i = 0; i < 20; i++) { + Location loc = UtilMath.randomElement(Magmus.getChallenge().getRaid().getPlayers()).getLocation(); if (UtilMath.r(2) == 1) { Challenge.getRaid().registerCreature(new UndeadKnight(Challenge, loc)); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/Magmus.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/Magmus.java index 746027618..729499e23 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/Magmus.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/Magmus.java @@ -1,20 +1,31 @@ package mineplex.game.clans.clans.worldevent.raid.wither.creature.magma; +import java.util.ArrayList; +import java.util.List; + import org.bukkit.Location; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.MagmaCube; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.core.common.util.UtilEnt; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.game.clans.clans.worldevent.api.EventCreature; +import mineplex.game.clans.clans.worldevent.api.BossPassive; +import mineplex.game.clans.clans.worldevent.raid.RaidCreature; import mineplex.game.clans.clans.worldevent.raid.wither.challenge.six.ChallengeSix; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; -public class Magmus extends EventCreature +public class Magmus extends RaidCreature { private ChallengeSix _challenge; - private MagmusPassive _passive; + protected List> Abilities = new ArrayList<>(); + + protected boolean TeleportBackASAP = true; public Magmus(ChallengeSix challenge, Location location) { @@ -22,7 +33,9 @@ public class Magmus extends EventCreature _challenge = challenge; spawnEntity(); - _passive = new MagmusPassive(this); + Abilities.add(new MagmusCataclysm(this)); + Abilities.add(new MagmusSmash(this)); + Abilities.add(new MagmusMeteor(this)); } protected ChallengeSix getChallenge() @@ -45,8 +58,11 @@ public class Magmus extends EventCreature private void endAbility() { - HandlerList.unregisterAll(_passive); - _passive = null; + Abilities.forEach(ability -> + { + HandlerList.unregisterAll(ability); + }); + Abilities.clear(); } @EventHandler @@ -63,8 +79,40 @@ public class Magmus extends EventCreature return; } - getEntity().teleport(getSpawnLocation()); + if (TeleportBackASAP) + { + getEntity().teleport(getSpawnLocation()); + } - _passive.tick(); + Abilities.forEach(BossPassive::tick); } + + @EventHandler + public void onMagmusDamage(CustomDamageEvent event) + { + if (event.GetDamagerEntity(false) == null) + { + return; + } + if (event.GetDamagerEntity(false).getEntityId() == getEntity().getEntityId() && (event.GetCause() != DamageCause.FIRE && event.GetCause() != DamageCause.CUSTOM && event.GetCause() != DamageCause.PROJECTILE)) + { + event.SetCancelled("Wrong Attack Type Magmus"); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void allyDamage(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId()) + { + LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE); + if (damager != null && !(damager instanceof Player)) + { + event.SetCancelled("Allied Damage"); + } + } + } + + @Override + public void handleDeath(Location location) {} } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusPassive.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusCataclysm.java similarity index 87% rename from Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusPassive.java rename to Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusCataclysm.java index f7fa43922..604ff9844 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusPassive.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusCataclysm.java @@ -11,15 +11,15 @@ import mineplex.core.common.util.UtilTime; import mineplex.game.clans.clans.worldevent.api.BossPassive; import mineplex.game.clans.clans.worldevent.raid.wither.challenge.six.ChallengeSix; -public class MagmusPassive extends BossPassive +public class MagmusCataclysm extends BossPassive { private long _lastUse; private List> _cataclysms = new ArrayList<>(); - public MagmusPassive(Magmus creature) + public MagmusCataclysm(Magmus creature) { super(creature); - _lastUse = System.currentTimeMillis(); + _lastUse = System.currentTimeMillis() - (getCooldown() * 1000); _cataclysms.add(HeatingUp.class); _cataclysms.add(InfernalMinions.class); _cataclysms.add(UndeadAlly.class); @@ -28,7 +28,7 @@ public class MagmusPassive extends BossPassive @Override public int getCooldown() { - return 30; + return 15; } @Override diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusEat.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusEat.java new file mode 100644 index 000000000..2fcfef365 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusEat.java @@ -0,0 +1,89 @@ +package mineplex.game.clans.clans.worldevent.raid.wither.creature.magma; + +import org.bukkit.entity.MagmaCube; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.game.clans.clans.worldevent.api.BossPassive; + +public class MagmusEat extends BossPassive +{ + private long _lastUse; + private Player _eating; + private int _ticks; + + public MagmusEat(Magmus creature) + { + super(creature); + _lastUse = System.currentTimeMillis(); + } + + private void spit() + { + double offset = UtilMath.offset(_eating, getEntity()); + //Velocity + UtilAction.velocity(_eating, + UtilAlg.getTrajectory2d(getLocation().toVector(), _eating.getLocation().toVector()), + 2 + 2 * offset, true, 0, 1.2 + 1.0 * offset, 3, true); + + getBoss().getEvent().getCondition().Factory().Falling("Spit Out", _eating, getEntity(), 10, false, true); + + _lastUse = System.currentTimeMillis(); + _eating = null; + _ticks = -1; + } + + private void eat() + { + if (_ticks < 20 * 10) + { + _eating.setFireTicks(40); + _eating.teleport(getEntity()); + } + else + { + spit(); + } + } + + private void initialEat(Player target) + { + _eating = target; + _ticks = 0; + getBoss().getEvent().getCondition().Factory().Silence("Eat", _eating, getEntity(), 10, true, true); + } + + @Override + public int getCooldown() + { + return 15; + } + + @Override + public boolean isProgressing() + { + return false; + } + + @Override + public void tick() + { + if (_eating != null) + { + eat(); + return; + } + if (UtilTime.elapsed(_lastUse, getCooldown() * 1000)) + { + Player target = UtilPlayer.getClosest(getLocation(), 3); + if (target != null) + { + initialEat(target); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusMeteor.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusMeteor.java new file mode 100644 index 000000000..5e76ef0de --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusMeteor.java @@ -0,0 +1,122 @@ +package mineplex.game.clans.clans.worldevent.raid.wither.creature.magma; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLargeFireball; +import org.bukkit.entity.LargeFireball; +import org.bukkit.entity.MagmaCube; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.ProjectileHitEvent; + +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.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.game.clans.clans.worldevent.api.BossPassive; +import net.minecraft.server.v1_8_R3.EntityLargeFireball; + +public class MagmusMeteor extends BossPassive +{ + private long _lastUse; + private List _shot = new ArrayList<>(); + + protected boolean Disabled = false; + + public MagmusMeteor(Magmus creature) + { + super(creature); + _lastUse = System.currentTimeMillis(); + } + + private void newBall() + { + if (Disabled) + { + return; + } + Player target = UtilMath.randomElement(getBoss().getChallenge().getRaid().getPlayers()); + LargeFireball ball = target.getWorld().spawn(target.getLocation().add(Math.random() * 24 - 12, 32 + Math.random() * 16, Math.random() * 24 - 12), LargeFireball.class); + + EntityLargeFireball eFireball = ((CraftLargeFireball) ball).getHandle(); + eFireball.dirX = (Math.random()-0.5)*0.02; + eFireball.dirY = -0.2 - 0.05 * Math.random(); + eFireball.dirZ = (Math.random()-0.5)*0.02; + + ball.setShooter(getEntity()); + ball.setYield(2.2f); + ball.setBounce(false); + _shot.add(ball); + } + + @Override + public int getCooldown() + { + return 30; + } + + @Override + public boolean isProgressing() + { + return false; + } + + @Override + public void tick() + { + if (Disabled) + { + return; + } + if (UtilTime.elapsed(_lastUse, getCooldown() * 1000)) + { + _lastUse = System.currentTimeMillis(); + for (int i = 0; i < 20; i++) + { + newBall(); + } + } + } + + @EventHandler + public void onExplode(EntityExplodeEvent event) + { + if (event.getEntity() instanceof LargeFireball) + { + LargeFireball ball = (LargeFireball) event.getEntity(); + if (ball.getShooter() instanceof MagmaCube && ((MagmaCube)ball.getShooter()).getEntityId() == getEntity().getEntityId()) + { + event.blockList().clear(); + return; + } + } + } + + @EventHandler + public void onBallHit(ProjectileHitEvent event) + { + if (event.getEntity() instanceof LargeFireball) + { + LargeFireball ball = (LargeFireball) event.getEntity(); + if (ball.getShooter() instanceof MagmaCube && ((MagmaCube)ball.getShooter()).getEntityId() == getEntity().getEntityId()) + { + _shot.remove(ball); + UtilParticle.PlayParticle(ParticleType.EXPLODE, ball.getLocation(), null, 0, 2, ViewDist.MAX, UtilServer.getPlayers()); + ball.getWorld().playSound(ball.getLocation(), Sound.EXPLODE, 10, 0); + Player hit = UtilPlayer.getClosest(ball.getLocation(), 0.5); + if (hit != null) + { + getBoss().getEvent().getDamageManager().NewDamageEvent(hit, getEntity(), ball, DamageCause.PROJECTILE, 4, true, true, false, getEntity().getName(), "Meteor Shower"); + } + ball.remove(); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusSmash.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusSmash.java new file mode 100644 index 000000000..2de2bb06d --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/magma/MagmusSmash.java @@ -0,0 +1,71 @@ +package mineplex.game.clans.clans.worldevent.raid.wither.creature.magma; + +import java.util.Map; + +import org.bukkit.entity.MagmaCube; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.game.clans.clans.worldevent.api.BossPassive; + +public class MagmusSmash extends BossPassive +{ + private long _lastUse; + + public MagmusSmash(Magmus creature) + { + super(creature); + _lastUse = System.currentTimeMillis(); + } + + private void slam() + { + //Action + Map targets = UtilPlayer.getInRadius(getLocation(), 5.5d + 0.5 * 5); + getBoss().TeleportBackASAP = false; + getEntity().setVelocity(new Vector(0, 5, 0)); + UtilServer.runSyncLater(() -> getBoss().TeleportBackASAP = false, 3 * 20); + for (Player player : targets.keySet()) + { + getBoss().getEvent().getDamageManager().NewDamageEvent(player, getEntity(), null, + DamageCause.CUSTOM, 6 * targets.get(player) + 0.5, false, true, false, + getEntity().getName(), "Smash"); + + //Velocity + UtilAction.velocity(player, + UtilAlg.getTrajectory2d(getLocation().toVector(), player.getLocation().toVector()), + 2 + 2 * targets.get(player), true, 0, 1.2 + 1.0 * targets.get(player), 3, true); + + //Condition + getBoss().getEvent().getCondition().Factory().Falling("Smash", player, getEntity(), 10, false, true); + } + } + + @Override + public int getCooldown() + { + return 10; + } + + @Override + public boolean isProgressing() + { + return false; + } + + @Override + public void tick() + { + if (UtilTime.elapsed(_lastUse, getCooldown() * 1000)) + { + _lastUse = System.currentTimeMillis(); + slam(); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/silverfish/PitSwarmer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/silverfish/PitSwarmer.java deleted file mode 100644 index 17fc0b66a..000000000 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/silverfish/PitSwarmer.java +++ /dev/null @@ -1,59 +0,0 @@ -package mineplex.game.clans.clans.worldevent.raid.wither.creature.silverfish; - -import org.bukkit.Location; -import org.bukkit.entity.Silverfish; -import org.bukkit.event.EventHandler; -import org.bukkit.event.HandlerList; - -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.game.clans.clans.worldevent.api.EventCreature; -import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; -import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid; - -public class PitSwarmer extends EventCreature -{ - private RaidChallenge _challenge; - private SwarmerPassive _passive; - - public PitSwarmer(RaidChallenge challenge, Location location) - { - super(challenge.getRaid(), location, "Pit Swarmer", true, 1, 100, true, Silverfish.class); - - _challenge = challenge; - spawnEntity(); - _passive = new SwarmerPassive(this); - } - - @Override - protected void spawnCustom() {} - - @Override - public void dieCustom() - { - endAbility(); - } - - private void endAbility() - { - HandlerList.unregisterAll(_passive); - _passive = null; - } - - @EventHandler - public void onTick(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - if (_challenge.isComplete()) - { - remove(); - return; - } - - _passive.tick(); - } -} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/silverfish/SwarmerPassive.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/silverfish/SwarmerPassive.java deleted file mode 100644 index 58a8f7e99..000000000 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/silverfish/SwarmerPassive.java +++ /dev/null @@ -1,49 +0,0 @@ -package mineplex.game.clans.clans.worldevent.raid.wither.creature.silverfish; - -import org.bukkit.entity.Silverfish; -import org.bukkit.event.EventHandler; - -import mineplex.game.clans.clans.worldevent.api.BossPassive; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; - -public class SwarmerPassive extends BossPassive -{ - public SwarmerPassive(PitSwarmer creature) - { - super(creature); - } - - @Override - public int getCooldown() - { - return 0; - } - - @Override - public boolean isProgressing() - { - return false; - } - - @Override - public void tick() {} - - @EventHandler - public void onDamage(CustomDamageEvent event) - { - if (event.GetDamagerEntity(false) != null) - { - if (event.GetDamagerEntity(false).getEntityId() == getEntity().getEntityId()) - { - event.AddMod("Swarm Attack", 1 - event.GetDamage()); - } - } - if (event.GetDamageeEntity() != null) - { - if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId()) - { - event.SetCancelled("Swarm Invulnerability"); - } - } - } -} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/BlackHole.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/BlackHole.java index 0431a4b15..2465a56ab 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/BlackHole.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/BlackHole.java @@ -6,6 +6,8 @@ import java.util.Map.Entry; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.entity.Wither; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.util.Vector; import mineplex.core.common.util.F; @@ -115,4 +117,13 @@ public class BlackHole extends BossPassive } } } + + @EventHandler + public void onKick(PlayerKickEvent event) + { + if (_chargeTicks != -1 && getBoss().getChallenge().getRaid().getPlayers().contains(event.getPlayer())) + { + event.setCancelled(true); + } + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/CharlesSkulls.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/CharlesSkulls.java index eccb7ab13..88e88a8cd 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/CharlesSkulls.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/CharlesSkulls.java @@ -1,5 +1,6 @@ package mineplex.game.clans.clans.worldevent.raid.wither.creature.wither; +import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; @@ -36,6 +37,7 @@ public class CharlesSkulls extends BossAbility { super(creature); + _guidedSkulls = new HashMap<>(); _lastUnguided = System.currentTimeMillis(); _lastGuided = System.currentTimeMillis(); _lastBombard = -1; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/CharlesWitherton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/CharlesWitherton.java index e86a246fc..1043b4187 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/CharlesWitherton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/CharlesWitherton.java @@ -4,25 +4,46 @@ import java.util.ArrayList; import java.util.List; import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWither; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.entity.Wither; +import org.bukkit.entity.WitherSkull; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ProjectileLaunchEvent; + +import com.google.common.base.Predicate; import mineplex.core.common.util.UtilEnt; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.worldevent.api.BossPassive; -import mineplex.game.clans.clans.worldevent.api.EventCreature; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; +import mineplex.game.clans.clans.worldevent.raid.RaidCreature; import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid; +import mineplex.game.clans.clans.worldevent.raid.wither.creature.wither.ai.PathfinderGoalCustomFloat; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import net.minecraft.server.v1_8_R3.Entity; +import net.minecraft.server.v1_8_R3.EntityHuman; +import net.minecraft.server.v1_8_R3.EntityInsentient; +import net.minecraft.server.v1_8_R3.EntityWither; +import net.minecraft.server.v1_8_R3.PathfinderGoalHurtByTarget; +import net.minecraft.server.v1_8_R3.PathfinderGoalLookAtPlayer; +import net.minecraft.server.v1_8_R3.PathfinderGoalNearestAttackableTarget; +import net.minecraft.server.v1_8_R3.PathfinderGoalRandomLookaround; +import net.minecraft.server.v1_8_R3.PathfinderGoalRandomStroll; -public class CharlesWitherton extends EventCreature +public class CharlesWitherton extends RaidCreature { private RaidChallenge _challenge; private CharlesSkulls _passive; private List> _abilities = new ArrayList<>(); - protected boolean Flying = false; + public boolean Flying = false; public CharlesWitherton(RaidChallenge challenge, Location location) { @@ -55,6 +76,26 @@ public class CharlesWitherton extends EventCreature protected void spawnCustom() { UtilEnt.vegetate(getEntity()); + CraftWither cw = (CraftWither)getEntity(); + EntityWither wither = cw.getHandle(); + wither.setVegetated(false); + wither.goalSelector.a(0, new PathfinderGoalCustomFloat(this, wither)); + wither.goalSelector.a(5, new PathfinderGoalRandomStroll(wither, 1.0D)); + wither.goalSelector.a(6, new PathfinderGoalLookAtPlayer(wither, EntityHuman.class, 8.0F)); + wither.goalSelector.a(7, new PathfinderGoalRandomLookaround(wither)); + wither.targetSelector.a(1, new PathfinderGoalHurtByTarget(wither, false, new Class[0])); + wither.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(wither, EntityInsentient.class, 0, false, false, new Predicate() + { + public boolean a(Entity entity) + { + return entity instanceof EntityHuman; + } + + public boolean apply(Entity entity) + { + return this.a(entity); + } + })); } @Override @@ -91,5 +132,54 @@ public class CharlesWitherton extends EventCreature _passive.tick(); _abilities.forEach(BossPassive::tick); + + if (Flying) + { + getEntity().setHealth(500); + } + else + { + getEntity().setHealth(100); + } } + + @EventHandler + public void handleBlockChange(EntityChangeBlockEvent event) + { + if (event.getEntity().getEntityId() == getEntity().getEntityId()) + { + event.setCancelled(true); + } + } + + @EventHandler + public void onLaunch(ProjectileLaunchEvent event) + { + if (event.getEntity() instanceof WitherSkull && event.getEntity().getShooter() instanceof Wither) + { + if (((Wither)event.getEntity().getShooter()).getEntityId() == getEntity().getEntityId()) + { + if (((WitherSkull)event.getEntity()).isCharged()) + { + event.setCancelled(true); + } + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void allyDamage(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId()) + { + LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE); + if (damager != null && !(damager instanceof Player)) + { + event.SetCancelled("Allied Damage"); + } + } + } + + @Override + public void handleDeath(Location location) {} } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/MiniCharles.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/MiniCharles.java index 5f4d86651..1a3a911e0 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/MiniCharles.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/MiniCharles.java @@ -1,30 +1,53 @@ package mineplex.game.clans.clans.worldevent.raid.wither.creature.wither; import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWither; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.entity.Wither; +import org.bukkit.entity.WitherSkull; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ProjectileLaunchEvent; + +import com.google.common.base.Predicate; import mineplex.core.common.util.UtilEnt; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.game.clans.clans.worldevent.api.EventCreature; import mineplex.game.clans.clans.worldevent.raid.RaidChallenge; +import mineplex.game.clans.clans.worldevent.raid.RaidCreature; import mineplex.game.clans.clans.worldevent.raid.wither.WitherRaid; +import mineplex.game.clans.clans.worldevent.raid.wither.creature.wither.ai.PathfinderGoalCustomFloat; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import net.minecraft.server.v1_8_R3.Entity; +import net.minecraft.server.v1_8_R3.EntityHuman; +import net.minecraft.server.v1_8_R3.EntityInsentient; +import net.minecraft.server.v1_8_R3.EntityWither; +import net.minecraft.server.v1_8_R3.PathfinderGoalHurtByTarget; +import net.minecraft.server.v1_8_R3.PathfinderGoalLookAtPlayer; +import net.minecraft.server.v1_8_R3.PathfinderGoalNearestAttackableTarget; +import net.minecraft.server.v1_8_R3.PathfinderGoalRandomLookaround; +import net.minecraft.server.v1_8_R3.PathfinderGoalRandomStroll; -public class MiniCharles extends EventCreature +public class MiniCharles extends RaidCreature { + private CharlesWitherton _charles; private RaidChallenge _challenge; private MiniCharlesSkulls _passive; private int _liveTicks; protected boolean Flying = false; - public MiniCharles(RaidChallenge challenge, Location location) + public MiniCharles(CharlesWitherton charles, Location location) { - super(challenge.getRaid(), location, "Charles' Minion", true, 50, 15000, true, Wither.class); + super(charles.getChallenge().getRaid(), location, "Charles' Minion", true, 50, 15000, true, Wither.class); - _challenge = challenge; + _charles = charles; + _challenge = charles.getChallenge(); spawnEntity(); _passive = new MiniCharlesSkulls(this); } @@ -33,6 +56,25 @@ public class MiniCharles extends EventCreature protected void spawnCustom() { UtilEnt.vegetate(getEntity()); + EntityWither wither = ((CraftWither)getEntity()).getHandle(); + wither.setVegetated(false); + wither.goalSelector.a(0, new PathfinderGoalCustomFloat(_charles, wither)); + wither.goalSelector.a(5, new PathfinderGoalRandomStroll(wither, 1.0D)); + wither.goalSelector.a(6, new PathfinderGoalLookAtPlayer(wither, EntityHuman.class, 8.0F)); + wither.goalSelector.a(7, new PathfinderGoalRandomLookaround(wither)); + wither.targetSelector.a(1, new PathfinderGoalHurtByTarget(wither, false, new Class[0])); + wither.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(wither, EntityInsentient.class, 0, false, false, new Predicate() + { + public boolean a(Entity entity) + { + return entity instanceof EntityHuman; + } + + public boolean apply(Entity entity) + { + return this.a(entity); + } + })); } @Override @@ -69,5 +111,54 @@ public class MiniCharles extends EventCreature { remove(); } + + if (Flying) + { + getEntity().setHealth(500); + } + else + { + getEntity().setHealth(100); + } } + + @EventHandler + public void handleBlockChange(EntityChangeBlockEvent event) + { + if (event.getEntity().getEntityId() == getEntity().getEntityId()) + { + event.setCancelled(true); + } + } + + @EventHandler + public void onLaunch(ProjectileLaunchEvent event) + { + if (event.getEntity() instanceof WitherSkull && event.getEntity().getShooter() instanceof Wither) + { + if (((Wither)event.getEntity().getShooter()).getEntityId() == getEntity().getEntityId()) + { + if (((WitherSkull)event.getEntity()).isCharged()) + { + event.setCancelled(true); + } + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void allyDamage(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getEntityId() == getEntity().getEntityId()) + { + LivingEntity damager = event.GetDamagerEntity(event.GetCause() == DamageCause.PROJECTILE); + if (damager != null && !(damager instanceof Player)) + { + event.SetCancelled("Allied Damage"); + } + } + } + + @Override + public void handleDeath(Location location) {} } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/SummonCorpse.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/SummonCorpse.java index 0471b69e2..492b8b714 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/SummonCorpse.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/SummonCorpse.java @@ -41,6 +41,7 @@ public class SummonCorpse extends BossPassive { if (UtilTime.elapsed(_lastUsed, getCooldown() * 1000)) { + _lastUsed = System.currentTimeMillis(); for (int i = 0; i < 6; i++) { getBoss().getEvent().registerCreature(new ReanimatedCorpse(getBoss().getChallenge(), getLocation())); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/SummonMinions.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/SummonMinions.java index b40618cfd..7ea48dcd1 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/SummonMinions.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/SummonMinions.java @@ -40,9 +40,10 @@ public class SummonMinions extends BossPassive { if (UtilTime.elapsed(_lastUsed, getCooldown() * 1000)) { + _lastUsed = System.currentTimeMillis(); for (int i = 0; i < 2; i++) { - getBoss().getEvent().registerCreature(new MiniCharles(getBoss().getChallenge(), getLocation())); + getBoss().getEvent().registerCreature(new MiniCharles(getBoss(), getLocation())); } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/SummonUndead.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/SummonUndead.java index dd855ea63..0862c84df 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/SummonUndead.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/SummonUndead.java @@ -41,6 +41,7 @@ public class SummonUndead extends BossPassive { if (UtilTime.elapsed(_lastUsed, getCooldown() * 1000)) { + _lastUsed = System.currentTimeMillis(); for (int i = 0; i < 6; i++) { getBoss().getEvent().registerCreature(new UndeadKnight(getBoss().getChallenge(), getLocation())); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/ai/PathfinderGoalCustomFloat.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/ai/PathfinderGoalCustomFloat.java new file mode 100644 index 000000000..227413fd3 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/raid/wither/creature/wither/ai/PathfinderGoalCustomFloat.java @@ -0,0 +1,33 @@ +package mineplex.game.clans.clans.worldevent.raid.wither.creature.wither.ai; + +import mineplex.game.clans.clans.worldevent.raid.wither.creature.wither.CharlesWitherton; +import net.minecraft.server.v1_8_R3.EntityInsentient; +import net.minecraft.server.v1_8_R3.Navigation; +import net.minecraft.server.v1_8_R3.PathfinderGoal; + +public class PathfinderGoalCustomFloat extends PathfinderGoal +{ + private CharlesWitherton _boss; + private EntityInsentient a; + + public PathfinderGoalCustomFloat(CharlesWitherton boss, EntityInsentient ent) + { + _boss = boss; + this.a = ent; + this.a(4); + ((Navigation)ent.getNavigation()).d(true); + } + + public boolean a() + { + return _boss.Flying; + } + + public void e() + { + if (this.a.bc().nextFloat() < 0.8F) + { + this.a.getControllerJump().a(); + } + } +} \ No newline at end of file