Whoops
This commit is contained in:
parent
baafa62713
commit
315a50aa16
@ -1,10 +1,10 @@
|
|||||||
package nautilus.game.arcade.game.games.smash.perks.zombie;
|
package nautilus.game.arcade.game.games.smash.perks.zombie;
|
||||||
|
|
||||||
import java.time.temporal.WeekFields;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -14,7 +14,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
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.C;
|
||||||
import mineplex.core.common.util.F;
|
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.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilBlock;
|
import mineplex.core.common.util.UtilBlock;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilEvent;
|
||||||
import mineplex.core.common.util.UtilGear;
|
import mineplex.core.common.util.UtilGear;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilParticle;
|
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.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
@ -38,50 +40,61 @@ import nautilus.game.arcade.kit.Perk;
|
|||||||
|
|
||||||
public class PerkDeathsGrasp extends Perk
|
public class PerkDeathsGrasp extends Perk
|
||||||
{
|
{
|
||||||
private HashMap<LivingEntity, Long> _live = new HashMap<LivingEntity, Long>();
|
|
||||||
private HashMap<LivingEntity, Long> _weakness = new HashMap<LivingEntity, Long>();
|
private static final int COOLDOWN = 12000;
|
||||||
|
|
||||||
|
private Map<LivingEntity, Long> _live = new HashMap<>();
|
||||||
|
private Map<LivingEntity, Long> _weakness = new HashMap<>();
|
||||||
|
|
||||||
public PerkDeathsGrasp()
|
public PerkDeathsGrasp()
|
||||||
{
|
{
|
||||||
super("Deaths Grasp", new String[]
|
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" });
|
||||||
{
|
|
||||||
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
|
@EventHandler
|
||||||
public void leap(PlayerInteractEvent event)
|
public void leap(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK)
|
if (!UtilEvent.isAction(event, ActionType.L))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (UtilBlock.usable(event.getClickedBlock()))
|
if (UtilBlock.usable(event.getClickedBlock()))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (!UtilGear.isBow(event.getPlayer().getItemInHand()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!Kit.HasKit(player))
|
if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Recharge.Instance.use(player, GetName(), 12000, true, true))
|
if (!hasPerk(player))
|
||||||
|
{
|
||||||
return;
|
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);
|
UtilAction.velocity(player, player.getLocation().getDirection(), 1.4, false, 0, 0.2, 1.2, true);
|
||||||
|
|
||||||
//Record
|
// Record
|
||||||
_live.put(player, System.currentTimeMillis());
|
_live.put(player, System.currentTimeMillis());
|
||||||
|
|
||||||
//Inform
|
// Inform
|
||||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||||
|
|
||||||
//Effect
|
// Effect
|
||||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_HURT, 1f, 1.4f);
|
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)
|
public void end(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Collide
|
// Collide
|
||||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||||
if (_live.containsKey(player))
|
if (_live.containsKey(player))
|
||||||
for (Player other : Manager.GetGame().GetPlayers(true))
|
for (Player other : Manager.GetGame().GetPlayers(true))
|
||||||
@ -104,7 +119,7 @@ public class PerkDeathsGrasp extends Perk
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Leap End
|
// Leap End
|
||||||
Iterator<LivingEntity> leapIter = _live.keySet().iterator();
|
Iterator<LivingEntity> leapIter = _live.keySet().iterator();
|
||||||
|
|
||||||
while (leapIter.hasNext())
|
while (leapIter.hasNext())
|
||||||
@ -120,7 +135,7 @@ public class PerkDeathsGrasp extends Perk
|
|||||||
leapIter.remove();
|
leapIter.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Weakness End
|
// Weakness End
|
||||||
Iterator<LivingEntity> weaknessIter = _weakness.keySet().iterator();
|
Iterator<LivingEntity> weaknessIter = _weakness.keySet().iterator();
|
||||||
|
|
||||||
while (weaknessIter.hasNext())
|
while (weaknessIter.hasNext())
|
||||||
@ -139,10 +154,8 @@ public class PerkDeathsGrasp extends Perk
|
|||||||
|
|
||||||
public void collide(Player damager, LivingEntity damagee)
|
public void collide(Player damager, LivingEntity damagee)
|
||||||
{
|
{
|
||||||
//Damage Event
|
// Damage Event
|
||||||
Manager.GetDamage().NewDamageEvent(damagee, damager, null,
|
Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, 6, false, true, false, damager.getName(), GetName());
|
||||||
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.velocity(damagee, UtilAlg.getTrajectory2d(damagee, damager), 1.6, false, 0, 1.2, 1.8, true);
|
||||||
|
|
||||||
@ -152,7 +165,7 @@ public class PerkDeathsGrasp extends Perk
|
|||||||
|
|
||||||
_weakness.put(damagee, System.currentTimeMillis());
|
_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(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()) + "."));
|
UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + "."));
|
||||||
|
|
||||||
@ -173,7 +186,8 @@ public class PerkDeathsGrasp extends Perk
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Player damager = event.GetDamagerPlayer(true);
|
Player damager = event.GetDamagerPlayer(true);
|
||||||
if (damager == null) return;
|
if (damager == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!Kit.HasKit(damager))
|
if (!Kit.HasKit(damager))
|
||||||
return;
|
return;
|
||||||
@ -183,10 +197,8 @@ public class PerkDeathsGrasp extends Perk
|
|||||||
|
|
||||||
event.AddMult(GetName(), GetName() + " Combo", 2, 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.RED_DUST, event.GetDamageeEntity().getLocation(), 0.5f, 0.5f, 0.5f, 0, 20, ViewDist.MAX, UtilServer.getPlayers());
|
||||||
ViewDist.MAX, UtilServer.getPlayers());
|
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.GetDamageeEntity().getLocation(), 0, 0, 0, 0, 1, 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);
|
damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_HURT, 1f, 2f);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,9 @@ public class PerkZombieBile extends SmashPerk implements IThrown
|
|||||||
{
|
{
|
||||||
|
|
||||||
private static final int COOLDOWN = 10000;
|
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<UUID, Long> _active = new HashMap<>();
|
private Map<UUID, Long> _active = new HashMap<>();
|
||||||
|
|
||||||
@ -128,13 +131,13 @@ public class PerkZombieBile extends SmashPerk implements IThrown
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Projectiles
|
// 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);
|
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));
|
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);
|
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
|
@EventHandler
|
||||||
public void death(PlayerDeathEvent event)
|
public void death(PlayerDeathEvent event)
|
||||||
{
|
{
|
||||||
if (_active.containsKey(event.getEntity()))
|
_active.remove(event.getEntity().getUniqueId());
|
||||||
{
|
|
||||||
_active.remove(event.getEntity());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -154,14 +154,17 @@ public class PerkZombieBile extends SmashPerk implements IThrown
|
|||||||
data.getThrown().remove();
|
data.getThrown().remove();
|
||||||
|
|
||||||
if (target == null)
|
if (target == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (target instanceof Player)
|
if (UtilPlayer.isSpectator(target))
|
||||||
if (!Manager.GetGame().IsAlive((Player) target))
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Damage Event
|
// 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();
|
data.getThrown().remove();
|
||||||
}
|
}
|
||||||
@ -182,8 +185,10 @@ public class PerkZombieBile extends SmashPerk implements IThrown
|
|||||||
public void Knockback(CustomDamageEvent event)
|
public void Knockback(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
|
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
event.AddKnockback(GetName(), 1);
|
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user