Witch SSM

This commit is contained in:
Chiss 2013-10-26 11:34:05 +11:00
parent 49e8c15f44
commit a52bd69558
8 changed files with 430 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package mineplex.core.common.util;
import java.lang.reflect.Field;
import mineplex.core.common.util.UtilParticle.ParticleType;
import net.minecraft.server.v1_6_R3.Packet63WorldParticles;
import org.bukkit.Location;
@ -104,4 +105,10 @@ public class UtilParticle
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
public static void PlayParticle(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count)
{
for (Player player : UtilServer.getPlayers())
PlayParticle(player, type, location, offsetX, offsetY, offsetZ, speed, count);
}
}

View File

@ -47,6 +47,7 @@ public class SuperSmash extends SoloGame
new Kit[]
{
new KitWitch(manager),
new KitSkeleton(manager),
new KitGolem(manager),
new KitSpider(manager),
@ -64,6 +65,7 @@ public class SuperSmash extends SoloGame
//new KitWither(manager),
new KitWolf(manager),
},
new String[]

View File

@ -27,7 +27,7 @@ public class KitBlaze extends SmashKit
{
public KitBlaze(ArcadeManager manager)
{
super(manager, "Blaze", KitAvailability.Green,
super(manager, "Blaze", KitAvailability.Blue,
new String[]
{

View File

@ -0,0 +1,93 @@
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.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.disguise.disguises.DisguiseSkeleton;
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.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
public class KitWitch extends SmashKit
{
public KitWitch(ArcadeManager manager)
{
super(manager, "Witch", KitAvailability.Blue,
new String[]
{
},
new Perk[]
{
new PerkSmashStats(6, 1.5, 0.15, 5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkBatWave(),
new PerkWitchPotion()
},
EntityType.WITCH,
new ItemStack(Material.POTION));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "",
new String[]
{
ChatColor.RESET + "",
}));
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 + "Bat Wave",
new String[]
{
ChatColor.RESET + "",
}));
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
DisguiseSkeleton disguise = new DisguiseSkeleton(player);
disguise.SetName(C.cYellow + player.getName());
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@EventHandler
public void Visuals(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
for (Player player : UtilServer.getPlayers())
{
if (!HasKit(player))
continue;
for (Player other : UtilServer.getPlayers())
{
UtilParticle.PlayParticle(other, ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 0.25f, 0.5f, 0.25f, 0, 2);
}
}
}
}

View File

@ -22,7 +22,7 @@ public class KitWolf extends SmashKit
{
public KitWolf(ArcadeManager manager)
{
super(manager, "Wolf", KitAvailability.Blue,
super(manager, "Wolf", KitAvailability.Green,
new String[]
{

View File

@ -0,0 +1,204 @@
package nautilus.game.arcade.kit.perks;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Bat;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
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.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
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 PerkBatWave extends Perk
{
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
private HashMap<Player, Location> _velocity = new HashMap<Player, Location>();
private HashMap<Player, ArrayList<Bat>> _bats = new HashMap<Player, ArrayList<Bat>>();
public PerkBatWave()
{
super("Bat Wave", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " to use " + C.cGreen + "Bat Wave"
});
}
@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;
//Start
_velocity.put(player, player.getEyeLocation());
_active.put(player, System.currentTimeMillis());
_bats.put(player, new ArrayList<Bat>());
for (int i=0 ; i<16 ; i++)
{
Manager.GetGame().CreatureAllowOverride = true;
Bat bat = player.getWorld().spawn(player.getEyeLocation(), Bat.class);
_bats.get(player).add(bat);
//bat.setLeashHolder(player);
Manager.GetGame().CreatureAllowOverride = false;
}
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : UtilServer.getPlayers())
{
if (!_active.containsKey(cur))
continue;
if (UtilTime.elapsed(_active.get(cur), 2000))
{
Clear(cur);
continue;
}
Location loc = _velocity.get(cur);
//Vector batVec = new Vector(0,0,0);
//double batCount = 0;
//Bat Movement
for (Bat bat : _bats.get(cur))
{
if (!bat.isValid())
continue;
//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.5).add(rand));
for (Player other : Manager.GetGame().GetPlayers(true))
{
if (other.equals(cur))
continue;
if (!Recharge.Instance.usable(other, "Hit by Bat"))
continue;
if (UtilEnt.hitBox(bat.getLocation(), other, 2, null))
{
//Damage Event
Manager.GetDamage().NewDamageEvent(other, cur, null,
DamageCause.CUSTOM, 2, true, true, false,
cur.getName(), GetName());
//Effect
bat.getWorld().playSound(bat.getLocation(), Sound.BAT_HURT, 1f, 1f);
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, bat.getLocation(), 0, 0, 0, 0, 3);
bat.remove();
//Recharge on hit
Recharge.Instance.useForce(other, "Hit by Bat", 200);
}
}
}
//Player Pull
/*
batVec.multiply(1/batCount);
Location batLoc = batVec.toLocation(cur.getWorld());
UtilAction.velocity(cur, UtilAlg.getTrajectory(cur.getLocation(), batLoc), 0.3, false, 0, 0, 10, false);
*/
}
}
@EventHandler
public void PlayerQuit(PlayerQuitEvent event)
{
Clear(event.getPlayer());
}
@EventHandler
public void PlayerDeath(PlayerDeathEvent event)
{
Clear(event.getEntity());
}
public void Clear(Player player)
{
_active.remove(player);
_velocity.remove(player);
if (_bats.containsKey(player))
{
for (Bat bat : _bats.get(player))
{
if (bat.isValid())
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, bat.getLocation(), 0, 0, 0, 0, 3);
bat.remove();
}
_bats.remove(player);
}
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return;
event.AddKnockback(GetName(), 1);
}
}

View File

@ -0,0 +1,61 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
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.UtilPlayer;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
public class PerkWitchBroom extends Perk
{
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
public PerkWitchBroom()
{
super("Broomstick", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " to use " + C.cGreen + "Broomstick"
});
}
@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;
//Start
_active.put(player, System.currentTimeMillis());
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
}

View File

@ -0,0 +1,61 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import org.bukkit.entity.Player;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
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.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
public class PerkWitchPotion extends Perk
{
public PerkWitchPotion()
{
super("Throw Potion", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " to use " + C.cGreen + "Throw Potion"
});
}
@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("_SPADE"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 2000, true))
return;
//Start
ThrownPotion potion = player.launchProjectile(ThrownPotion.class);
UtilAction.velocity(potion, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
}