diff --git a/Maps/Gravity/Gravity_ShatteredSatalite.zip b/Maps/Gravity/Gravity_ShatteredSatalite.zip new file mode 100644 index 000000000..3293bce41 Binary files /dev/null and b/Maps/Gravity/Gravity_ShatteredSatalite.zip differ diff --git a/Maps/Gravity/Space.zip b/Maps/Gravity/Space.zip deleted file mode 100644 index 1d8830b4c..000000000 Binary files a/Maps/Gravity/Space.zip and /dev/null differ diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBat.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBat.java index a13c7b305..8788d0702 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBat.java @@ -9,12 +9,12 @@ public class DisguiseBat extends DisguiseAnimal DataWatcher.a(16, new Byte((byte)0)); } - public boolean isFlying() + public boolean isSitting() { return (DataWatcher.getByte(16) & 0x1) != 0; } - public void setFlying(boolean paramBoolean) + public void setSitting(boolean paramBoolean) { int i = DataWatcher.getByte(16); if (paramBoolean) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index cc7f503e2..78e6118e8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -1000,8 +1000,15 @@ public abstract class Game implements Listener _helpTimer = System.currentTimeMillis(); - Announce(C.cWhite + C.Bold + "TIP " + ChatColor.RESET + _helpColor + _help[_helpIndex]); + String msg = C.cWhite + C.Bold + "TIP " + ChatColor.RESET + _helpColor + _help[_helpIndex]; + + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1f); + UtilPlayer.message(player, msg); + } + _helpIndex = (_helpIndex + 1)%_help.length; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java index 00b3e0f5a..561335a37 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java @@ -5,17 +5,25 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; +import org.bukkit.FireworkEffect.Type; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftFallingSand; +import org.bukkit.entity.Arrow; import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; import org.bukkit.entity.Slime; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; @@ -25,8 +33,13 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -50,6 +63,12 @@ public class Gravity extends SoloGame //Player Hooks private HashMap _hooks = new HashMap(); + private HashMap _arrows = new HashMap(); + + private ArrayList _powerups = new ArrayList(); + private Location _powerup = null; + private long _lastPowerup = 0; + public Gravity(ArcadeManager manager) { super(manager, GameType.Gravity, @@ -61,30 +80,38 @@ public class Gravity extends SoloGame new String[] { - C.cGreen + "Push Drop" + C.cGray + " to kick off blocks", - C.cGreen + "Left-Click" + C.cGray + " to use " + F.skill("Block Cannon"), + C.cGreen + "Push Drop" + C.cGray + " to boost off blocks", + C.cGreen + "Left-Click" + C.cGray + " to use " + F.skill("Sonic Blast"), C.cGreen + "Right-Click" + C.cGray + " to use " + F.skill("Jetpack"), "Food is Oxygen. Restore it at Emerald Blocks.", "Last player alive wins!" }); - + _help = new String[] { "Push DROP to launch yourself off platforms.", "You automatically grab onto nearby platforms.", "Hold Block to use your Jetpack", "Your Experience Bar is your Jetpack Fuel", + "Restore Jetpack Fuel by collecting Powerups", + "Powerups are flashing green fireworks", "Your Hunger is your Oxygen Level", "Restore Oxygen at the Emerald Blocks", }; this.DamagePvP = false; - this.HungerSet = 20; + this.HungerSet = 10; this.WorldTimeSet = 18000; - + this.CompassEnabled = true; } + + @Override + public void ParseData() + { + _powerups = this.WorldData.GetDataLocs("LIME"); + } @EventHandler public void CreatePlayerObjects(GameStateChangeEvent event) @@ -100,6 +127,27 @@ public class Gravity extends SoloGame player.setExp(0.9999f); } } + + @EventHandler + public void AnnounceBoost(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + Announce(C.Bold + C.cPurple + "Press " + C.Bold + C.cWhite + "DROP WEAPON" + C.Bold + C.cPurple + " to boost yourself off platforms!"); + } + + @EventHandler + public void ClearObjects(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + for (GravityObject obj : _objects) + obj.Clean(); + + _objects.clear(); + } @EventHandler public void KickOff(PlayerDropItemEvent event) @@ -114,7 +162,7 @@ public class Gravity extends SoloGame @EventHandler public void Jetpack(UpdateEvent event) { - if (!IsLive()) + if (!InProgress()) return; if (event.getType() != UpdateType.TICK) @@ -128,6 +176,9 @@ public class Gravity extends SoloGame @EventHandler public void Shoot(PlayerInteractEvent event) { + if (!IsLive()) + return; + if (event.isCancelled()) return; @@ -149,15 +200,29 @@ public class Gravity extends SoloGame return; //Projectile + Vector vel = player.getLocation().getDirection().multiply(1.2); + + Arrow arrow = player.getWorld().spawnArrow( + player.getEyeLocation().add(player.getLocation().getDirection().multiply(2.5)).subtract(new Vector(0,0.8,0)), + player.getLocation().getDirection(), (float) vel.length(), 0f); + arrow.setShooter(player); + + UtilEnt.ghost(arrow, true, true); + + _arrows.put(arrow, vel); + + event.setCancelled(true); + + /* OLD Vector velocity = player.getLocation().getDirection().multiply(1.2); - FallingBlock projectile = player.getWorld().spawnFallingBlock(player.getEyeLocation().add(player.getLocation().getDirection().multiply(2)), Material.SKULL, (byte)0); + FallingBlock projectile = player.getWorld().spawnFallingBlock(player.getEyeLocation().subtract(0, 1.2, 0).add(player.getLocation().getDirection().multiply(2)), Material.SKULL, (byte)0); - _objects.add(new GravityBomb(this, projectile, 12, velocity)); + _objects.add(new GravityBomb(this, projectile, 12, velocity, player)); //Sound - player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 2f, 0.25f); - player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 2f, 0.25f); + player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.5f, 2f); + */ } @EventHandler @@ -371,14 +436,14 @@ public class Gravity extends SoloGame if (!(obj instanceof GravityBomb)) continue; - - HashSet debris = ((GravityBomb)obj).DetonateCheck(); - - if (!debris.isEmpty()) + + HashSet debris = ((GravityBomb)obj).BombDetonate(); + + if (debris != null && !debris.isEmpty()) { newDebris.addAll(debris); objectIterator.remove(); - obj.CustomCollide(); + obj.CustomCollide(null); obj.Clean(); } } @@ -401,18 +466,191 @@ public class Gravity extends SoloGame event.getEntity().remove(); } } - + @EventHandler public void OxygenSuffocate(UpdateEvent event) { if (event.getType() != UpdateType.SEC) return; - + if (!IsLive()) return; - + for (GravityObject object : _objects) if (object instanceof GravityPlayer) ((GravityPlayer)object).Oxygen(); } + + public ArrayList GetObjects() + { + return _objects; + } + + @EventHandler + public void BowShoot(EntityShootBowEvent event) + { + Player shooter = (Player)event.getEntity(); + + Vector vel = event.getProjectile().getVelocity(); + vel.multiply(0.6); + + Arrow arrow = shooter.getWorld().spawnArrow( + shooter.getEyeLocation().add(shooter.getLocation().getDirection().multiply(1.5)).subtract(new Vector(0,0.8,0)), + shooter.getLocation().getDirection(), (float) vel.length(), 0f); + arrow.setShooter(shooter); + + UtilEnt.ghost(arrow, true, true); + + _arrows.put(arrow, vel); + + event.setCancelled(true); + } + + @EventHandler + public void BowUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator arrowIterator = _arrows.keySet().iterator(); + + while (arrowIterator.hasNext()) + { + Arrow arrow = arrowIterator.next(); + + for (GravityObject obj : _objects) + { + if (UtilMath.offset(obj.Base.getLocation().add(0, 0.5, 0), arrow.getLocation()) > obj.Size) + continue; + + if (obj instanceof GravityPlayer) + { + if (obj.Ent.equals(arrow.getShooter())) + continue; + } + + BowExplode(arrow); + break; + } + + if (!arrow.isValid() || arrow.getTicksLived() > 200) + { + arrow.remove(); + arrowIterator.remove(); + } + else + { + arrow.setVelocity(_arrows.get(arrow)); + UtilParticle.PlayParticle(ParticleType.FLAME, arrow.getLocation(), 0, 0, 0, 0, 1); + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, arrow.getLocation(), 0, 0, 0, 0, 1); + arrow.getWorld().playSound(arrow.getLocation(), Sound.FIZZ, 0.3f, 0.5f); + } + } + } + + @EventHandler + public void BowHit(ProjectileHitEvent event) + { + BowExplode(event.getEntity()); + } + + public void BowExplode(Projectile proj) + { + //Blast Objs + for (GravityObject obj : _objects) + { + if (UtilMath.offset(proj, obj.Base) > 3) + continue; + + obj.AddVelocity(UtilAlg.getTrajectory(proj, obj.Base).multiply(0.4), 10); + + obj.CustomCollide(null); + + obj.GrabDelay = System.currentTimeMillis(); + obj.SetMovingBat(true); + } + + //Blast Debris + for (Block block : UtilBlock.getInRadius(proj.getLocation().add(0, 0.5, 0), 3d).keySet()) + { + if (UtilBlock.airFoliage(block)) + continue; + + if (block.getType() == Material.EMERALD_BLOCK) + continue; + + //Projectile + Vector velocity = UtilAlg.getTrajectory(proj.getLocation(), block.getLocation().add(0.5, 0.5, 0.5)); + velocity.add(proj.getVelocity().normalize()); + velocity.add((new Vector(Math.random()-0.5,Math.random()-0.5,Math.random()-0.5)).multiply(0.5)); + velocity.multiply(0.3); + + //Block + Material type = block.getType(); + byte data = block.getData(); + block.setType(Material.AIR); + + //Projectile + FallingBlock projectile = block.getWorld().spawnFallingBlock(block.getLocation().add(0.5, 0.6, 0.5), type,data); + GravityDebris newDebris = new GravityDebris(this, projectile, 12, velocity); + + //Add + _objects.add(newDebris); + } + + //Effect + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, proj.getLocation(), 0, 0, 0, 0, 1); + proj.getWorld().playSound(proj.getLocation(), Sound.EXPLODE, 0.6f, 1.5f); + + //Remove + proj.remove(); + } + + @EventHandler + public void PowerupUpdate(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.SEC) + return; + + if (!UtilTime.elapsed(_lastPowerup, 15000)) + return; + + if (_powerup == null) + _powerup = UtilAlg.Random(_powerups); + + else + { + FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.GREEN).with(Type.BALL).trail(false).build(); + UtilFirework.playFirework(_powerup, effect); + } + } + + @EventHandler + public void PowerupCollect(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (_powerup == null) + return; + + for (Player player : GetPlayers(true)) + { + if (UtilMath.offset(player.getLocation(), _powerup) < 3) + { + UtilPlayer.message(player, F.main("Game", "You collected " + F.skill("Jetpack Fuel") + "!")); + player.setExp(Math.min(0.9999f, player.getExp() + 0.25f)); + + player.getWorld().playSound(player.getLocation(), Sound.DRINK, 1f, 0.5f); + + _powerup = null; + _lastPowerup = System.currentTimeMillis(); + + break; + } + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java index 12217ec6a..41e02ddab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java @@ -5,15 +5,11 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.disguise.disguises.DisguiseBat; -import mineplex.core.disguise.disguises.DisguiseChicken; +import nautilus.game.arcade.game.games.gravity.objects.*; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftFallingSand; -import org.bukkit.entity.Chicken; import org.bukkit.entity.Entity; -import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Player; -import org.bukkit.entity.Slime; import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; @@ -27,6 +23,7 @@ public abstract class GravityObject public Vector Vel; public Zombie Base; + public DisguiseBat Bat; public long GrabDelay = 0; @@ -54,9 +51,9 @@ public abstract class GravityObject Base.setMaxHealth(60); Base.setHealth(60); - DisguiseBat disguise = new DisguiseBat(Base); - //disguise.setBaby(); - Host.Manager.GetDisguise().disguise(disguise); + Bat = new DisguiseBat(Base); + Bat.setSitting(false); + Host.Manager.GetDisguise().disguise(Bat); UtilEnt.Vegetate(Base, true); UtilEnt.ghost(Base, true, true); @@ -81,21 +78,21 @@ public abstract class GravityObject if (Ent.getVehicle() == null) Base.setPassenger(Ent); - + Base.setVelocity(Vel); //Effect if (Vel.length() > 0) { - if (IsPlayer()) + if (this instanceof GravityPlayer) { - UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, Ent.getLocation().add(0, 0.5, 0), 0, 0, 0, 0, 1); + UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, Ent.getLocation().subtract(0, 0.5, 0), 0, 0, 0, 0, 1); } - else if (Ent instanceof FallingBlock) + else if (this instanceof GravityBomb) { - UtilParticle.PlayParticle(ParticleType.RED_DUST, Ent.getLocation().add(0, -0.1, 0), 0, 0, 0, 0, 1); + UtilParticle.PlayParticle(ParticleType.FLAME, Ent.getLocation().add(0, -0.1, 0), 0, 0, 0, 0, 1); } - else if (Ent instanceof Slime) + else if (this instanceof GravityHook) { UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, Ent.getLocation().add(0, 0.1, 0), 0, 0, 0, 0, 1); } @@ -118,6 +115,9 @@ public abstract class GravityObject if (this.Vel.length() == 0 && other.Vel.length() == 0) return; + if (!this.CanCollide(other) || !other.CanCollide(this)) + return; + double size = this.Size; if (other.Size > size) size = other.Size; @@ -150,11 +150,20 @@ public abstract class GravityObject other.GrabDelay = System.currentTimeMillis(); //Collide - this.CustomCollide(); - other.CustomCollide(); + this.CustomCollide(other); + other.CustomCollide(this); + + //Animation + this.SetMovingBat(true); + other.SetMovingBat(true); } - public void CustomCollide() + public boolean CanCollide(GravityObject other) + { + return true; + } + + public void CustomCollide(GravityObject other) { } @@ -186,12 +195,23 @@ public abstract class GravityObject { Vel.normalize().multiply(3); } + + SetMovingBat(true); } public void Clean() { - Ent.remove(); Ent.leaveVehicle(); + + if (!(Ent instanceof Player)) + Ent.remove(); + Base.remove(); } + + public void SetMovingBat(boolean moving) + { + Bat.setSitting(!moving); + Host.Manager.GetDisguise().updateDisguise(Bat); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/kits/KitJetpack.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/kits/KitJetpack.java index 1bcda50a7..5b9302952 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/kits/KitJetpack.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/kits/KitJetpack.java @@ -37,17 +37,23 @@ public class KitJetpack extends Kit public void GiveItems(Player player) { //player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SHEARS, (byte)0, 1, "Block Cannon")); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, - C.cYellow + "Left-Click: " + C.cWhite + "Block Cannon " + C.cYellow + "Right-Click: " + C.cWhite + "Jetpack")); - //player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1, "Grappling Hook")); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Space Suit")); + + //player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, "Space Shooter")); + //player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 64, "Space Arrows")); + + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.GOLD_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS)); } @Override public void SpawnCustom(LivingEntity ent) { - ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); - ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); - ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); - ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); + ent.getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET)); + ent.getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE)); + ent.getEquipment().setLeggings(new ItemStack(Material.GOLD_LEGGINGS)); + ent.getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS)); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityBomb.java index bc89b2dc6..de2f0adfb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityBomb.java @@ -4,7 +4,9 @@ import java.util.HashSet; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilParticle.ParticleType; import nautilus.game.arcade.game.games.gravity.Gravity; import nautilus.game.arcade.game.games.gravity.GravityObject; @@ -14,13 +16,21 @@ import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.entity.Entity; import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.Player; import org.bukkit.util.Vector; public class GravityBomb extends GravityObject { - public GravityBomb(Gravity host, Entity ent, double mass, Vector vel) + public Player Owner; + private long _blockHitDelay; + + public GravityBomb(Gravity host, Entity ent, double mass, Vector vel, Player owner) { super(host, ent, mass, 1.5, vel); + + Owner = owner; + + _blockHitDelay = System.currentTimeMillis(); } @Override @@ -28,15 +38,107 @@ public class GravityBomb extends GravityObject { Ent.getWorld().playSound(Ent.getLocation(), Sound.EXPLODE, 1f, 1f); } - - public HashSet DetonateCheck() + + public boolean CollideCheck(GravityObject other) { + if (this.equals(other)) + return false; + + if (System.currentTimeMillis() < this.CollideDelay) + return false; + + if (System.currentTimeMillis() < other.CollideDelay) + return false; + + if (this.Vel.length() == 0 && other.Vel.length() == 0) + return false; + + double size = this.Size; + if (other.Size > size) + size = other.Size; + + if (UtilMath.offset(this.Base, other.Base) > size) + return false; + + return true; + } + + public HashSet BombDetonate() + { + boolean collided = false; + + //Collide with Objects + for (GravityObject obj : Host.GetObjects()) + { + if (!CollideCheck(obj)) + continue; + + collided = true; + } + + //Collide with Blocks + if (!collided && UtilTime.elapsed(_blockHitDelay, 100)) + for (Block block : UtilBlock.getInRadius(Base.getLocation().add(0, 0.5, 0), 2d).keySet()) + { + if (UtilBlock.airFoliage(block)) + continue; + + //X + if (block.getLocation().getX() + 0.5 < Base.getLocation().getX()) + if (Vel.getX() > 0) + continue; + + if (block.getLocation().getX() + 0.5 > Base.getLocation().getX()) + if (Vel.getX() < 0) + continue; + + //Y + if (block.getLocation().getY() + 0.5 < Base.getLocation().getY()) + if (Vel.getY() > 0) + continue; + + if (block.getLocation().getY() + 0.5 > Base.getLocation().getY()) + if (Vel.getY() < 0) + continue; + + //Z + if (block.getLocation().getZ() + 0.5 < Base.getLocation().getZ()) + if (Vel.getZ() > 0) + continue; + + if (block.getLocation().getZ() + 0.5 > Base.getLocation().getZ()) + if (Vel.getZ() < 0) + continue; + + collided = true; + break; + } + + if (!collided) + return null; + + //Blast Objs + for (GravityObject obj : Host.GetObjects()) + { + if (UtilMath.offset(this.Base, obj.Base) > 3) + continue; + + if (this.equals(obj)) + continue; + + if (System.currentTimeMillis() < obj.CollideDelay) + continue; + + if (this.Vel.length() == 0 && obj.Vel.length() == 0) + continue; + + obj.AddVelocity(UtilAlg.getTrajectory(this.Base, obj.Base).multiply(0.4), 10); + } + + //Blast Debris HashSet debris = new HashSet(); - if (!Ent.isValid()) - return debris; - - for (Block block : UtilBlock.getInRadius(Ent.getLocation(), 1.5d).keySet()) + for (Block block : UtilBlock.getInRadius(Base.getLocation().add(0, 0.5, 0), 3d).keySet()) { if (UtilBlock.airFoliage(block)) continue; @@ -47,6 +149,7 @@ public class GravityBomb extends GravityObject //Projectile Vector velocity = UtilAlg.getTrajectory(Ent.getLocation(), block.getLocation().add(0.5, 0.5, 0.5)); velocity.add(Vel.clone().normalize()); + velocity.add((new Vector(Math.random()-0.5,Math.random()-0.5,Math.random()-0.5)).multiply(0.5)); velocity.multiply(0.3); //Block @@ -66,9 +169,17 @@ public class GravityBomb extends GravityObject } @Override - public void CustomCollide() + public void CustomCollide(GravityObject other) { + + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, Ent.getLocation(), 0, 0, 0, 0, 1); + Ent.getWorld().playSound(Ent.getLocation(), Sound.EXPLODE, 0.3f, 1f); Ent.remove(); - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, Ent.getLocation(), 0, 0, 0, 0, 1); + } + + @Override + public boolean CanCollide(GravityObject other) + { + return false; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityDebris.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityDebris.java index e18a177c7..8dc9dbc26 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityDebris.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityDebris.java @@ -1,5 +1,7 @@ package nautilus.game.arcade.game.games.gravity.objects; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; import nautilus.game.arcade.game.games.gravity.Gravity; import nautilus.game.arcade.game.games.gravity.GravityObject; @@ -12,6 +14,18 @@ public class GravityDebris extends GravityObject { super(host, ent, mass, 2, vel); - CollideDelay = System.currentTimeMillis() + 250; + CollideDelay = System.currentTimeMillis() + 500; + } + + @Override + public void CustomCollide(GravityObject other) + { + Ent.remove(); + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, Ent.getLocation(), 0, 0, 0, 0, 1); + } + + public boolean CanCollide(GravityObject other) + { + return !(other instanceof GravityDebris); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityPlayer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityPlayer.java index a31c41cc9..0912eba3a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityPlayer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityPlayer.java @@ -1,13 +1,10 @@ package nautilus.game.arcade.game.games.gravity.objects; -import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; @@ -17,7 +14,6 @@ import nautilus.game.arcade.game.games.gravity.Gravity; import nautilus.game.arcade.game.games.gravity.GravityObject; import org.bukkit.Effect; -import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -33,6 +29,8 @@ public class GravityPlayer extends GravityObject public GravityPlayer(Gravity host, Entity ent, double mass, Vector vel) { super(host, ent, mass, 2, vel); + + SetMovingBat(false); } @Override @@ -79,8 +77,6 @@ public class GravityPlayer extends GravityObject public void AutoGrab() { - //AntiClip(); - if (Vel.length() == 0) return; @@ -101,34 +97,18 @@ public class GravityPlayer extends GravityObject //Effect Ent.getWorld().playEffect(Ent.getLocation(), Effect.STEP_SOUND, 1); + //Bat + SetMovingBat(false); + //UtilPlayer.message(Ent, "You grabbed onto a Block"); } - public void AntiClip() - { - if (!NearBlock() || Vel.length() > 0.05) - return; - - Location target = Base.getLocation().getBlock().getLocation().add(0.5, 0.5, 0.5); - target.setY(Base.getLocation().getY()); - - if (UtilMath.offset(Base.getLocation(), target) > 0.25) - { - this.AddVelocity(UtilAlg.getTrajectory(Base.getLocation(), target).multiply(0.05), 0.05); - } - else - { - Vel.multiply(0); - Base.setVelocity(new Vector(0,0,0)); - } - } - public void KickOff(Player player) { if (!Ent.equals(player)) return; - if (!NearBlock()) + if (!Bat.isSitting() && !NearBlock()) return; GrabDelay = System.currentTimeMillis(); @@ -157,9 +137,6 @@ public class GravityPlayer extends GravityObject if (!player.isBlocking()) return; - if (player.getItemInHand().getType() != Material.IRON_SWORD) - return; - if (player.getExp() <= 0) { if (Recharge.Instance.use(player, "Fuel", 1000, false)) @@ -215,4 +192,10 @@ public class GravityPlayer extends GravityObject UtilPlayer.message(Ent, F.main("Game", "Get more Oxygen from the Emerald Blocks!")); } } + + @Override + public void CustomCollide(GravityObject other) + { + UtilPlayer.health((Player)Ent, -1); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java index b6942719e..1f1a90623 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java @@ -146,6 +146,18 @@ public class HungerGames extends SoloGame "Stay away from the Deep Freeze!", "Last tribute alive wins!" }); + + _help = new String[] + { + C.cGreen + "Use a Compass to find and kill enemies!", + C.cAqua + "Crouch to become invisible to Compass tracking!", + C.cGreen + "Avoid the Deep Freeze at all costs!", + C.cAqua + "Use TNT & Tripwires to make traps!", + C.cGreen + "You lose Speed 2 at start of game if you attack.", + C.cAqua + "Avoid enemies who have better gear than you!", + C.cGreen + "Compass finds Supply Drops during night time.", + C.cAqua + "Compass finds Players during day time.", + }; Manager.GetAntiStack().SetEnabled(false); @@ -1610,38 +1622,4 @@ public class HungerGames extends SoloGame { _redChunks.remove(event.getPlayer()); } - - private long _helpTimer = 0; - private int _helpIndex = 0; - private String[] _help = new String[] - { - C.cGreen + "Use a Compass to find and kill enemies!", - C.cAqua + "Crouch to become invisible to Compass tracking!", - C.cGreen + "Avoid the Deep Freeze at all costs!", - C.cAqua + "Use TNT & Tripwires to make traps!", - C.cGreen + "You lose Speed 2 at start of game if you attack.", - C.cAqua + "Avoid enemies who have better gear than you!", - C.cGreen + "Compass finds Supply Drops during night time.", - C.cAqua + "Compass finds Players during day time.", - }; - - @EventHandler - public void StateUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - - if (this.GetState() != GameState.Recruit) - return; - - if (!UtilTime.elapsed(_helpTimer, 8000)) - return; - - _helpTimer = System.currentTimeMillis(); - - for (Player player : UtilServer.getPlayers()) - UtilPlayer.message(player, C.cWhite + C.Bold + "TIP " + ChatColor.RESET + _help[_helpIndex]); - - _helpIndex = (_helpIndex + 1)%_help.length; - } }