diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java index a659a2ee2..ebaebf084 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java @@ -1,10 +1,10 @@ package nautilus.game.arcade.game.games.smash.perks.zombie; -import java.time.temporal.WeekFields; import java.util.HashMap; import java.util.Iterator; +import java.util.Map; -import org.bukkit.GameMode; +import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Arrow; import org.bukkit.entity.LivingEntity; @@ -14,7 +14,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; +import org.fusesource.jansi.internal.Kernel32.COORD; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -22,14 +22,16 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -38,50 +40,61 @@ import nautilus.game.arcade.kit.Perk; public class PerkDeathsGrasp extends Perk { - private HashMap _live = new HashMap(); - private HashMap _weakness = new HashMap(); + + private static final int COOLDOWN = 12000; + + private Map _live = new HashMap<>(); + private Map _weakness = new HashMap<>(); - public PerkDeathsGrasp() + public PerkDeathsGrasp() { - super("Deaths Grasp", new String[] - { - C.cYellow + "Left-Click" + C.cGray + " with Bow to use " + C.cGreen + "Deaths Grasp", - C.cGray + "+100% Arrow Damage to enemies thrown by Deaths Grasp" - }); + super("Deaths Grasp", new String[] { C.cYellow + "Left-Click" + C.cGray + " with Bow to use " + C.cGreen + "Deaths Grasp", C.cGray + "+100% Arrow Damage to enemies thrown by Deaths Grasp" }); } @EventHandler public void leap(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.L)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (!UtilGear.isBow(event.getPlayer().getItemInHand())) - return; + } Player player = event.getPlayer(); - if (!Kit.HasKit(player)) + if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW) + { return; + } - if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) + if (!hasPerk(player)) + { return; + } + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + UtilAction.velocity(player, player.getLocation().getDirection(), 1.4, false, 0, 0.2, 1.2, true); - //Record + // Record _live.put(player, System.currentTimeMillis()); - //Inform + // Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); - - //Effect + + // Effect player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_HURT, 1f, 1.4f); } @@ -89,9 +102,11 @@ public class PerkDeathsGrasp extends Perk public void end(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - - //Collide + } + + // Collide for (Player player : Manager.GetGame().GetPlayers(true)) if (_live.containsKey(player)) for (Player other : Manager.GetGame().GetPlayers(true)) @@ -104,62 +119,60 @@ public class PerkDeathsGrasp extends Perk return; } - //Leap End + // Leap End Iterator leapIter = _live.keySet().iterator(); - + while (leapIter.hasNext()) { LivingEntity ent = leapIter.next(); - + if (!UtilEnt.isGrounded(ent)) continue; - - if (!UtilTime.elapsed(_live.get(ent), 1000)) + + if (!UtilTime.elapsed(_live.get(ent), 1000)) continue; - + leapIter.remove(); } - //Weakness End + // Weakness End Iterator weaknessIter = _weakness.keySet().iterator(); - + while (weaknessIter.hasNext()) { LivingEntity ent = weaknessIter.next(); - + if (!UtilEnt.isGrounded(ent)) continue; - - if (!UtilTime.elapsed(_weakness.get(ent), 1000)) + + if (!UtilTime.elapsed(_weakness.get(ent), 1000)) continue; - + weaknessIter.remove(); } } - + public void collide(Player damager, LivingEntity damagee) { - //Damage Event - Manager.GetDamage().NewDamageEvent(damagee, damager, null, - DamageCause.CUSTOM, 6, false, true, false, - damager.getName(), GetName()); - + // Damage Event + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, 6, false, true, false, damager.getName(), GetName()); + UtilAction.velocity(damagee, UtilAlg.getTrajectory2d(damagee, damager), 1.6, false, 0, 1.2, 1.8, true); - + UtilAction.zeroVelocity(damager); - + damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_HURT, 1f, 0.7f); - + _weakness.put(damagee, System.currentTimeMillis()); - //Inform + // Inform UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); - + Recharge.Instance.recharge(damager, GetName()); Recharge.Instance.use(damager, GetName(), 2000, true, true); } - + @EventHandler(priority = EventPriority.HIGH) public void arrowDamage(CustomDamageEvent event) { @@ -168,26 +181,25 @@ public class PerkDeathsGrasp extends Perk if (!(event.GetProjectile() instanceof Arrow)) return; - + if (!_weakness.containsKey(event.GetDamageeEntity())) return; Player damager = event.GetDamagerPlayer(true); - if (damager == null) return; + if (damager == null) + return; if (!Kit.HasKit(damager)) return; - + if (!Manager.IsAlive(damager)) return; event.AddMult(GetName(), GetName() + " Combo", 2, true); - - UtilParticle.PlayParticle(ParticleType.RED_DUST, event.GetDamageeEntity().getLocation(), 0.5f, 0.5f, 0.5f, 0, 20, - ViewDist.MAX, UtilServer.getPlayers()); - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.GetDamageeEntity().getLocation(), 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - + + UtilParticle.PlayParticle(ParticleType.RED_DUST, event.GetDamageeEntity().getLocation(), 0.5f, 0.5f, 0.5f, 0, 20, ViewDist.MAX, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.GetDamageeEntity().getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_HURT, 1f, 2f); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java index 982230c41..cea58d3c1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java @@ -40,7 +40,10 @@ public class PerkZombieBile extends SmashPerk implements IThrown { private static final int COOLDOWN = 10000; - + private static final int ITEMS = 3; + private static final int DAMAGE = 3; + private static final int KNOCKBACK_MAGNITUDE = 1; + private Map _active = new HashMap<>(); public PerkZombieBile() @@ -128,13 +131,13 @@ public class PerkZombieBile extends SmashPerk implements IThrown } // Projectiles - for (int i = 0; i < 3; i++) + for (int i = 0; i < ITEMS; i++) { Vector rand = new Vector((Math.random() - 0.5) * 0.525, (Math.random() - 0.5) * 0.525, (Math.random() - 0.5) * 0.525); Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()).subtract(0, 0.5, 0), new ItemStack(Material.ROTTEN_FLESH)); UtilAction.velocity(ent, player.getLocation().getDirection().add(rand), 0.8, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, System.currentTimeMillis() + 2000, true, true, true, false, 0.5f); + Manager.GetProjectile().AddThrow(ent, player, this, 2000, true, true, true, false, 0.5f); } } } @@ -142,10 +145,7 @@ public class PerkZombieBile extends SmashPerk implements IThrown @EventHandler public void death(PlayerDeathEvent event) { - if (_active.containsKey(event.getEntity())) - { - _active.remove(event.getEntity()); - } + _active.remove(event.getEntity().getUniqueId()); } @Override @@ -154,14 +154,17 @@ public class PerkZombieBile extends SmashPerk implements IThrown data.getThrown().remove(); if (target == null) + { return; - - if (target instanceof Player) - if (!Manager.GetGame().IsAlive((Player) target)) - return; - + } + + if (UtilPlayer.isSpectator(target)) + { + return; + } + // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 3, true, false, false, UtilEnt.getName(data.getThrower()), GetName()); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, DAMAGE, true, false, false, UtilEnt.getName(data.getThrower()), GetName()); data.getThrown().remove(); } @@ -182,8 +185,10 @@ public class PerkZombieBile extends SmashPerk implements IThrown public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; - - event.AddKnockback(GetName(), 1); + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } }