From c8afa151d9f4246a686df6af021c5dc1b4177032 Mon Sep 17 00:00:00 2001 From: Chiss Date: Fri, 30 Jan 2015 14:42:39 +1100 Subject: [PATCH] SSM Zombie + Spider Update --- .../arcade/game/games/smash/SuperSmash.java | 15 +- .../game/games/smash/kits/KitBlaze.java | 2 +- .../game/games/smash/kits/KitCreeper.java | 5 +- .../game/games/smash/kits/KitSkeleton.java | 2 +- .../game/games/smash/kits/KitSpider.java | 21 +- .../game/games/smash/kits/KitZombie.java | 38 ++-- .../nautilus/game/arcade/kit/SmashKit.java | 3 + .../game/arcade/kit/perks/PerkBarrage.java | 8 +- .../arcade/kit/perks/PerkDeathsGrasp.java | 10 +- .../game/arcade/kit/perks/PerkFirefly.java | 4 +- .../game/arcade/kit/perks/PerkNeedler.java | 5 +- .../game/arcade/kit/perks/PerkOvercharge.java | 202 ++++++++++++++++++ .../arcade/kit/perks/PerkSpidersNest.java | 111 ++++++++++ .../game/arcade/kit/perks/PerkWebShot.java | 7 +- .../game/arcade/kit/perks/PerkZombieBile.java | 148 +++++++++++++ .../game/arcade/kit/perks/PerkZombieRot.java | 67 ++++++ 16 files changed, 597 insertions(+), 51 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpidersNest.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieRot.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index c93d72527..121952f9d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -64,7 +64,7 @@ public class SuperSmash extends SoloGame private Location _powerupCurrent = null; private Location _powerupTarget = null; private EnderCrystal _powerup = null; - private long _lastPowerup = 0; + private long _nextPowerup = 0; private HashSet _restoreBlock = new HashSet(); @@ -141,6 +141,8 @@ public class SuperSmash extends SoloGame for (Player player : GetPlayers(true)) _lives.put(player, 4); + + _nextPowerup = (long) (System.currentTimeMillis() + 120000 + 180000 * Math.random()); } @EventHandler @@ -242,7 +244,7 @@ public class SuperSmash extends SoloGame if (_powerup == null) { - if (!UtilTime.elapsed(_lastPowerup, 12000)) + if (System.currentTimeMillis() < _nextPowerup) return; if (WorldData.GetDataLocs("RED").isEmpty()) @@ -253,7 +255,7 @@ public class SuperSmash extends SoloGame Location newTarget = UtilAlg.Random(WorldData.GetDataLocs("RED")); _powerupTarget = newTarget; - _powerupCurrent = _powerupTarget.clone().add(0, 160, 0); + _powerupCurrent = _powerupTarget.clone().add(0, 120, 0); //Blocks for (int x=-1 ; x<=1 ; x++) @@ -285,8 +287,7 @@ public class SuperSmash extends SoloGame _powerupTarget = null; _powerupCurrent = null; - _lastPowerup = System.currentTimeMillis(); - + //Restore Blocks for (BlockData block : _restoreBlock) block.restore(true); @@ -332,11 +333,9 @@ public class SuperSmash extends SoloGame best.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, ((SmashKit)GetKit(best)).getSuperCharges(), C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + ((SmashKit)GetKit(best)).getSuperName())); - _lastPowerup = System.currentTimeMillis(); + _nextPowerup = (long) (System.currentTimeMillis() + 120000 + 180000 * Math.random()); Manager.GetGame().Announce(C.Bold + best.getName() + " collected " + C.cGreen + C.Bold + "Smash Crystal" + ChatColor.RESET + C.Bold + "!"); - - best.setHealth(20); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java index 55fe03da6..fb3f18e92 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java @@ -47,7 +47,7 @@ public class KitBlaze extends SmashKit }, EntityType.BLAZE, new ItemStack(Material.BLAZE_ROD), - "Phoenix", 16000, Sound.BLAZE_DEATH); + "Phoenix", 18000, Sound.BLAZE_DEATH); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java index bf884989f..b73d68ad3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java @@ -104,10 +104,7 @@ public class KitCreeper extends SmashKit @Override public void giveSuperItems(Player player) { - player.getInventory().remove(Material.IRON_SPADE); - player.getInventory().remove(Material.IRON_AXE); - - UtilInv.Update(player); + } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java index be9b11ee1..7da07a994 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java @@ -43,7 +43,7 @@ public class KitSkeleton extends SmashKit new PerkKnockbackArrow(1.75), new PerkBoneExplosion(), new PerkRopedArrow("Roped Arrow", 1, 5000), - new PerkBarrage(5, 300, true, false), + new PerkBarrage(5, 300, true, true), new PerkSkeletonArrowStorm() }, EntityType.SKELETON, 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 1bb10abdc..2dd3c0108 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 @@ -2,6 +2,7 @@ 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; @@ -18,6 +19,7 @@ import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.PerkSmashStats; import nautilus.game.arcade.kit.perks.PerkSpiderLeap; import nautilus.game.arcade.kit.perks.PerkNeedler; +import nautilus.game.arcade.kit.perks.PerkSpidersNest; import nautilus.game.arcade.kit.perks.PerkWebShot; public class KitSpider extends SmashKit @@ -32,14 +34,15 @@ public class KitSpider extends SmashKit new Perk[] { - new PerkSmashStats(7, 1.6, 0.3, 5.5), + new PerkSmashStats(7, 1.5, 0.3, 6), new PerkSpiderLeap(), new PerkNeedler(), new PerkWebShot(), + new PerkSpidersNest() }, EntityType.SPIDER, new ItemStack(Material.WEB), - "", 0, null); + "Spider Nest", 30000, Sound.SPIDER_DEATH); } @Override @@ -88,8 +91,20 @@ public class KitSpider extends SmashKit ChatColor.RESET + "", ChatColor.RESET + C.cAqua + "Wall Climb uses Energy (Experience Bar)", })); + + if (Manager.GetGame().GetState() == GameState.Recruit) + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Spiders Nest", + new String[] + { + ChatColor.RESET + "Spawn a nest of webs around you to trap", + ChatColor.RESET + "enemy players. Your attacks heal you and", + ChatColor.RESET + "permanently increase your health. ", + ChatColor.RESET + "", + ChatColor.RESET + "Your abilities have a one second recharge.", + })); - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET)); + 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)); 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 480c23c3c..00e5e30fb 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 @@ -17,12 +17,13 @@ import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkFleshArrow; 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.PerkSmashStats; import nautilus.game.arcade.kit.perks.PerkDeathsGrasp; +import nautilus.game.arcade.kit.perks.PerkZombieBile; public class KitZombie extends SmashKit { @@ -39,8 +40,9 @@ public class KitZombie extends SmashKit new PerkSmashStats(6, 1.25, 0.3, 4.5), new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkFletcher(2, 2, false), - new PerkKnockbackArrow(2), - new PerkFleshArrow(), + new PerkKnockbackArrow(1.5), + new PerkOvercharge(6, 250, true), + new PerkZombieBile(), new PerkDeathsGrasp(), new PerkNightLivingDead() @@ -54,35 +56,37 @@ public class KitZombie extends SmashKit public void giveCoreItems(Player player) { UtilInv.Clear(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 + "Deaths Grasp", + C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bile Blaster", new String[] { - ChatColor.RESET + "Leap forwards. If you collide with an opponent,", - ChatColor.RESET + "you deal damage, throw them behind you and", - ChatColor.RESET + "instantly recharges the ability.", + ChatColor.RESET + "Spew up your dinner from last night.", + ChatColor.RESET + "Deals damage and knockback to enemies.", })); 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 + "Flesh Arrow", + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Deaths Grasp", new String[] { - ChatColor.RESET + "Instantly fires an arrow with a baby ", - ChatColor.RESET + "zombie impaled on it. The zombie will", - ChatColor.RESET + "attack enemies after the arrow hits.", + ChatColor.RESET + "Leap forwards. If you collide with an ", + ChatColor.RESET + "opponent, you deal damage, throw them ", + ChatColor.RESET + "behind you and recharge the ability.", + ChatColor.RESET + "", + ChatColor.RESET + "Arrows deal double damage to enemies", + ChatColor.RESET + "recently hit by Deaths Grasp.", })); if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 1, - C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Combo Shot", + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 1, + C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Corrupted Arrow", new String[] { - ChatColor.RESET + "Your arrows deal 2x damage to oppoents", - ChatColor.RESET + "who are airborne from Deaths Grasp.", - ChatColor.RESET + "", + ChatColor.RESET + "Charge your arrows to corrupt them,", + ChatColor.RESET + "adding up to an additional 6 damage.", })); + if (Manager.GetGame().GetState() == GameState.Recruit) player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Night of the Living Dead", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java index 889cd6256..72bfc668f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java @@ -109,6 +109,9 @@ public abstract class SmashKit extends Kit activateSuper(event.getPlayer()); + //Heal + event.getPlayer().setHealth(event.getPlayer().getMaxHealth()); + //Inform + Effect event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), _superSound, 20f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBarrage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBarrage.java index 6b1f8cbcb..2542e5b3b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBarrage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBarrage.java @@ -126,7 +126,7 @@ public class PerkBarrage extends SmashPerk { if (_useExp) { - cur.setLevel(_charge.get(cur)); + cur.setExp(0f); } _charge.remove(cur); _chargeLast.remove(cur); @@ -138,7 +138,7 @@ public class PerkBarrage extends SmashPerk if (_useExp) { - cur.setLevel(_charge.get(cur)); + cur.setExp(Math.min(0.9999f, (float)_charge.get(cur) / (float)_max)); } _chargeLast.put(cur, System.currentTimeMillis()); @@ -204,7 +204,7 @@ public class PerkBarrage extends SmashPerk _charge.put(cur, arrows - 1); if (_useExp) { - cur.setLevel(_charge.get(cur)); + cur.setExp(Math.min(0.9999f, (float)_charge.get(cur) / (float)_max)); } // Fire Arrow @@ -219,7 +219,7 @@ public class PerkBarrage extends SmashPerk { if (_useExp) { - cur.setLevel(0); + cur.setExp(0f); } _charge.remove(cur); _chargeLast.remove(cur); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java index a1efe6f55..e6efdac23 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java @@ -43,7 +43,7 @@ public class PerkDeathsGrasp extends Perk super("Deaths Grasp", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Deaths Grasp", - C.cGray + "+4 Arrow Damage to enemies thrown by Deaths Grasp" + C.cGray + "+100% Arrow Damage to enemies thrown by Deaths Grasp" }); } @@ -53,13 +53,13 @@ public class PerkDeathsGrasp extends Perk if (event.isCancelled()) return; - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK) return; if (UtilBlock.usable(event.getClickedBlock())) return; - if (!UtilGear.isAxe(event.getPlayer().getItemInHand())) + if (!UtilGear.isBow(event.getPlayer().getItemInHand())) return; Player player = event.getPlayer(); @@ -114,7 +114,7 @@ public class PerkDeathsGrasp extends Perk if (!UtilTime.elapsed(_live.get(ent), 1000)) continue; - _live.remove(ent); + leapIter.remove(); } //Weakness End @@ -177,7 +177,7 @@ public class PerkDeathsGrasp extends Perk if (!Manager.IsAlive(damager)) return; - event.AddMod(GetName(), GetName() + " Combo", 4, true); + event.AddMult(GetName(), GetName() + " Combo", 2, true); UtilParticle.PlayParticle(ParticleType.RED_DUST, event.GetDamageeEntity().getLocation(), 0.5f, 0.5f, 0.5f, 0, 20); UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.GetDamageeEntity().getLocation(), 0, 0, 0, 0, 1); 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 index 2f9c40f26..c8c2946a3 100644 --- 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 @@ -122,10 +122,10 @@ public class PerkFirefly extends SmashPerk if (_tick == 0) { //Firework - UtilFirework.playFirework(data.Player.getLocation().add(0, 0.6, 0), Type.BURST, Color.RED, superActive, superActive); + UtilFirework.playFirework(data.Player.getLocation().add(0, 0.6, 0), isSuperActive(data.Player) ? Type.BALL : Type.BURST, Color.RED, false, superActive); } - for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), isSuperActive(data.Player) ? 5 : 4)) + for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), isSuperActive(data.Player) ? 6 : 4)) { if (other.equals(data.Player)) continue; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java index 1835f3bca..ad5b33be5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java @@ -22,8 +22,9 @@ 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.SmashPerk; -public class PerkNeedler extends Perk +public class PerkNeedler extends SmashPerk { private HashMap _active = new HashMap(); private HashSet _arrows = new HashSet(); @@ -56,7 +57,7 @@ public class PerkNeedler extends Perk if (!Kit.HasKit(player)) return; - if (!Recharge.Instance.use(player, GetName(), 1800, true, true)) + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 1000 : 1800, true, true)) return; _active.put(player, 8); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java new file mode 100644 index 000000000..85003f3fa --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java @@ -0,0 +1,202 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.Iterator; +import java.util.WeakHashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +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.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.UtilParticle; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.SmashPerk; + +public class PerkOvercharge extends SmashPerk +{ + private WeakHashMap _charge = new WeakHashMap(); + private WeakHashMap _chargeLast = new WeakHashMap(); + + private WeakHashMap _arrows = new WeakHashMap(); + + 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) + { + Player player = event.getPlayer(); + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW) + return; + + if (isSuperActive(player)) + return; + + if (!Kit.HasKit(player)) + return; + + if (!player.getInventory().contains(Material.ARROW)) + return; + + if (event.getClickedBlock() != null) + if (UtilBlock.usable(event.getClickedBlock())) + return; + + // Start Charge + _charge.put(player, 0); + _chargeLast.put(player, System.currentTimeMillis()); + } + + @EventHandler + public void charge(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : UtilServer.getPlayers()) + { + // Not Charging + if (!_charge.containsKey(cur)) + continue; + + // Max Charge + if (_charge.get(cur) >= _max) + continue; + + // Charge Interval + if (_charge.get(cur) == 0) + { + if (!UtilTime.elapsed(_chargeLast.get(cur), 1000)) + continue; + } + else + { + if (!UtilTime.elapsed(_chargeLast.get(cur), _tick)) + continue; + } + + // No Longer Holding Bow + if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW) + { + if (_useExp) + cur.setExp(0f); + + _charge.remove(cur); + _chargeLast.remove(cur); + continue; + } + + // Increase Charge + _charge.put(cur, _charge.get(cur) + 1); + + if (_useExp) + cur.setExp(Math.min(0.9999f, (float)_charge.get(cur) / (float)_max)); + + _chargeLast.put(cur, 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)) + return; + + int charge = _charge.remove(player); + if (charge <= 0) + return; + + // Start Barrage + _arrows.put(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, true); + } + + @EventHandler + public void clean(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Iterator arrowIterator = _arrows.keySet().iterator(); arrowIterator.hasNext();) + { + Entity arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid()) + arrowIterator.remove(); + else + UtilParticle.PlayParticle(ParticleType.RED_DUST, arrow.getLocation(), 0, 0, 0, 0, 1); + } + } + + @EventHandler + public void quit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + _charge.remove(player); + _chargeLast.remove(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpidersNest.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpidersNest.java new file mode 100644 index 000000000..6a2dfbaf9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpidersNest.java @@ -0,0 +1,111 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashMap; +import java.util.WeakHashMap; + +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.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.SmashPerk; + +public class PerkSpidersNest extends SmashPerk +{ + private WeakHashMap _preHealth = new WeakHashMap(); + + public PerkSpidersNest() + { + super("Spider Nest", new String[] {}); + } + + @Override + public void addSuperCustom(Player player) + { + //Nest + HashMap 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) + Manager.GetBlockRestore().Add(block, 30, (byte)0, (long) (30000 + 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 (!isSuperActive(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 (!isSuperActive(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); + + UtilParticle.PlayParticle(ParticleType.RED_DUST, damagee.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12); + + 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/kit/perks/PerkWebShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java index f69fad40c..6657a5391 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java @@ -17,15 +17,14 @@ 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.UtilInv; 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.kit.Perk; +import nautilus.game.arcade.kit.SmashPerk; -public class PerkWebShot extends Perk implements IThrown +public class PerkWebShot extends SmashPerk implements IThrown { public PerkWebShot() { @@ -59,7 +58,7 @@ public class PerkWebShot extends Perk implements IThrown if (!Kit.HasKit(player)) return; - if (!Recharge.Instance.use(player, GetName(), 10000, true, true)) + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 1000 : 10000, true, true)) return; event.setCancelled(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java new file mode 100644 index 000000000..49a9a4d90 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java @@ -0,0 +1,148 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashMap; +import java.util.Iterator; + +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.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.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.itemstack.ItemStackFactory; +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.kit.SmashPerk; + +public class PerkZombieBile extends SmashPerk implements IThrown +{ + private HashMap _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 (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("_AXE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 8000, true, 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; + + Iterator activeIter = _active.keySet().iterator(); + + while (activeIter.hasNext()) + { + Player player = activeIter.next(); + + //Expire + if (UtilTime.elapsed(_active.get(player), 2400)) + { + 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.6,(Math.random()-0.5)*0.6,(Math.random()-0.5)*0.6); + + org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()).subtract(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(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, 1.5d); + } + } + } + + @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, true, 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/PerkZombieRot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieRot.java new file mode 100644 index 000000000..d3da06539 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieRot.java @@ -0,0 +1,67 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashMap; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +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.SmashPerk; + +public class PerkZombieRot extends SmashPerk +{ + public PerkZombieRot() + { + super("Rot", new String[] + { + C.cGray + "Leave a path that slows and prevents jumping.", + }); + } + + @EventHandler + public void SnowAura(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!Kit.HasKit(player)) + continue; + + //Blocks + HashMap blocks = UtilBlock.getInRadius(player.getLocation(), 3); + for (Block block : blocks.keySet()) + { + if (UtilBlock.solid(block.getRelative(BlockFace.UP))) + continue; + + if (!UtilBlock.solid(block)) + continue; + + //Snow + Manager.GetBlockRestore().Add(block, 159, (byte)12, 3000); + } + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (Kit.HasKit(player)) + continue; + + if (player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.STAINED_CLAY || + player.getLocation().getBlock().getRelative(BlockFace.DOWN).getData() != 12) + continue; + + Manager.GetCondition().Factory().Slow(GetName(), player, null, 1.9, 1, false, false, false, false); + Manager.GetCondition().Factory().Jump(GetName(), player, null, 1.9, 244, false, false, false); + } + } +}