diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java index cefda5788..b0013e5a6 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java @@ -284,8 +284,19 @@ public class UtilEnt return ents; } - public static boolean hitBox(Location loc, LivingEntity ent, double mult) + public static boolean hitBox(Location loc, LivingEntity ent, double mult, EntityType disguise) { + if (disguise != null) + { + if (disguise == EntityType.SQUID) + { + if (UtilMath.offset(loc, ent.getLocation().add(0, 0.4, 0)) < 0.6 * mult) + return true; + + return false; + } + } + if (ent instanceof Player) { Player player = (Player)ent; @@ -304,7 +315,7 @@ public class UtilEnt } else if (loc.getY() > ent.getLocation().getY() && loc.getY() < ent.getLocation().getY() + 1) - if (UtilMath.offset2d(loc, ent.getLocation()) < 0.5) + if (UtilMath.offset2d(loc, ent.getLocation()) < 0.5 * mult) return true; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java index f0616c88c..380df6fcb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java @@ -4,6 +4,7 @@ import java.util.HashSet; import java.util.WeakHashMap; import mineplex.core.MiniPlugin; +import mineplex.core.disguise.DisguiseManager; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; @@ -31,7 +32,15 @@ public class ProjectileManager extends MiniPlugin { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, expireTime, hitPlayer, hitBlock, idle, false, - null, 1f, 1f, null, 0, null, hitboxMult)); + null, 1f, 1f, null, 0, null, hitboxMult, null)); + } + + public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, + long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, double hitboxMult, DisguiseManager disguise) + { + _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, + expireTime, hitPlayer, hitBlock, idle, false, + null, 1f, 1f, null, 0, null, hitboxMult, disguise)); } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, @@ -39,7 +48,7 @@ public class ProjectileManager extends MiniPlugin { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, expireTime, hitPlayer, hitBlock, idle, pickup, - null, 1f, 1f, null, 0, null, hitboxMult)); + null, 1f, 1f, null, 0, null, hitboxMult, null)); } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, @@ -48,7 +57,7 @@ public class ProjectileManager extends MiniPlugin { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, expireTime, hitPlayer, hitBlock, idle, false, - sound, soundVolume, soundPitch, effect, effectData, effectRate, hitboxMult)); + sound, soundVolume, soundPitch, effect, effectData, effectRate, hitboxMult, null)); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java index 5d025ca82..d051848a6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java @@ -4,6 +4,8 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.disguise.disguises.DisguiseSquid; import org.bukkit.Effect; import org.bukkit.GameMode; @@ -12,6 +14,7 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -37,11 +40,12 @@ public class ProjectileUser private UpdateType _effectRate = UpdateType.TICK; private double _hitboxMult = 1; + private DisguiseManager _disguise; public ProjectileUser(ProjectileManager throwInput, Entity thrown, LivingEntity thrower, IThrown callback, long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate, - double hitboxMult) + double hitboxMult, DisguiseManager disguise) { Throw = throwInput; @@ -63,6 +67,7 @@ public class ProjectileUser _effectRate = effectRate; _hitboxMult = hitboxMult; + _disguise = disguise; } public void Effect(UpdateEvent event) @@ -108,8 +113,15 @@ public class ProjectileUser if (((Player)ent).getGameMode() == GameMode.CREATIVE) continue; + EntityType disguise = null; + if (_disguise != null && _disguise.getDisguise(ent) != null) + { + if (_disguise.getDisguise(ent) instanceof DisguiseSquid) + disguise = EntityType.SQUID; + } + //Hit Player - if (UtilEnt.hitBox(_thrown.getLocation(), ent, _hitboxMult)) + if (UtilEnt.hitBox(_thrown.getLocation(), ent, _hitboxMult, disguise)) { _callback.Collide(ent, null, this); return true; diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java index 787eb354a..7f9dea9f5 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java @@ -80,7 +80,7 @@ public class Fire extends MiniPlugin } - if (!UtilEnt.hitBox(fire.getLocation(), ent, 1.5)) + if (!UtilEnt.hitBox(fire.getLocation(), ent, 1.5, null)) continue; collided.put(fire, ent); @@ -120,7 +120,7 @@ public class Fire extends MiniPlugin return; } - if (!UtilEnt.hitBox(fire.getLocation(), player, 1.5)) + if (!UtilEnt.hitBox(fire.getLocation(), player, 1.5, null)) return; //Remove diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java index bbac27718..25606e5a9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java @@ -30,7 +30,7 @@ public class BaconBrawl extends SoloGame new String[] { "Knock other pigs out of the arena!", - "Last pig in the arena wins!" + "Last pig in the arena wins!" }); this.DamageTeamSelf = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitSniper.java index 0cc188cdc..f78b0ed16 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitSniper.java @@ -30,7 +30,7 @@ public class KitSniper extends Kit new Perk[] { new PerkSquidSwim(), - new PerkSquidSniper() + new PerkSquidSniper() }, EntityType.SQUID, new ItemStack(Material.INK_SACK)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidRifle.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidRifle.java index 772238e8e..1343bf474 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidRifle.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidRifle.java @@ -88,10 +88,8 @@ public class PerkSquidRifle extends Perk implements IThrown Firework fw = Manager.GetFirework().launchFirework(player.getEyeLocation().subtract(0, 0.5, 0).add(player.getLocation().getDirection()), effect, vel); _fireworks.put(fw, vel); - Manager.GetProjectile().AddThrow(fw, player, this, -1, true, true, true, - null, 1f, 1f, - null, 1, UpdateType.SLOW, - 2.5d); + //Projectile + Manager.GetProjectile().AddThrow(fw, player, this, -1, true, true, true, 2d, Manager.GetDisguise()); } catch (Exception e) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidShotgun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidShotgun.java index c6f45b477..5fda4bff9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidShotgun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidShotgun.java @@ -95,10 +95,8 @@ public class PerkSquidShotgun extends Perk implements IThrown Firework fw = Manager.GetFirework().launchFirework(player.getEyeLocation().subtract(0, 0.5, 0).add(player.getLocation().getDirection()), effect, vel); _fireworks.put(fw, vel); - Manager.GetProjectile().AddThrow(fw, player, this, -1, true, true, true, - null, 1f, 1f, - null, 1, UpdateType.SLOW, - 2.5d); + //Projectile + Manager.GetProjectile().AddThrow(fw, player, this, -1, true, true, true, 2d, Manager.GetDisguise()); } catch (Exception e) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSniper.java index 3a8d0b51f..ba965db7d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSniper.java @@ -88,10 +88,8 @@ public class PerkSquidSniper extends Perk implements IThrown Firework fw = Manager.GetFirework().launchFirework(player.getEyeLocation().subtract(0, 0.5, 0).add(player.getLocation().getDirection()), effect, vel); _fireworks.put(fw, vel); - Manager.GetProjectile().AddThrow(fw, player, this, -1, true, true, true, - null, 1f, 1f, - null, 1, UpdateType.SLOW, - 3d); + //Projectile + Manager.GetProjectile().AddThrow(fw, player, this, -1, true, true, true, 2d, Manager.GetDisguise()); } catch (Exception e) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSwim.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSwim.java index edd49570d..1f6ea91fe 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSwim.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSwim.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; -import java.util.Iterator; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -18,16 +17,33 @@ import nautilus.game.arcade.kit.Perk; public class PerkSquidSwim extends Perk { + private HashMap _push = new HashMap(); private HashMap _active = new HashMap(); - + public PerkSquidSwim() { super("Swimming", new String[] { - C.cYellow + "Tap Crouch" + C.cGray + " to use " + C.cGreen + "Squid Thrust" + C.cYellow + "Tap Crouch" + C.cGray + " to use " + C.cGreen + "Squid Thrust", + C.cYellow + "Hold Crouch" + C.cGray + " to use " + C.cGreen + "Squid Swim" }); } + @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.007)); + } + } + @EventHandler public void Use(PlayerToggleSneakEvent event) { @@ -36,48 +52,69 @@ public class PerkSquidSwim extends Perk Player player = event.getPlayer(); + //Store Push + if (!player.isSneaking()) + { + _push.put(event.getPlayer(), System.currentTimeMillis()); + return; + } + + if (!_push.containsKey(player) || UtilTime.elapsed(_push.get(player), 500)) + return; + if (!Kit.HasKit(player)) return; - - event.setCancelled(true); if (!player.getLocation().getBlock().isLiquid()) return; - + + if (player.getExp() < 0.5) + return; + if (!Recharge.Instance.use(player, GetName(), 500, false)) return; - + + player.setExp(player.getExp() - 0.5f); + //Velocity UtilAction.velocity(player, 0.9, 0.2, 2, false); - + //Sound player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 0.5f, 0.75f); - + _active.put(player, System.currentTimeMillis()); } - + @EventHandler public void Reuse(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; - - Iterator swimIterator = _active.keySet().iterator(); - - while (swimIterator.hasNext()) + + for (Player player : Manager.GetGame().GetPlayers(true)) { - Player player = swimIterator.next(); - - if (UtilTime.elapsed(_active.get(player), 200)) - { - swimIterator.remove(); - continue; - } - if (!player.getLocation().getBlock().isLiquid()) continue; + + //Fast Thrust + if (_active.containsKey(player)) + { + if (!UtilTime.elapsed(_active.get(player), 200)) + { + UtilAction.velocity(player, 1, 0.1, 2, false); + continue; + } + else + { + _active.remove(player); + } + } - UtilAction.velocity(player, 0.9, 0.2, 2, false); + //Swim + if (player.isSneaking()) + { + UtilAction.velocity(player, 0.5, 0, 2, false); + } } } }