Finished Gravity
INcluded map
This commit is contained in:
parent
0fba94f8ae
commit
e124dde006
BIN
Maps/Gravity/Gravity_ShatteredSatalite.zip
Normal file
BIN
Maps/Gravity/Gravity_ShatteredSatalite.zip
Normal file
Binary file not shown.
Binary file not shown.
@ -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)
|
||||
|
@ -1000,7 +1000,14 @@ 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;
|
||||
}
|
||||
|
@ -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<Player, GravityHook> _hooks = new HashMap<Player, GravityHook>();
|
||||
|
||||
private HashMap<Arrow, Vector> _arrows = new HashMap<Arrow, Vector>();
|
||||
|
||||
private ArrayList<Location> _powerups = new ArrayList<Location>();
|
||||
private Location _powerup = null;
|
||||
private long _lastPowerup = 0;
|
||||
|
||||
public Gravity(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Gravity,
|
||||
@ -61,8 +80,8 @@ 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!"
|
||||
@ -74,18 +93,26 @@ public class Gravity extends SoloGame
|
||||
"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)
|
||||
{
|
||||
@ -101,6 +128,27 @@ public class Gravity extends SoloGame
|
||||
}
|
||||
}
|
||||
|
||||
@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
|
||||
@ -372,13 +437,13 @@ public class Gravity extends SoloGame
|
||||
if (!(obj instanceof GravityBomb))
|
||||
continue;
|
||||
|
||||
HashSet<GravityDebris> debris = ((GravityBomb)obj).DetonateCheck();
|
||||
HashSet<GravityDebris> debris = ((GravityBomb)obj).BombDetonate();
|
||||
|
||||
if (!debris.isEmpty())
|
||||
if (debris != null && !debris.isEmpty())
|
||||
{
|
||||
newDebris.addAll(debris);
|
||||
objectIterator.remove();
|
||||
obj.CustomCollide();
|
||||
obj.CustomCollide(null);
|
||||
obj.Clean();
|
||||
}
|
||||
}
|
||||
@ -415,4 +480,177 @@ public class Gravity extends SoloGame
|
||||
if (object instanceof GravityPlayer)
|
||||
((GravityPlayer)object).Oxygen();
|
||||
}
|
||||
|
||||
public ArrayList<GravityObject> 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<Arrow> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
@ -87,15 +84,15 @@ public abstract class GravityObject
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
@ -29,14 +39,106 @@ public class GravityBomb extends GravityObject
|
||||
Ent.getWorld().playSound(Ent.getLocation(), Sound.EXPLODE, 1f, 1f);
|
||||
}
|
||||
|
||||
public HashSet<GravityDebris> 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<GravityDebris> 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<GravityDebris> debris = new HashSet<GravityDebris>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -147,6 +147,18 @@ public class HungerGames extends SoloGame
|
||||
"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);
|
||||
|
||||
this.WorldTimeSet = 0;
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user