diff --git a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java index 0d4e63c6a..500a636f2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java @@ -41,18 +41,18 @@ public class BlockRestore extends MiniPlugin if (Contains(event.getBlockPlaced())) event.setCancelled(true); } - + @EventHandler(priority=EventPriority.LOW) public void Piston(BlockPistonExtendEvent event) { if (event.isCancelled()) return; - + Block push = event.getBlock(); for (int i=0 ; i<13 ; i++) { push = push.getRelative(event.getDirection()); - + if (push.getType() == Material.AIR) return; @@ -102,17 +102,17 @@ public class BlockRestore extends MiniPlugin if (((block.getTypeId() == 78 && block.getData() >= (byte)7) || block.getTypeId() == 80) && GetData(block) != null) { GetData(block).update(78, heightAdd, expireTime, meltDelay); - + if (heightJumps > 0) Snow(block.getRelative(BlockFace.UP), heightAdd, heightMax, expireTime, meltDelay, heightJumps-1); if (heightJumps == -1) Snow(block.getRelative(BlockFace.UP), heightAdd, heightMax, expireTime, meltDelay, -1); - + return; } //Not Grounded if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN)) && block.getRelative(BlockFace.DOWN).getTypeId() != 78) return; - + //Not on Solid Snow if (block.getRelative(BlockFace.DOWN).getTypeId() == 78 && block.getRelative(BlockFace.DOWN).getData() < (byte)7) return; @@ -121,6 +121,10 @@ public class BlockRestore extends MiniPlugin if (block.getRelative(BlockFace.DOWN).getTypeId() == 79) return; + //No Snow on Fence + if (block.getRelative(BlockFace.DOWN).getTypeId() == 85) + return; + //Not Buildable if (!UtilBlock.airFoliage(block) && block.getTypeId() != 78) return; @@ -129,10 +133,12 @@ public class BlockRestore extends MiniPlugin if (block.getTypeId() == 78) if (block.getData() >= (byte)heightMax) heightAdd = 0; - + //Snow - if (!Contains(block)) GetBlocks().put(block, new BlockRestoreData(block, 78, (byte)Math.max(0, heightAdd-1), expireTime, meltDelay)); - else GetData(block).update(78, heightAdd, expireTime, meltDelay); + if (!Contains(block)) + GetBlocks().put(block, new BlockRestoreData(block, 78, (byte)Math.max(0, heightAdd-1), expireTime, meltDelay)); + else + GetData(block).update(78, heightAdd, expireTime, meltDelay); } public boolean Contains(Block block) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/SuperSmash.java index 9931a1a1e..109821d29 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/SuperSmash.java @@ -8,11 +8,15 @@ import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityRegainHealthEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -35,6 +39,12 @@ public class SuperSmash extends SoloGame { new KitSkeleton(manager), new KitEnderman(manager), + new KitBlaze(manager), + new KitChicken(manager), + new KitGolem(manager), + new KitSnowman(manager), + new KitSpider(manager), + new KitSlime(manager), }, new String[] @@ -60,7 +70,7 @@ public class SuperSmash extends SoloGame return; for (Player player : GetPlayers(true)) - _lives.put(player, 3); + _lives.put(player, 5); } @EventHandler @@ -124,9 +134,10 @@ public class SuperSmash extends SoloGame int lives = GetLives(player); String out; - if (lives == 3) out = lives + " " + C.cGreen + player.getName(); - else if (lives == 2) out = lives + " " + C.cYellow + player.getName(); - else if (lives == 1) out = lives + " " + C.cGold + player.getName(); + if (lives >= 4) out = lives + " " + C.cGreen + player.getName(); + else if (lives == 3) out = lives + " " + C.cYellow + player.getName(); + else if (lives == 2) out = lives + " " + C.cGold + player.getName(); + else if (lives == 1) out = lives + " " + C.cRed + player.getName(); else if (lives == 0) out = lives + " " + C.cRed + player.getName(); else continue; @@ -139,4 +150,33 @@ public class SuperSmash extends SoloGame GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(lives); } } + + @EventHandler(priority = EventPriority.HIGH) + public void Knockback(CustomDamageEvent event) + { + if (event.GetDamageePlayer() != null) + event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth())); + + if (event.GetCause() == DamageCause.VOID) + event.AddMod("Smash Void", "Void Kill", 5000, false); + } + + @EventHandler + public void Regeneration(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + for (Player player : GetPlayers(true)) + { + UtilPlayer.health(player, 2); + } + } + + @EventHandler + public void HealthChange(EntityRegainHealthEvent event) + { + if (event.getRegainReason() == RegainReason.SATIATED) + event.setCancelled(true); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitBlaze.java new file mode 100644 index 000000000..7c7af2d61 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitBlaze.java @@ -0,0 +1,62 @@ +package nautilus.game.arcade.game.standalone.smash.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.disguise.disguises.DisguiseBlaze; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.SmashKit; +import nautilus.game.arcade.kit.perks.PerkDamageSet; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkFirefly; +import nautilus.game.arcade.kit.perks.PerkFlamingSword; +import nautilus.game.arcade.kit.perks.PerkKnockbackMultiplier; +import nautilus.game.arcade.kit.perks.PerkSpeed; + +public class KitBlaze extends SmashKit +{ + public KitBlaze(ArcadeManager manager) + { + super(manager, "Blaze", KitAvailability.Free, + + new String[] + { + }, + + new Perk[] + { + new PerkDoubleJump("Double Jump", 1, 1, false), + new PerkDamageSet(6), + new PerkKnockbackMultiplier(1.50), + new PerkSpeed(1), + new PerkFlamingSword(), + new PerkFirefly(12000) + }, + EntityType.BLAZE, + null); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Inferno")); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Firefly")); + + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + + //Disguise + DisguiseBlaze disguise = new DisguiseBlaze(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitChicken.java new file mode 100644 index 000000000..3bae130b2 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitChicken.java @@ -0,0 +1,61 @@ +package nautilus.game.arcade.game.standalone.smash.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.disguise.disguises.DisguiseChicken; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.SmashKit; +import nautilus.game.arcade.kit.perks.PerkChickenRocket; +import nautilus.game.arcade.kit.perks.PerkDamageSet; +import nautilus.game.arcade.kit.perks.PerkEggGun; +import nautilus.game.arcade.kit.perks.PerkFlap; +import nautilus.game.arcade.kit.perks.PerkKnockbackMultiplier; + +public class KitChicken extends SmashKit +{ + public KitChicken(ArcadeManager manager) + { + super(manager, "Chicken", KitAvailability.Free, + + new String[] + { + }, + + new Perk[] + { + new PerkFlap(0.8, 0.8, false), + new PerkDamageSet(4), + new PerkKnockbackMultiplier(1.75), + new PerkEggGun(), + new PerkChickenRocket() + + }, + EntityType.CHICKEN, + null); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Egg Blaster")); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Chicken Missile")); + + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS)); + + //Disguise + DisguiseChicken disguise = new DisguiseChicken(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitEnderman.java index 6e211e390..7c690ca0d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitEnderman.java @@ -1,36 +1,47 @@ package nautilus.game.arcade.game.standalone.smash.kits; +import java.util.HashMap; + 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.entity.PlayerDeathEvent; import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseEnderman; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.PerkBlink; +import nautilus.game.arcade.kit.perks.PerkBlockToss; +import nautilus.game.arcade.kit.perks.PerkDamageSet; import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkKnockbackMultiplier; +import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; +import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; -public class KitEnderman extends Kit +public class KitEnderman extends SmashKit { + public HashMap _disguises = new HashMap(); + public KitEnderman(ArcadeManager manager) { super(manager, "Enderman", KitAvailability.Free, new String[] { - "" }, new Perk[] { new PerkDoubleJump("Double Jump", 0.8, 0.8, false), - new PerkBlink("Blink", 12, 4000) + new PerkDamageSet(7), + new PerkKnockbackMultiplier(1.25), + new PerkBlink("Blink", 12, 6000), + new PerkBlockToss() }, EntityType.ENDERMAN, null); @@ -40,15 +51,48 @@ public class KitEnderman extends Kit @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Block Toss")); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Blink")); - UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); - UtilPlayer.message(player, F.elem("Right-Click with Axe") + " to use " + F.elem("Blink")); - UtilPlayer.message(player, C.Line); + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); - player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_IDLE, 4f, 1f); + //Disguise + DisguiseEnderman disguise = new DisguiseEnderman(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + _disguises.put(player, disguise); + } + + @EventHandler + public void BlockGrab(PerkBlockGrabEvent event) + { + SetBlock(_disguises.get(event.GetPlayer()), event.GetId(), event.GetData()); + } + + @EventHandler + public void BlockThrow(PerkBlockThrowEvent event) + { + SetBlock(_disguises.get(event.GetPlayer()), 0, (byte)0); + } + + @EventHandler + public void Death(PlayerDeathEvent event) + { + SetBlock(_disguises.get(event.getEntity()), 0, (byte)0); + } + + public void SetBlock(DisguiseEnderman disguise, int id, byte data) + { + if (disguise == null) + return; + disguise.SetCarriedId(id); + disguise.SetCarriedData(data); + //disguise.Update(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitGolem.java new file mode 100644 index 000000000..5c0f5e8f2 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitGolem.java @@ -0,0 +1,58 @@ +package nautilus.game.arcade.game.standalone.smash.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.disguise.disguises.DisguiseIronGolem; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.SmashKit; +import nautilus.game.arcade.kit.perks.*; + +public class KitGolem extends SmashKit +{ + public KitGolem(ArcadeManager manager) + { + super(manager, "Iron Golem", KitAvailability.Free, + + new String[] + { + }, + + new Perk[] + { + new PerkDoubleJump("Double Jump", 0.8, 0.8, false), + new PerkDamageSet(6), + new PerkMammoth(), + new PerkSlow(0), + new PerkIronSkin(1), + new PerkSeismicSlam(), + new PerkFissure(), + + }, + EntityType.IRON_GOLEM, + null); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Fissure")); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Seismic Slam")); + + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + + //Disguise + DisguiseIronGolem disguise = new DisguiseIronGolem(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSkeleton.java index f535be2ad..3939d20ca 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSkeleton.java @@ -5,34 +5,40 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.C; import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkDamageSet; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkFletcher; -import nautilus.game.arcade.kit.perks.PerkLeaper; +import nautilus.game.arcade.kit.perks.PerkKnockbackArrow; +import nautilus.game.arcade.kit.perks.PerkKnockbackMultiplier; +import nautilus.game.arcade.kit.perks.PerkRopedArrow; -public class KitSkeleton extends Kit +public class KitSkeleton extends SmashKit { public KitSkeleton(ArcadeManager manager) { - super(manager, "Skeletal Archer", KitAvailability.Free, + super(manager, "Skeleton", KitAvailability.Free, new String[] { - "Animated dead, specialising in escape and archery." }, new Perk[] { new PerkDoubleJump("Double Jump", 0.8, 0.8, false), - new PerkLeaper("Leap", 1, 1, 3000), - new PerkFletcher(3, 2, false), - new PerkBarrage(5, 250, true) + new PerkDamageSet(5), + new PerkKnockbackMultiplier(1.1), + new PerkFletcher(1, 2, false), + new PerkKnockbackArrow(2), + new PerkRopedArrow("Roped Arrow", 1, 4000), + new PerkBarrage(5, 250, true), }, EntityType.SKELETON, new ItemStack(Material.BOW)); @@ -41,9 +47,14 @@ public class KitSkeleton extends Kit @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "???")); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Roped Arrow")); + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + //Disguise DisguiseSkeleton disguise = new DisguiseSkeleton(player); disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSlime.java index c9f6730c6..141879b40 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSlime.java @@ -4,49 +4,56 @@ import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import mineplex.core.common.util.C; import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.SmashKit; +import nautilus.game.arcade.kit.perks.PerkDamageSet; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkFallDamage; -import nautilus.game.arcade.kit.perks.PerkLeaper; +import nautilus.game.arcade.kit.perks.PerkKnockbackMultiplier; +import nautilus.game.arcade.kit.perks.PerkSlimeSlam; -public class KitSlime extends Kit +public class KitSlime extends SmashKit { public KitSlime(ArcadeManager manager) { - super(manager, "Slime", KitAvailability.Hide, + super(manager, "Slime", KitAvailability.Free, new String[] { - "Bouncey and g" }, new Perk[] { - new PerkLeaper("Bounce", 2, 2, 8000), - new PerkFallDamage(-20), - new PerkDoubleJump("Double Jump", 1, 1, false) + new PerkDoubleJump("Double Jump", 1.2, 1, false), + new PerkDamageSet(7), + new PerkKnockbackMultiplier(1.4), + new PerkSlimeSlam(), }, EntityType.SLIME, null); - } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "???")); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "???")); + + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); //Disguise DisguiseSlime disguise = new DisguiseSlime(player); disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.SetCustomNameVisible(true); - disguise.SetSize(3); Manager.GetDisguise().Disguise(disguise); + + disguise.SetSize(3); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSnowman.java new file mode 100644 index 000000000..35512e5e2 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSnowman.java @@ -0,0 +1,62 @@ +package nautilus.game.arcade.game.standalone.smash.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.disguise.disguises.DisguiseSnowman; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.SmashKit; +import nautilus.game.arcade.kit.perks.PerkArcticAura; +import nautilus.game.arcade.kit.perks.PerkBlizzard; +import nautilus.game.arcade.kit.perks.PerkDamageSet; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkIcePath; +import nautilus.game.arcade.kit.perks.PerkKnockbackMultiplier; + +public class KitSnowman extends SmashKit +{ + public KitSnowman(ArcadeManager manager) + { + super(manager, "Snowman", KitAvailability.Free, + + new String[] + { + }, + + new Perk[] + { + new PerkDoubleJump("Double Jump", 0.8, 0.8, false), + new PerkDamageSet(6), + new PerkKnockbackMultiplier(1.2), + new PerkArcticAura(), + new PerkBlizzard(), + new PerkIcePath(), + }, + EntityType.SNOWMAN, + null); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Blizzard")); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Ice Path")); + + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + + //Disguise + DisguiseSnowman disguise = new DisguiseSnowman(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSpider.java new file mode 100644 index 000000000..c6e2af12b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/standalone/smash/kits/KitSpider.java @@ -0,0 +1,55 @@ +package nautilus.game.arcade.game.standalone.smash.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.disguise.disguises.DisguiseSpider; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.SmashKit; +import nautilus.game.arcade.kit.perks.PerkDamageSet; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkKnockbackMultiplier; + +public class KitSpider extends SmashKit +{ + public KitSpider(ArcadeManager manager) + { + super(manager, "Spider", KitAvailability.Free, + + new String[] + { + }, + + new Perk[] + { + new PerkDoubleJump("Double Jump", 0.8, 0.8, false), + new PerkDamageSet(7), + new PerkKnockbackMultiplier(1.25), + }, + EntityType.SPIDER, + null); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "???")); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "???")); + + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + + //Disguise + DisguiseSpider disguise = new DisguiseSpider(player); + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + Manager.GetDisguise().Disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArcticAura.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArcticAura.java new file mode 100644 index 000000000..ece2ee4b7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArcticAura.java @@ -0,0 +1,59 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashMap; + +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.UtilMath; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkArcticAura extends Perk +{ + 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 (!Kit.HasKit(player)) + continue; + + double range = 5*player.getExp(); + + //Blocks + double duration = 2000; + HashMap blocks = UtilBlock.getInRadius(player.getLocation(), range); + for (Block block : blocks.keySet()) + { + //Snow + Manager.GetBlockRestore().Snow(block, (byte)1, (byte)1, (long)(duration * (1 + blocks.get(block))), 250, 0); + } + + for (Player other : Manager.GetGame().GetPlayers(true)) + { + if (other.equals(player)) + continue; + + if (UtilMath.offset(player, other) > range) + continue; + + Manager.GetCondition().Factory().Slow("Aura Slow", other, player, 0.9, 0, false, false, false, false); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java index ab0ef8d75..a847e894f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java @@ -1,8 +1,11 @@ package nautilus.game.arcade.kit.perks; +import org.bukkit.Color; import org.bukkit.Effect; +import org.bukkit.FireworkEffect; import org.bukkit.Location; import org.bukkit.Sound; +import org.bukkit.FireworkEffect.Type; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; @@ -28,7 +31,7 @@ public class PerkBlink extends Perk { super("Leaper", new String[] { - C.cYellow + "Right-Click" + C.cGray + " with Axes to " + C.cGreen + name + C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + name }); _name = name; @@ -79,8 +82,10 @@ public class PerkBlink extends Perk //Smoke Trail if (!lastSmoke.equals(newTarget.getBlock())) + { lastSmoke.getWorld().playEffect(lastSmoke.getLocation(), Effect.SMOKE, 4); - + } + lastSmoke = newTarget.getBlock(); } @@ -93,16 +98,39 @@ public class PerkBlink extends Perk Location loc = player.getLocation().add(player.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0))); if (curRange > 0) + { + //Firework + FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.BLACK).with(Type.BALL).trail(false).build(); + + try + { + Manager.GetFirework().playFirework(player.getEyeLocation(), effect); + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f); + } + catch (Exception e) + { + e.printStackTrace(); + } + player.teleport(loc); + + //Firework + try + { + Manager.GetFirework().playFirework(player.getEyeLocation(), effect); + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + player.setFallDistance(0); //Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(_name) + ".")); - - //Effect - player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 0.4f, 1.2f); - player.getWorld().playSound(player.getLocation(), Sound.SILVERFISH_KILL, 1f, 1.6f); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java new file mode 100644 index 000000000..0d4a551fa --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java @@ -0,0 +1,119 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.WeakHashMap; + +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.ProjectileHitEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilMath; +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 WeakHashMap _snowball = new WeakHashMap(); + + 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 (!Kit.HasKit(player)) + continue; + + player.setExp((float) Math.min(0.999, player.getExp()+0.015)); + } + } + + @EventHandler + public void Snow(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!player.isBlocking()) + continue; + + if (!Kit.HasKit(player)) + continue; + + //Energy + if (player.getExp() < 0.1) + continue; + + player.setExp((float) Math.max(0, player.getExp()-(1f/9f))); + + for (int i=0 ; i<4 ; 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.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(GetName()); + damagee.setVelocity(proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0))); + } + + @EventHandler + public void SnowballForm(ProjectileHitEvent event) + { + if (!(event.getEntity() instanceof Snowball)) + return; + + if (_snowball.remove(event.getEntity()) == null) + return; + + Manager.GetBlockRestore().Snow(event.getEntity().getLocation().getBlock(), (byte)1, (byte)7, 2000, 250, 0); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java new file mode 100644 index 000000000..253cabd3e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java @@ -0,0 +1,233 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashMap; +import java.util.HashSet; + +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.UtilEvent; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; +import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; + +import org.bukkit.Effect; +import org.bukkit.block.Block; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +public class PerkBlockToss extends Perk implements IThrown +{ + private HashMap _holding = new HashMap(); + private HashMap _charge = new HashMap(); + private HashSet _charged = new HashSet(); + private HashMap _falling = new HashMap(); + + public PerkBlockToss() + { + super("Block Toss", new String[] + { + C.cYellow + "Hold Block" + C.cGray + " to " + C.cGreen + "Grab Block", + C.cYellow + "Release Block" + C.cGray + " to " + C.cGreen + "Throw Block" + }); + } + + @EventHandler + public void Grab(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + return; + + if (!Kit.HasKit(player)) + return; + + if (!UtilGear.isSword(player.getItemInHand())) + return; + + if (_holding.containsKey(player)) + return; + + Block grab = event.getClickedBlock(); + + if (UtilBlock.usable(grab)) + return; + + //Event + PerkBlockGrabEvent blockEvent = new PerkBlockGrabEvent(player, grab.getTypeId(), grab.getData()); + UtilServer.getServer().getPluginManager().callEvent(blockEvent); + System.out.println("grab event"); + + //Block to Item + FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), (byte)0); + Manager.GetBlockRestore().Add(event.getClickedBlock(), 0, (byte)0, 10000); + + //Action + player.eject(); + player.setPassenger(block); + _holding.put(player, block); + _falling.put(block, player); + _charge.put(player, System.currentTimeMillis()); + + //Effect + player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, block.getMaterial().getId()); + } + + @EventHandler + public void Throw(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet voidSet = new HashSet(); + HashSet throwSet = new HashSet(); + + for (Player cur : _holding.keySet()) + { + if (cur.getPassenger() == null) + { + voidSet.add(cur); + continue; + } + + if (_holding.get(cur).getVehicle() == null) + { + voidSet.add(cur); + continue; + } + + if (!_holding.get(cur).getVehicle().equals(cur)) + { + voidSet.add(cur); + continue; + } + + //Throw + if (!cur.isBlocking()) + throwSet.add(cur); + + //Charged Tick + if (!_charged.contains(cur)) + if (System.currentTimeMillis() - _charge.get(cur) > 1000) + { + _charged.add(cur); + cur.playEffect(cur.getLocation(), Effect.CLICK1, 0); + } + } + + for (Player cur : voidSet) + { + FallingBlock block = _holding.remove(cur); + _charge.remove(cur); + _charged.remove(cur); + block.remove(); + + //Event + PerkBlockThrowEvent blockEvent = new PerkBlockThrowEvent(cur); + UtilServer.getServer().getPluginManager().callEvent(blockEvent); + } + + for (Player cur : throwSet) + { + FallingBlock block = _holding.remove(cur); + _charged.remove(cur); + long charge = System.currentTimeMillis() - _charge.remove(cur); + + //Throw + cur.eject(); + double mult = 1; + if (charge < 1000) + mult = mult * (charge/1000d); + + //Action + UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0, 0, 1, true); + Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, + null, 0, 0, null, 0, UpdateType.FASTEST, 2d); + + //Event + PerkBlockThrowEvent blockEvent = new PerkBlockThrowEvent(cur); + UtilServer.getServer().getPluginManager().callEvent(blockEvent); + } + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target == null) + return; + + //Damage Event + Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + DamageCause.PROJECTILE, 2 + (data.GetThrown().getVelocity().length() * 10), true, true, false, + UtilEnt.getName(data.GetThrower()), GetName()); + + //Block to Item + if (data.GetThrown() instanceof FallingBlock) + { + FallingBlock thrown = (FallingBlock) data.GetThrown(); + + FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), (byte)0); + + //Remove Old + _falling.remove(thrown); + thrown.remove(); + + //Add New + if (data.GetThrower() instanceof Player) + _falling.put(newThrown, (Player)data.GetThrower()); + } + } + + @Override + public void Idle(ProjectileUser data) + { + + } + + @Override + public void Expire(ProjectileUser data) + { + + } + + + @EventHandler + public void BlockForm(EntityChangeBlockEvent event) + { + if (!(event.getEntity() instanceof FallingBlock)) + return; + + FallingBlock falling = (FallingBlock)event.getEntity(); + + falling.getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, falling.getBlockId()); + + _falling.remove(falling); + falling.remove(); + + event.setCancelled(true); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + return; + + event.AddKnockback(GetName(), 2.5); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java new file mode 100644 index 000000000..8e3af08f1 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java @@ -0,0 +1,181 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Sound; +import org.bukkit.entity.Chicken; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +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.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 nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.data.ChickenMissileData; + +public class PerkChickenRocket extends Perk +{ + private HashSet _data = new HashSet(); + + public PerkChickenRocket() + { + super("Chicken Missile", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Chicken Missile", + C.cGreen + "Chicken Missile" + C.cGray + " instantly recharges if you hit a player." + }); + } + + @EventHandler + public void Missile(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 6000, true)) + return; + + Manager.GetGame().CreatureAllowOverride = true; + Chicken ent = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Chicken.class); + ent.getLocation().setPitch(0); + ent.getLocation().setYaw(player.getLocation().getYaw()); + ent.setBaby(); + ent.setAgeLock(true); + UtilEnt.Vegetate(ent); + Manager.GetGame().CreatureAllowOverride = false; + + _data.add(new ChickenMissileData(player, ent)); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator dataIterator = _data.iterator(); + + while (dataIterator.hasNext()) + { + ChickenMissileData data = dataIterator.next(); + + data.Chicken.setVelocity(data.Direction); + data.Chicken.getWorld().playSound(data.Chicken.getLocation(), Sound.CHICKEN_HURT, 0.3f, 1.5f); + + boolean detonate = false; + + if (UtilTime.elapsed(data.Time, 4000)) + { + detonate = true; + } + else + { + //Hit Player + for (Player other : Manager.GetGame().GetPlayers(true)) + { + if (other.equals(data.Player)) + continue; + + if (UtilMath.offset(data.Chicken.getLocation(), other.getLocation().add(0, 0.5, 0)) > 2) + continue; + + //Recharge + Recharge.Instance.useForce(data.Player, GetName(), -1); + + detonate = true; + break; + } + + //Hit Block + if (!detonate && data.HasHitBlock()) + { + detonate = true; + } + } + + if (detonate) + { + //Damage + for (Player other : UtilPlayer.getNearby(data.Chicken.getLocation(), 3)) + { + if (!Manager.GetGame().IsAlive(other)) + continue; + + //Damage Event + Manager.GetDamage().NewDamageEvent(other, data.Player, null, + DamageCause.PROJECTILE, 10, false, true, false, + data.Player.getName(), GetName()); + + UtilAction.velocity(other, UtilAlg.getTrajectory2d(data.Chicken, other), 1.6, true, 0.8, 0, 10, true); + } + + //Explosion + data.Chicken.getWorld().createExplosion(data.Chicken.getLocation(), 1.8f); + + //Firework + FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.WHITE).with(Type.BALL).trail(false).build(); + + try + { + Manager.GetFirework().playFirework(data.Chicken.getLocation().add(0, 0.6, 0), effect); + } + catch (Exception e) + { + e.printStackTrace(); + } + + data.Chicken.remove(); + dataIterator.remove(); + continue; + } + } + } + + @EventHandler + public void ExplosionDamageCancel(EntityDamageEvent event) + { + if (event.getCause() == DamageCause.ENTITY_EXPLOSION || event.getCause() == DamageCause.BLOCK_EXPLOSION) + { + for (ChickenMissileData data : _data) + { + if (UtilMath.offset(data.Chicken, event.getEntity()) < 8) + { + event.setCancelled(true); + } + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDamageSet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDamageSet.java new file mode 100644 index 000000000..fd85ffe5e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDamageSet.java @@ -0,0 +1,48 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.C; +import nautilus.game.arcade.kit.Perk; + +public class PerkDamageSet extends Perk +{ + private double _power; + + public PerkDamageSet(double power) + { + super("Damage", new String[] + { + C.cGray + "Melee attacks deal " + (int)power + " Damage.", + }); + + _power = power; + } + + @EventHandler(priority = EventPriority.HIGH) + public void Knockback(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!Kit.HasKit(damager)) + return; + + if (!Manager.IsAlive(damager)) + return; + + double mod = _power - event.GetDamageInitial(); + + if (mod == 0) + return; + + event.AddMod(damager.getName(), "Attack", mod, true); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java index 8d400201e..73addf2db 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java @@ -39,6 +39,9 @@ public class PerkDoubleJump extends Perk { Player player = event.getPlayer(); + if (!Kit.HasKit(player)) + return; + if (player.getGameMode() == GameMode.CREATIVE) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEggGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEggGun.java new file mode 100644 index 000000000..d658942fe --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEggGun.java @@ -0,0 +1,123 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashMap; + +import org.bukkit.Sound; +import org.bukkit.entity.Egg; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +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.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.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 PerkEggGun extends Perk +{ + private HashMap _active = new HashMap(); + + public PerkEggGun() + { + super("Egg Blaster", new String[] + { + C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Egg Blaster" + }); + } + + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 1500, true)) + return; + + _active.put(player, System.currentTimeMillis()); + + 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()) + { + if (!_active.containsKey(cur)) + continue; + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + if (UtilTime.elapsed(_active.get(cur), 750)) + { + _active.remove(cur); + continue; + } + + Egg egg = cur.getWorld().spawn(cur.getLocation().add(0, 0.5, 0).add(cur.getLocation().getDirection()), Egg.class); + egg.setVelocity(cur.getLocation().getDirection().add(new Vector(0,0.2,0))); + egg.setShooter(cur); + + //Effect + cur.getWorld().playSound(cur.getLocation(), Sound.CHICKEN_EGG_POP, 0.5f, 1f); + } + } + + @EventHandler + public void EggHit(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + if (!(event.GetProjectile() instanceof Egg)) + return; + + if (event.GetDamage() >= 1) + return; + + event.SetCancelled("Egg Blaster"); + + Egg egg = (Egg)event.GetProjectile(); + + //Damage Event + Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), egg.getShooter(), egg, + DamageCause.PROJECTILE, 1, true, true, false, + UtilEnt.getName(egg.getShooter()), GetName()); + + event.GetDamageeEntity().setVelocity(new Vector(0,0,0)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkExplode.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkExplode.java index 2c8165312..3bfbfa8e0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkExplode.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkExplode.java @@ -29,7 +29,7 @@ public class PerkExplode extends Perk { super("Explosive", new String[] { - C.cYellow + "Right-Click" + C.cGray + " with Axes to " + C.cGreen + name + C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + name }); _name = name; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java new file mode 100644 index 000000000..7d677407e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java @@ -0,0 +1,198 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Color; +import org.bukkit.EntityEffect; +import org.bukkit.FireworkEffect; +import org.bukkit.Sound; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +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.UtilBlock; +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.kit.Perk; +import nautilus.game.arcade.kit.perks.data.FireflyData; + +public class PerkFirefly extends Perk +{ + private HashSet _data = new HashSet(); + private int _tick = 0; + + private long _recharge; + + public PerkFirefly(long recharge) + { + super("Firefly", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Firefly" + }); + + _recharge = recharge; + } + + @EventHandler + public void Skill(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), _recharge, true)) + return; + + _data.add(new FireflyData(player)); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + _tick = (_tick + 1)%3; + + Iterator dataIterator = _data.iterator(); + + while (dataIterator.hasNext()) + { + FireflyData data = dataIterator.next(); + + //Teleport + if (!UtilTime.elapsed(data.Time, 1000)) + { + data.Player.teleport(data.Location); + data.Player.getWorld().playSound(data.Location, Sound.EXPLODE, 0.2f, 0.6f); + + if (_tick == 0) + { + //Firework + FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.ORANGE).with(Type.BURST).trail(false).build(); + + try + { + Manager.GetFirework().playFirework(data.Player.getLocation(), effect); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + } + //Velocity + else if (!UtilTime.elapsed(data.Time, 2000)) + { + data.Player.setVelocity(data.Location.getDirection().multiply(0.6).add(new Vector(0,0.1,0))); + data.Player.getWorld().playSound(data.Location, Sound.EXPLODE, 0.6f, 1.2f); + + if (_tick == 0) + { + //Firework + FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.RED).with(Type.BURST).trail(false).build(); + + try + { + Manager.GetFirework().playFirework(data.Player.getLocation(), effect); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + + for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), 3)) + { + if (other.equals(data.Player)) + continue; + + if (!Manager.GetGame().IsAlive(other)) + continue; + + other.playEffect(EntityEffect.HURT); + + if (_tick == 0) + if (!data.Targets.contains(other)) + { + data.Targets.add(other); + + //Damage Event + Manager.GetDamage().NewDamageEvent(other, data.Player, null, + DamageCause.CUSTOM, 12, true, true, false, + data.Player.getName(), GetName()); + + UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(data.Player) + data.Player.getName()) + " hit you with " + F.elem(GetName()) + ".")); + } + } + } + else + { + dataIterator.remove(); + } + } + } + + @EventHandler + public void FireflyDamage(CustomDamageEvent event) + { + Iterator dataIterator = _data.iterator(); + + while (dataIterator.hasNext()) + { + FireflyData data = dataIterator.next(); + + if (!data.Player.equals(event.GetDamageeEntity())) + continue; + + if (UtilTime.elapsed(data.Time, 1000) || event.GetCause() == DamageCause.ENTITY_ATTACK) + { + event.SetCancelled("Firefly Immunity"); + } + else + { + dataIterator.remove(); + } + } + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + return; + + event.AddKnockback(GetName(), 2.5); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFissure.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFissure.java new file mode 100644 index 000000000..5e9881f2c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFissure.java @@ -0,0 +1,90 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashSet; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +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.UtilEnt; +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.FissureData; + +public class PerkFissure extends Perk +{ + private HashSet _active = new HashSet(); + + public PerkFissure() + { + super("Fissure", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Fissure" + }); + } + + @EventHandler + public void Leap(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!UtilEnt.isGrounded(player)) + { + UtilPlayer.message(player, F.main("Game", "You cannot use " + F.skill(GetName()) + " while airborne.")); + return; + } + + if (!Recharge.Instance.use(player, GetName(), 1000, true)) + return; + + FissureData data = new FissureData(this, player, player.getLocation().getDirection(), player.getLocation().add(0, -0.5, 0)); + _active.add(data); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet remove = new HashSet(); + + for (FissureData data : _active) + if (data.Update()) + remove.add(data); + + for (FissureData data : remove) + { + _active.remove(data); + data.Clear(); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java new file mode 100644 index 000000000..3d66ec8b8 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java @@ -0,0 +1,101 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.GameMode; +import org.bukkit.Sound; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerToggleFlightEvent; + +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.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 PerkFlap extends Perk +{ + private double _power; + private boolean _control; + + public PerkFlap(double power, double heightLimit, boolean control) + { + super("Flap", new String[] + { + C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Flap" + }); + + _power = power; + _control = control; + } + + @EventHandler + public void FlightHop(PlayerToggleFlightEvent event) + { + Player player = event.getPlayer(); + + if (player.getGameMode() == GameMode.CREATIVE) + return; + + if (!Kit.HasKit(player)) + return; + + event.setCancelled(true); + player.setFlying(false); + + //Disable Flight + player.setAllowFlight(false); + + double power = 0.4 + 0.6 * (_power * player.getExp()); + + //Velocity + if (_control) + { + UtilAction.velocity(player, power, 0.2, 10, true); + } + else + { + UtilAction.velocity(player, player.getLocation().getDirection(), power, true, power, 0, 10, true); + } + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float)(0.3 + player.getExp()), (float)(Math.random()/2+1)); + + //Set Recharge + Recharge.Instance.use(player, GetName(), 80, false); + + //Energy + player.setExp(Math.max(0f, player.getExp() - (1f/9f))); + } + + @EventHandler + public void FlightUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (player.getGameMode() == GameMode.CREATIVE) + continue; + + if (!Kit.HasKit(player)) + continue; + + + if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + { + player.setExp(0.999f); + player.setAllowFlight(true); + } + else if (Recharge.Instance.usable(player, GetName()) && player.getExp() > 0) + { + player.setAllowFlight(true); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIcePath.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIcePath.java new file mode 100644 index 000000000..5eae40d05 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIcePath.java @@ -0,0 +1,91 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Effect; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; +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 HashSet _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 (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 1000, true)) + return; + + player.setVelocity(new Vector(0,0,0)); + player.teleport(player.getLocation().add(0, 0.5, 0)); + + _data.add(new IcePathData(player)); + } + + @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, 6000); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java new file mode 100644 index 000000000..c179ac777 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java @@ -0,0 +1,75 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.Effect; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +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.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.event.PerkLeapEvent; + +public class PerkLeap extends Perk +{ + private String _name; + private double _power; + private double _heightMax; + private long _recharge; + + public PerkLeap(String name, double power, double heightLimit, long recharge) + { + super("Leaper", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + name + }); + + _name = name; + _power = power; + _heightMax = heightLimit; + _recharge = recharge; + } + + @EventHandler + public void Leap(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, _name, _recharge, true)) + return; + + UtilAction.velocity(player, _power, 0.2, _heightMax, true); + player.setFallDistance(0); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(_name) + ".")); + + player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); + + PerkLeapEvent leapEvent = new PerkLeapEvent(player); + UtilServer.getServer().getPluginManager().callEvent(leapEvent); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java new file mode 100644 index 000000000..019b934a2 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java @@ -0,0 +1,139 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashMap; + +import org.bukkit.Effect; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +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.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkSeismicSlam extends Perk +{ + private HashMap _live = new HashMap(); + + public PerkSeismicSlam() + { + super("Seismic Slam", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " with Shovel to " + C.cGreen + "Seismic Slam" + }); + } + + @EventHandler + public void Leap(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 1000, true)) + return; + + //Action + Vector vec = player.getLocation().getDirection(); + if (vec.getY() < 0) + vec.setY(vec.getY() * -1); + + UtilAction.velocity(player, vec, 1, true, 1, 0, 1, true); + + //Record + _live.put(player, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Slam(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!UtilEnt.isGrounded(player)) + continue; + + if (!_live.containsKey(player)) + continue; + + if (!UtilTime.elapsed(_live.get(player), 1000)) + continue; + + _live.remove(player); + + //Action + int damage = 12; + double range = 6; + + HashMap targets = UtilEnt.getInRadius(player.getLocation(), range); + for (LivingEntity cur : targets.keySet()) + { + if (cur.equals(player)) + continue; + + if (!UtilEnt.isGrounded(player)) + continue; + + //Damage Event + Manager.GetDamage().NewDamageEvent(cur, player, null, + DamageCause.CUSTOM, damage * targets.get(cur) + 0.5, false, true, false, + player.getName(), GetName()); + + //Velocity + UtilAction.velocity(cur, + UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()), + 1.8 * targets.get(cur), true, 0, 0.4 + 1.0 * targets.get(cur), 1.6, true); + + //Condition + Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true); + + //Inform + if (cur instanceof Player) + UtilPlayer.message((Player)cur, F.main("Game", F.name(player.getName()) +" hit you with " + F.skill(GetName()) + ".")); + } + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f); + for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet()) + if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur)) + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId()); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlam.java index c5674e205..bd1e71999 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlam.java @@ -33,7 +33,7 @@ public class PerkSlam extends Perk { super("Slam", new String[] { - C.cYellow + "Right-Click" + C.cGray + " with Axes to " + C.cGreen + name + C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + name }); _name = name; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java new file mode 100644 index 000000000..bc31ffba5 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java @@ -0,0 +1,136 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashMap; + +import org.bukkit.GameMode; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +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.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.kit.Perk; + +public class PerkSlimeSlam extends Perk +{ + private HashMap _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 (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 6000, true)) + return; + + UtilAction.velocity(player, player.getLocation().getDirection(), 1.2, 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()) + ".")); + } + + @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 (other.getGameMode() == GameMode.SURVIVAL) + if (!other.equals(player)) + if (UtilMath.offset(player, other) < 2) + { + DoSlam(player, other); + _live.remove(player); + return; + } + + //End + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!UtilEnt.isGrounded(player)) + continue; + + if (!_live.containsKey(player)) + continue; + + if (!UtilTime.elapsed(_live.get(player), 1000)) + continue; + + _live.remove(player); + } + } + + public void DoSlam(Player damager, LivingEntity damagee) + { + int damage = 10; + + //Damage Event + Manager.GetDamage().NewDamageEvent(damager, damagee, null, + DamageCause.CUSTOM, damage, 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(), 2.5); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlow.java new file mode 100644 index 000000000..bed33d89d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlow.java @@ -0,0 +1,42 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.arcade.kit.Perk; + +public class PerkSlow extends Perk +{ + private int _level; + + public PerkSlow(int level) + { + super("Speed", new String[] + { + C.cGray + "Permanent Slow " + (level+1), + }); + + _level = level; + } + + @EventHandler + public void DigSpeed(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + if (Manager.GetGame() == null) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!Kit.HasKit(player)) + continue; + + Manager.GetCondition().Factory().Slow(GetName(), player, player, 8, _level, false, false, false, false); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/ChickenMissileData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/ChickenMissileData.java new file mode 100644 index 000000000..c1b1a4a46 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/ChickenMissileData.java @@ -0,0 +1,57 @@ +package nautilus.game.arcade.kit.perks.data; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; +public class ChickenMissileData +{ + public Player Player; + public Entity Chicken; + public Vector Direction; + public long Time; + + public double LastX; + public double LastY; + public double LastZ; + + public ChickenMissileData(Player player, Entity chicken) + { + Player = player; + Chicken = chicken; + Direction = player.getLocation().getDirection().multiply(0.6); + Time = System.currentTimeMillis(); + } + + public boolean HasHitBlock() + { + //Not First Run + if (LastX != 0 && LastY != 0 && LastZ != 0) + { + if (Math.abs(Chicken.getLocation().getX() - LastX) < Math.abs(Direction.getX()/10d)) + { + return true; + } + if (Math.abs(Chicken.getLocation().getY() - LastY) < Math.abs(Direction.getY()/10d)) + { + if (Direction.getY() > 0) + { + return true; + } + else if (Direction.getY() < -0.02) + { + return true; + } + } + if (Math.abs(Chicken.getLocation().getZ() - LastZ) < Math.abs(Direction.getZ()/10d)) + { + return true; + } + } + + LastX = Chicken.getLocation().getX(); + LastY = Chicken.getLocation().getY(); + LastZ = Chicken.getLocation().getZ(); + + return false; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java new file mode 100644 index 000000000..bba1b9518 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java @@ -0,0 +1,203 @@ +package nautilus.game.arcade.kit.perks.data; + +import java.util.ArrayList; +import java.util.HashSet; + +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.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.arcade.kit.perks.PerkFissure; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +public class FissureData +{ + private PerkFissure Host; + + private Player _player; + + private Vector _vec; + private Location _loc; + private Location _startLoc; + + private int _height = 0; + private int _handled = 0; + + private HashSet _hit = new HashSet(); + + private ArrayList _path = new ArrayList(); + + public FissureData(PerkFissure host, Player player, Vector vec, Location loc) + { + Host = host; + + vec.setY(0); + vec.normalize(); + vec.multiply(0.1); + + this._player = player; + this._vec = vec; + this._loc = loc; + this._startLoc = new Location(loc.getWorld(), loc.getX(), loc.getY(), loc.getZ()); + + MakePath(); + } + + private void MakePath() + { + while (UtilMath.offset2d(_loc, _startLoc) < 14) + { + _loc.add(_vec); + + Block block = _loc.getBlock(); + + if (block.equals(_startLoc.getBlock())) + continue; + + if (_path.contains(block)) + continue; + + //Up + if (UtilBlock.solid(block.getRelative(BlockFace.UP))) + { + _loc.add(0, 1, 0); + block = _loc.getBlock(); + + if (UtilBlock.solid(block.getRelative(BlockFace.UP))) + return; + } + + //Down + else if (!UtilBlock.solid(block)) + { + _loc.add(0, -1, 0); + block = _loc.getBlock(); + + if (!UtilBlock.solid(block)) + return; + } + + if (UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), _loc) > 0.5) + continue; + + _path.add(block); + + //Effect + _loc.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + + //Slow + for (Player cur : block.getWorld().getPlayers()) + if (!cur.equals(_player)) + if (UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), cur.getLocation()) < 1.5) + { + //Condition + Host.Manager.GetCondition().Factory().Slow("Fissure", cur, _player, 4, 1, false, true, true, true); + } + } + } + + public boolean Update() + { + if (_handled >= _path.size()) + return true; + + Block block = _path.get(_handled); + + //Cannot raise + if (block.getTypeId() == 46) + return false; + + Block up = block.getRelative(0, _height + 1, 0); + + //Done Column + if (!UtilBlock.airFoliage(up)) + { + _loc.getWorld().playEffect(up.getLocation(), Effect.STEP_SOUND, up.getTypeId()); + _height = 0; + _handled++; + return false; + } + + //Boost Column + if (block.getTypeId() == 1) Host.Manager.GetBlockRestore().Add(block, 4, block.getData(), 14000); + if (block.getTypeId() == 2) Host.Manager.GetBlockRestore().Add(block, 3, block.getData(), 14000); + if (block.getTypeId() == 98) Host.Manager.GetBlockRestore().Add(block, 98, (byte)2, 14000); + + Host.Manager.GetBlockRestore().Add(up, block.getTypeId(), block.getData(), 10000 - (1000 * _height)); + _height++; + + //Effect + up.getWorld().playEffect(up.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + + //Damage + for (Player cur : up.getWorld().getPlayers()) + if (!cur.equals(_player)) + { + //Teleport + if (cur.getLocation().getBlock().equals(block)) + { + cur.teleport(cur.getLocation().add(0, 1, 0)); + + + } + + //Damage + if (!_hit.contains(cur)) + if (UtilMath.offset(up.getLocation().add(0.5, 0.5, 0.5), cur.getLocation()) < 1.5) + { + _hit.add(cur); + + int damage = 4 + _handled; + + //Damage Event + Host.Manager.GetDamage().NewDamageEvent(cur, _player, null, + DamageCause.CUSTOM, damage, false, false, false, + _player.getName(), "Fissure"); + + //Inform + UtilPlayer.message(cur, F.main("Game", F.name(_player.getName()) +" hit you with " + F.skill(Host.GetName()) + ".")); + + final Player fPlayer = cur; + final Location fLoc = up.getLocation().add(0.5, 0.5, 0.5); + + Host.Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Host.Manager.GetPlugin(), new Runnable() + { + public void run() + { + //Velocity + UtilAction.velocity(fPlayer, UtilAlg.getTrajectory2d(fLoc, fPlayer.getLocation()), + 1 + 0.1*_handled, true, 0.6 + 0.05*_handled, 0, 10, true); + } + }, 4); + } + } + + //Next Column + if (_height >= Math.min(2, _handled/3 + 1)) + { + _height = 0; + _handled++; + } + + return (_handled >= _path.size()); + } + + public void Clear() + { + _hit.clear(); + _path.clear(); + Host = null; + _player = null; + _loc = null; + _startLoc = null; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/IcePathData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/IcePathData.java new file mode 100644 index 000000000..b308da2e1 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/IcePathData.java @@ -0,0 +1,99 @@ +package nautilus.game.arcade.kit.perks.data; + +import java.util.ArrayList; + +import mineplex.core.common.util.UtilMath; + +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +public class IcePathData +{ + private ArrayList _blocks; + + public IcePathData(Player player) + { + _blocks = new ArrayList(); + + //Add Blocks + if (Math.abs(player.getLocation().getDirection().getX()) > Math.abs(player.getLocation().getDirection().getZ())) + { + GetBlocks(player.getLocation().add(0, 0, 1), 16); + GetBlocks(player.getLocation().add(0, 0, -1), 16); + } + else + { + GetBlocks(player.getLocation().add(1, 0, 0), 16); + GetBlocks(player.getLocation().add(-1, 0, 0), 16); + } + + GetBlocks(player.getLocation(), 16); + + //Sort Blocks + for (int i=0 ; i<_blocks.size() ; i++) + { + for (int j=0 ; j+1<_blocks.size() ; j++) + { + if (UtilMath.offset(player.getLocation(), _blocks.get(j).getLocation().add(0.5, 0.5, 0.5)) > + UtilMath.offset(player.getLocation(), _blocks.get(j+1).getLocation().add(0.5, 0.5, 0.5))) + { + Block temp = _blocks.get(j); + _blocks.set(j, _blocks.get(j+1)); + _blocks.set(j+1, temp); + } + } + } + } + + public void GetBlocks(Location loc, int length) + { + //Below Player + loc.subtract(0, 1, 0); + + Vector dir = loc.getDirection(); + + double hLength = Math.sqrt(dir.getX()*dir.getX() + dir.getZ()*dir.getZ()); + + if (Math.abs(dir.getY()) > hLength) + { + if (dir.getY() > 0) + dir.setY(hLength); + else + dir.setY(-hLength); + + dir.normalize(); + } + + //Backtrack + loc.subtract(dir.clone().multiply(2)); + + double dist = 0; + while (dist < length) + { + dist += 0.2; + + loc.add(dir.clone().multiply(0.2)); + + if (loc.getBlock().getTypeId() == 79) + continue; + + if (loc.getBlock().getTypeId() == 0 || loc.getBlock().getTypeId() == 78) + { + if (!_blocks.contains(loc.getBlock())) + { + _blocks.add(loc.getBlock()); + } + } + } + } + + public Block GetNextBlock() + { + if (_blocks.isEmpty()) + return null; + + return _blocks.remove(0); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index 2097cf2cc..93e111d5d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -186,13 +186,19 @@ public class GameFlagManager implements Listener if (game.IsAlive(player)) { game.RespawnPlayer(player); - player.setVelocity(new Vector(0,0,0)); } else { game.SetSpectator(player); - player.setVelocity(new Vector(0,0,0)); } + + Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + player.setVelocity(new Vector(0,0,0)); + } + }, 0); } @EventHandler(priority = EventPriority.LOWEST)