From baafa62713222c31f35c23337122d652ddb8086f Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 24 Sep 2016 21:09:25 +0100 Subject: [PATCH] Just more converting --- .../arcade/game/games/smash/kits/KitCow.java | 4 +- .../game/games/smash/kits/KitSlime.java | 146 +---- .../game/games/smash/kits/KitSnowman.java | 61 +- .../game/games/smash/kits/KitSpider.java | 76 +-- .../game/games/smash/kits/KitWitch.java | 80 +-- .../game/games/smash/kits/KitWither.java | 143 ----- .../games/smash/kits/KitWitherSkeleton.java | 90 +-- .../arcade/game/games/smash/kits/KitWolf.java | 79 +-- .../game/games/smash/kits/KitZombie.java | 63 +- .../games/smash/perks/blaze/PerkInferno.java | 4 +- ...CowMooshroomMadness.java => SmashCow.java} | 4 +- .../smash/perks/slime/PerkSlimeRocket.java | 422 +++++++++++++ .../smash/perks/slime/PerkSlimeSlam.java | 185 ++++++ .../games/smash/perks/slime/SmashSlime.java | 138 +++++ .../smash/perks/snowman/PerkArcticAura.java | 56 ++ .../smash/perks/snowman/PerkBlizzard.java | 173 ++++++ .../smash/perks/snowman/PerkDamageSnow.java | 49 ++ .../smash/perks/snowman/PerkIcePath.java | 112 ++++ .../smash/perks/snowman/SmashSnowman.java | 202 +++++++ .../games/smash/perks/spider/PerkNeedler.java | 186 ++++++ .../smash/perks/spider/PerkSpiderLeap.java | 170 ++++++ .../games/smash/perks/spider/PerkWebShot.java | 143 +++++ .../games/smash/perks/spider/SmashSpider.java | 154 +++++ .../games/smash/perks/witch/PerkBatWave.java | 312 ++++++++++ .../smash/perks/witch/PerkWitchPotion.java | 185 ++++++ .../games/smash/perks/witch/SmashBat.java | 312 ++++++++++ .../perks/witherskeleton/PerkWitherImage.java | 291 +++++++++ .../perks/witherskeleton/PerkWitherSkull.java | 229 +++++++ .../witherskeleton/SmashWitherSkeleton.java | 136 +++++ .../games/smash/perks/wolf/SmashWolf.java | 561 ++++++++++++++++++ .../smash/perks/zombie/PerkDeathsGrasp.java | 193 ++++++ .../perks/zombie/PerkNightLivingDead.java | 150 +++++ .../smash/perks/zombie/PerkOvercharge.java | 252 ++++++++ .../smash/perks/zombie/PerkZombieBile.java | 189 ++++++ .../arcade/kit/perks/PerkSlimeRocket.java | 141 +++-- .../game/arcade/kit/perks/PerkSpiderLeap.java | 109 ++-- 36 files changed, 5147 insertions(+), 653 deletions(-) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/{PerkCowMooshroomMadness.java => SmashCow.java} (94%) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkBlizzard.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkDamageSnow.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashBat.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkNightLivingDead.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java index 87d62ed0e..ca09f3e87 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java @@ -16,7 +16,7 @@ import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowAngryHerd; import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowMilkSpiral; -import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowMooshroomMadness; +import nautilus.game.arcade.game.games.smash.perks.cow.SmashCow; import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowStampede; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; @@ -31,7 +31,7 @@ public class KitCow extends SmashKit2 new PerkCowStampede(), new PerkCowAngryHerd(), new PerkCowMilkSpiral(), - new PerkCowMooshroomMadness() + new SmashCow() }; private static final ItemStack IN_HAND = new ItemStack(Material.MILK_BUCKET); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java index a33ce5f77..eb8c7a5f2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java @@ -1,38 +1,27 @@ package nautilus.game.arcade.game.games.smash.kits; -import mineplex.core.common.util.*; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.disguise.disguises.DisguiseBase; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.condition.Condition.ConditionType; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkSlimeRocket; import nautilus.game.arcade.kit.perks.PerkSlimeSlam; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.inventory.ItemStack; - -public class KitSlime extends SmashKit +public class KitSlime extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(6, 1.75, 0.35, 3), @@ -77,18 +66,24 @@ public class KitSlime extends SmashKit private static final ItemStack[] PLAYER_ARMOR = { null, null, - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_HELMET), }; public KitSlime(ArcadeManager manager) { - super(manager, "Slime", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND, "Giga Slime", 24000, Sound.SLIME_ATTACK); + super(manager, "Slime", KitAvailability.Free, PERKS, EntityType.SLIME, IN_HAND, DisguiseSlime.class); } - + @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + + DisguiseSlime disguise = (DisguiseSlime) Manager.GetDisguise().getActiveDisguise(player); + + disguise.SetSize(3); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -99,103 +94,4 @@ public class KitSlime extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } - @Override - public void giveSuperItems(Player player) - { - player.getInventory().remove(Material.IRON_SWORD); - player.getInventory().remove(Material.IRON_AXE); - - UtilInv.Update(player); - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseSlime disguise = new DisguiseSlime(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - - disguise.SetSize(3); - } - - @Override - public void activateSuperCustom(Player player) - { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); - if (disguise != null && disguise instanceof DisguiseSlime) - { - DisguiseSlime slime = (DisguiseSlime) disguise; - - slime.SetSize(14); - Manager.GetDisguise().updateDisguise(slime); - } - - player.setExp(0.99f); - - Manager.GetCondition().Factory().Speed("Giga Slime", player, player, 20, 2, false, false, false); - } - - @Override - public void deactivateSuperCustom(Player player) - { - Manager.GetCondition().EndCondition(player, ConditionType.SPEED, "Giga Slime"); - } - - @EventHandler(priority = EventPriority.LOW) - public void immunityDamagee(CustomDamageEvent event) - { - if (event.GetDamageePlayer() == null || event.GetDamagerEntity(true) == null) - return; - - if (this.isSuperActive(event.GetDamageePlayer())) - event.SetCancelled(getSuperName()); - } - - @EventHandler(priority = EventPriority.LOW) - public void immunityDamager(CustomDamageEvent event) - { - if (event.GetCause() != DamageCause.ENTITY_ATTACK) - return; - - if (event.GetDamagerPlayer(true) == null) - return; - - if (isSuperActive(event.GetDamagerPlayer(true))) - event.SetCancelled(getSuperName()); - } - - @EventHandler - public void collide(UpdateEvent event) - { - for (Player player : getSuperActive()) - for (Player other : Manager.GetGame().GetPlayers(true)) - { - if (player.equals(other)) - continue; - - if (Manager.isSpectator(other)) - continue; - - if (UtilMath.offset(player.getLocation().add(0, 3, 0), other.getLocation()) < 5) - { - Manager.GetDamage().NewDamageEvent(other, player, null, - DamageCause.CUSTOM, 8, true, false, false, - player.getName(), GetName()); - - UtilParticle.PlayParticle(ParticleType.SLIME, other.getLocation().add(0, 0.6, 0), 1f, 1f, 1f, 0, 20, - ViewDist.LONG, UtilServer.getPlayers()); - - player.getWorld().playSound(other.getLocation(), Sound.SLIME_ATTACK, 3f, 1f); - } - } - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java index a9c90dc1d..49e508d07 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java @@ -1,5 +1,11 @@ package nautilus.game.arcade.game.games.smash.kits; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSnowman; @@ -7,21 +13,18 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; +import nautilus.game.arcade.kit.perks.PerkArcticAura; +import nautilus.game.arcade.kit.perks.PerkBlizzard; +import nautilus.game.arcade.kit.perks.PerkDamageSnow; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkIcePath; +import nautilus.game.arcade.kit.perks.PerkSnowTurret; -public class KitSnowman extends SmashKit +public class KitSnowman extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(6, 1.4, 0.3, 6), @@ -69,33 +72,22 @@ public class KitSnowman extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_HELMET), }; public KitSnowman(ArcadeManager manager) { - super(manager, "Snowman", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.SNOWMAN, IN_HAND, "Snow Turret", 0, Sound.STEP_SNOW); - setSuperCharges(3); - } - - @Override - public void giveCoreItems(Player player) - { - - } - - @Override - public void giveSuperItems(Player player) - { - + super(manager, "Snowman", KitAvailability.Gem, 5000, PERKS, EntityType.SNOWMAN, IN_HAND, DisguiseSnowman.class); } @Override public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -103,16 +95,5 @@ public class KitSnowman extends SmashKit player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); player.getInventory().setArmorContents(PLAYER_ARMOR); - - //Disguise - DisguiseSnowman disguise = new DisguiseSnowman(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java index 3569d5168..b41eb323b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java @@ -1,5 +1,11 @@ package nautilus.game.arcade.game.games.smash.kits; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSpider; @@ -7,21 +13,16 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; +import nautilus.game.arcade.kit.perks.PerkNeedler; +import nautilus.game.arcade.kit.perks.PerkSpiderLeap; +import nautilus.game.arcade.kit.perks.PerkSpidersNest; +import nautilus.game.arcade.kit.perks.PerkWebShot; -public class KitSpider extends SmashKit +public class KitSpider extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(6, 1.5, 0.25, 6), @@ -78,55 +79,32 @@ public class KitSpider extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_HELMET), }; public KitSpider(ArcadeManager manager) { - super(manager, "Spider", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SPIDER, IN_HAND, "Spider Nest", 30000, Sound.SPIDER_DEATH); - } - - @Override - public void giveCoreItems(Player player) - { - UtilInv.Clear(player); - - player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3], PLAYER_ITEMS[4]); - - player.getInventory().setArmorContents(PLAYER_ARMOR); - } - - @Override - public void giveSuperItems(Player player) - { - + super(manager, "Spider", KitAvailability.Free, PERKS, EntityType.SPIDER, IN_HAND, DisguiseSpider.class); } @Override public void GiveItems(Player player) { - giveCoreItems(player); - - //Disguise - DisguiseSpider disguise = new DisguiseSpider(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); + disguise(player); - if (Manager.GetGame().GetState() == GameState.Prepare) + UtilInv.Clear(player); + + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); + + if (Manager.GetGame().GetState() == GameState.Recruit) { - player.setExp(0.99F); + player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3], PLAYER_ITEMS[4]); } + + player.getInventory().setArmorContents(PLAYER_ARMOR); + player.setExp(0.99F); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java index 077cb52de..6c8999905 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java @@ -1,5 +1,12 @@ package nautilus.game.arcade.game.games.smash.kits; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseWitch; @@ -7,21 +14,16 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; +import nautilus.game.arcade.kit.perks.PerkBatForm; +import nautilus.game.arcade.kit.perks.PerkBatWave; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkWitchPotion; -public class KitWitch extends SmashKit +public class KitWitch extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(6, 1.5, 0.3, 5), @@ -74,20 +76,22 @@ public class KitWitch extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), null }; public KitWitch(ArcadeManager manager) { - super(manager, "Witch", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, EntityType.WITCH, IN_HAND, "Bat Form", 20000, Sound.BAT_HURT); + super(manager, "Witch", KitAvailability.Gem, 6000, PERKS, EntityType.WITCH, IN_HAND, DisguiseWitch.class); } @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -97,48 +101,4 @@ public class KitWitch extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } - - @Override - public void giveSuperItems(Player player) - { - player.getInventory().remove(Material.IRON_SPADE); - player.getInventory().remove(Material.IRON_AXE); - - player.getInventory().addItem(PLAYER_ITEMS[4]); - - UtilInv.Update(player); - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseWitch disguise = new DisguiseWitch(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } - - @Override - public void activateSuperCustom(Player player) - { - for (Perk perk : GetPerks()) - if (perk instanceof PerkDoubleJump) - ((PerkDoubleJump) perk).disableForPlayer(player); - } - - @Override - public void deactivateSuperCustom(Player player) - { - for (Perk perk : GetPerks()) - if (perk instanceof PerkDoubleJump) - ((PerkDoubleJump) perk).enableForPlayer(player); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java deleted file mode 100644 index c0bc1f970..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java +++ /dev/null @@ -1,143 +0,0 @@ -package nautilus.game.arcade.game.games.smash.kits; - -import org.bukkit.Color; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.LeatherArmorMeta; - -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilServer; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkSkullShot; - -public class KitWither extends SmashKit -{ - public KitWither(ArcadeManager manager) - { - super(manager, "Wither", KitAvailability.Gem, 5000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(6, 1.2, 0.3, 6), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkSkullShot(), - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW), - "", 0, null); - } - - @Override - public void giveCoreItems(Player player) - { - UtilInv.Clear(player); - - player.getInventory().addItem(new ItemStack(Material.ARROW)); - - ItemStack head = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte)1, 1); - player.getInventory().setHelmet(head); - - ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE); - LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta(); - meta.setColor(Color.BLACK); - armor.setItemMeta(meta); - player.getInventory().setChestplate(armor); - - ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS); - LeatherArmorMeta metaLegs = (LeatherArmorMeta)armor.getItemMeta(); - metaLegs.setColor(Color.BLACK); - armor.setItemMeta(metaLegs); - player.getInventory().setLeggings(legs); - - ItemStack boots = new ItemStack(Material.LEATHER_BOOTS); - LeatherArmorMeta metaBoots = (LeatherArmorMeta)armor.getItemMeta(); - metaBoots.setColor(Color.BLACK); - boots.setItemMeta(metaBoots); - player.getInventory().setBoots(boots); - } - - @Override - public void giveSuperItems(Player player) - { - - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - } - - @EventHandler - public void InvisibilityUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - for (Player player : UtilServer.getPlayers()) - { - if (!HasKit(player)) - continue; - - if (player.getInventory().getChestplate() == null) - continue; - - Manager.GetCondition().Factory().Invisible("Wither Invis", player, player, 1.9, 0, false, false, false); - } - } - - @Override - public Entity SpawnEntity(Location loc) - { - EntityType type = _entityType; - if (type == EntityType.PLAYER) - type = EntityType.ZOMBIE; - - LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type); - - entity.setRemoveWhenFarAway(false); - entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit"); - entity.setCustomNameVisible(true); - entity.getEquipment().setItemInHand(_itemInHand); - - Manager.GetCondition().Factory().Invisible("Kit Invis", entity, entity, 7777, 0, false, false, false); - - UtilEnt.Vegetate(entity); - - SpawnCustom(entity); - - return entity; - } - - @Override - public void SpawnCustom(LivingEntity ent) - { - ItemStack head = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte)1, 1); - ent.getEquipment().setHelmet(head); - - ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE); - LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta(); - meta.setColor(Color.BLACK); - armor.setItemMeta(meta); - ent.getEquipment().setChestplate(armor); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java index 05df3d898..6787c436f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java @@ -1,16 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilInv; -import mineplex.core.disguise.disguises.DisguiseSkeleton; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; @@ -19,10 +8,25 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.inventory.ItemStack; -public class KitWitherSkeleton extends SmashKit +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkWitherForm; +import nautilus.game.arcade.kit.perks.PerkWitherImage; +import nautilus.game.arcade.kit.perks.PerkWitherSkull; +import net.minecraft.server.v1_8_R3.MobSpawnerAbstract.a; + +public class KitWitherSkeleton extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(6, 1.2, 0.3, 6), @@ -68,21 +72,33 @@ public class KitWitherSkeleton extends SmashKit private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET) + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_HELMET) }; - public KitWitherSkeleton(ArcadeManager manager) { - super(manager, "Wither Skeleton", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND, "Wither Form", 18000, Sound.WITHER_SPAWN); + super(manager, "Wither Skeleton", KitAvailability.Gem, 6000, PERKS, EntityType.SKELETON, IN_HAND, DisguiseSkeleton.class); } +// @Override +// public void giveSuperItems(Player player) +// { +// player.getInventory().remove(Material.IRON_SWORD); +// player.getInventory().remove(Material.IRON_AXE); +// +// player.getInventory().addItem(PLAYER_ITEMS[3]); +// +// UtilInv.Update(player); +// } + @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -92,31 +108,23 @@ public class KitWitherSkeleton extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override - public void giveSuperItems(Player player) - { - player.getInventory().remove(Material.IRON_SWORD); - player.getInventory().remove(Material.IRON_AXE); - - player.getInventory().addItem(PLAYER_ARMOR[3]); - - UtilInv.Update(player); - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - + public void disguise(Player player) + { //Disguise DisguiseSkeleton disguise = new DisguiseSkeleton(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + GameTeam gameTeam = Manager.GetGame().GetTeam(player); + + if (gameTeam != null) + { + disguise.setName(gameTeam.GetColor() + player.getName()); + } else + { disguise.setName(player.getName()); - + } + disguise.setCustomNameVisible(true); disguise.SetSkeletonType(SkeletonType.WITHER); disguise.hideArmor(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java index 11e9d18d0..bededf3e2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java @@ -1,29 +1,26 @@ package nautilus.game.arcade.game.games.smash.kits; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; -import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseWolf; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkWolf; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -public class KitWolf extends SmashKit +public class KitWolf extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(5, 1.6, 0.25, 5), @@ -66,23 +63,24 @@ public class KitWolf extends SmashKit }) }; - private static final ItemStack[] PLAYER_ARMOR = { null, - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.IRON_CHESTPLATE), null }; public KitWolf(ArcadeManager manager) { - super(manager, "Wolf", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.WOLF, IN_HAND, "Frenzy", 30000, Sound.WOLF_HOWL); + super(manager, "Wolf", KitAvailability.Gem, 4000, PERKS, EntityType.WOLF, IN_HAND, DisguiseWolf.class); } @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -92,53 +90,4 @@ public class KitWolf extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } - - @Override - public void giveSuperItems(Player player) - { - - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseWolf disguise = new DisguiseWolf(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } - - @Override - public void activateSuperCustom(Player player) - { - Manager.GetCondition().Factory().Strength(GetName(), player, player, 30, 1, false, false, false); - Manager.GetCondition().Factory().Speed(GetName(), player, player, 30, 2, false, false, false); - Manager.GetCondition().Factory().Regen(GetName(), player, player, 30, 2, false, false, false); - - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); - if (disguise instanceof DisguiseWolf) - { - ((DisguiseWolf) disguise).setAngry(true); - Manager.GetDisguise().updateDisguise(disguise); - } - } - - @Override - public void deactivateSuperCustom(Player player) - { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); - if (disguise instanceof DisguiseWolf) - { - ((DisguiseWolf) disguise).setAngry(false); - Manager.GetDisguise().updateDisguise(disguise); - } - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java index 2edb8d1c2..7e73d6410 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java @@ -1,16 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilInv; -import mineplex.core.disguise.disguises.DisguiseZombie; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; @@ -18,7 +7,24 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -public class KitZombie extends SmashKit +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkDeathsGrasp; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkFletcher; +import nautilus.game.arcade.kit.perks.PerkKnockbackArrow; +import nautilus.game.arcade.kit.perks.PerkNightLivingDead; +import nautilus.game.arcade.kit.perks.PerkOvercharge; +import nautilus.game.arcade.kit.perks.PerkZombieBile; + +public class KitZombie extends SmashKit2 { private static final String[] DESCRIPTION = { }; @@ -69,9 +75,9 @@ public class KitZombie extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), null, }; @@ -82,8 +88,10 @@ public class KitZombie extends SmashKit } @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -94,27 +102,4 @@ public class KitZombie extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } - - @Override - public void giveSuperItems(Player player) - { - - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseZombie disguise = new DisguiseZombie(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java index 36f108068..7eb44eca3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java @@ -49,8 +49,10 @@ public class PerkInferno extends SmashPerk public void EnergyUpdate(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - + } + for (Player player : Manager.GetGame().GetPlayers(true)) { if (!hasPerk(player)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMooshroomMadness.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java similarity index 94% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMooshroomMadness.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java index d7687b983..04519fc8e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMooshroomMadness.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java @@ -11,14 +11,14 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; -public class PerkCowMooshroomMadness extends SmashUltimate +public class SmashCow extends SmashUltimate { private static final long DURATION = 30000; private static final int DAMAGE_BUFF = 1; private static final int HEALTH = 30; - public PerkCowMooshroomMadness() + public SmashCow() { super("Mooshroom Madness", new String[] {}, Sound.COW_IDLE, DURATION); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java new file mode 100644 index 000000000..6b2d92b4d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java @@ -0,0 +1,422 @@ +package nautilus.game.arcade.game.games.smash.perks.slime; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Slime; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +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.core.disguise.disguises.DisguiseSlime; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkSlimeRocket extends SmashPerk implements IThrown +{ + + private static final long COOLDOWN = 6000; + private static final float ENERGY_PER_TICK = 0.004F; + private static final int KNOCKBACK_MAGNITUDE = 3; + + private Map _charge = new HashMap<>(); + private Map _owner = new HashMap<>(); + private Map _lastAttack = new HashMap<>(); + + public PerkSlimeRocket() + { + super("Slime Rocket", new String[] { C.cYellow + "Hold/Release Block" + C.cGray + " to use " + C.cGreen + "Slime Rocket" }); + } + + @EventHandler + public void EnergyUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!hasPerk(player)) + { + continue; + } + + if (isSuperActive(player)) + { + continue; + } + + int size = 1; + if (player.getExp() > 0.8) + { + size = 3; + } + else if (player.getExp() > 0.55) + { + size = 2; + } + + DisguiseSlime slime = (DisguiseSlime) Manager.GetDisguise().getActiveDisguise(player); + + if (slime != null && slime.GetSize() != size) + { + slime.SetSize(size); + Manager.GetDisguise().updateDisguise(slime); + } + + if (player.isBlocking()) + { + continue; + } + + player.setExp((float) Math.min(0.999, player.getExp() + ENERGY_PER_TICK)); + } + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + UtilPlayer.message(player, F.main("Skill", "You are charging " + F.skill(GetName()) + ".")); + + _charge.put(player.getUniqueId(), System.currentTimeMillis()); + } + + @EventHandler + public void ChargeRelease(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator chargeIterator = _charge.keySet().iterator(); + + while (chargeIterator.hasNext()) + { + UUID key = chargeIterator.next(); + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + chargeIterator.remove(); + continue; + } + + long time = _charge.get(key); + + // Charge + if (player.isBlocking()) + { + // Energy Depleted + if (player.getExp() < 0.1) + { + FireRocket(player); + chargeIterator.remove(); + } + else + { + double elapsed = Math.min(3, (double) (System.currentTimeMillis() - time) / 1000d); + + // Use Energy + if (!UtilTime.elapsed(time, 3000)) + { + player.setExp((float) Math.max(0, player.getExp() - 0.01f)); + } + + // AutoFire + if (UtilTime.elapsed(time, 5000)) + { + FireRocket(player); + chargeIterator.remove(); + } + + // Effect + player.getWorld().playSound(player.getLocation(), Sound.SLIME_WALK, 0.5f, (float) (0.5 + 1.5 * (elapsed / 3d))); + UtilParticle.PlayParticle(ParticleType.SLIME, player.getLocation().add(0, 1, 0), (float) (elapsed / 6d), (float) (elapsed / 6d), (float) (elapsed / 6d), 0, (int) (elapsed * 5), + ViewDist.LONGER, UtilServer.getPlayers()); + } + } + // Release + else + { + FireRocket(player); + chargeIterator.remove(); + } + } + } + + public void FireRocket(Player player) + { + double charge = Math.min(3, (double) (System.currentTimeMillis() - _charge.get(player.getUniqueId())) / 1000d); + + // Spawn Slime + Manager.GetGame().CreatureAllowOverride = true; + Slime slime = player.getWorld().spawn(player.getEyeLocation(), Slime.class); + slime.setSize(1); + Manager.GetGame().CreatureAllowOverride = false; + + // Size + slime.setSize(Math.max(1, (int) charge)); + + slime.setMaxHealth(5 + charge * 7); + slime.setHealth(slime.getMaxHealth()); + + _owner.put(slime, player.getUniqueId()); + + // Inform + UtilPlayer.message(player, F.main("Skill", "You released " + F.skill(GetName()) + ".")); + + slime.leaveVehicle(); + player.eject(); + + UtilAction.velocity(slime, player.getLocation().getDirection(), 1 + charge / 2d, false, 0, 0.2, 10, true); + + Manager.GetProjectile().AddThrow(slime, player, this, -1, true, true, true, true, null, 0, 0, null, 0, UpdateType.FASTEST, 1f); + } + + @EventHandler + public void SlimeTarget(EntityTargetEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!_owner.containsKey(event.getEntity())) + { + return; + } + + if (event.getTarget() instanceof Player) + { + if (isTeamDamage((Player) event.getTarget(), UtilPlayer.searchExact(_owner.get(event.getEntity().getUniqueId())))) + { + event.setCancelled(true); + return; + } + } + + if (_owner.get(event.getEntity()).equals(event.getTarget())) + { + event.setCancelled(true); + } + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target == null) + { + return; + } + + if (!(data.getThrown() instanceof Slime)) + { + return; + } + + Slime slime = (Slime) data.getThrown(); + + if (target instanceof Player && data.getThrower() instanceof Player) + { + Player targetPlayer = (Player) target; + Player throwerPlayer = (Player) data.getThrower(); + + if (isTeamDamage(targetPlayer, throwerPlayer)) + { + return; + } + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 3 + slime.getSize() * 3, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } + + @Override + public void Idle(ProjectileUser data) + { + + } + + @Override + public void Expire(ProjectileUser data) + { + + } + + @EventHandler + public void SlimeDamage(CustomDamageEvent event) + { + if (!(event.GetDamagerEntity(false) instanceof Slime)) + { + return; + } + + Slime slime = (Slime) event.GetDamagerEntity(false); + + // Attack Rate + if (_lastAttack.containsKey(slime) && !UtilTime.elapsed(_lastAttack.get(slime), 500)) + { + event.SetCancelled("Slime Attack Rate"); + return; + } + + _lastAttack.put(slime, System.currentTimeMillis()); + + // Get Owner + UUID key = _owner.get(slime); + Player owner = UtilPlayer.searchExact(key); + + if (owner == null) + { + return; + } + + if (isTeamDamage(owner, event.GetDamageePlayer())) + { + event.SetCancelled("Team Damage"); + return; + } + + if (owner != null && owner.equals(event.GetDamageeEntity())) + { + event.SetCancelled("Owner Damage"); + } + else + { + event.AddMod("Slime Damage", "Negate", -event.GetDamageInitial(), false); + event.AddMod("Slime Damage", "Attack", 2 * slime.getSize(), true); + event.AddKnockback("Slime Knockback", 2); + } + } + + @EventHandler + public void SlimeClean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + Iterator slimeIterator = _owner.keySet().iterator(); + + while (slimeIterator.hasNext()) + { + Slime slime = slimeIterator.next(); + + // Shrink + if (slime.getVehicle() == null) + { + if (slime.getTicksLived() > 120) + { + slime.setTicksLived(1); + + Manager.GetBlood().Effects(null, slime.getLocation(), 6 + 6 * slime.getSize(), 0.2 + 0.1 * slime.getSize(), null, 1f, 1f, Material.SLIME_BALL, (byte) 0, 15, false); + + if (slime.getSize() <= 1) + { + slime.remove(); + } + else + { + slime.setSize(slime.getSize() - 1); + } + } + } + + if (!slime.isValid()) + { + slimeIterator.remove(); + } + } + + slimeIterator = _lastAttack.keySet().iterator(); + + while (slimeIterator.hasNext()) + { + Slime slime = slimeIterator.next(); + + if (!slime.isValid()) + { + slimeIterator.remove(); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java new file mode 100644 index 000000000..2bc39bb17 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java @@ -0,0 +1,185 @@ +package nautilus.game.arcade.game.games.smash.perks.slime; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +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; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkSlimeSlam extends SmashPerk +{ + + private static final int COOLDOWN = 6000; + private static final int HIT_BOX = 2; + private static final int START_TIME = 1000; + private static final int DAMAGE = 7; + private static final int KNOCKBACK_MAGNITUDE = 2; + + private Map _live = new HashMap<>(); + + public PerkSlimeSlam() + { + super("Slime Slam", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Slime Slam" }); + } + + @EventHandler + public void Leap(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + UtilAction.velocity(player, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 1.2, true); + + // Record + _live.put(player.getUniqueId(), System.currentTimeMillis()); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void End(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + List alivePlayers = Manager.GetGame().GetPlayers(true); + + // Collide + for (Player player : alivePlayers) + { + if (!_live.containsKey(player)) + { + continue; + } + + for (Player other : alivePlayers) + { + if (UtilPlayer.isSpectator(other)) + { + continue; + } + + if (other.equals(player)) + { + continue; + } + + if (UtilMath.offset(player, other) < HIT_BOX) + { + doSlam(player, other); + _live.remove(player); + return; + } + } + } + + // End + for (Player player : alivePlayers) + { + UUID key = player.getUniqueId(); + + if (!UtilEnt.isGrounded(player)) + { + continue; + } + + if (!_live.containsKey(key)) + { + continue; + } + + if (!UtilTime.elapsed(_live.get(key), START_TIME)) + { + continue; + } + + _live.remove(key); + } + } + + public void doSlam(Player damager, LivingEntity damagee) + { + // Recoil Event + if (!isSuperActive(damager)) + { + Manager.GetDamage().NewDamageEvent(damager, damagee, null, DamageCause.CUSTOM, DAMAGE / 4, true, true, false, damager.getName(), GetName() + " Recoil"); + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, DAMAGE, true, true, false, damager.getName(), GetName()); + + // Inform + UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java new file mode 100644 index 000000000..7c41af96f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java @@ -0,0 +1,138 @@ +package nautilus.game.arcade.game.games.smash.perks.slime; + +import java.util.List; + +import org.bukkit.Material; +import org.bukkit.Sound; +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.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.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseSlime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashSlime extends SmashUltimate +{ + + private static final long DURATION = 24000; + private static final int HIT_BOX = 5; + private static final int DAMAGE = 8; + + public SmashSlime() + { + super("Giga Slime", new String[] {}, Sound.SLIME_ATTACK, DURATION); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + player.getInventory().remove(Material.IRON_SWORD); + player.getInventory().remove(Material.IRON_AXE); + + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + if (disguise != null && disguise instanceof DisguiseSlime) + { + DisguiseSlime slime = (DisguiseSlime) disguise; + + slime.SetSize(14); + Manager.GetDisguise().updateDisguise(slime); + } + + player.setExp(0.99f); + + Manager.GetCondition().Factory().Speed(GetName(), player, player, 20, 2, false, false, false); + + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + Manager.GetCondition().EndCondition(player, ConditionType.SPEED, GetName()); + } + + @EventHandler(priority = EventPriority.LOW) + public void immunityDamagee(CustomDamageEvent event) + { + if (event.GetDamageePlayer() == null || event.GetDamagerEntity(true) == null) + { + return; + } + + if (isUsingUltimate(event.GetDamageePlayer())) + { + event.SetCancelled(GetName()); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void immunityDamager(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { + return; + } + + if (event.GetDamagerPlayer(true) == null) + { + return; + } + + if (isUsingUltimate(event.GetDamagerPlayer(true))) + { + event.SetCancelled(GetName()); + } + } + + @EventHandler + public void collide(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + List alivePlayers = Manager.GetGame().GetPlayers(true); + + for (Player player : alivePlayers) + { + for (Player other : alivePlayers) + { + if (player.equals(other)) + { + continue; + } + + if (UtilPlayer.isSpectator(other)) + { + continue; + } + + if (UtilMath.offset(player.getLocation().add(0, 3, 0), other.getLocation()) < HIT_BOX) + { + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, false, false, player.getName(), GetName()); + + UtilParticle.PlayParticle(ParticleType.SLIME, other.getLocation().add(0, 0.6, 0), 1f, 1f, 1f, 0, 20, ViewDist.LONG, UtilServer.getPlayers()); + + player.getWorld().playSound(other.getLocation(), Sound.SLIME_ATTACK, 3f, 1f); + } + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java new file mode 100644 index 000000000..d02695389 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java @@ -0,0 +1,56 @@ +package nautilus.game.arcade.game.games.smash.perks.snowman; + +import java.util.Map; + +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkArcticAura extends Perk +{ + + private static final int DURATION = 2000; + private static final int RANGE = 5; + + public PerkArcticAura() + { + super("Arctic Aura", new String[] { "You freeze things around you, slowing enemies." }); + } + + @EventHandler + public void SnowAura(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!hasPerk(player)) + { + continue; + } + + if (UtilPlayer.isSpectator(player)) + { + continue; + } + + double range = RANGE * player.getExp(); + + Map blocks = UtilBlock.getInRadius(player.getLocation(), range); + + for (Block block : blocks.keySet()) + { + Manager.GetBlockRestore().snow(block, (byte) 1, (byte) 1, (long) (DURATION * (1 + blocks.get(block))), 250, 0); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkBlizzard.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkBlizzard.java new file mode 100644 index 000000000..7a2690bcf --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkBlizzard.java @@ -0,0 +1,173 @@ +package nautilus.game.arcade.game.games.smash.perks.snowman; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkBlizzard extends Perk +{ + + private static final float MAX_ENERGY = 0.99F; + private static final float ENERGY_PER_TICK = 1 / 60; + private static final float ENERGY_PER_USE = 1 / 9; + private static final int SNOWBALL_PER_USE = 4; + + private Map _snowball = new HashMap<>(); + + public PerkBlizzard() + { + super("Blizzard", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Blizzard" }); + } + + @EventHandler + public void EnergyUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!hasPerk(player)) + { + continue; + } + + if (player.isBlocking()) + { + continue; + } + + player.setExp(Math.min(MAX_ENERGY, player.getExp() + ENERGY_PER_TICK)); + } + } + + @EventHandler + public void Snow(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + { + return; + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!player.isBlocking()) + { + continue; + } + + if (!hasPerk(player)) + { + continue; + } + + // Energy + if (player.getExp() < 0.1) + { + continue; + } + + player.setExp(Math.max(0, player.getExp() - ENERGY_PER_USE)); + + for (int i = 0; i < SNOWBALL_PER_USE; i++) + { + Snowball snow = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Snowball.class); + double x = 0.1 - (UtilMath.r(20) / 100d); + double y = UtilMath.r(20) / 100d; + double z = 0.1 - (UtilMath.r(20) / 100d); + snow.setShooter(player); + snow.setVelocity(player.getLocation().getDirection().add(new Vector(x, y, z)).multiply(2)); + _snowball.put(snow, player); + } + + // Effect + player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 0.1f, 0.5f); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void Snowball(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.PROJECTILE) + { + return; + } + + Projectile proj = event.GetProjectile(); + + if (proj == null) + { + return; + } + + if (!(proj instanceof Snowball)) + { + return; + } + + if (!_snowball.containsKey(proj)) + { + return; + } + + LivingEntity damagee = event.GetDamageeEntity(); + + if (damagee == null) + { + return; + } + + event.SetCancelled("Blizzard"); + + UtilAction.velocity(damagee, proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0))); + + // Damage Event + if (damagee instanceof Player) + { + if (Recharge.Instance.use((Player) damagee, GetName(), 200, false, false)) + { + Manager.GetDamage().NewDamageEvent(damagee, event.GetDamagerEntity(true), null, DamageCause.CUSTOM, 1, false, true, false, UtilEnt.getName(event.GetDamagerEntity(true)), GetName()); + } + } + } + + @EventHandler + public void SnowballForm(ProjectileHitEvent event) + { + Projectile proj = event.getEntity(); + + if (!(proj instanceof Snowball)) + { + return; + } + + if (_snowball.remove(proj) == null) + { + return; + } + + Manager.GetBlockRestore().snow(proj.getLocation().getBlock(), (byte) 1, (byte) 7, 2000, 250, 0); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkDamageSnow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkDamageSnow.java new file mode 100644 index 000000000..3fd58b90e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkDamageSnow.java @@ -0,0 +1,49 @@ +package nautilus.game.arcade.game.games.smash.perks.snowman; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.arcade.kit.Perk; + +public class PerkDamageSnow extends Perk +{ + private int _damage; + private double _knockback; + + public PerkDamageSnow(int damage, double knockback) + { + super("Snow Attack", new String[] { C.cGray + "+" + damage + " Damage and " + (int) ((knockback - 1) * 100) + "% Knockback to enemies on snow.", }); + + _damage = damage; + _knockback = knockback; + } + + @EventHandler(priority = EventPriority.HIGH) + public void Knockback(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getLocation().getBlock().getType() != Material.SNOW) + { + return; + } + + Player damager = event.GetDamagerPlayer(true); + + if (damager == null) + { + return; + } + + if (!hasPerk(damager) || UtilPlayer.isSpectator(damager)) + { + return; + } + + event.AddMod(damager.getName(), GetName(), _damage, false); + event.AddKnockback("Knockback Snow", _knockback); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java new file mode 100644 index 000000000..b11a3472c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java @@ -0,0 +1,112 @@ +package nautilus.game.arcade.game.games.smash.perks.snowman; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.bukkit.Effect; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.data.IcePathData; + +public class PerkIcePath extends Perk +{ + + private static final long COOLDOWN = 12000; + private static final long MELT_TIME = 6000; + + private Set _data = new HashSet<>(); + + public PerkIcePath() + { + super("Ice Path", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Ice Path" }); + } + + @EventHandler + public void Skill(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + player.teleport(player.getLocation().add(0, 1, 0)); + UtilAction.velocity(player, new Vector(0, 0.5, 0)); + + _data.add(new IcePathData(player)); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Freeze(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator dataIterator = _data.iterator(); + + while (dataIterator.hasNext()) + { + IcePathData data = dataIterator.next(); + + Block block = data.GetNextBlock(); + + if (block == null) + { + dataIterator.remove(); + } + else + { + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 79); + Manager.GetBlockRestore().add(block, 79, (byte) 0, MELT_TIME); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java new file mode 100644 index 000000000..381d3968d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java @@ -0,0 +1,202 @@ +package nautilus.game.arcade.game.games.smash.perks.snowman; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Snowball; +import org.bukkit.entity.Snowman; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +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.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashSnowman extends SmashUltimate +{ + + private static final int TURRET_HEALTH = 40; + private static final int MAX_TICKS = 400; + private static final int RATE = 250; + private static final float KNOCKBACK_MAGNITUDE = 2.5F; + + private Map _snowball = new HashMap<>(); + + private Map _turret = new HashMap<>(); + + public SmashSnowman() + { + super("Snow Turret", new String[] {}, Sound.STEP_SNOW, 0); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + Game game = Manager.GetGame(); + + game.CreatureAllowOverride = true; + Snowman ent = player.getWorld().spawn(player.getEyeLocation(), Snowman.class); + game.CreatureAllowOverride = false; + + UtilEnt.Vegetate(ent); + UtilEnt.ghost(ent, true, false); + + ent.setMaxHealth(TURRET_HEALTH); + ent.setHealth(TURRET_HEALTH); + + UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false); + + _turret.put(ent, player); + } + + @EventHandler + public void updateSnowman(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + { + return; + } + + Iterator turretIter = _turret.keySet().iterator(); + + while (turretIter.hasNext()) + { + Snowman snowman = turretIter.next(); + Player player = _turret.get(snowman); + + if (snowman.getTicksLived() > MAX_TICKS) + { + UtilParticle.PlayParticle(ParticleType.SNOWBALL_POOF, snowman.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); + turretIter.remove(); + snowman.remove(); + continue; + } + + Player target = UtilPlayer.getClosest(snowman.getLocation(), player); + + if (target == null) + { + continue; + } + + snowman.setTarget(target); + + // Snowball + double mult = 1 + Math.min(3, UtilMath.offset(snowman, target) / 16); + double heightBonus = UtilMath.offset(snowman, target) / 140; + Vector rand = new Vector((Math.random() - 0.5) * 0.2, (Math.random() - 0.5) * 0.2, (Math.random() - 0.5) * 0.2); + + _snowball.put(snowman.launchProjectile(Snowball.class, UtilAlg.getTrajectory(snowman.getLocation(), target.getLocation()).multiply(mult).add(rand).add(new Vector(0, heightBonus, 0))), + player); + + // Look dir + UtilEnt.CreatureMoveFast(snowman, target.getLocation(), 0.1f); + + // Sound + snowman.getWorld().playSound(snowman.getLocation(), Sound.STEP_SNOW, 0.6f, 1f); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void snowballHit(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.PROJECTILE) + { + return; + } + + Projectile proj = event.GetProjectile(); + + if (proj == null) + { + return; + } + + if (!(proj instanceof Snowball)) + { + return; + } + + if (!_snowball.containsKey(proj)) + { + return; + } + + LivingEntity damagee = event.GetDamageeEntity(); + + if (damagee == null) + { + return; + } + + event.SetCancelled("Turret"); + + if (damagee.equals(_snowball.get(proj))) + { + return; + } + + UtilAction.velocity(damagee, proj.getVelocity().multiply(0.3).add(new Vector(0, 0.3, 0))); + + // Damage Event + if (!(damagee instanceof LivingEntity)) + { + return; + } + + if (!Recharge.Instance.use((Player) damagee, GetName() + " Hit", RATE, false, false)) + { + return; + } + + Manager.GetDamage().NewDamageEvent(damagee, _snowball.get(proj), null, DamageCause.PROJECTILE, 2, false, true, false, UtilEnt.getName(_snowball.get(proj)), GetName()); + } + + @EventHandler + public void damageCancel(CustomDamageEvent event) + { + if (_turret.containsKey(event.GetDamageeEntity())) + { + event.SetCancelled("Turret Immunity"); + } + } + + @EventHandler + public void clean(ProjectileHitEvent event) + { + _snowball.remove(event.getEntity()); + } + + @EventHandler + public void knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java new file mode 100644 index 000000000..4153fca46 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java @@ -0,0 +1,186 @@ +package nautilus.game.arcade.game.games.smash.perks.spider; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkNeedler extends SmashPerk +{ + + private static final long COOLDOWN_NORMAL = 2000; + private static final long COOLDOWN_SMASH = 600; + private static final float DAMAGE = 1.1F; + private static final int MAX_TICKS = 300; + + private Map _active = new HashMap<>(); + private Set _arrows = new HashSet<>(); + + public PerkNeedler() + { + super("Needler", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Needler" }); + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? COOLDOWN_SMASH : COOLDOWN_NORMAL, !isSuperActive(player), !isSuperActive(player))) + { + return; + } + + _active.put(player.getUniqueId(), 8); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : UtilServer.getPlayers()) + { + UUID key = cur.getUniqueId(); + + if (!_active.containsKey(key)) + { + continue; + } + + if (!cur.isBlocking()) + { + _active.remove(key); + continue; + } + + int count = _active.get(key) - 1; + + if (count <= 0) + { + _active.remove(key); + continue; + } + else + { + _active.put(key, count); + } + + Arrow arrow = cur.getWorld().spawnArrow(cur.getEyeLocation().add(cur.getLocation().getDirection()), cur.getLocation().getDirection(), 1.2f, 6); + arrow.setShooter(cur); + _arrows.add(arrow); + + // Sound + cur.getWorld().playSound(cur.getLocation(), Sound.SPIDER_IDLE, 0.8f, 2f); + } + } + + @EventHandler + public void ArrowDamamge(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + { + return; + } + + if (event.GetDamagerPlayer(true) == null) + { + return; + } + + if (!(event.GetProjectile() instanceof Arrow)) + { + return; + } + + Player damager = event.GetDamagerPlayer(true); + + if (!hasPerk(damager)) + { + return; + } + + event.SetCancelled("Needler Cancel"); + + event.GetProjectile().remove(); + + // Damage Event + Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), damager, null, DamageCause.THORNS, DAMAGE, true, true, false, damager.getName(), GetName()); + + if (!isTeamDamage(damager, event.GetDamageePlayer())) + { + Manager.GetCondition().Factory().Poison(GetName(), event.GetDamageeEntity(), damager, 2, 0, false, false, false); + } + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Arrow arrow = arrowIterator.next(); + + if (arrow.isOnGround() || !arrow.isValid() || arrow.getTicksLived() > MAX_TICKS) + { + arrowIterator.remove(); + arrow.remove(); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java new file mode 100644 index 000000000..0eb494eae --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java @@ -0,0 +1,170 @@ +package nautilus.game.arcade.game.games.smash.perks.spider; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.GameMode; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkSpiderLeap extends Perk +{ + + private static final float ENERGY_PER_TICK = 1 / 80; + private static final float ENERGY_PER_LEAP = 1 / 6; + + private Set _secondJump = new HashSet<>(); + + public PerkSpiderLeap() + { + super("Spider Leap", new String[] { C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Spider Leap", C.cYellow + "Hold Crouch" + C.cGray + " to " + C.cGreen + "Wall Climb", C.cWhite + + "Wall Climb requires Energy (Experience Bar)." + }); + } + + @EventHandler + public void WallClimb(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player player : UtilServer.getPlayers()) + { + if (UtilPlayer.isSpectator(player)) + { + continue; + } + + if (!hasPerk(player)) + { + continue; + } + + if (!player.isSneaking()) + { + if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + { + player.setExp((float) Math.min(0.999, player.getExp() + ENERGY_PER_TICK)); + _secondJump.remove(player.getUniqueId()); + } + + continue; + } + + player.setExp((float) Math.max(0, player.getExp() - ENERGY_PER_TICK)); + + if (player.getExp() <= 0) + { + continue; + } + + if (!Recharge.Instance.usable(player, GetName())) + { + continue; + } + + for (Block block : UtilBlock.getSurrounding(player.getLocation().getBlock(), true)) + { + if (!UtilBlock.airFoliage(block) && !block.isLiquid()) + { + UtilAction.velocity(player, new Vector(0, 0.2, 0)); + + if (!_secondJump.contains(player.getUniqueId())) + { + player.setAllowFlight(true); + _secondJump.add(player.getUniqueId()); + } + + continue; + } + } + } + } + + @EventHandler + public void FlightHop(PlayerToggleFlightEvent event) + { + Player player = event.getPlayer(); + + if (!hasPerk(player)) + { + return; + } + + if (UtilPlayer.isSpectator(player)) + { + return; + } + + if (player.getGameMode() == GameMode.CREATIVE) + { + return; + } + + event.setCancelled(true); + player.setFlying(false); + + // Disable Flight + player.setAllowFlight(false); + + if (player.getExp() < ENERGY_PER_LEAP) + { + return; + } + + // Velocity + UtilAction.velocity(player, 1.0, 0.2, 1.0, true); + + // Energy + player.setExp((float) Math.max(0, player.getExp() - ENERGY_PER_LEAP)); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 1f, 1.5f); + + Recharge.Instance.use(player, GetName(), 500, false, false); + } + + @EventHandler + public void FlightUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (UtilPlayer.isSpectator(player)) + { + continue; + } + + if (!hasPerk(player)) + { + continue; + } + + if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + { + player.setAllowFlight(true); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java new file mode 100644 index 000000000..faf02aebd --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java @@ -0,0 +1,143 @@ +package nautilus.game.arcade.game.games.smash.perks.spider; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +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.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkWebShot extends SmashPerk implements IThrown +{ + + private static final long COOLDOWN_NORMAL = 10000; + private static final long COOLDOWN_SMASH = 1000; + private static final int WEBS = 20; + + public PerkWebShot() + { + super("Spin Web", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Spin Web" }); + } + + @EventHandler + public void ShootWeb(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? COOLDOWN_SMASH : COOLDOWN_NORMAL, !isSuperActive(player), !isSuperActive(player))) + { + return; + } + + event.setCancelled(true); + + // Boost + UtilAction.velocity(player, 1.2, 0.2, 1.2, true); + + for (int i = 0; i < WEBS; i++) + { + Item ent = player.getWorld().dropItem(player.getLocation().add(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.WEB, (byte) 0, 1, "Web " + player.getName() + " " + i)); + + Vector random = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); + random.normalize(); + random.multiply(0.2); + + UtilAction.velocity(ent, player.getLocation().getDirection().multiply(-1).add(random), 1 + Math.random() * 0.4, false, 0, 0.2, 10, false); + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, 0.5f); + } + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + + // Effect + player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 2f, 0.6f); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target != null) + { + data.getThrown().remove(); + + Manager.GetBlockRestore().add(target.getLocation().getBlock(), 30, (byte) 0, 3000); + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 6, false, false, false, UtilEnt.getName(data.getThrower()), GetName()); + + UtilAction.zeroVelocity(target); + + return; + } + + Web(data); + } + + @Override + public void Idle(ProjectileUser data) + { + Web(data); + } + + @Override + public void Expire(ProjectileUser data) + { + Web(data); + } + + public void Web(ProjectileUser data) + { + Location loc = data.getThrown().getLocation(); + data.getThrown().remove(); + + if (data.getThrown().getTicksLived() > 3) + { + Manager.GetBlockRestore().add(loc.getBlock(), 30, (byte) 0, 2000); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java new file mode 100644 index 000000000..2549dd73c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java @@ -0,0 +1,154 @@ +package nautilus.game.arcade.game.games.smash.perks.spider; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Sound; +import org.bukkit.block.Block; +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.common.util.UtilBlock; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashSpider extends SmashUltimate +{ + private static final long DURATION = 30000; + + private Map _preHealth = new HashMap<>(); + + public SmashSpider() + { + super("Spider Nest", new String[] {}, Sound.SPIDER_DEATH, DURATION); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + // Nest + Map blocks = UtilBlock.getInRadius(player.getLocation().getBlock(), 16); + + for (Block block : blocks.keySet()) + { + if (blocks.get(block) > 0.07) + { + continue; + } + + if (!UtilBlock.airFoliage(block)) + { + continue; + } + + if (block.getY() > player.getLocation().getY() + 10) + { + continue; + } + + if (block.getY() < player.getLocation().getY() - 10) + { + continue; + } + + Manager.GetBlockRestore().add(block, 30, (byte) 0, (long) (DURATION + 5000 * Math.random())); + } + + // Regen + Manager.GetCondition().Factory().Regen(GetName(), player, player, 30, 0, false, false, false); + } + + @EventHandler(priority = EventPriority.HIGH) + public void damagePre(CustomDamageEvent event) + { + if (event.IsCancelled()) + { + return; + } + + if (event.GetCause() != DamageCause.ENTITY_ATTACK && event.GetCause() != DamageCause.PROJECTILE && event.GetCause() != DamageCause.CUSTOM) + { + return; + } + + Player damager = event.GetDamagerPlayer(true); + + if (damager == null) + { + return; + } + + LivingEntity damagee = event.GetDamageeEntity(); + + if (damagee == null) + { + return; + } + + if (!isUsingUltimate(damager)) + { + return; + } + + _preHealth.put(damagee, damagee.getHealth()); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void damagePost(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damager = event.GetDamagerPlayer(true); + + if (damager == null) + { + return; + } + + LivingEntity damagee = event.GetDamageeEntity(); + + if (damagee == null) + { + return; + } + + if (!isUsingUltimate(damager)) + { + return; + + } + if (!_preHealth.containsKey(damagee)) + { + return; + } + + double diff = (_preHealth.remove(damagee) - damagee.getHealth()) / 2d; + + if (diff <= 0) + { + return; + } + + damager.setMaxHealth(Math.min(60, damager.getMaxHealth() + diff)); + damager.setHealth(damager.getHealth() + diff); + + UtilParticle.PlayParticle(ParticleType.HEART, damager.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); + + UtilParticle.PlayParticle(ParticleType.RED_DUST, damagee.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); + + if (event.GetCause() == DamageCause.ENTITY_ATTACK) + { + damager.getWorld().playSound(damager.getLocation(), Sound.SPIDER_IDLE, 1.5f, 1f); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java new file mode 100644 index 000000000..2c6f48e0f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java @@ -0,0 +1,312 @@ +package nautilus.game.arcade.game.games.smash.perks.witch; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Bat; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +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.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkBatWave extends SmashPerk +{ + + private static final long COOLDOWN = 8000; + private static final long LEASH_COOLDOWN = 500; + private static final long HIT_COOLDOWN = 200; + private static final int HIT_BOX = 2; + private static final int DAMAGE = 3; + private static final float KNOCKBACK_MAGNITUDE = 1.75F; + + private static final String LEASH = "Leash Bats"; + private static final String HIT = "Hit By Bat"; + + private Map _active = new HashMap<>(); + private Map _direction = new HashMap<>(); + private Map> _bats = new HashMap<>(); + private Set _pulling = new HashSet<>(); + private Set _allowLeash = new HashSet<>(); + + public PerkBatWave() + { + super("Bat Wave", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Bat Wave", C.cYellow + "Double Right-Click" + C.cGray + " with Spade to use " + + C.cGreen + "Bat Leash" }); + } + + @EventHandler + public void Deactivate(CustomDamageEvent event) + { + Player player = event.GetDamageePlayer(); + + if (player == null) + { + return; + } + + if (_pulling.remove(player.getUniqueId())) + { + for (Bat bat : _bats.get(player.getUniqueId())) + { + bat.setLeashHolder(null); + } + } + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSpade(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + UUID key = player.getUniqueId(); + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, false, true)) + { + if (_active.containsKey(key)) + { + if (!Recharge.Instance.use(player, LEASH, LEASH_COOLDOWN, false, false)) + { + return; + } + + if (!_pulling.remove(key)) + { + if (_allowLeash.remove(key)) + { + _pulling.add(key); + + for (Bat bat : _bats.get(key)) + { + bat.setLeashHolder(player); + } + } + } + else + { + for (Bat bat : _bats.get(key)) + { + bat.setLeashHolder(null); + } + } + } + else + { + // Inform + Recharge.Instance.use(player, GetName(), COOLDOWN, true, true); + } + } + else + { + // Start + _direction.put(key, player.getEyeLocation()); + _active.put(key, System.currentTimeMillis()); + _allowLeash.add(key); + + _bats.put(key, new ArrayList()); + + Manager.GetGame().CreatureAllowOverride = true; + + for (int i = 0; i < 32; i++) + { + Bat bat = player.getWorld().spawn(player.getEyeLocation(), Bat.class); + _bats.get(key).add(bat); + } + + Manager.GetGame().CreatureAllowOverride = false; + + // Inform + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player cur : UtilServer.getPlayers()) + { + UUID key = cur.getUniqueId(); + + if (!_active.containsKey(key)) + { + continue; + } + + if (UtilTime.elapsed(_active.get(key), 2500)) + { + Clear(cur); + continue; + } + + Location loc = _direction.get(key); + + Vector batVec = new Vector(0, 0, 0); + double batCount = 0; + + // Bat Movement + for (Bat bat : _bats.get(key)) + { + if (!bat.isValid()) + { + continue; + } + + batVec.add(bat.getLocation().toVector()); + batCount++; + + Vector rand = new Vector((Math.random() - 0.5) / 2, (Math.random() - 0.5) / 2, (Math.random() - 0.5) / 2); + bat.setVelocity(loc.getDirection().clone().multiply(0.5).add(rand)); + + for (Player other : Manager.GetGame().GetPlayers(true)) + { + if (other.equals(cur)) + { + continue; + } + + if (!Recharge.Instance.usable(other, HIT)) + { + continue; + } + + if (UtilEnt.hitBox(bat.getLocation(), other, HIT_BOX, null)) + { + // Damage Event + Manager.GetDamage().NewDamageEvent(other, cur, null, DamageCause.CUSTOM, DAMAGE, true, true, false, cur.getName(), GetName()); + + // Effect + bat.getWorld().playSound(bat.getLocation(), Sound.BAT_HURT, 1f, 1f); + UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, bat.getLocation(), 0, 0, 0, 0, 3, ViewDist.LONG, UtilServer.getPlayers()); + + bat.remove(); + + // Recharge on hit + Recharge.Instance.useForce(other, HIT, HIT_COOLDOWN); + } + } + } + + // Player Pull + if (_pulling.contains(key)) + { + batVec.multiply(1 / batCount); + + Location batLoc = batVec.toLocation(cur.getWorld()); + + UtilAction.velocity(cur, UtilAlg.getTrajectory(cur.getLocation(), batLoc), 0.35, false, 0, 0, 10, false); + } + } + } + + @EventHandler + public void PlayerQuit(PlayerQuitEvent event) + { + Clear(event.getPlayer()); + } + + @EventHandler + public void PlayerDeath(PlayerDeathEvent event) + { + Clear(event.getEntity()); + } + + public void Clear(Player player) + { + UUID key = player.getUniqueId(); + + _active.remove(key); + _direction.remove(key); + _pulling.remove(key); + + if (_bats.containsKey(key)) + { + for (Bat bat : _bats.get(key)) + { + if (bat.isValid()) + { + UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, bat.getLocation(), 0, 0, 0, 0, 3, ViewDist.LONG, UtilServer.getPlayers()); + } + + bat.remove(); + } + + _bats.remove(player); + } + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java new file mode 100644 index 000000000..8c37318fc --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java @@ -0,0 +1,185 @@ +package nautilus.game.arcade.game.games.smash.perks.witch; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.ThrownPotion; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +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.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkWitchPotion extends SmashPerk +{ + + private static final long COOLDOWN = 2000; + private static final int RANGE_NOMRAL = 3; + private static final int RANGE_SMASH = 4; + private static final int DAMAGE_NORMAL = 7; + private static final int DAMAGE_SMASH = 10; + private static final int KNOCKBACK_MAGNITUDE = 2; + + private List _proj = new ArrayList<>(); + + public PerkWitchPotion() + { + super("Daze Potion", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Daze Potion" }); + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + // Start + ThrownPotion potion = player.launchProjectile(ThrownPotion.class); + UtilAction.velocity(potion, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false); + + _proj.add(potion); + + // Inform + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Hit(ProjectileHitEvent event) + { + if (!_proj.remove(event.getEntity())) + { + return; + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (player.equals(event.getEntity().getShooter())) + { + continue; + } + + if (!(event.getEntity().getShooter() instanceof Player)) + { + continue; + } + + Player thrower = (Player) event.getEntity().getShooter(); + + if (UtilMath.offset(player.getLocation().add(0, 1, 0), event.getEntity().getLocation()) > (isSuperActive(thrower) ? RANGE_SMASH : RANGE_NOMRAL)) + { + continue; + } + + String name = UtilEnt.getName((LivingEntity) event.getEntity().getShooter()); + + // Standard + if (!isSuperActive(thrower)) + { + // Damage Event + Manager.GetDamage().NewDamageEvent(player, thrower, null, DamageCause.CUSTOM, DAMAGE_NORMAL, true, true, false, name, GetName()); + + Manager.GetCondition().Factory().Slow(GetName(), player, null, 3, 1, true, false, false, false); + } + // Super Effect + else + { + // Damage Event + Manager.GetDamage().NewDamageEvent(player, thrower, null, DamageCause.CUSTOM, DAMAGE_SMASH, true, true, false, name, GetName()); + + Manager.GetCondition().Factory().Slow(GetName(), player, null, 7, 2, true, false, false, false); + } + } + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator potionIterator = _proj.iterator(); + + while (potionIterator.hasNext()) + { + Projectile proj = potionIterator.next(); + + if (!proj.isValid()) + { + potionIterator.remove(); + continue; + } + + UtilParticle.PlayParticle(ParticleType.MOB_SPELL, proj.getLocation(), 0, 0, 0, 0, 1, ViewDist.LONGER, UtilServer.getPlayers()); + } + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashBat.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashBat.java new file mode 100644 index 000000000..94e898356 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashBat.java @@ -0,0 +1,312 @@ +package nautilus.game.arcade.game.games.smash.perks.witch; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +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.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.disguises.DisguiseBat; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.data.SonicBoomData; + +public class SmashBat extends SmashUltimate +{ + + private static final long DURATION = 20000; + private static final long COOLDOWN = 1200; + private static final long MAX_TIME = 12000; + private static final int HIT_BOX = 4; + private static final int DAMAGE_RADIUS = 10; + private static final int DAMAGE = 12; + private static final int FLAP_COOLDOWN = 40; + private static final int KNOCKBACK_MAGNITUDE = 2; + + private List _sonic = new ArrayList<>(); + + public SmashBat() + { + super("Bat Form", new String[] {}, Sound.BAT_HURT, DURATION); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + player.getInventory().remove(Material.IRON_SPADE); + player.getInventory().remove(Material.IRON_AXE); + + player.getInventory().addItem(new ItemStack(Material.DIAMOND_AXE)); + + for (Perk perk : Kit.GetPerks()) + { + if (perk instanceof PerkDoubleJump) + { + ((PerkDoubleJump) perk).disableForPlayer(player); + } + } + + Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(player)); + + SmashKit2 kit = (SmashKit2) Kit; + kit.disguise(player, DisguiseBat.class); + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + for (Perk perk : Kit.GetPerks()) + { + if (perk instanceof PerkDoubleJump) + { + ((PerkDoubleJump) perk).enableForPlayer(player); + } + } + + Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(player)); + + SmashKit2 kit = (SmashKit2) Kit; + kit.disguise(player); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void attackCancel(CustomDamageEvent event) + { + if (event.IsCancelled()) + { + return; + } + + Player player = event.GetDamagerPlayer(true); + + if (player == null) + { + return; + } + + if (!isUsingUltimate(player)) + { + return; + } + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { + return; + } + + event.SetCancelled("Bat Form Melee Cancel"); + } + + @EventHandler(priority = EventPriority.LOW) // Happen before activation of + // Super + public void sonicBoom(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!isUsingUltimate(player)) + { + return; + } + + if (event.getAction() == Action.PHYSICAL) + { + return; + } + + if (!Recharge.Instance.use(player, GetName() + " Screech", COOLDOWN, false, false)) + { + return; + } + + // Effect + player.getWorld().playSound(player.getLocation(), Sound.BAT_HURT, 1f, 0.75f); + + _sonic.add(new SonicBoomData(player)); + } + + @EventHandler + public void sonicBoomUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator sonicIter = _sonic.iterator(); + + while (sonicIter.hasNext()) + { + SonicBoomData data = sonicIter.next(); + + // Time Boom + if (UtilTime.elapsed(data.Time, MAX_TIME)) + { + sonicIter.remove(); + explode(data); + continue; + } + + // Block Boom + if (!UtilBlock.airFoliage(data.Location.getBlock())) + { + sonicIter.remove(); + explode(data); + continue; + } + + // Proxy Boom + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (Manager.isSpectator(player)) + { + continue; + } + + if (player.equals(data.Shooter)) + { + continue; + } + + if (UtilMath.offset(player.getLocation().add(0, 1, 0), data.Location) < HIT_BOX) + { + sonicIter.remove(); + explode(data); + continue; + } + } + + // Move + data.Location.add(data.Direction.clone().multiply(1)); + + // Effect + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Location, 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + data.Location.getWorld().playSound(data.Location, Sound.FIZZ, 1f, 2f); + } + } + + private void explode(SonicBoomData data) + { + // Effect + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Location, 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + data.Location.getWorld().playSound(data.Location, Sound.EXPLODE, 1f, 1.5f); + + // Damage + Map targets = UtilEnt.getInRadius(data.Location, DAMAGE_RADIUS); + + for (LivingEntity cur : targets.keySet()) + { + if (cur.equals(data.Shooter)) + { + continue; + } + + Manager.GetDamage().NewDamageEvent(cur, data.Shooter, null, DamageCause.CUSTOM, DAMAGE * targets.get(cur) + 0.5, true, false, false, data.Shooter.getName(), GetName()); + } + } + + @EventHandler + public void flap(PlayerToggleFlightEvent event) + { + Player player = event.getPlayer(); + + if (Manager.isSpectator(player)) + { + return; + } + + if (!isUsingUltimate(player)) + { + return; + } + + if (player.getGameMode() == GameMode.CREATIVE) + { + return; + } + + event.setCancelled(true); + player.setFlying(false); + + // Disable Flight + player.setAllowFlight(false); + + // Velocity + UtilAction.velocity(player, player.getLocation().getDirection(), 0.8, false, 0, 0.8, 1, true); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float) (0.3 + player.getExp()), (float) (Math.random() / 2 + 0.5)); + + // Set Recharge + Recharge.Instance.use(player, GetName() + " Flap", FLAP_COOLDOWN, false, false); + } + + @EventHandler + public void flapRecharge(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player player : ((SmashKit) Kit).getSuperActive()) + { + if (Manager.isSpectator(player)) + { + continue; + } + + if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + { + player.setAllowFlight(true); + } + else if (Recharge.Instance.usable(player, GetName() + " Flap")) + { + player.setAllowFlight(true); + } + } + } + + @EventHandler + public void knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java new file mode 100644 index 000000000..49d800c70 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java @@ -0,0 +1,291 @@ +package nautilus.game.arcade.game.games.smash.perks.witherskeleton; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +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.block.Action; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkWitherImage extends SmashPerk +{ + + private static final long COOLDOWN = 12000; + private static final long SWAP_COOLDOWN = 2000; + + private Map _skeletons = new HashMap<>(); + + public PerkWitherImage() + { + super("Wither Image", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Wither Image", C.cYellow + "Double Right-Click" + C.cGray + " with Axe to " + C.cGreen + + "Wither Swap" }); + } + + @EventHandler + public void activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!_skeletons.containsKey(player.getUniqueId())) + { + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + // Spawn + Manager.GetGame().CreatureAllowOverride = true; + Skeleton skel = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Skeleton.class); + Manager.GetGame().CreatureAllowOverride = false; + + skel.setSkeletonType(SkeletonType.WITHER); + + skel.getEquipment().setItemInHand(player.getItemInHand()); + skel.setMaxHealth(20); + skel.setHealth(skel.getMaxHealth()); + + if (Manager.GetGame().GetTeamList().size() > 1) + { + skel.setCustomName(Manager.GetColor(player) + player.getName()); + } + else + { + skel.setCustomName(C.cYellow + player.getName()); + } + + skel.setCustomNameVisible(true); + + UtilAction.velocity(skel, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, true); + + _skeletons.put(player.getUniqueId(), skel); + + Recharge.Instance.use(player, "Wither Swap", SWAP_COOLDOWN, false, false); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.WITHER_SPAWN, 1f, 1f); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + else + { + if (!Recharge.Instance.use(player, "Wither Swap", SWAP_COOLDOWN, true, false)) + { + return; + } + + Skeleton skel = _skeletons.get(player.getUniqueId()); + + Location loc = skel.getLocation(); + skel.teleport(player.getLocation()); + player.teleport(loc); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.WITHER_SPAWN, 1f, 2f); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Wither Swap") + ".")); + } + } + + @EventHandler + public void entityTarget(EntityTargetEvent event) + { + if (_skeletons.containsValue(event.getEntity())) + { + if (event.getTarget() instanceof Player) + { + if (isTeamDamage((Player) event.getTarget(), getOwner((Skeleton) event.getEntity()))) + { + event.setCancelled(true); + } + } + + if (_skeletons.get(event.getTarget().getUniqueId()).equals(event.getEntity())) + { + event.setCancelled(true); + } + } + } + + @EventHandler + public void damage(CustomDamageEvent event) + { + Player damagee = event.GetDamageePlayer(); + + if (damagee == null) + { + return; + } + + if (!_skeletons.containsKey(damagee.getUniqueId())) + { + return; + } + + LivingEntity damager = event.GetDamagerEntity(false); + + if (damager == null) + { + return; + } + + if (_skeletons.get(damagee.getUniqueId()).equals(damager)) + { + event.SetCancelled("Wither Image"); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void minionDamageTransfer(CustomDamageEvent event) + { + LivingEntity damager = event.GetDamagerEntity(true); + + if (damager == null) + return; + + if (!_skeletons.containsValue(damager)) + { + return; + } + + for (UUID uuid : _skeletons.keySet()) + { + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + return; + } + + if (_skeletons.get(uuid).equals(damager)) + { + event.SetDamager(player); + event.setKnockbackOrigin(damager.getLocation()); + event.AddMod(GetName(), "Wither Image", -5.5, true); + } + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + { + return; + + } + Iterator playerIterator = _skeletons.keySet().iterator(); + + while (playerIterator.hasNext()) + { + UUID uuid = playerIterator.next(); + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + playerIterator.remove(); + continue; + } + + Skeleton skel = _skeletons.get(uuid); + + if (!player.isValid() || !skel.isValid() || skel.getTicksLived() > 160 || UtilBlock.liquid(skel.getLocation().getBlock())) + { + // Effect + Manager.GetBlood().Effects(null, skel.getLocation().add(0, 0.5, 0), 12, 0.3, Sound.WITHER_HURT, 1f, 0.75f, Material.BONE, (byte) 0, 40, false); + + playerIterator.remove(); + skel.remove(); + continue; + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void clean(PlayerDeathEvent event) + { + Skeleton skel = _skeletons.remove(event.getEntity().getUniqueId()); + + if (skel != null) + { + // Effect + Manager.GetBlood().Effects(null, skel.getLocation().add(0, 0.5, 0), 12, 0.3, Sound.WITHER_HURT, 1f, 0.75f, Material.BONE, (byte) 0, 40, false); + + skel.remove(); + } + } + + private Player getOwner(Skeleton skel) + { + for (UUID uuid : _skeletons.keySet()) + { + Skeleton other = _skeletons.get(uuid); + + if (other.equals(skel)) + { + return UtilPlayer.searchExact(uuid); + } + } + + return null; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java new file mode 100644 index 000000000..8f6845044 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java @@ -0,0 +1,229 @@ +package nautilus.game.arcade.game.games.smash.perks.witherskeleton; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.WitherSkull; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +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.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkWitherSkull extends SmashPerk +{ + + private static final int COOLDOWN_NORMAL = 6000; + private static final int COOLDOWN_SMASH = 1000; + private static final int DAMAGE = 12; + private static final float KNOCKBACK_MAGNITUDE = 1.5F; + + private Map _active = new HashMap<>(); + private Set _ignoreControl = new HashSet<>(); + + public PerkWitherSkull() + { + super("Wither Skull", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Wither Skull" }); + } + + @EventHandler(priority = EventPriority.LOW) // Happen BEFORE super is + // triggered + public void activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + boolean smash = isSuperActive(player); + + if (!smash) + { + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), smash ? COOLDOWN_SMASH : COOLDOWN_NORMAL, !smash, !smash)) + { + return; + } + + // Fire + WitherSkull skull = player.launchProjectile(WitherSkull.class); + + if (!smash) + { + skull.setDirection(player.getLocation().getDirection()); + } + + _active.put(skull, player.getLocation().getDirection().multiply(0.6)); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 1f, 1f); + + // Inform + if (!smash) + { + UtilPlayer.message(player, F.main("Skill", "You launched " + F.skill(GetName()) + ".")); + } + + // Control + if (!smash) + { + _ignoreControl.remove(player.getUniqueId()); + } + else + { + _ignoreControl.add(player.getUniqueId()); + } + } + + @EventHandler + public void cleanAndControl(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator skullIterator = _active.keySet().iterator(); + + while (skullIterator.hasNext()) + { + WitherSkull skull = skullIterator.next(); + Player player = (Player) skull.getShooter(); + + if (!skull.isValid()) + { + skullIterator.remove(); + skull.remove(); + continue; + } + + if (_ignoreControl.contains(player.getUniqueId())) + { + continue; + } + + if (player.isBlocking() && !_ignoreControl.contains(player.getUniqueId())) + { + skull.setDirection(player.getLocation().getDirection()); + skull.setVelocity(player.getLocation().getDirection().multiply(0.6)); + _active.put(skull, player.getLocation().getDirection().multiply(0.6)); + } + else + { + _ignoreControl.add(player.getUniqueId()); + skull.setDirection(_active.get(skull)); + skull.setVelocity(_active.get(skull)); + } + } + } + + @EventHandler + public void explode(EntityExplodeEvent event) + { + if (!_active.containsKey(event.getEntity())) + { + return; + } + + event.setCancelled(true); + + WitherSkull skull = (WitherSkull) event.getEntity(); + + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, skull.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + + explode(skull, event.getLocation(), (LivingEntity) skull.getShooter()); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void explodeDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + { + return; + } + + if (event.GetProjectile() != null && event.GetProjectile() instanceof WitherSkull) + { + event.SetCancelled("Wither Skull Cancel"); + } + } + + private void explode(WitherSkull skull, Location loc, LivingEntity shooter) + { + double scale = 0.4 + 0.6 * Math.min(1, skull.getTicksLived() / 20d); + + // Players + Map players = UtilPlayer.getInRadius(skull.getLocation(), 6); + + for (Player player : players.keySet()) + { + if (Manager.isSpectator(player)) + { + continue; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(player, (LivingEntity) skull.getShooter(), null, DamageCause.CUSTOM, DAMAGE * players.get(player) * scale, true, true, false, UtilEnt.getName( + (LivingEntity) skull.getShooter()), GetName()); + } + } + + @EventHandler + public void knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java new file mode 100644 index 000000000..5711820e7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java @@ -0,0 +1,136 @@ +package nautilus.game.arcade.game.games.smash.perks.witherskeleton; + +import java.util.ArrayList; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +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.UtilBlock; +import mineplex.core.disguise.disguises.DisguiseWither; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashWitherSkeleton extends SmashUltimate +{ + + private static final long DURAITON = 18000; + + public SmashWitherSkeleton() + { + super("Wither Form", new String[] {}, Sound.WITHER_SPAWN, DURAITON); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(player)); + + SmashKit2 kit = (SmashKit2) Kit; + kit.disguise(player, DisguiseWither.class); + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(player)); + + SmashKit2 kit = (SmashKit2) Kit; + kit.disguise(player); + + player.setFlying(false); + } + + @EventHandler + public void witherBump(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + { + return; + } + + for (Player player : ((SmashKit) Kit).getSuperActive()) + { + ArrayList collisions = new ArrayList(); + + // Bump + for (Block block : UtilBlock.getInRadius(player.getLocation().add(0, 0.5, 0), 1.5d).keySet()) + { + if (!UtilBlock.airFoliage(block)) + { + collisions.add(block.getLocation().add(0.5, 0.5, 0.5)); + } + } + + Vector vec = UtilAlg.getAverageBump(player.getLocation(), collisions); + + if (vec == null) + continue; + + UtilAction.velocity(player, vec, 0.6, false, 0, 0.4, 10, true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void witherMeleeCancel(CustomDamageEvent event) + { + if (event.IsCancelled()) + { + return; + } + + Player player = event.GetDamagerPlayer(true); + + if (player == null) + { + return; + } + + if (!isUsingUltimate(player)) + { + return; + } + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { + return; + } + + event.SetCancelled("Wither Form Melee Cancel"); + } + + @EventHandler + public void witherFlight(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player player : ((SmashKit) Kit).getSuperActive()) + { + if (player.isFlying()) + { + continue; + } + + player.setAllowFlight(true); + player.setFlying(true); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java new file mode 100644 index 000000000..af0145b89 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java @@ -0,0 +1,561 @@ +package nautilus.game.arcade.game.games.smash.perks.wolf; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Wolf; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseWolf; +import mineplex.core.common.util.UtilItem; +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; +import mineplex.minecraft.game.core.condition.ConditionFactory; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashWolf extends SmashUltimate +{ + + private static final int DURATION = 30000; + private static final int TACKLE_COOLDOWN_NORMAL = 8000; + private static final int TACKLE_COOLDOWN_SMASH = 1600; + private static final int WOLF_HEALTH = 30; + private static final float WOLF_HIT_BOX = 2.5F; + private static final int WOLF_MAX_TICKS = 70; + private static final int TACKLE_DAMAGE = 5; + private static final int STRIKE_DAMAGE = 7; + + private static final String CUB_TACKLE = "Cub Tackle"; + private static final String WOLF_STRIKE = "Wolf Strike"; + + private Map _owner = new HashMap<>(); + private Map _tackle = new HashMap<>(); + + private Map _strike = new HashMap<>(); + + private Map> _repeat = new HashMap<>(); + + private Map _tacklestrike = new HashMap<>(); + + public SmashWolf() + { + super("Frenzy", new String[] { C.cGray + "Attacks give +1 Damage for 3 seconds. Stacks.", C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + CUB_TACKLE, C.cYellow + + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + WOLF_STRIKE, C.cGray + "Wolf Strike deals 300% Knockback to tackled opponents.", }, Sound.WOLF_HOWL, DURATION); + } + + @EventHandler + public void tackleTrigger(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + boolean smash = isUsingUltimate(player); + + if (!Recharge.Instance.use(player, CUB_TACKLE, smash ? TACKLE_COOLDOWN_SMASH : TACKLE_COOLDOWN_NORMAL, !smash, !smash)) + { + return; + } + + // Get Nearest Wolf + Manager.GetGame().CreatureAllowOverride = true; + Wolf wolf = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Wolf.class); + Manager.GetGame().CreatureAllowOverride = false; + + wolf.setBaby(); + + wolf.setAngry(true); + + UtilEnt.Vegetate(wolf); + + wolf.setMaxHealth(WOLF_HEALTH); + wolf.setHealth(wolf.getMaxHealth()); + + UtilAction.velocity(wolf, player.getLocation().getDirection(), 1.8, false, 0, 0.2, 1.2, true); + + player.getWorld().playSound(wolf.getLocation(), Sound.WOLF_BARK, 1f, 1.8f); + + // Record + _owner.put(wolf, player.getUniqueId()); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(CUB_TACKLE) + ".")); + } + + @EventHandler + public void tackleCollide(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + // Collide + Iterator wolfIterator = _owner.keySet().iterator(); + + while (wolfIterator.hasNext()) + { + Wolf wolf = wolfIterator.next(); + + // Hit Player + for (Player other : Manager.GetGame().GetPlayers(true)) + { + if (Manager.isSpectator(other)) + { + continue; + } + + if (UtilEnt.hitBox(wolf.getLocation(), other, WOLF_HIT_BOX, null)) + { + if (other.equals(tackleGetOwner(wolf))) + { + continue; + + } + + tackleCollideAction(tackleGetOwner(wolf), other, wolf); + wolfIterator.remove(); + return; + } + + if (!wolf.isValid() || (UtilEnt.isGrounded(wolf) && wolf.getTicksLived() > WOLF_MAX_TICKS)) + { + wolf.remove(); + wolfIterator.remove(); + } + } + } + } + + public void tackleCollideAction(Player damager, LivingEntity damagee, Wolf wolf) + { + if (damager == null) + { + return; + } + + _tackle.put(wolf, damagee); + + wolf.setVelocity(new Vector(0, -0.6, 0)); + UtilAction.zeroVelocity(damagee); + + // Damage + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, TACKLE_DAMAGE, false, true, false, damager.getName(), CUB_TACKLE); + + // Sound + damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_GROWL, 1.5f, 1.5f); + + // Inform + UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(CUB_TACKLE) + ".")); + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(CUB_TACKLE) + ".")); + } + + @EventHandler + public void tackleUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator wolfIterator = _tackle.keySet().iterator(); + + while (wolfIterator.hasNext()) + { + Wolf wolf = wolfIterator.next(); + LivingEntity ent = _tackle.get(wolf); + + if (!wolf.isValid() || !ent.isValid() || wolf.getTicksLived() > WOLF_MAX_TICKS) + { + wolf.remove(); + wolfIterator.remove(); + continue; + } + + if (UtilMath.offset(wolf, ent) < WOLF_HIT_BOX) + { + Manager.GetCondition().Factory().Slow(CUB_TACKLE, ent, wolf, 0.9, 1, false, false, false, false); + UtilAction.velocity(ent, new Vector(0, -0.3, 0)); + } + + // Move + Location loc = ent.getLocation(); + loc.add(UtilAlg.getTrajectory2d(ent, wolf).multiply(1)); + + UtilEnt.CreatureMove(wolf, loc, 1); + } + } + + public Player tackleGetOwner(Wolf wolf) + { + if (_owner.containsKey(wolf)) + { + return UtilPlayer.searchExact(_owner.get(wolf)); + } + + return null; + } + + @EventHandler + public void tackleTargetCancel(EntityTargetEvent event) + { + if (_owner.containsKey(event.getEntity())) + { + if (_owner.get(event.getEntity()).equals(event.getTarget())) + { + event.setCancelled(true); + } + } + } + + @EventHandler + public void tackleDamage(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { + return; + } + + LivingEntity damager = event.GetDamagerEntity(false); + + if (damager == null) + { + return; + } + + if (damager instanceof Wolf) + { + event.SetCancelled("Wolf Cub"); + } + } + + @EventHandler + public void strikeTrigger(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSpade(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + boolean smash = isUsingUltimate(player); + + if (!Recharge.Instance.use(player, WOLF_STRIKE, smash ? 1600 : 8000, !smash, !smash)) + { + return; + } + + // Velocity + UtilAction.velocity(player, player.getLocation().getDirection(), 1.6, false, 1, 0.2, 1.2, true); + + // Record + _strike.put(player.getUniqueId(), System.currentTimeMillis()); + + player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 1f, 1.2f); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(WOLF_STRIKE) + ".")); + } + + @EventHandler + public void strikeEnd(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + // Collide + Iterator playerIterator = _strike.keySet().iterator(); + + while (playerIterator.hasNext()) + { + UUID uuid = playerIterator.next(); + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + playerIterator.remove(); + continue; + } + + for (Player other : Manager.GetGame().GetPlayers(true)) + { + if (player.equals(other)) + { + continue; + } + + if (Manager.isSpectator(other)) + { + continue; + } + + if (UtilEnt.hitBox(player.getLocation().add(0, 1, 0), other, WOLF_HIT_BOX, null)) + { + strikeHit(player, other); + playerIterator.remove(); + return; + } + } + + if (!UtilEnt.isGrounded(player)) + { + continue; + } + + if (!UtilTime.elapsed(_strike.get(uuid), 1500)) + { + continue; + } + + playerIterator.remove(); + } + } + + public void strikeHit(Player damager, LivingEntity damagee) + { + UtilAction.zeroVelocity(damager); + + // Remove tackle + Iterator wolfIterator = _tackle.keySet().iterator(); + + while (wolfIterator.hasNext()) + { + Wolf wolf = wolfIterator.next(); + + if (_tackle.get(wolf).equals(damagee)) + { + wolf.remove(); + wolfIterator.remove(); + + _tacklestrike.put(damagee, System.currentTimeMillis()); + } + } + + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, STRIKE_DAMAGE, true, true, false, damager.getName(), WOLF_STRIKE); + + // Sound + damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_BARK, 1.5f, 1f); + + // Inform + UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(WOLF_STRIKE) + ".")); + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(WOLF_STRIKE) + ".")); + } + + @EventHandler + public void strikeKnockback(CustomDamageEvent event) + { + if (event.GetReason() != null && event.GetReason().contains(WOLF_STRIKE)) + { + if (_tacklestrike.containsKey(event.GetDamageeEntity()) && !UtilTime.elapsed(_tacklestrike.get(event.GetDamageeEntity()), 100)) + { + event.AddKnockback(GetName(), 3.0); + + // Blood + event.GetDamageeEntity().getWorld().playEffect(event.GetDamageeEntity().getLocation(), Effect.STEP_SOUND, 55); + + // Double Sound + event.GetDamageeEntity().getWorld().playSound(event.GetDamageeEntity().getLocation(), Sound.WOLF_BARK, 2f, 1.5f); + } + else + { + event.AddKnockback(GetName(), 1.5); + } + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void RepeatDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + { + return; + } + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { + return; + } + + Player damager = event.GetDamagerPlayer(false); + + if (damager == null) + { + return; + } + + if (!hasPerk(damager)) + { + return; + } + + if (!_repeat.containsKey(damager.getUniqueId())) + { + _repeat.put(damager.getUniqueId(), new ArrayList()); + _repeat.get(damager.getUniqueId()).add(System.currentTimeMillis()); + + // Exp + damager.setExp(Math.min(0.99F, _repeat.get(damager.getUniqueId()).size() / 9f)); + + return; + } + + int count = _repeat.get(damager.getUniqueId()).size(); + + if (count > 0) + { + event.AddMod(damager.getName(), "Ravage", Math.min(2, count), false); + + // Sound + damager.getWorld().playSound(damager.getLocation(), Sound.WOLF_BARK, (float) (0.5 + count * 0.25), (float) (1 + count * 0.25)); + } + + _repeat.get(damager.getUniqueId()).add(System.currentTimeMillis()); + + // Exp + damager.setExp(Math.min(0.9999f, _repeat.get(damager.getUniqueId()).size() / 9f)); + } + + @EventHandler + public void RepeatExpire(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator playerIterator = _repeat.keySet().iterator(); + + while (playerIterator.hasNext()) + { + UUID uuid = playerIterator.next(); + Player player = UtilPlayer.searchExact(uuid); + + Iterator timeIterator = _repeat.get(uuid).iterator(); + + while (timeIterator.hasNext()) + { + long time = timeIterator.next(); + + if (UtilTime.elapsed(time, 3000)) + { + timeIterator.remove(); + } + } + + // Exp + player.setExp(Math.min(0.9999f, _repeat.get(player).size() / 9f)); + } + } + + @Override + public void activate(Player player) + { + super.activate(player); + + ConditionFactory factory = Manager.GetCondition().Factory(); + + factory.Strength(GetName(), player, player, 30, 1, false, false, false); + factory.Speed(GetName(), player, player, 30, 2, false, false, false); + factory.Regen(GetName(), player, player, 30, 2, false, false, false); + + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + + if (disguise instanceof DisguiseWolf) + { + ((DisguiseWolf) disguise).setAngry(true); + Manager.GetDisguise().updateDisguise(disguise); + } + + Recharge.Instance.recharge(player, WOLF_STRIKE); + Recharge.Instance.recharge(player, CUB_TACKLE); + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + + if (disguise instanceof DisguiseWolf) + { + ((DisguiseWolf) disguise).setAngry(false); + Manager.GetDisguise().updateDisguise(disguise); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java new file mode 100644 index 000000000..a659a2ee2 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java @@ -0,0 +1,193 @@ +package nautilus.game.arcade.game.games.smash.perks.zombie; + +import java.time.temporal.WeekFields; +import java.util.HashMap; +import java.util.Iterator; + +import org.bukkit.GameMode; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +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; +import nautilus.game.arcade.kit.Perk; + +public class PerkDeathsGrasp extends Perk +{ + private HashMap _live = new HashMap(); + private HashMap _weakness = new HashMap(); + + public PerkDeathsGrasp() + { + super("Deaths Grasp", new String[] + { + C.cYellow + "Left-Click" + C.cGray + " with Bow to use " + C.cGreen + "Deaths Grasp", + C.cGray + "+100% Arrow Damage to enemies thrown by Deaths Grasp" + }); + } + + @EventHandler + public void leap(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (!UtilGear.isBow(event.getPlayer().getItemInHand())) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) + return; + + UtilAction.velocity(player, player.getLocation().getDirection(), 1.4, false, 0, 0.2, 1.2, true); + + //Record + _live.put(player, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_HURT, 1f, 1.4f); + } + + @EventHandler + public void end(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + //Collide + for (Player player : Manager.GetGame().GetPlayers(true)) + if (_live.containsKey(player)) + for (Player other : Manager.GetGame().GetPlayers(true)) + if (!Manager.isSpectator(other)) + if (!other.equals(player)) + if (UtilMath.offset(player, other) < 2) + { + collide(player, other); + _live.remove(player); + return; + } + + //Leap End + Iterator leapIter = _live.keySet().iterator(); + + while (leapIter.hasNext()) + { + LivingEntity ent = leapIter.next(); + + if (!UtilEnt.isGrounded(ent)) + continue; + + if (!UtilTime.elapsed(_live.get(ent), 1000)) + continue; + + leapIter.remove(); + } + + //Weakness End + Iterator weaknessIter = _weakness.keySet().iterator(); + + while (weaknessIter.hasNext()) + { + LivingEntity ent = weaknessIter.next(); + + if (!UtilEnt.isGrounded(ent)) + continue; + + if (!UtilTime.elapsed(_weakness.get(ent), 1000)) + continue; + + weaknessIter.remove(); + } + } + + public void collide(Player damager, LivingEntity damagee) + { + //Damage Event + Manager.GetDamage().NewDamageEvent(damagee, damager, null, + DamageCause.CUSTOM, 6, false, true, false, + damager.getName(), GetName()); + + UtilAction.velocity(damagee, UtilAlg.getTrajectory2d(damagee, damager), 1.6, false, 0, 1.2, 1.8, true); + + UtilAction.zeroVelocity(damager); + + damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_HURT, 1f, 0.7f); + + _weakness.put(damagee, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); + + Recharge.Instance.recharge(damager, GetName()); + Recharge.Instance.use(damager, GetName(), 2000, true, true); + } + + @EventHandler(priority = EventPriority.HIGH) + public void arrowDamage(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + if (!(event.GetProjectile() instanceof Arrow)) + return; + + if (!_weakness.containsKey(event.GetDamageeEntity())) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + if (!Kit.HasKit(damager)) + return; + + if (!Manager.IsAlive(damager)) + return; + + event.AddMult(GetName(), GetName() + " Combo", 2, true); + + UtilParticle.PlayParticle(ParticleType.RED_DUST, event.GetDamageeEntity().getLocation(), 0.5f, 0.5f, 0.5f, 0, 20, + ViewDist.MAX, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.GetDamageeEntity().getLocation(), 0, 0, 0, 0, 1, + ViewDist.MAX, UtilServer.getPlayers()); + + damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_HURT, 1f, 2f); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkNightLivingDead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkNightLivingDead.java new file mode 100644 index 000000000..46c7fa2bd --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkNightLivingDead.java @@ -0,0 +1,150 @@ +package nautilus.game.arcade.game.games.smash.perks.zombie; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.entity.Zombie; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import nautilus.game.arcade.kit.perks.data.NightLivingDeadData; + +public class PerkNightLivingDead extends SmashPerk +{ + private ArrayList _night = new ArrayList(); + + private HashSet _ignoreList = new HashSet();; + + public PerkNightLivingDead() + { + super("Night of the Living Dead", new String[] + { + }, false); + } + + @Override + public void addSuperCustom(Player player) + { + _night.add(new NightLivingDeadData(player)); + } + + @EventHandler + public void timeUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (_night.isEmpty() && Manager.GetGame().WorldTimeSet != 12000) + { + Manager.GetGame().WorldTimeSet = (Manager.GetGame().WorldTimeSet + 50)%24000; + } + else if (!_night.isEmpty() && Manager.GetGame().WorldTimeSet != 18000) + { + Manager.GetGame().WorldTimeSet = (Manager.GetGame().WorldTimeSet + 50)%24000; + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator nightIter = _night.iterator(); + + while (nightIter.hasNext()) + { + NightLivingDeadData data = nightIter.next(); + + //Expire + if (UtilTime.elapsed(data.Time, 30000)) + { + nightIter.remove(); + + for (Zombie zombie : data.Zombies) + zombie.damage(1000); + continue; + } + + //Spawn + if (UtilTime.elapsed(data.LastSpawn, 1000)) + { + Location origin = UtilAlg.Random(Manager.GetGame().GetPlayers(true)).getLocation(); + Location loc = findSpawn(origin); + + if (Math.abs(loc.getY() - origin.getY()) > 6) + continue; + + if (!UtilBlock.airFoliage(loc.getBlock()) || !UtilBlock.airFoliage(loc.getBlock().getRelative(BlockFace.UP))) + continue; + + //Set Spawned + data.LastSpawn = System.currentTimeMillis(); + + //Move Down + loc.subtract(0, 1, 0); + + //Spawn + Manager.GetGame().CreatureAllowOverride = true; + Zombie zombie = loc.getWorld().spawn(loc, Zombie.class); + Manager.GetGame().CreatureAllowOverride = false; + + data.Zombies.add(zombie); + + //Pop up + zombie.setVelocity(new Vector(0,0.4,0)); + //zombie.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 9999, 1, true)); + + //Effect + zombie.getWorld().playSound(zombie.getLocation(), Sound.ZOMBIE_IDLE, 1f, 0.75f); + + loc.getWorld().playEffect(loc, Effect.STEP_SOUND, loc.getBlock().getType()); + } + } + } + + @EventHandler + public void update(EntityTargetEvent event) + { + for (NightLivingDeadData data : _night) + { + if (data.Zombies.contains(event.getEntity())) + { + if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) event.getTarget(); + + if (smash.GetTeam(data.Player).equals(smash.GetTeam(targetPlayer))) + { + event.setCancelled(true); + } + } + if (data.Player.equals(event.getTarget())) + { + event.setCancelled(true); + } + } + } + } + + public Location findSpawn(Location area) + { + return UtilBlock.getHighest(area.getWorld(), (int)(area.getX() + Math.random() * 24 - 12), (int)(area.getZ() + Math.random() * 24 - 12), _ignoreList).getLocation().add(0.5, 0.5, 0.5); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java new file mode 100644 index 000000000..fa61a59ff --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java @@ -0,0 +1,252 @@ +package nautilus.game.arcade.game.games.smash.perks.zombie; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkOvercharge extends SmashPerk +{ + private Map _charge = new HashMap<>(); + private Map _chargeLast = new HashMap<>(); + + private Map _arrows = new HashMap<>(); + + private int _max; + private long _tick; + private boolean _useExp; + + public PerkOvercharge(int max, long tick, boolean useExpBar) + { + super("Corrupted Arrow", new String[] { C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Corrupted Arrow" }); + + _useExp = useExpBar; + _max = max; + _tick = tick; + } + + @EventHandler + public void drawBow(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW) + { + return; + } + + if (!player.getInventory().contains(Material.ARROW)) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + // Start Charge + _charge.put(player.getUniqueId(), 0); + _chargeLast.put(player.getUniqueId(), System.currentTimeMillis()); + } + + @EventHandler + public void charge(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player cur : UtilServer.getPlayers()) + { + UUID uuid = cur.getUniqueId(); + + // Not Charging + if (!_charge.containsKey(uuid)) + { + continue; + } + + // Max Charge + if (_charge.get(uuid) >= _max) + { + continue; + } + + // Charge Interval + if (_charge.get(uuid) == 0) + { + if (!UtilTime.elapsed(_chargeLast.get(uuid), 1000)) + { + continue; + } + } + else + { + if (!UtilTime.elapsed(_chargeLast.get(uuid), _tick)) + { + continue; + } + } + + // No Longer Holding Bow + if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW) + { + if (_useExp) + { + cur.setExp(0f); + } + + _charge.remove(uuid); + _chargeLast.remove(uuid); + continue; + } + + // Increase Charge + _charge.put(uuid, _charge.get(cur) + 1); + + if (_useExp) + { + cur.setExp(Math.min(0.99f, _charge.get(cur) / _max)); + } + + _chargeLast.put(uuid, System.currentTimeMillis()); + + // Effect + cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur))); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void fireBow(EntityShootBowEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!Manager.GetGame().IsLive()) + { + return; + } + + if (!(event.getEntity() instanceof Player)) + { + return; + } + + if (!(event.getProjectile() instanceof Arrow)) + { + return; + } + + Player player = (Player) event.getEntity(); + + if (!_charge.containsKey(player.getUniqueId())) + { + return; + } + + int charge = _charge.remove(player.getUniqueId()); + + if (charge <= 0) + { + return; + } + + // Start Barrage + _arrows.put((Arrow) event.getProjectile(), charge); + + player.setExp(0f); + } + + @EventHandler(priority = EventPriority.HIGH) + public void damageBonus(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + { + return; + } + + if (!_arrows.containsKey(event.GetProjectile())) + { + return; + } + + int charge = _arrows.remove(event.GetProjectile()); + + event.AddMod(GetName(), GetName(), charge * 0.9, true); + } + + @EventHandler + public void clean(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Iterator arrowIterator = _arrows.keySet().iterator(); arrowIterator.hasNext();) + { + Arrow arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround() || arrow.getTicksLived() > 120) + { + arrowIterator.remove(); + } + else + { + UtilParticle.PlayParticle(ParticleType.RED_DUST, arrow.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + } + } + } + + @EventHandler + public void quit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + _charge.remove(player.getUniqueId()); + _chargeLast.remove(player.getUniqueId()); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java new file mode 100644 index 000000000..982230c41 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java @@ -0,0 +1,189 @@ +package nautilus.game.arcade.game.games.smash.perks.zombie; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkZombieBile extends SmashPerk implements IThrown +{ + + private static final int COOLDOWN = 10000; + + private Map _active = new HashMap<>(); + + public PerkZombieBile() + { + super("Spew Bile", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Spew Bile" }); + } + + @EventHandler + public void activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + _active.put(player.getUniqueId(), System.currentTimeMillis()); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void deactivateDeath(PlayerDeathEvent event) + { + if (!hasPerk(event.getEntity())) + { + return; + } + + _active.remove(event.getEntity().getUniqueId()); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator activeIter = _active.keySet().iterator(); + + while (activeIter.hasNext()) + { + UUID uuid = activeIter.next(); + Player player = UtilPlayer.searchExact(uuid); + + // Expire + if (UtilTime.elapsed(_active.get(player.getUniqueId()), 2000)) + { + activeIter.remove(); + continue; + } + + // Sound + if (Math.random() > 0.85) + { + player.getWorld().playSound(player.getLocation(), Sound.BURP, 1f, (float) (Math.random() + 0.5)); + } + + // Projectiles + for (int i = 0; i < 3; i++) + { + Vector rand = new Vector((Math.random() - 0.5) * 0.525, (Math.random() - 0.5) * 0.525, (Math.random() - 0.5) * 0.525); + + Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()).subtract(0, 0.5, 0), new ItemStack(Material.ROTTEN_FLESH)); + UtilAction.velocity(ent, player.getLocation().getDirection().add(rand), 0.8, false, 0, 0.2, 10, false); + Manager.GetProjectile().AddThrow(ent, player, this, System.currentTimeMillis() + 2000, true, true, true, false, 0.5f); + } + } + } + + @EventHandler + public void death(PlayerDeathEvent event) + { + if (_active.containsKey(event.getEntity())) + { + _active.remove(event.getEntity()); + } + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + data.getThrown().remove(); + + if (target == null) + return; + + if (target instanceof Player) + if (!Manager.GetGame().IsAlive((Player) target)) + return; + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 3, true, false, false, UtilEnt.getName(data.getThrower()), GetName()); + + data.getThrown().remove(); + } + + @Override + public void Idle(ProjectileUser data) + { + data.getThrown().remove(); + } + + @Override + public void Expire(ProjectileUser data) + { + data.getThrown().remove(); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + return; + + event.AddKnockback(GetName(), 1); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java index f71dc6aca..6e94c5983 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java @@ -12,7 +12,6 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -22,6 +21,9 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; @@ -35,11 +37,15 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkSlimeRocket extends SmashPerk implements IThrown { + + private static final long COOLDOWN = 6000; + private static final float ENERGY_PER_TICK = 0.004F; + private static final int KNOCKBACK_MAGNITUDE = 3; + private Map _charge = new HashMap<>(); private Map _owner = new HashMap<>(); private Map _lastAttack = new HashMap<>(); @@ -60,11 +66,15 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown for (Player player : Manager.GetGame().GetPlayers(true)) { if (!hasPerk(player)) + { continue; - + } + if (isSuperActive(player)) + { continue; - + } + int size = 1; if (player.getExp() > 0.8) { @@ -84,9 +94,11 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown } if (player.isBlocking()) + { continue; + } - player.setExp((float) Math.min(0.999, player.getExp() + 0.004)); + player.setExp((float) Math.min(0.999, player.getExp() + ENERGY_PER_TICK)); } } @@ -94,46 +106,69 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown public void Activate(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD")) - return; + } Player player = event.getPlayer(); + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + if (isSuperActive(player)) + { return; + } - if (!Kit.HasKit(player)) + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { return; - - if (!Recharge.Instance.use(player, GetName(), 6000, true, true)) - return; - + } + UtilPlayer.message(player, F.main("Skill", "You are charging " + F.skill(GetName()) + ".")); - _charge.put(player, System.currentTimeMillis()); + _charge.put(player.getUniqueId(), System.currentTimeMillis()); } @EventHandler public void ChargeRelease(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - - Iterator chargeIterator = _charge.keySet().iterator(); + } + + Iterator chargeIterator = _charge.keySet().iterator(); while (chargeIterator.hasNext()) { - Player player = chargeIterator.next(); + UUID key = chargeIterator.next(); + Player player = UtilPlayer.searchExact(key); - long time = _charge.get(player); + if (player == null) + { + chargeIterator.remove(); + continue; + } + + long time = _charge.get(key); // Charge if (player.isBlocking()) @@ -178,7 +213,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown public void FireRocket(Player player) { - double charge = Math.min(3, (double) (System.currentTimeMillis() - _charge.get(player)) / 1000d); + double charge = Math.min(3, (double) (System.currentTimeMillis() - _charge.get(player.getUniqueId())) / 1000d); // Spawn Slime Manager.GetGame().CreatureAllowOverride = true; @@ -192,7 +227,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown slime.setMaxHealth(5 + charge * 7); slime.setHealth(slime.getMaxHealth()); - _owner.put(slime, player); + _owner.put(slime, player.getUniqueId()); // Inform UtilPlayer.message(player, F.main("Skill", "You released " + F.skill(GetName()) + ".")); @@ -209,19 +244,21 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown public void SlimeTarget(EntityTargetEvent event) { if (event.isCancelled()) - return; - - if (!_owner.containsKey(event.getEntity())) - return; - - if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) { - TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); - Player targetPlayer = (Player) event.getTarget(); - - if (smash.GetTeam(_owner.get(event.getEntity())).equals(smash.GetTeam(targetPlayer))) + return; + } + + if (!_owner.containsKey(event.getEntity())) + { + return; + } + + if (event.getTarget() instanceof Player) + { + if (isTeamDamage((Player) event.getTarget(), UtilPlayer.searchExact(_owner.get(event.getEntity().getUniqueId())))) { event.setCancelled(true); + return; } } @@ -235,20 +272,23 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown public void Collide(LivingEntity target, Block block, ProjectileUser data) { if (target == null) + { return; + } if (!(data.getThrown() instanceof Slime)) + { return; + } Slime slime = (Slime) data.getThrown(); - if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player) + if (target instanceof Player && data.getThrower() instanceof Player) { - TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); Player targetPlayer = (Player) target; Player throwerPlayer = (Player) data.getThrower(); - if (smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer))) + if (isTeamDamage(targetPlayer, throwerPlayer)) { return; } @@ -262,9 +302,11 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; + } - event.AddKnockback(GetName(), 3.0); + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } @Override @@ -297,19 +339,18 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown _lastAttack.put(slime, System.currentTimeMillis()); // Get Owner - Player owner = _owner.get(slime); - // if (owner != null) - // event.SetDamager(owner); This gives knockback from wrong direction :( + UUID key = _owner.get(slime); + Player owner = UtilPlayer.searchExact(key); - if (Manager.GetGame() instanceof TeamSuperSmash) + if (owner == null) { - TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + return; + } - if (smash.GetTeam(owner).equals(smash.GetTeam(event.GetDamageePlayer()))) - { - event.SetCancelled("Team Damage"); - return; - } + if (isTeamDamage(owner, event.GetDamageePlayer())) + { + event.SetCancelled("Team Damage"); + return; } if (owner != null && owner.equals(event.GetDamageeEntity())) @@ -328,7 +369,9 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown public void SlimeClean(UpdateEvent event) { if (event.getType() != UpdateType.SEC) + { return; + } Iterator slimeIterator = _owner.keySet().iterator(); @@ -346,14 +389,20 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown Manager.GetBlood().Effects(null, slime.getLocation(), 6 + 6 * slime.getSize(), 0.2 + 0.1 * slime.getSize(), null, 1f, 1f, Material.SLIME_BALL, (byte) 0, 15, false); if (slime.getSize() <= 1) + { slime.remove(); + } else + { slime.setSize(slime.getSize() - 1); + } } } if (!slime.isValid()) + { slimeIterator.remove(); + } } slimeIterator = _lastAttack.keySet().iterator(); @@ -363,7 +412,9 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown Slime slime = slimeIterator.next(); if (!slime.isValid()) + { slimeIterator.remove(); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java index 37d07564d..4df288188 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java @@ -1,6 +1,8 @@ package nautilus.game.arcade.kit.perks; import java.util.HashSet; +import java.util.Set; +import java.util.UUID; import org.bukkit.GameMode; import org.bukkit.Sound; @@ -15,6 +17,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; @@ -23,67 +26,77 @@ import nautilus.game.arcade.kit.Perk; public class PerkSpiderLeap extends Perk { - private HashSet _secondJump = new HashSet(); - public PerkSpiderLeap() + private static final float ENERGY_PER_TICK = 1 / 80; + private static final float ENERGY_PER_LEAP = 1 / 6; + + private Set _secondJump = new HashSet<>(); + + public PerkSpiderLeap() { - super("Spider Leap", new String[] - { - C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Spider Leap", - C.cYellow + "Hold Crouch" + C.cGray + " to " + C.cGreen + "Wall Climb", - C.cWhite + "Wall Climb requires Energy (Experience Bar)." - - }); + super("Spider Leap", new String[] { C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Spider Leap", C.cYellow + "Hold Crouch" + C.cGray + " to " + C.cGreen + "Wall Climb", C.cWhite + + "Wall Climb requires Energy (Experience Bar)." + }); } - + @EventHandler public void WallClimb(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - + } + for (Player player : UtilServer.getPlayers()) { - if (Manager.isSpectator(player)) + if (UtilPlayer.isSpectator(player)) + { continue; - - if (!Kit.HasKit(player)) + } + + if (!hasPerk(player)) + { continue; + } if (!player.isSneaking()) { if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) { - player.setExp((float) Math.min(0.999, player.getExp()+(1f/80f))); - _secondJump.remove(player); + player.setExp((float) Math.min(0.999, player.getExp() + ENERGY_PER_TICK)); + _secondJump.remove(player.getUniqueId()); } continue; } - - player.setExp((float) Math.max(0, player.getExp()-(1f/80f))); - + + player.setExp((float) Math.max(0, player.getExp() - ENERGY_PER_TICK)); + if (player.getExp() <= 0) + { continue; + } if (!Recharge.Instance.usable(player, GetName())) + { continue; + } for (Block block : UtilBlock.getSurrounding(player.getLocation().getBlock(), true)) { if (!UtilBlock.airFoliage(block) && !block.isLiquid()) { UtilAction.velocity(player, new Vector(0, 0.2, 0)); - - if (!_secondJump.contains(player)) + + if (!_secondJump.contains(player.getUniqueId())) { player.setAllowFlight(true); - _secondJump.add(player); + _secondJump.add(player.getUniqueId()); } - + continue; } - } + } } } @@ -91,37 +104,45 @@ public class PerkSpiderLeap extends Perk public void FlightHop(PlayerToggleFlightEvent event) { Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) + + if (!hasPerk(player)) + { return; + } - if (Manager.isSpectator(player)) + if (UtilPlayer.isSpectator(player)) + { return; + } if (player.getGameMode() == GameMode.CREATIVE) + { return; + } event.setCancelled(true); player.setFlying(false); - - //Disable Flight + + // Disable Flight player.setAllowFlight(false); - - if (player.getExp() < (1f/6f)) + + if (player.getExp() < ENERGY_PER_LEAP) + { return; + } - //Velocity + // Velocity UtilAction.velocity(player, 1.0, 0.2, 1.0, true); - - //Energy - player.setExp((float) Math.max(0, player.getExp()-(1f/6f))); - - //Sound + + // Energy + player.setExp((float) Math.max(0, player.getExp() - ENERGY_PER_LEAP)); + + // Sound player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 1f, 1.5f); - + Recharge.Instance.use(player, GetName(), 500, false, false); } - + @EventHandler public void FlightUpdate(UpdateEvent event) { @@ -130,14 +151,20 @@ public class PerkSpiderLeap extends Perk for (Player player : UtilServer.getPlayers()) { - if (Manager.isSpectator(player)) + if (UtilPlayer.isSpectator(player)) + { continue; + } - if (!Kit.HasKit(player)) + if (!hasPerk(player)) + { continue; + } if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + { player.setAllowFlight(true); + } } } }