squid skill

This commit is contained in:
Cheese 2015-09-14 14:14:06 +10:00
parent d9142ac33f
commit ac269839c5
8 changed files with 255 additions and 11 deletions

View File

@ -264,8 +264,8 @@ public class ProjectileUser
//Idle
if (_idle)
{
if (_thrown.getVelocity().length() < 0.2 &&
!UtilBlock.airFoliage(_thrown.getLocation().getBlock().getRelative(BlockFace.DOWN)))
if (_thrown.getVelocity().length() < 0.2 && (_thrown.isOnGround() ||
!UtilBlock.airFoliage(_thrown.getLocation().getBlock().getRelative(BlockFace.DOWN))))
{
_callback.Idle(this);
return true;

View File

@ -13,6 +13,7 @@ import mineplex.core.disguise.disguises.DisguiseSquid;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkFishFlurry;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
@ -38,6 +39,7 @@ public class KitSkySquid extends SmashKit
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkSuperSquid(),
new PerkInkBlast(),
new PerkFishFlurry(),
new PerkStormSquid()
},
EntityType.SQUID,
@ -67,6 +69,16 @@ public class KitSkySquid extends SmashKit
ChatColor.RESET + "the sky in the direction you are looking.",
}));
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 + "Fish Flurry",
new String[]
{
ChatColor.RESET + "Target a location to create a geyser.",
ChatColor.RESET + "After a few seconds, the geyser will explode",
ChatColor.RESET + "with all sorts of marine life which will",
ChatColor.RESET + "damage nearby opponents.",
}));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Storm Squid",

View File

@ -0,0 +1,20 @@
package nautilus.game.arcade.game.games.smash.perks;
import java.util.HashSet;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
public class DataSquidGeyser
{
public Player Player;
public HashSet<Block> Blocks;
public long StartTime;
public DataSquidGeyser(Player player, HashSet<Block> blocks)
{
StartTime = System.currentTimeMillis();
Player = player;
Blocks = blocks;
}
}

View File

@ -0,0 +1,206 @@
package nautilus.game.arcade.game.games.smash.perks;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
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.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.UtilAlg;
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.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
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 mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkFishFlurry extends SmashPerk implements IThrown
{
private ArrayList<DataSquidGeyser> _active = new ArrayList<DataSquidGeyser>();
public PerkFishFlurry()
{
super("Fish Flurry", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Fish Flurry"
});
}
@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("_SPADE"))
return;
Player player = event.getPlayer();
if (isSuperActive(player))
return;
if (!Kit.HasKit(player))
return;
Block block = player.getTargetBlock(null, 64);
if (block == null || block.getType() == Material.AIR)
{
UtilPlayer.message(player, F.main("Game", "You must target a block."));
return;
}
if (!Recharge.Instance.use(player, GetName(), 24000, true, true))
return;
event.setCancelled(true);
HashSet<Block> blocks = new HashSet<Block>();
for (Block cur : UtilBlock.getInRadius(block, 3.5d).keySet())
{
if (UtilBlock.airFoliage(cur))
continue;
if (!UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)))
continue;
blocks.add(cur);
}
_active.add(new DataSquidGeyser(player, blocks));
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<DataSquidGeyser> activeIter = _active.iterator();
while (activeIter.hasNext())
{
DataSquidGeyser data = activeIter.next();
//paticles
for (Block block : data.Blocks)
UtilParticle.PlayParticle(ParticleType.SPLASH, block.getLocation().add(0.5, 1, 0.5), 0.25f, 0, 0.25f, 0, 10, ViewDist.LONG, UtilServer.getPlayers());
//sound
Block block = UtilAlg.Random(data.Blocks);
if (Math.random() > 0.5)
block.getWorld().playSound(block.getLocation(), Math.random() > 0.5 ? Sound.SPLASH : Sound.SPLASH2, 0.5f, 1f);
//Fish
if (!UtilTime.elapsed(data.StartTime, 2000))
{
}
else if (!UtilTime.elapsed(data.StartTime, 6000))
{
for (int i=0 ; i<1 ; i++)
{
Item fish = block.getWorld().dropItem(block.getLocation().add(0.5, 1.5, 0.5),
ItemStackFactory.Instance.CreateStack(Material.RAW_FISH, (byte)UtilMath.r(4), 1, "Fish" + System.currentTimeMillis()));
Vector random = new Vector(
Math.random() - 0.5,
1 + Math.random() * 1,
Math.random() - 0.5);
UtilAction.velocity(fish, random, 0.25 + 0.4 * Math.random(), false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(fish, data.Player, this,
-1, true, true, true,
null, 1f, 1f,
null, UpdateType.TICK, 1f);
}
}
else
{
activeIter.remove();
}
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target != null)
{
//Damage Event
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
DamageCause.PROJECTILE, 3, true, true, false,
UtilEnt.getName(data.GetThrower()), GetName());
UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers());
}
data.GetThrown().remove();
}
@Override
public void Idle(ProjectileUser data)
{
data.GetThrown().remove();
}
@Override
public void Expire(ProjectileUser data)
{
data.GetThrown().remove();
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return;
event.AddKnockback(GetName(), 1.5);
event.setKnockbackOrigin(event.GetDamageeEntity().getLocation().add(Math.random()-0.5, Math.random()-0.5, Math.random()-0.5));
}
}

View File

@ -119,8 +119,10 @@ public class PerkCreeperElectricity extends Perk
//Inform
UtilPlayer.message(damagee, F.main("Skill", "You hit " + F.elem(UtilEnt.getName(event.GetDamagerPlayer(false))) + " with " + F.skill(GetName()) + "."));
//Lightning
//Elec
damagee.getWorld().strikeLightningEffect(damagee.getLocation());
Manager.GetCondition().Factory().Shock(GetName(), event.GetDamagerEntity(false), event.GetDamageeEntity(), 1, false, false);
SetPowered(damagee, false);
//Damage Event

View File

@ -76,12 +76,12 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte)0));
UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false);
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
null, 1f, 1f,
null, 1, UpdateType.SLOW,
0.5f);
0.65f);
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
@ -130,6 +130,6 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return;
event.AddKnockback(GetName(), 1.5);
event.AddKnockback(GetName(), 2);
}
}

View File

@ -75,9 +75,10 @@ public class PerkInkBlast extends SmashPerk implements IThrown
UtilInv.Update(player);
for (int i=0 ; i<9 ; i++)
for (int i=0 ; i<8 ; i++)
{
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.INK_SACK));
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()),
ItemStackFactory.Instance.CreateStack(Material.INK_SACK, (byte)0, 1, "Ink" + Math.random()));
Vector random = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5);
random.normalize();
@ -90,7 +91,7 @@ public class PerkInkBlast extends SmashPerk implements IThrown
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
null, 1f, 1f,
Effect.SMOKE, 4, UpdateType.TICK,
ParticleType.EXPLODE, UpdateType.TICK,
0.5f);
}

View File

@ -13,9 +13,12 @@ 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.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -93,8 +96,8 @@ public class PerkSuperSquid extends SmashPerk
UtilAction.velocity(cur, 0.6, 0.1, 1, true);
cur.getWorld().playSound(cur.getLocation(), Sound.SPLASH2, 0.2f, 1f);
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 8);
cur.getWorld().playSound(cur.getLocation(), Sound.SPLASH2, 0.5f, 1f);
UtilParticle.PlayParticle(ParticleType.SPLASH, cur.getLocation().add(0, 0.5, 0), 0.3f, 0.3f, 0.3f, 0, 60, ViewDist.LONG, UtilServer.getPlayers());
}
}