Merge branch 'master' of ssh://dev.mineplex.com:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2014-01-18 09:08:12 -06:00
commit dea96a9e65
44 changed files with 1974 additions and 382 deletions

BIN
Maps/Gravity/Space.zip Normal file

Binary file not shown.

View File

@ -275,6 +275,34 @@ public class UtilPlayer
return best;
}
public static Player getClosest(Location loc, Entity ignore)
{
Player best = null;
double bestDist = 0;
for (Player cur : loc.getWorld().getPlayers())
{
if (cur.getGameMode() == GameMode.CREATIVE)
continue;
if (cur.isDead())
continue;
if (ignore != null && ignore.equals(cur))
continue;
double dist = UtilMath.offset(cur.getLocation(), loc);
if (best == null || dist < bestDist)
{
best = cur;
bestDist = dist;
}
}
return best;
}
public static void kick(Player player, String module, String message)
{
kick(player,module,message, true);

View File

@ -287,6 +287,9 @@ public class AntiHack extends MiniPlugin
public void sendReport(Player player, String report, String severity)
{
if (severity.equals("Extreme"))
player.kickPlayer(C.cRed + "MAC" + C.cWhite + " - " + C.cYellow + "You were kicked for suspicious movement.");
//XXX Send to Database for Staff
}

View File

@ -4,6 +4,7 @@ import java.util.HashSet;
import java.util.WeakHashMap;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
@ -32,7 +33,7 @@ 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));
null, 1f, 1f, null, 0, null, null, hitboxMult, null));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
@ -40,7 +41,7 @@ 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, disguise));
null, 1f, 1f, null, 0, null, null, hitboxMult, disguise));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
@ -48,7 +49,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));
null, 1f, 1f, null, 0, null, null, hitboxMult, null));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
@ -57,7 +58,16 @@ 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, null));
sound, soundVolume, soundPitch, effect, effectData, effectRate, null, hitboxMult, null));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, ParticleType particle, Effect effect, int effectData, UpdateType effectRate, double hitboxMult)
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, hitboxMult, null));
}
@EventHandler

View File

@ -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.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseSquid;
@ -35,6 +37,7 @@ public class ProjectileUser
private Sound _sound = null;
private float _soundVolume = 1f;
private float _soundPitch = 1f;
private ParticleType _particle = null;
private Effect _effect = null;
private int _effectData = 0;
private UpdateType _effectRate = UpdateType.TICK;
@ -44,7 +47,9 @@ public class ProjectileUser
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,
Sound sound, float soundVolume, float soundPitch,
Effect effect, int effectData, UpdateType effectRate,
ParticleType particle,
double hitboxMult, DisguiseManager disguise)
{
Throw = throwInput;
@ -62,6 +67,7 @@ public class ProjectileUser
_sound = sound;
_soundVolume = soundVolume;
_soundPitch = soundPitch;
_particle = particle;
_effect = effect;
_effectData = effectData;
_effectRate = effectRate;
@ -81,6 +87,9 @@ public class ProjectileUser
if (_effect != null)
_thrown.getWorld().playEffect(_thrown.getLocation(), _effect, _effectData);
if (_particle != null)
UtilParticle.PlayParticle(_particle, _thrown.getLocation(), 0f, 0f, 0f, 0, 1);
}
public boolean Collision()

View File

@ -33,9 +33,10 @@ public class NewsManager extends MiniPlugin
_news = new String[]
{
"Europe Servers: " + C.cGreen + C.Bold + "BACK ONLINE" + ChatColor.RESET + "!",
"New SSM Kit: " + C.cYellow + C.Bold + "Magma Cube" + ChatColor.RESET + "!",
"New Rank: " + C.cPurple + C.Bold + "Hero Rank" + ChatColor.RESET + "!",
"Europe Servers: " + C.cGreen + C.Bold + "BACK ONLINE",
"New SSM Kit: " + C.cYellow + C.Bold + "Pig",
"SSM: " + C.cGreen + C.Bold + "Many kits rebalanced!",
"New Rank: " + C.cPurple + C.Bold + "Hero Rank",
};
}

View File

@ -40,22 +40,9 @@ public class Undead extends HorseMount
for (Horse horse : GetActive().values())
UtilParticle.PlayParticle(ParticleType.FLAME, horse.getLocation().add(0, 1, 0), 0.25f, 0.25f, 0.25f, 0, 2);
if (event.getType() == UpdateType.FAST)
{
for (Horse horse : GetActive().values())
for (Player player : UtilServer.getPlayers())
{
try
{
UtilParticle.PlayParticle(player, ParticleType.LAVA, horse.getLocation().add(0, 1, 0), 0.25f, 0.25f, 0.25f, 0, 1);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
UtilParticle.PlayParticle(ParticleType.LAVA, horse.getLocation().add(0, 1, 0), 0.25f, 0.25f, 0.25f, 0, 1);
}
}

View File

@ -1,215 +0,0 @@
package mineplex.minecraft.game.classcombat.Skill.Brute;
import java.util.WeakHashMap;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent;
public class FleshHook extends SkillActive implements IThrown
{
private WeakHashMap<Player, Integer> _charge = new WeakHashMap<Player, Integer>();
private WeakHashMap<Player, Long> _chargeLast = new WeakHashMap<Player, Long>();
public FleshHook(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels,
int energy, int energyMod,
long recharge, long rechargeMod, boolean rechargeInform,
Material[] itemArray,
Action[] actionArray)
{
super(skills, name, classType, skillType,
cost, levels,
energy, energyMod,
recharge, rechargeMod, rechargeInform,
itemArray,
actionArray);
SetDesc(new String[]
{
"Hold Block to charge Flesh Hook.",
"Release Block to release it.",
"",
"If Flesh Hook hits a player, it",
"deals up to 12 damage, and rips them",
"towards you with high velocity.",
});
}
@Override
public String GetEnergyString()
{
return "Energy: 20 + (5 per 20% Strength)";
}
@Override
public boolean CustomCheck(Player player, int level)
{
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9)
{
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false;
}
return true;
}
@Override
public void Skill(Player player, int level)
{
//Start Charge
_charge.put(player, 0);
_chargeLast.put(player, System.currentTimeMillis());
}
@EventHandler
public void ChargeRelease(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : GetUsers())
{
//Not Charging
if (!_charge.containsKey(cur))
continue;
//Level
int level = GetLevel(cur);
if (level == 0) return;
//Add Charge
if (cur.isBlocking())
{
//Max Charge
if (_charge.get(cur) >= 4)
continue;
//Charge Interval
if (!UtilTime.elapsed(_chargeLast.get(cur), 400))
continue;
//Energy
if (!Factory.Energy().use(cur, GetName(), 5, true, false))
continue;
//Increase Charge
_charge.put(cur, _charge.get(cur) + 1);
_chargeLast.put(cur, System.currentTimeMillis());
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), GetName() + ": " + F.elem("+" + (_charge.get(cur) * 25) + "% Strength")));
//Effect
for (int i=_charge.get(cur) ; i>0 ; i--)
cur.playEffect(cur.getLocation(), Effect.CLICK2, 0);
}
//Release Charge
else
{
double base = 0.8;
//Action
Item item = cur.getWorld().dropItem(cur.getEyeLocation().add(cur.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(131));
UtilAction.velocity(item, cur.getLocation().getDirection(),
base + (_charge.remove(cur) * (0.25*base)), false, 0, 0.2, 20, false);
Factory.Projectile().AddThrow(item, cur, this, -1, true, true, true,
Sound.FIRE_IGNITE, 1.4f, 0.8f, null, 0, UpdateType.TICK, 1.5d);
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
//Effect
item.getWorld().playSound(item.getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.8f);
}
}
}
@Override
public void Reset(Player player)
{
_charge.remove(player);
_chargeLast.remove(player);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
//Remove
double velocity = data.GetThrown().getVelocity().length();
data.GetThrown().remove();
if (!(data.GetThrower() instanceof Player))
return;
Player player = (Player)data.GetThrower();
//Level
int level = GetLevel(player);
if (level == 0) return;
if (target == null)
return;
//Pull
UtilAction.velocity(target,
UtilAlg.getTrajectory(target.getLocation(), player.getLocation()),
2, false, 0, 0.8, 1.5, true);
//Condition
Factory.Condition().Factory().Falling(GetName(), target, player, 10, false, true);
//Damage Event
Factory.Damage().NewDamageEvent(target, player, null,
DamageCause.CUSTOM, velocity * 8, false, true, false,
player.getName(), GetName());
//Event
if (target != null)
UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(player, GetName(), ClassType.Brute, target));
//Inform
UtilPlayer.message(target, F.main(GetClassType().name(), F.name(player.getName()) + " pulled you with " + F.skill(GetName(level)) + "."));
}
@Override
public void Idle(ProjectileUser data)
{
//Remove
data.GetThrown().remove();
}
@Override
public void Expire(ProjectileUser data)
{
//Remove
data.GetThrown().remove();
}
}

View File

@ -17,6 +17,7 @@ import nautilus.game.arcade.game.games.dragonriders.DragonRiders;
import nautilus.game.arcade.game.games.dragons.Dragons;
import nautilus.game.arcade.game.games.draw.Draw;
import nautilus.game.arcade.game.games.evolution.Evolution;
import nautilus.game.arcade.game.games.gravity.Gravity;
import nautilus.game.arcade.game.games.halloween.Halloween;
import nautilus.game.arcade.game.games.hideseek.HideSeek;
import nautilus.game.arcade.game.games.hungergames.HungerGames;
@ -58,6 +59,7 @@ public class GameFactory
else if (gameType == GameType.DragonRiders) return new DragonRiders(_manager);
else if (gameType == GameType.Draw) return new Draw(_manager);
else if (gameType == GameType.Evolution) return new Evolution(_manager);
else if (gameType == GameType.Gravity) return new Gravity(_manager);
else if (gameType == GameType.Halloween) return new Halloween(_manager);
else if (gameType == GameType.HideSeek) return new HideSeek(_manager);
else if (gameType == GameType.HungerGames) return new HungerGames(_manager);

View File

@ -15,6 +15,7 @@ public enum GameType
Dragons("Dragons"),
Draw("Draw My Thing"),
Evolution("Evolution"),
Gravity("Gravity"),
Halloween("Halloween Horror"),
HideSeek("Block Hunt"),
Horse("Horseback"),

View File

@ -0,0 +1,167 @@
package nautilus.game.arcade.game.games.gravity;
import java.util.ArrayList;
import java.util.Iterator;
import org.bukkit.Material;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.gravity.kits.*;
import nautilus.game.arcade.kit.Kit;
public class Gravity extends SoloGame
{
private ArrayList<GravityObject> _objects = new ArrayList<GravityObject>();
public Gravity(ArcadeManager manager)
{
super(manager, GameType.Gravity,
new Kit[]
{
new KitPlayer(manager)
},
new String[]
{
"Knock other players into space",
"You auto-grab onto nearby blocks",
C.cGreen + "Push Drop" + C.cGray + " to kick off blocks",
"Last player alive wins!"
});
this.DamagePvP = false;
this.HungerSet = 20;
this.WorldTimeSet = 22;
}
@EventHandler
public void CreatePlayerObjects(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
return;
for (Player player : GetPlayers(true))
{
_objects.add(new GravityObject(this, player, 60, null));
}
}
@EventHandler
public void KickOff(PlayerDropItemEvent event)
{
for (GravityObject object : _objects)
object.KickOff(event.getPlayer());
event.setCancelled(true);
}
@EventHandler
public void Shoot(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("SHEARS"))
return;
Player player = event.getPlayer();
if (!Recharge.Instance.use(player, "Block Cannon", 2000, true))
return;
Vector velocity = new Vector(0,0,0);
for (GravityObject object : _objects)
if (object.Ent.equals(player))
velocity = object.Vel.clone();
//velocity.add(player.getLocation().getDirection().multiply(1.2));
velocity = player.getLocation().getDirection().multiply(1.2);
FallingBlock projectile = player.getWorld().spawnFallingBlock(player.getEyeLocation().add(player.getLocation().getDirection().multiply(2)), Material.SKULL, (byte)0);
_objects.add(new GravityObject(this, projectile, 20, velocity));
}
@EventHandler
public void Jetpack(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() != UpdateType.TICK)
return;
for (GravityObject object : _objects)
object.Jetpack();
}
@EventHandler
public void ObjectUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (!InProgress() && GetState() != GameState.End)
return;
//Movement + Invalid
Iterator<GravityObject> objectIterator = _objects.iterator();
while (objectIterator.hasNext())
{
GravityObject obj = objectIterator.next();
obj.Update();
if (!obj.Update())
{
objectIterator.remove();
}
}
//AutoGrab
for (GravityObject a : _objects)
a.AutoGrab();
//Collision
for (GravityObject a : _objects)
for (GravityObject b : _objects)
a.Collide(b);
}
@EventHandler
public void FallDamage(CustomDamageEvent event)
{
if (event.GetCause() == DamageCause.FALL || event.GetCause() == DamageCause.SUFFOCATION)
event.SetCancelled("Fall");
}
}

View File

@ -0,0 +1,233 @@
package nautilus.game.arcade.game.games.gravity;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public class GravityObject
{
public Gravity Host;
public Entity Ent;
public double Mass;
public Vector Vel;
public Chicken Base;
public long GrabDelay = 0;
public long CollideDelay;
public GravityObject(Gravity host, Entity ent, double mass, Vector vel)
{
Host = host;
Ent = ent;
Mass = mass;
CollideDelay = System.currentTimeMillis() + 100;
if (vel != null)
Vel = vel;
else
Vel = new Vector(0,0,0);
Host.CreatureAllowOverride = true;
Base = ent.getWorld().spawn(ent.getLocation().subtract(0, 0, 0), Chicken.class);
Host.CreatureAllowOverride = false;
Base.setBaby();
UtilEnt.Vegetate(Base);
UtilEnt.ghost(Base, true, true);
}
public boolean IsPlayer()
{
return Ent instanceof Player;
}
public boolean Update()
{
if (!Ent.isValid())
return false;
if (!Base.isValid())
return false;
if (IsPlayer())
if (!Host.IsAlive((Player)Ent))
return false;
if (Ent.getVehicle() == null)
{
Base.setPassenger(Ent);
UtilPlayer.message(Ent, "Attaching to Space Suit");
}
Base.setVelocity(Vel);
return true;
}
public void Collide(GravityObject other)
{
if (this.equals(other))
return;
if (System.currentTimeMillis() < this.CollideDelay)
return;
if (System.currentTimeMillis() < other.CollideDelay)
return;
if (UtilMath.offset(this.Base, other.Base) > 2)
return;
Vector v1 = Vel;
Vector v2 = other.Vel;
//Physics
double totalMass = this.Mass + other.Mass;
this.Vel = v1.clone().multiply((this.Mass - other.Mass)/(totalMass)).add(v2.clone().multiply((2 * other.Mass)/(totalMass)));
other.Vel = v1.clone().multiply((2 * this.Mass)/(totalMass)).subtract(v2.clone().multiply((this.Mass - other.Mass)/(totalMass)));
//Sound
double power = v1.clone().multiply(this.Mass).subtract(v2.clone().multiply(other.Mass)).length();
Host.Announce("Collision Power: " + power);
this.Ent.getWorld().playSound(this.Ent.getLocation(), Sound.ZOMBIE_WOOD, 1f, 1f);
other.Ent.getWorld().playSound(other.Ent.getLocation(), Sound.ZOMBIE_WOOD, 1f, 1f);
//Delay
this.CollideDelay = System.currentTimeMillis() + 1000;
other.CollideDelay = System.currentTimeMillis() + 1000;
this.GrabDelay = System.currentTimeMillis();
other.GrabDelay = System.currentTimeMillis();
//Inform
Host.Announce(UtilEnt.getName(this.Ent) + " collided with " + UtilEnt.getName(other.Ent) + " with Power: " + power);
}
public boolean NearBlock()
{
for (Block block : UtilBlock.getSurrounding(Base.getLocation().getBlock(), true))
{
if (UtilBlock.airFoliage(block))
continue;
if (UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), Base.getLocation()) < 1.6)
return true;
}
for (Block block : UtilBlock.getSurrounding(Base.getLocation().getBlock().getRelative(BlockFace.UP), true))
{
if (UtilBlock.airFoliage(block))
continue;
if (UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), Base.getLocation().add(0, 1, 0)) < 1.6)
return true;
}
for (Block block : UtilBlock.getSurrounding(Base.getLocation().getBlock().getRelative(BlockFace.UP).getRelative(BlockFace.UP), true))
{
if (UtilBlock.airFoliage(block))
continue;
if (UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), Base.getLocation().add(0, 2, 0)) < 1.6)
return true;
}
return false;
}
public void AutoGrab()
{
if (!IsPlayer())
return;
if (Vel.length() == 0)
return;
if (!UtilTime.elapsed(GrabDelay, 1000))
return;
if (!NearBlock())
return;
Vel.multiply(0);
GrabDelay = System.currentTimeMillis();
UtilPlayer.message(Ent, "You grabbed onto a Block");
}
public void KickOff(Player player)
{
if (!Ent.equals(player))
return;
if (!NearBlock())
return;
GrabDelay = System.currentTimeMillis();
AddVelocity(player.getLocation().getDirection().multiply(0.5), 0.5);
UtilPlayer.message(Ent, "You kicked off a Block");
}
public void Jetpack()
{
if (!Ent.isValid())
return;
if (!(Ent instanceof Player))
return;
Player player = ((Player)Ent);
if (!player.isBlocking())
return;
AddVelocity(player.getLocation().getDirection().multiply(0.015), 0.5);
}
public void AddVelocity(Vector vel)
{
AddVelocity(vel, 50);
}
public void AddVelocity(Vector vel, double limit)
{
double preLength = Vel.length();
Vel.add(vel);
//Soft Limit
if (Vel.length() > limit && Vel.length() > preLength)
{
Vel.normalize().multiply(preLength);
}
//Hard Limit
if (Vel.length() > 3)
{
Vel.normalize().multiply(3);
}
}
}

View File

@ -0,0 +1,51 @@
package nautilus.game.arcade.game.games.gravity.kits;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitPlayer extends Kit
{
public KitPlayer(ArcadeManager manager)
{
super(manager, "Player", KitAvailability.Free,
new String[]
{
"SPAAAAAAAAAAAAAACE"
},
new Perk[]
{
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_AXE));
}
@Override
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, "Jetpack"));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1, "Grappling Hook"));
}
@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));
}
}

View File

@ -0,0 +1,6 @@
package nautilus.game.arcade.game.games.shootinggallery;
public class ShootingGallery
{
}

View File

@ -62,10 +62,11 @@ public class SuperSmash extends SoloGame
new KitBlaze(manager),
new KitWitch(manager),
new KitChicken(manager),
//new KitSkeletalHorse(manager),
new KitPig(manager),
new KitSkySquid(manager),
new KitWitherSkeleton(manager),
new KitMagmaCube(manager)
new KitMagmaCube(manager),
},
@ -346,6 +347,9 @@ public class SuperSmash extends SoloGame
for (Player player : GetPlayers(true))
{
player.setSaturation(3f);
player.setExhaustion(0f);
if (player.getFoodLevel() <= 0)
{
Manager.GetDamage().NewDamageEvent(player, null, null,

View File

@ -0,0 +1,68 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseCow;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
public class KitCow extends SmashKit
{
public KitCow(ArcadeManager manager)
{
super(manager, "Mad Cow", KitAvailability.Blue,
new String[]
{
},
new Perk[]
{
new PerkSmashStats(7, 1.0, 0.25, 8),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
},
EntityType.COW,
new ItemStack(Material.MILK_BUCKET));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Stampede",
new String[]
{
ChatColor.RESET + "",
}));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Body Slam",
new String[]
{
ChatColor.RESET + "",
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS));
//Disguise
DisguiseCow disguise = new DisguiseCow(player);
disguise.SetName(C.cYellow + player.getName());
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
}

View File

@ -66,13 +66,14 @@ public class KitCreeper extends SmashKit
ChatColor.RESET + "large damage and knockback.",
}));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Lightning Shield",
new String[]
{
ChatColor.RESET + "When attacked by a non-melee attack,",
ChatColor.RESET + "you gain Lightning Shield for 3 seconds.",
ChatColor.RESET + "you gain Lightning Shield for 2 seconds.",
ChatColor.RESET + "",
ChatColor.RESET + "Lightning Shield blocks 1 melee attack,",
ChatColor.RESET + "striking lightning on the attacker.",

View File

@ -30,7 +30,7 @@ public class KitGolem extends SmashKit
new PerkSmashStats(7, 1.0, 0.25, 8),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkSlow(0),
new PerkFissure(),
new PerkIronHook(),
new PerkSeismicSlam(),
},
@ -41,19 +41,16 @@ public class KitGolem extends SmashKit
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Fissure",
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Iron Hook",
new String[]
{
ChatColor.RESET + "Smash the ground with such power that",
ChatColor.RESET + "a line of earth fissures infront of you.",
ChatColor.RESET + "",
ChatColor.RESET + "The initial slam path Slows opponents.",
ChatColor.RESET + "The fissure gives damage and knockback.",
ChatColor.RESET + "Throw a metal hook at opponents.",
ChatColor.RESET + "If it hits, it deals damage and pulls",
ChatColor.RESET + "them towards you with great force.",
}));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Seismic Slam",
new String[]
{

View File

@ -27,7 +27,7 @@ public class KitMagmaCube extends SmashKit
new Perk[]
{
new PerkSmashStats(6, 1.75, 0.4, 3),
new PerkSmashStats(5, 1.75, 0.4, 3),
new PerkDoubleJump("Double Jump", 1.2, 1, false),
new PerkMagmaBoost(),
new PerkMagmaBlast(),

View File

@ -0,0 +1,109 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguisePig;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
public class KitPig extends SmashKit
{
public KitPig(ArcadeManager manager)
{
super(manager, "Pig", KitAvailability.Blue,
new String[]
{
},
new Perk[]
{
new PerkSmashStats(5, 1.7, 0.25, 5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkPigBaconBounce(),
new PerkPigBaconBomb(),
new PerkPigZombie(),
},
EntityType.PIG,
new ItemStack(Material.PORK));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bouncy Bacon",
new String[]
{
ChatColor.RESET + "Bouncy Bacon launches a peice of bacon,",
ChatColor.RESET + "dealing damage and knockback to enemies.",
ChatColor.RESET + "",
ChatColor.RESET + "Eat the bacon to restore some Energy.",
ChatColor.RESET + "Bacon that hit an enemy will restore Health.",
}));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Baby Bacon Bombs",
new String[]
{
ChatColor.RESET + "Give birth to a baby pig, giving",
ChatColor.RESET + "yourself a boost forwards. ",
ChatColor.RESET + "",
ChatColor.RESET + "Your baby pig will run to annoy",
ChatColor.RESET + "nearby enemies, exploding on them.",
}));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.PORK, (byte)0, 1,
C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Nether Pig",
new String[]
{
ChatColor.RESET + "When your health drops below 4, you morph",
ChatColor.RESET + "into a Nether Pig. This gives you Speed I,",
ChatColor.RESET + "10 Armor and half Energy costs for skills.",
ChatColor.RESET + "",
ChatColor.RESET + "When your health returns to 8, you return",
ChatColor.RESET + "back to Pig Form.",
}));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
//Disguise
DisguisePig disguise = new DisguisePig(player);
disguise.SetName(C.cYellow + player.getName());
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@EventHandler
public void EnergyUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
continue;
player.setExp((float) Math.min(0.999, player.getExp()+0.005));
}
}
}

View File

@ -0,0 +1,124 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Horse.Variant;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.disguise.disguises.DisguiseCow;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
public class KitSkeletalHorse extends SmashKit
{
public KitSkeletalHorse(ArcadeManager manager)
{
super(manager, "Skeletal Horse", KitAvailability.Blue,
new String[]
{
},
new Perk[]
{
new PerkSmashStats(6, 1.4, 0.35, 6),
new PerkDoubleJump("Double Jump", 1, 1, false),
new PerkHorseKick(),
new PerkBoneRush(),
new PerkInfernalHorror()
},
EntityType.HORSE,
new ItemStack(Material.MILK_BUCKET));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Kick",
new String[]
{
ChatColor.RESET + "Stand on your hind legs and maul enemies",
ChatColor.RESET + "infront of you with your front legs, dealing",
ChatColor.RESET + "damage and large knockback.",
}));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Rush",
new String[]
{
ChatColor.RESET + "Charge forth in a deadly wave of bones.",
ChatColor.RESET + "Bones deal small damage and knockback.",
ChatColor.RESET + "",
ChatColor.RESET + "Holding Crouch will prevent you from",
ChatColor.RESET + "moving forward with the bones.",
}));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.FIRE, (byte)0, 1,
C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Infernal Horror",
new String[]
{
ChatColor.RESET + "Charge your Rage by taking/dealing damage.",
ChatColor.RESET + "When your Rage hits 100%, you transform",
ChatColor.RESET + "into Infernal Horror.",
ChatColor.RESET + "",
ChatColor.RESET + "Infernal Horror has Speed 2, 1 Bonus Damage",
ChatColor.RESET + "and improved Bone Rush and Bone Kick.",
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
//Disguise
DisguiseCow disguise = new DisguiseCow(player);
disguise.SetName(C.cYellow + player.getName());
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@Override
public Entity SpawnEntity(Location loc)
{
EntityType type = _entityType;
if (type == EntityType.PLAYER)
type = EntityType.ZOMBIE;
LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type);
entity.setRemoveWhenFarAway(false);
entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit" + (GetAvailability() == KitAvailability.Blue ? ChatColor.GRAY + " (" + ChatColor.WHITE + "Ultra" + ChatColor.GRAY + ")" : ""));
entity.setCustomNameVisible(true);
entity.getEquipment().setItemInHand(_itemInHand);
if (type == EntityType.HORSE)
{
Horse horse = (Horse)entity;
horse.setAdult();
horse.setVariant(Variant.SKELETON_HORSE);
}
UtilEnt.Vegetate(entity);
SpawnCustom(entity);
return entity;
}
}

View File

@ -35,7 +35,7 @@ public class KitSnowman extends SmashKit
{
new PerkSmashStats(5, 1.4, 0.4, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkDamageSnow(3, 1.25),
new PerkDamageSnow(2, 1.25),
new PerkArcticAura(),
new PerkBlizzard(),
new PerkIcePath(),

View File

@ -34,7 +34,7 @@ public class KitWitch extends SmashKit
new Perk[]
{
new PerkSmashStats(6, 1.5, 0.15, 5),
new PerkSmashStats(6, 1.5, 0.3, 5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkWitchPotion(),
new PerkBatWave(),

View File

@ -12,6 +12,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
@ -28,7 +29,7 @@ public class PerkAxeThrower extends Perk implements IThrown
{
super("Axe Thrower", new String[]
{
C.cYellow + "RIGHT-Click" + C.cGray + " with Axes to " + C.cGreen + "Throw Axe",
C.cYellow + "Right-Click" + C.cGray + " with Axes to " + C.cGreen + "Throw Axe",
});
}
@ -44,6 +45,9 @@ public class PerkAxeThrower extends Perk implements IThrown
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))

View File

@ -121,7 +121,7 @@ public class PerkBatWave extends Perk
_bats.put(player, new ArrayList<Bat>());
for (int i=0 ; i<24 ; i++)
for (int i=0 ; i<32 ; i++)
{
Manager.GetGame().CreatureAllowOverride = true;
Bat bat = player.getWorld().spawn(player.getEyeLocation(), Bat.class);
@ -145,7 +145,7 @@ public class PerkBatWave extends Perk
if (!_active.containsKey(cur))
continue;
if (UtilTime.elapsed(_active.get(cur), 2000))
if (UtilTime.elapsed(_active.get(cur), 3000))
{
Clear(cur);
continue;
@ -165,8 +165,8 @@ public class PerkBatWave extends Perk
batVec.add(bat.getLocation().toVector());
batCount++;
Vector rand = new Vector((Math.random() - 0.5)/3, (Math.random() - 0.5)/3, (Math.random() - 0.5)/3);
bat.setVelocity(loc.getDirection().clone().multiply(0.75).add(rand));
Vector rand = new Vector((Math.random() - 0.5)/2, (Math.random() - 0.5)/2, (Math.random() - 0.5)/2);
bat.setVelocity(loc.getDirection().clone().multiply(0.5).add(rand));
for (Player other : Manager.GetGame().GetPlayers(true))
{

View File

@ -110,7 +110,7 @@ public class PerkBlizzard extends Perk
if (damagee instanceof Player)
if (Recharge.Instance.use((Player)damagee, GetName(), 250, false))
Manager.GetDamage().NewDamageEvent(damagee, event.GetDamagerEntity(true), null,
DamageCause.PROJECTILE, 1.5, false, true, false,
DamageCause.PROJECTILE, 1, false, true, false,
UtilEnt.getName(event.GetDamagerEntity(true)), GetName());
}

View File

@ -113,7 +113,7 @@ public class PerkBlockToss extends Perk implements IThrown
//Charged Tick
if (!_charged.contains(cur))
if (System.currentTimeMillis() - _charge.get(cur) > 1000)
if (System.currentTimeMillis() - _charge.get(cur) > 800)
{
_charged.add(cur);
cur.playEffect(cur.getLocation(), Effect.CLICK1, 0);
@ -133,9 +133,9 @@ public class PerkBlockToss extends Perk implements IThrown
long charge = System.currentTimeMillis() - _charge.remove(cur);
//Throw
double mult = 1.2;
if (charge < 1000)
mult = mult * (charge/1000d);
double mult = 1.4;
if (charge < 800)
mult = mult * (0.25 + 0.75 * (charge/800d));
//Action
UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true);
@ -156,7 +156,7 @@ public class PerkBlockToss extends Perk implements IThrown
//Damage Event
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
DamageCause.PROJECTILE, 2 + (data.GetThrown().getVelocity().length() * 10), true, true, false,
DamageCause.PROJECTILE, 2 + (data.GetThrown().getVelocity().length() * 8), true, true, false,
UtilEnt.getName(data.GetThrower()), GetName());
//Block to Item

View File

@ -12,11 +12,10 @@ import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkBoneExplosion extends Perk
@ -30,7 +29,7 @@ public class PerkBoneExplosion extends Perk
}
@EventHandler
public void Leap(PlayerInteractEvent event)
public void Skill(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
@ -55,7 +54,7 @@ public class PerkBoneExplosion extends Perk
if (!Recharge.Instance.use(player, GetName(), 10000, true))
return;
HashMap<Player, Double> nearby = UtilPlayer.getInRadius(player.getLocation(), 8);
HashMap<Player, Double> nearby = UtilPlayer.getInRadius(player.getLocation(), 10);
for (Player other : nearby.keySet())
{
if (player.equals(other))
@ -66,11 +65,8 @@ public class PerkBoneExplosion extends Perk
//Damage Event
Manager.GetDamage().NewDamageEvent(other, player, null,
DamageCause.CUSTOM, 4, false, true, false,
DamageCause.CUSTOM, 6 * nearby.get(other), true, true, false,
player.getName(), GetName());
//Velocity
UtilAction.velocity(other, UtilAlg.getTrajectory(player, other), 1.2 + 0.8 * nearby.get(other), false, 0, 0.8 + 0.6 * nearby.get(other), 1.2, true);
}
//Inform
@ -79,4 +75,13 @@ public class PerkBoneExplosion extends Perk
//Effect
Manager.GetBlood().Effects(player.getLocation().add(0, 0.5, 0), 48, 0.8, Sound.SKELETON_HURT, 2f, 1.2f, Material.BONE, (byte)0, 40, false);
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return;
event.AddKnockback(GetName(), 4);
}
}

View File

@ -0,0 +1,199 @@
package nautilus.game.arcade.kit.perks;
import java.util.Iterator;
import java.util.WeakHashMap;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkBoneRush extends Perk implements IThrown
{
private WeakHashMap<Player, Long> _active = new WeakHashMap<Player, Long>();
private double yLimit = 0.25;
public PerkBoneRush()
{
super("Bone Rush", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Bone Rush",
C.cGray + "Crouch to avoid movement with " + C.cGreen + "Bone Rush"
});
}
@EventHandler
public void Skill(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 10000, true))
return;
//Blazing
boolean infernal = false;
for (Perk perk : Kit.GetPerks())
{
if (perk instanceof PerkInfernalHorror)
{
infernal = ((PerkInfernalHorror)perk).IsActive(player);
}
}
_active.put(player, System.currentTimeMillis());
if (!infernal)
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
else
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill("Flame Rush") + "."));
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Player> playerIterator = _active.keySet().iterator();
while (playerIterator.hasNext())
{
Player player = playerIterator.next();
if (!player.isValid() || UtilTime.elapsed(_active.get(player), 1500))
{
playerIterator.remove();
continue;
}
//Blazing
boolean infernal = false;
for (Perk perk : Kit.GetPerks())
{
if (perk instanceof PerkInfernalHorror)
{
infernal = ((PerkInfernalHorror)perk).IsActive(player);
}
}
//Sound
if (!infernal)
player.getWorld().playSound(player.getLocation(), Sound.SKELETON_HURT, 0.4f, (float)(Math.random() + 1));
else
{
player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 1f, (float)(Math.random() + 1));
player.getWorld().playSound(player.getLocation(), Sound.GHAST_FIREBALL, 1f, (float)(Math.random() + 1));
}
//Velocity
Vector dir = player.getLocation().getDirection();
if (dir.getY() > yLimit)
dir.setY(yLimit);
//Player
if (!player.isSneaking())
UtilAction.velocity(player, dir, 0.6, false, 0, 0.1, 0.3, false);
//Bones
for (int i=0 ; i<6 ; i++)
{
if (!infernal)
{
Item bone = player.getWorld().dropItem(player.getLocation().add(Math.random()*5 - 2.5, Math.random()*3, Math.random()*5 - 2.5), new ItemStack(Material.BONE));
UtilAction.velocity(bone, dir, 0.6 + 0.3 * Math.random(), false, 0, 0.1 + Math.random() * 0.05, 0.3, false);
Manager.GetProjectile().AddThrow(bone, player, this, -1, true, true, true, false, 1d);
}
else
{
Item fire = player.getWorld().dropItem(player.getLocation().add(Math.random()*5 - 2.5, Math.random()*3, Math.random()*5 - 2.5), new ItemStack(Material.FIRE));
UtilAction.velocity(fire, dir, 0.6 + 0.3 * Math.random(), false, 0, 0.1 + Math.random() * 0.05, 0.3, false);
Manager.GetProjectile().AddThrow(fire, player, this, -1, true, true, true, false, 1d);
}
}
}
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return;
event.AddKnockback(GetName(), 10);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
boolean burning = ((Item)data.GetThrown()).getItemStack().getType() == Material.FIRE;
data.GetThrown().remove();
if (target == null)
return;
//Damage Event
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
DamageCause.CUSTOM, 1, false, true, false,
UtilEnt.getName(data.GetThrower()), GetName());
if (burning)
Manager.GetCondition().Factory().Ignite("Flame Rush", target, data.GetThrower(), 0.4, true, false);
target.setVelocity(data.GetThrown().getVelocity());
}
@Override
public void Idle(ProjectileUser data)
{
data.GetThrown().remove();
}
@Override
public void Expire(ProjectileUser data)
{
data.GetThrown().remove();
}
}

View File

@ -123,7 +123,7 @@ public class PerkCreeperElectricity extends Perk
//Damage Event
Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), damagee, null,
DamageCause.LIGHTNING, 6, true, true, false,
DamageCause.LIGHTNING, 4, true, true, false,
damagee.getName(), GetName());
}
@ -163,6 +163,6 @@ public class PerkCreeperElectricity extends Perk
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return;
event.AddKnockback(GetName(), 4);
event.AddKnockback(GetName(), 2.5);
}
}

View File

@ -86,7 +86,7 @@ public class PerkFirefly extends Perk
FireflyData data = dataIterator.next();
//Teleport
if (!UtilTime.elapsed(data.Time, 1250))
if (!UtilTime.elapsed(data.Time, 1500))
{
data.Player.setVelocity(new Vector(0,0,0));//.teleport(data.Location);
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.2f, 0.6f);

View File

@ -1,11 +1,11 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftHorse;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Horse;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -16,11 +16,13 @@ import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguisePig;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -31,15 +33,16 @@ public class PerkHorseKick extends Perk
{
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
private HashMap<Entity, Long> _burning = new HashMap<Entity, Long>();
public PerkHorseKick()
{
super("Horse Kick", new String[]
super("Bone Kick", new String[]
{
C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Horse Kick"
C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Bone Kick"
});
}
@EventHandler
public void Activate(PlayerInteractEvent event)
{
@ -63,45 +66,78 @@ public class PerkHorseKick extends Perk
if (!Recharge.Instance.use(player, GetName(), 6000, true))
return;
Horse horse = GetHorse(player);
//Horse Skill
if (horse != null)
//Horse Animation
DisguiseBase horse = Manager.GetDisguise().getDisguise(player);
if (horse != null && horse instanceof DisguisePig)
{
//((CraftHorse)player).getHandle().p(true); //XXX
}
//Animation
_active.put(player, System.currentTimeMillis());
((CraftHorse)horse).getHandle().p(true);
//Attack
Location loc = horse.getLocation().add(horse.getLocation().getDirection().multiply(1.5));
//Blazing
boolean infernal = false;
for (Perk perk : Kit.GetPerks())
{
if (perk instanceof PerkInfernalHorror)
{
infernal = ((PerkInfernalHorror)perk).IsActive(player);
}
}
for (Entity other : horse.getWorld().getEntities())
String name = GetName();
if (infernal)
name = "Flame Kick";
//AoE Area
Location loc = player.getLocation();
loc.add(player.getLocation().getDirection().setY(0).normalize().multiply(1.5));
loc.add(0, 0.8, 0);
for (Entity other : player.getWorld().getEntities())
{
if (!(other instanceof LivingEntity))
continue;
if (other.equals(horse.getPassenger()))
if (other instanceof Player)
if (!Manager.GetGame().IsAlive((Player)other))
continue;
if (other.equals(horse))
if (other.equals(player))
continue;
if (UtilMath.offset(loc, other.getLocation()) > 2)
if (UtilMath.offset(loc, other.getLocation()) > 2.5)
continue;
//Damage Event
Manager.GetDamage().NewDamageEvent((LivingEntity)other, (LivingEntity)horse.getPassenger(), null,
DamageCause.ENTITY_ATTACK, 8, true, false, false,
UtilEnt.getName(horse.getPassenger()), GetName());
}
Manager.GetDamage().NewDamageEvent((LivingEntity)other, player, null,
DamageCause.CUSTOM, 6, true, true, false,
player.getName(), name);
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
//Player Skill
else
//Sound
player.getWorld().playSound(player.getLocation(), Sound.SKELETON_HURT, 4f, 0.6f);
player.getWorld().playSound(player.getLocation(), Sound.SKELETON_HURT, 4f, 0.6f);
//Inform
UtilPlayer.message(other, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(name) + "."));
//Store
if (infernal)
{
_burning.put(other, System.currentTimeMillis());
if (other instanceof LivingEntity)
Manager.GetCondition().Factory().Ignite(name, (LivingEntity)other, player, 2.5, true, false);
}
}
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(name) + "."));
//Slow
Manager.GetCondition().Factory().Slow(name, player, player, 0.8, 3, false, false, true, false);
}
@EventHandler
@ -110,55 +146,53 @@ public class PerkHorseKick extends Perk
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : UtilServer.getPlayers())
{
if (!_active.containsKey(cur))
continue;
//Player
Iterator<Player> playerIterator = _active.keySet().iterator();
Horse horse = GetHorse(cur);
while (playerIterator.hasNext())
{
Player player = playerIterator.next();
//Horse Skill
if (horse != null)
if (!player.isValid() || player.getHealth() <= 0 || UtilTime.elapsed(_active.get(player), 1000))
{
if (horse.getPassenger() == null || !(horse.getPassenger() instanceof LivingEntity))
{
_active.remove(cur);
((CraftHorse)horse).getHandle().p(false);
continue;
playerIterator.remove();
//((CraftHorse)player).getHandle().p(false); //XXX
Manager.GetCondition().EndCondition(player, null, GetName());
}
if (UtilTime.elapsed(_active.get(cur), 1000))
{
_active.remove(cur);
((CraftHorse)horse).getHandle().p(false);
continue;
}
}
//Player Skill
else
{
Location loc = player.getLocation();
loc.add(player.getLocation().getDirection().setY(0).normalize().multiply(1.5));
loc.add(0, 0.8, 0);
}
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, loc, 0.3f, 0.3f, 0.3f, 0, 2);
}
}
public Horse GetHorse(Player player)
//Burning
Iterator<Entity> burningIterator = _burning.keySet().iterator();
while (burningIterator.hasNext())
{
if (player.getVehicle() == null)
return null;
Entity ent = burningIterator.next();
if (player.getVehicle() instanceof Horse)
return (Horse)player.getVehicle();
return null;
if (!ent.isValid() || UtilTime.elapsed(_burning.get(ent), 2500))
{
burningIterator.remove();
}
else
{
UtilParticle.PlayParticle(ParticleType.FLAME, ent.getLocation().add(0, 0.8, 0), 0f, 0f, 0f, 0, 1);
}
}
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
if (event.GetReason() == null || (!event.GetReason().contains(GetName()) && !event.GetReason().contains("Flame Kick")))
return;
event.AddKnockback(GetName(), 2);
event.AddKnockback(GetName(), 4);
}
}

View File

@ -0,0 +1,173 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashSet;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkInfernalHorror extends Perk
{
public HashSet<Player> _active = new HashSet<Player>();
public PerkInfernalHorror()
{
super("Infernal Horror", new String[]
{
C.cGray + "Tranform into " + F.skill("Infernal Horror") + " at 100% Rage.",
C.cGray + "Charge your Rage by dealing/taking damage."
});
}
@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.max(0, player.getExp()-0.001));
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void DamagerEnergy(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() == DamageCause.FIRE_TICK)
return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
if (!Kit.HasKit(damager))
return;
damager.setExp(Math.min(0.999f, damager.getExp() + (float)(event.GetDamage()/80d)));
ActiveCheck(damager);
}
@EventHandler(priority = EventPriority.MONITOR)
public void DamageeEnergy(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() == DamageCause.FIRE_TICK)
return;
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
if (!Kit.HasKit(damagee))
return;
damagee.setExp(Math.min(0.999f, damagee.getExp() + (float)(event.GetDamage()/80d)));
ActiveCheck(damagee);
}
@EventHandler(priority = EventPriority.HIGH)
public void DamageBoost(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
Player damager = event.GetDamagerPlayer(false);
if (damager == null) return;
if (!Kit.HasKit(damager))
return;
if (!_active.contains(damager))
return;
event.AddMod(damager.getName(), GetName(), 1, false);
}
@EventHandler
public void Check(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : Manager.GetGame().GetPlayers(true))
if (Kit.HasKit(player))
ActiveCheck(player);
}
public void ActiveCheck(Player player)
{
//Active
if (_active.contains(player))
{
player.setExp((float) Math.max(0, player.getExp()-0.005));
if (player.getExp() > 0)
{
//Condition
Manager.GetCondition().Factory().Speed(GetName(), player, player, 0.9, 1, false, false, false);
//Particles
UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 0.25f, 0.25f, 0.25f, 0, 1);
if (Math.random() > 0.9)
UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation().add(0, 1, 0), 0.25f, 0.25f, 0.25f, 0, 1);
}
else
{
_active.remove(player);
//Inform
UtilPlayer.message(player, F.main("Skill", "You are no longer " + F.skill("Infernal Horror") + "."));
}
}
//Not Active
else if (player.getExp() > 0.99)
{
_active.add(player);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.FIRE, 2f, 1f);
player.getWorld().playSound(player.getLocation(), Sound.FIRE, 2f, 1f);
//Inform
UtilPlayer.message(player, F.main("Skill", "You transformed into " + F.skill("Infernal Horror") + "."));
}
}
@EventHandler
public void Clean(PlayerDeathEvent event)
{
_active.remove(event.getEntity());
event.getEntity().setExp(0f);
}
public boolean IsActive(Player player)
{
return _active.contains(player);
}
}

View File

@ -0,0 +1,122 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import nautilus.game.arcade.kit.Perk;
public class PerkIronHook extends Perk implements IThrown
{
public PerkIronHook()
{
super("Iron Hook", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Iron Hook"
});
}
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 8000, true))
return;
//Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(131));
UtilAction.velocity(item, player.getLocation().getDirection(),
1.6, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(item, player, this, -1, true, true, true,
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 2d);
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
//Effect
item.getWorld().playSound(item.getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.8f);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
//Remove
double velocity = data.GetThrown().getVelocity().length();
data.GetThrown().remove();
if (!(data.GetThrower() instanceof Player))
return;
Player player = (Player)data.GetThrower();
if (target == null)
return;
//Pull
UtilAction.velocity(target,
UtilAlg.getTrajectory(target.getLocation(), player.getLocation()),
2, false, 0, 0.8, 1.5, true);
//Condition
Manager.GetCondition().Factory().Falling(GetName(), target, player, 10, false, true);
//Damage Event
Manager.GetDamage().NewDamageEvent(target, player, null,
DamageCause.CUSTOM, velocity * 8, false, true, false,
player.getName(), GetName());
//Inform
UtilPlayer.message(target, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + "."));
}
@Override
public void Idle(ProjectileUser data)
{
//Remove
data.GetThrown().remove();
}
@Override
public void Expire(ProjectileUser data)
{
//Remove
data.GetThrown().remove();
}
}

View File

@ -0,0 +1,175 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.WeakHashMap;
import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
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 mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguisePigZombie;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkPigBaconBomb extends Perk
{
private WeakHashMap<Player, HashSet<Pig>> _pigs = new WeakHashMap<Player, HashSet<Pig>>();
public PerkPigBaconBomb()
{
super("Baby Bacon Bomb", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Baby Bacon Bomb"
});
}
@EventHandler
public void Skill(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
float energy = 0.40f;
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise != null && disguise instanceof DisguisePigZombie)
energy = 0.2f;
//Energy
if (player.getExp() < energy)
{
UtilPlayer.message(player, F.main("Energy", "Not enough Energy to use " + F.skill(GetName()) + "."));
return;
}
//Recharge
if (!Recharge.Instance.use(player, GetName(), 100, false))
return;
//Use Energy
player.setExp(Math.max(0f, player.getExp() - energy));
//Velocity
UtilAction.velocity(player, player.getLocation().getDirection(), 0.8, true, 0.9, 0, 1, true);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 0.75f);
//Pig
Manager.GetGame().CreatureAllowOverride = true;
Pig pig = player.getWorld().spawn(player.getLocation(), Pig.class);
pig.setHealth(5);
pig.setVelocity(new Vector(0, -0.4, 0));
Manager.GetGame().CreatureAllowOverride = false;
pig.setBaby();
UtilEnt.Vegetate(pig);
UtilEnt.ghost(pig, true, false);
//Store
if (!_pigs.containsKey(player))
_pigs.put(player, new HashSet<Pig>());
_pigs.get(player).add(pig);
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void Check(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : _pigs.keySet())
{
Iterator<Pig> pigIterator = _pigs.get(player).iterator();
while (pigIterator.hasNext())
{
Pig pig = pigIterator.next();
if (!pig.isValid() || pig.getTicksLived() > 120)
{
PigExplode(pigIterator, pig, player);
continue;
}
Player target = UtilPlayer.getClosest(pig.getLocation(), player);
if (target == null)
continue;
UtilEnt.CreatureMoveFast(pig, target.getLocation(), 1.2f);
if (UtilMath.offset(target, pig) < 2)
PigExplode(pigIterator, pig, player);
}
}
}
public void PigExplode(Iterator<Pig> pigIterator, Pig pig, Player owner)
{
//Effect
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, pig.getLocation().add(0, 0.5, 0), 0, 0, 0, 0, 1);
//Sound
pig.getWorld().playSound(pig.getLocation(), Sound.EXPLODE, 0.6f, 2f);
pig.getWorld().playSound(pig.getLocation(), Sound.PIG_DEATH, 1f, 2f);
//Damage
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(pig.getLocation(), 4);
for (LivingEntity cur : targets.keySet())
{
if (cur.equals(owner))
continue;
//Damage Event
Manager.GetDamage().NewDamageEvent(cur, owner, null,
DamageCause.CUSTOM, 4 * targets.get(cur) + 2, false, true, false,
owner.getName(), GetName());
}
//Remove
pigIterator.remove();
pig.remove();
}
}

View File

@ -0,0 +1,173 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashSet;
import java.util.WeakHashMap;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
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.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguisePigZombie;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
public class PerkPigBaconBounce extends Perk implements IThrown
{
public PerkPigBaconBounce()
{
super("Bouncy Bacon", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Bouncy Bacon",
});
}
@EventHandler
public void Skill(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
float energy = 0.2f;
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise != null && disguise instanceof DisguisePigZombie)
energy = 0.1f;
//Energy
if (player.getExp() < energy)
{
UtilPlayer.message(player, F.main("Energy", "Not enough Energy to use " + F.skill(GetName()) + "."));
return;
}
//Recharge
if (!Recharge.Instance.use(player, GetName(), 100, false))
return;
//Use Energy
player.setExp(Math.max(0f, player.getExp() - energy));
//Launch
Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.PORK));
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1d);
ent.setPickupDelay(9999);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 1.5f);
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
Rebound(data.GetThrower(), data.GetThrown());
if (target == null)
return;
//Damage Event
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
DamageCause.CUSTOM, 3.5, true, true, false,
UtilEnt.getName(data.GetThrower()), GetName());
Item item = (Item)data.GetThrown();
item.setItemStack(new ItemStack(Material.GRILLED_PORK));
}
@Override
public void Idle(ProjectileUser data)
{
Rebound(data.GetThrower(), data.GetThrown());
}
@Override
public void Expire(ProjectileUser data)
{
Rebound(data.GetThrower(), data.GetThrown());
}
public void Rebound(LivingEntity player, Entity ent)
{
ent.getWorld().playSound(ent.getLocation(), Sound.ITEM_PICKUP, 1f, 0.5f);
double mult = 0.5 + (0.035 * UtilMath.offset(player.getLocation(), ent.getLocation()));
//Velocity
ent.setVelocity(player.getLocation().toVector().subtract(ent.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult));
//Ticks
if (ent instanceof Item)
((Item)ent).setPickupDelay(5);
}
@EventHandler(priority = EventPriority.LOWEST)
public void Pickup(PlayerPickupItemEvent event)
{
if (!Kit.HasKit(event.getPlayer()))
return;
if (event.getItem().getItemStack().getType() != Material.PORK && event.getItem().getItemStack().getType() != Material.GRILLED_PORK)
return;
//Remove
event.getItem().remove();
//Restore Energy
event.getPlayer().setExp(Math.min(0.999f, event.getPlayer().getExp() + 0.05f));
//Sound
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.EAT, 2f, 1f);
//Heal
if (event.getItem().getItemStack().getType() == Material.GRILLED_PORK)
{
UtilPlayer.health(event.getPlayer(), 1);
UtilParticle.PlayParticle(ParticleType.HEART, event.getPlayer().getLocation().add(0, 0.5, 0), 0.2f, 0.2f, 0.2f, 0, 4);
}
}
}

View File

@ -0,0 +1,112 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashSet;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguisePig;
import mineplex.core.disguise.disguises.DisguisePigZombie;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkPigZombie extends Perk
{
public HashSet<Player> _active = new HashSet<Player>();
public PerkPigZombie()
{
super("Nether Pig", new String[]
{
C.cGray + "Become Nether Pig when HP is below 4.",
C.cGray + "Return to Pig when HP is above 6."
});
}
@EventHandler
public void Check(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!Kit.HasKit(player))
continue;
//Active
if (_active.contains(player))
{
Manager.GetCondition().Factory().Speed("Pig Zombie", player, player, 0.9, 0, false, false, false);
if (player.getHealth() < 8)
continue;
//Deactivate
_active.remove(player);
//Armor
player.getInventory().setHelmet(null);
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
//Disguise
DisguisePig disguise = new DisguisePig(player);
disguise.SetName(C.cYellow + player.getName());
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 1f);
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 1f);
//Inform
UtilPlayer.message(player, F.main("Skill", "You returned to " + F.skill("Pig Form") + "."));
}
//Not Active
else
{
if (player.getHealth() <= 0 || player.getHealth() > 4)
continue;
//Activate
_active.add(player);
//Armor
player.getInventory().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
player.getInventory().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
player.getInventory().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
player.getInventory().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
//Disguise
DisguisePigZombie disguise = new DisguisePigZombie(player);
disguise.SetName(C.cYellow + player.getName());
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 2f, 1f);
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 2f, 1f);
//Inform
UtilPlayer.message(player, F.main("Skill", "You transformed into " + F.skill("Nether Pig Form") + "."));
}
}
}
@EventHandler
public void Clean(PlayerDeathEvent event)
{
_active.remove(event.getEntity());
}
}

View File

@ -19,6 +19,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;

View File

@ -25,6 +25,7 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkSeismicSlam extends Perk
@ -35,7 +36,7 @@ public class PerkSeismicSlam extends Perk
{
super("Seismic Slam", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Seismic Slam"
C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Seismic Slam"
});
}
@ -54,7 +55,7 @@ public class PerkSeismicSlam extends Perk
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE"))
return;
Player player = event.getPlayer();
@ -100,7 +101,7 @@ public class PerkSeismicSlam extends Perk
//Action
int damage = 12;
double range = 6;
double range = 8;
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), range);
for (LivingEntity cur : targets.keySet())
@ -113,14 +114,9 @@ public class PerkSeismicSlam extends Perk
//Damage Event
Manager.GetDamage().NewDamageEvent(cur, player, null,
DamageCause.CUSTOM, damage * targets.get(cur) + 0.5, false, true, false,
DamageCause.CUSTOM, damage * targets.get(cur) + 0.5, true, true, false,
player.getName(), GetName());
//Velocity
UtilAction.velocity(cur,
UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()),
1.8 * targets.get(cur), true, 0, 0.4 + 1.0 * targets.get(cur), 1.6, true);
//Condition
Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true);
@ -136,4 +132,13 @@ public class PerkSeismicSlam extends Perk
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId());
}
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return;
event.AddKnockback(GetName(), 2.4);
}
}

View File

@ -192,7 +192,7 @@ public class PerkSlimeRocket extends Perk implements IThrown
public void FireRocket(Player player)
{
double charge = Math.min(3, _active.get(player).getTicksLived()/20d);
double charge = Math.max(1, Math.min(3, _active.get(player).getTicksLived()/20d));
if (_active.get(player) == null || !_active.get(player).isValid())
{
@ -329,7 +329,7 @@ public class PerkSlimeRocket extends Perk implements IThrown
//Shrink
if (slime.getVehicle() == null)
{
if (slime.getTicksLived() > 60)
if (slime.getTicksLived() > 120)
{
slime.setTicksLived(1);

View File

@ -7,12 +7,15 @@ import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
@ -30,7 +33,7 @@ public class PerkSuperSquid extends Perk
{
super("Super Squid", new String[]
{
C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Super Squid"
C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Super Squid",
});
}
@ -79,7 +82,7 @@ public class PerkSuperSquid extends Perk
continue;
}
if (UtilTime.elapsed(_active.get(cur), 1000))
if (UtilTime.elapsed(_active.get(cur), 800))
{
_active.remove(cur);
continue;

View File

@ -113,7 +113,7 @@ public class PerkWitchPotion extends Perk
continue;
}
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, proj.getLocation(), 0, 0, 0, 0, 1);
UtilParticle.PlayParticle(ParticleType.MOB_SPELL, proj.getLocation(), 0, 0, 0, 0, 1);
}
}

View File

@ -76,7 +76,7 @@ public class PerkWitherImage extends Perk
skel.setSkeletonType(SkeletonType.WITHER);
skel.getEquipment().setItemInHand(player.getItemInHand());
skel.setMaxHealth(50);
skel.setMaxHealth(20);
skel.setHealth(skel.getMaxHealth());
skel.setCustomName(C.cYellow + player.getName());