SSM: Added Wither Skeleton and Creeper kits

Compass: no longer teleports if not holding compass (on click)
SSM: various balance changes.
This commit is contained in:
Chiss 2013-09-05 13:55:42 +10:00
parent 9121d429c2
commit 768f57ae5e
26 changed files with 1062 additions and 63 deletions

View File

@ -228,7 +228,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
@EventHandler
public void TeleportDisguises(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
if (event.getType() != UpdateType.SEC)
return;
for (Player player : Bukkit.getOnlinePlayers())

View File

@ -205,6 +205,9 @@ public class DamageManager extends MiniPlugin
private void Damage(CustomDamageEvent event)
{
if (event.GetDamageeEntity() == null)
return;
if (event.GetDamageeEntity().getHealth() <= 0)
return;
@ -281,6 +284,15 @@ public class DamageManager extends MiniPlugin
if (!UtilGear.isMat(player.getItemInHand(), Material.BOOK))
continue;
UtilPlayer.message(player, " ");
UtilPlayer.message(player, "=====================================");
UtilPlayer.message(player, F.elem("Reason ") + event.GetReason());
UtilPlayer.message(player, F.elem("Cause ") + event.GetCause());
UtilPlayer.message(player, F.elem("Damager ") + UtilEnt.getName(event.GetDamagerEntity(true)));
UtilPlayer.message(player, F.elem("Damagee ") + UtilEnt.getName(event.GetDamageeEntity()));
UtilPlayer.message(player, F.elem("Projectile ") + UtilEnt.getName(event.GetProjectile()));
UtilPlayer.message(player, F.elem("Damage ") + event.GetDamage());
UtilPlayer.message(player, F.elem("Damage Initial ") + event.GetDamageInitial());
for (DamageChange cur : event.GetDamageMod())
UtilPlayer.message(player, F.elem("Mod ") + cur.GetDamage() + " - " + cur.GetReason() + " by " + cur.GetSource());
@ -293,11 +305,9 @@ public class DamageManager extends MiniPlugin
for (String cur : event.GetCancellers())
UtilPlayer.message(player, F.elem("Cancel ") + cur);
UtilPlayer.message(player, F.elem("Damager ") + UtilEnt.getName(event.GetDamagerEntity(true)));
UtilPlayer.message(player, F.elem("Damagee ") + UtilEnt.getName(event.GetDamageeEntity()));
UtilPlayer.message(player, F.elem("Reason ") + event.GetReason());
UtilPlayer.message(player, F.elem("Damage ") + event.GetDamage());
UtilPlayer.message(player, F.elem("Damage Initial ") + event.GetDamageInitial());
}
}

View File

@ -16,6 +16,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
@ -146,6 +147,9 @@ public class CompassAddon extends MiniPlugin
Player player = event.getPlayer();
if (!UtilGear.isMat(player.getItemInHand(), Material.COMPASS))
return;
if (Manager.GetGame().IsAlive(player))
return;

View File

@ -8,6 +8,7 @@ import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
@ -45,18 +46,19 @@ public class SuperSmash extends SoloGame
new Kit[]
{
new KitSkeleton(manager),
new KitEnderman(manager),
new KitGolem(manager),
new KitSlime(manager),
new KitSpider(manager),
new KitSlime(manager),
new KitCreeper(manager),
new KitEnderman(manager),
new KitSnowman(manager),
new KitBlaze(manager),
new KitWitherSkeleton(manager),
new KitChicken(manager),
new KitKnight(manager),
new KitSkySquid(manager),
new KitWitherSkeleton(manager),
},
@ -292,4 +294,13 @@ public class SuperSmash extends SoloGame
event.setCancelled(true);
}
@EventHandler
public void ExplosionDamageCancel(EntityDamageEvent event)
{
if (event.getCause() == DamageCause.ENTITY_EXPLOSION || event.getCause() == DamageCause.BLOCK_EXPLOSION)
{
event.setCancelled(true);
}
}
}

View File

@ -101,4 +101,10 @@ public class KitBlaze extends SmashKit
Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false);
}
}
@Override
public int GetCost()
{
return 8000;
}
}

View File

@ -0,0 +1,97 @@
package nautilus.game.arcade.game.standalone.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.DisguiseCreeper;
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.PerkCreeperElectricity;
import nautilus.game.arcade.kit.perks.PerkCreeperExplode;
import nautilus.game.arcade.kit.perks.PerkCreeperSulphurBomb;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
public class KitCreeper extends SmashKit
{
public KitCreeper(ArcadeManager manager)
{
super(manager, "Creeper", KitAvailability.Green,
new String[]
{
},
new Perk[]
{
new PerkSmashStats(6, 1.65, 0.4, 3.5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkCreeperElectricity(),
new PerkCreeperSulphurBomb(),
new PerkCreeperExplode(),
},
EntityType.CREEPER,
new ItemStack(Material.TNT));
}
@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 + "Sulphur Bomb",
new String[]
{
ChatColor.RESET + "Throw a small bomb of sulphur.",
ChatColor.RESET + "Explodes on contact with players,",
ChatColor.RESET + "dealing some damage and 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 + "Explosive Leap",
new String[]
{
ChatColor.RESET + "You freeze in location and charge up",
ChatColor.RESET + "for 1.5 seconds. Then you explode!",
ChatColor.RESET + "You are sent flying in the direction",
ChatColor.RESET + "you are looking, while opponents take",
ChatColor.RESET + "large damage and knockback.",
}));
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 + "",
ChatColor.RESET + "Lightning Shield blocks 1 melee attack,",
ChatColor.RESET + "striking lightning on the attacker.",
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS));
//Disguise
DisguiseCreeper disguise = new DisguiseCreeper(player);
disguise.SetName(C.cYellow + player.getName());
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@Override
public int GetCost()
{
return 4000;
}
}

View File

@ -34,7 +34,7 @@ public class KitEnderman extends SmashKit
public KitEnderman(ArcadeManager manager)
{
super(manager, "Enderman", KitAvailability.Free,
super(manager, "Enderman", KitAvailability.Green,
new String[]
{
@ -142,4 +142,10 @@ public class KitEnderman extends SmashKit
}
}
}
@Override
public int GetCost()
{
return 4000;
}
}

View File

@ -34,6 +34,7 @@ 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.PerkNotFinished;
import nautilus.game.arcade.kit.perks.PerkDoubleJumpHorse;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import nautilus.game.arcade.kit.perks.PerkHorseKick;
@ -62,6 +63,7 @@ public class KitKnight extends SmashKit
new PerkKnockbackArrow(2),
new PerkDoubleJumpHorse(),
new PerkHorseKick(),
new PerkNotFinished()
},
EntityType.HORSE,
new ItemStack(Material.IRON_BARDING));

View File

@ -65,7 +65,7 @@ public class KitSkeleton extends SmashKit
ChatColor.RESET + "towards it, with great power.",
}));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 1,
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 1,
C.cYellow + C.Bold + "Charge Bow" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Barrage",
new String[]
{
@ -83,6 +83,7 @@ public class KitSkeleton extends SmashKit
DisguiseSkeleton disguise = new DisguiseSkeleton(player);
disguise.SetName(C.cYellow + player.getName());
disguise.SetCustomNameVisible(true);
disguise.hideArmor();
Manager.GetDisguise().disguise(disguise);
}
}

View File

@ -87,4 +87,10 @@ public class KitSnowman extends SmashKit
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@Override
public int GetCost()
{
return 6000;
}
}

View File

@ -93,4 +93,10 @@ public class KitSpider extends SmashKit
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@Override
public int GetCost()
{
return 2000;
}
}

View File

@ -14,15 +14,16 @@ 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.PerkComingSoon;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
import nautilus.game.arcade.kit.perks.PerkWitherImage;
import nautilus.game.arcade.kit.perks.PerkWitherSkull;
public class KitWitherSkeleton extends SmashKit
{
public KitWitherSkeleton(ArcadeManager manager)
{
super(manager, "Wither Skeleton", KitAvailability.Green,
super(manager, "Wither Skeleton", KitAvailability.Blue,
new String[]
{
@ -30,9 +31,10 @@ public class KitWitherSkeleton extends SmashKit
new Perk[]
{
new PerkSmashStats(7, 1.6, 0.25, 7.5),
new PerkSmashStats(6, 1.1, 0.3, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkComingSoon(),
new PerkWitherSkull(),
new PerkWitherImage(),
},
EntityType.SKELETON,
new ItemStack(Material.IRON_SWORD));
@ -42,31 +44,43 @@ public class KitWitherSkeleton extends SmashKit
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Coming Soon...",
C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Guided Wither Skull",
new String[]
{
ChatColor.RESET + "",
ChatColor.RESET + "",
ChatColor.RESET + "Launch a Wither Skull forwards, hold",
ChatColor.RESET + "block to guide the missile! Release",
ChatColor.RESET + "block to detonate it midair.",
}));
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 + "Coming Soon...",
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Image",
new String[]
{
ChatColor.RESET + "Create an exact image of yourself.",
ChatColor.RESET + "The copy is launched forwards with",
ChatColor.RESET + "high speeds. Lasts 8 seconds.",
ChatColor.RESET + "",
ChatColor.RESET + "",
ChatColor.RESET + "Use the skill again to swap positions",
ChatColor.RESET + "with your image.",
}));
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.IRON_BOOTS));
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
DisguiseSkeleton disguise = new DisguiseSkeleton(player);
disguise.SetName(C.cYellow + player.getName());
disguise.SetCustomNameVisible(true);
disguise.SetSkeletonType(SkeletonType.WITHER);
disguise.hideArmor();
Manager.GetDisguise().disguise(disguise);
}
@Override
public int GetCost()
{
return 6000;
}
}

View File

@ -14,7 +14,9 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -44,7 +46,7 @@ public class PerkBlizzard extends Perk
if (!Kit.HasKit(player))
continue;
player.setExp((float) Math.min(0.999, player.getExp()+0.01));
player.setExp((float) Math.min(0.999, player.getExp()+0.008));
}
}
@ -101,8 +103,15 @@ public class PerkBlizzard extends Perk
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return;
event.SetCancelled(GetName());
event.SetCancelled("Blizzard");
damagee.setVelocity(proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0)));
//Damage Event
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,
UtilEnt.getName(event.GetDamagerEntity(true)), GetName());
}
@EventHandler

View File

@ -14,7 +14,6 @@ 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;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
@ -198,19 +197,4 @@ public class PerkChickenRocket extends Perk
}
}
}
@EventHandler
public void ExplosionDamageCancel(EntityDamageEvent event)
{
if (event.getCause() == DamageCause.ENTITY_EXPLOSION || event.getCause() == DamageCause.BLOCK_EXPLOSION)
{
for (ChickenMissileData data : _data)
{
if (UtilMath.offset(data.Chicken, event.getEntity()) < 8)
{
event.setCancelled(true);
}
}
}
}
}

View File

@ -1,15 +0,0 @@
package nautilus.game.arcade.kit.perks;
import mineplex.core.common.util.C;
import nautilus.game.arcade.kit.Perk;
public class PerkComingSoon extends Perk
{
public PerkComingSoon()
{
super("Digger", new String[]
{
C.cRed + C.Bold + "COMING SOON...",
});
}
}

View File

@ -0,0 +1,165 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseCreeper;
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 PerkCreeperElectricity extends Perk
{
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
public PerkCreeperElectricity()
{
super("Lightning Shield", new String[]
{
"When hit by a non-melee attack, you gain " + C.cGreen + "Lightning Shield"
});
}
@EventHandler
public void Shield(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() == DamageCause.ENTITY_ATTACK)
return;
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
if (!Kit.HasKit(damagee))
return;
_active.put(damagee, System.currentTimeMillis());
SetPowered(damagee, true);
//Sound
damagee.getWorld().playSound(damagee.getLocation(), Sound.CREEPER_HISS, 3f, 1.25f);
//Inform
UtilPlayer.message(damagee, F.main("Skill", "You gained " + F.skill(GetName()) + "."));
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Player> shieldIterator = _active.keySet().iterator();
while (shieldIterator.hasNext())
{
Player player = shieldIterator.next();
if (!IsPowered(player))
{
shieldIterator.remove();
SetPowered(player, false);
continue;
}
if (UtilTime.elapsed(_active.get(player), 3000))
{
shieldIterator.remove();
SetPowered(player, false);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 3f, 0.75f);
}
}
}
@EventHandler
public void Damage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
if (!Kit.HasKit(damagee))
return;
if (!IsPowered(damagee))
return;
event.SetCancelled("Lightning Shield");
//Inform
UtilPlayer.message(damagee, F.main("Skill", "You hit " + F.elem(UtilEnt.getName(event.GetDamagerPlayer(false))) + " with " + F.skill(GetName()) + "."));
//Lightning
damagee.getWorld().strikeLightningEffect(damagee.getLocation());
SetPowered(damagee, false);
//Damage Event
Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), damagee, null,
DamageCause.LIGHTNING, 6, true, true, false,
damagee.getName(), GetName());
}
public DisguiseCreeper GetDisguise(Player player)
{
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise == null)
return null;
if (!(disguise instanceof DisguiseCreeper))
return null;
return (DisguiseCreeper)disguise;
}
public void SetPowered(Player player, boolean powered)
{
DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null) return;
creeper.SetPowered(powered);
Manager.GetDisguise().updateDisguise(creeper);
}
public boolean IsPowered(Player player)
{
DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null) return false;
return creeper.IsPowered();
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return;
event.AddKnockback(GetName(), 4);
}
}

View File

@ -0,0 +1,194 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
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.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseCreeper;
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 PerkCreeperExplode extends Perk
{
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
public PerkCreeperExplode()
{
super("Explode", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Shovel use " + C.cGreen + "Explosive Leap"
});
}
@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(), 8000, true))
return;
_active.put(player, System.currentTimeMillis());
IncreaseSize(player);
UtilPlayer.message(player, F.main("Skill", "You are charging " + F.skill(GetName()) + "."));
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Player> chargeIterator = _active.keySet().iterator();
while (chargeIterator.hasNext())
{
Player player = chargeIterator.next();
double elapsed = (System.currentTimeMillis() - _active.get(player))/1000d;
//Idle in Air
player.setVelocity(new Vector(0,0,0));
//Sound
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, (float)(0.5 + elapsed), (float)(0.5 + elapsed));
IncreaseSize(player);
player.setExp(Math.min(0.99f, (float)(elapsed/1.5)));
//Not Detonated
if (elapsed < 1.5)
continue;
chargeIterator.remove();
//Unpower
DecreaseSize(player);
//Explode
player.getWorld().createExplosion(player.getLocation(), (float) 2.0);
//Damage
for (Entity ent : player.getWorld().getEntities())
{
if (!(ent instanceof LivingEntity))
continue;
if (ent.equals(player))
continue;
double dist = UtilMath.offset(player.getLocation(), ent.getLocation());
double maxRange = 8;
if (dist > maxRange)
continue;
if (ent instanceof Player)
if (!Manager.GetGame().IsAlive((Player)ent))
continue;
LivingEntity livingEnt = (LivingEntity)ent;
double scale = 0.4 + 0.6 * ((maxRange-dist)/maxRange);
//Damage Event
Manager.GetDamage().NewDamageEvent(livingEnt, player, null,
DamageCause.CUSTOM, 20 * scale, true, true, false,
player.getName(), GetName());
}
//Velocity
UtilAction.velocity(player, 1.8, 0.2, 1.4, true);
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
}
public DisguiseCreeper GetDisguise(Player player)
{
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise == null)
return null;
if (!(disguise instanceof DisguiseCreeper))
return null;
return (DisguiseCreeper)disguise;
}
public int GetSize(Player player)
{
DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null) return 0;
return creeper.bV();
}
public void DecreaseSize(Player player)
{
DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null) return;
creeper.a(-1);
Manager.GetDisguise().updateDisguise(creeper);
}
public void IncreaseSize(Player player)
{
DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null) return;
creeper.a(1);
Manager.GetDisguise().updateDisguise(creeper);
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return;
event.AddKnockback(GetName(), 2.5);
}
}

View File

@ -0,0 +1,125 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
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.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
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 mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkCreeperSulphurBomb extends Perk implements IThrown
{
public PerkCreeperSulphurBomb()
{
super("Sulphur Bomb", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Sulphur Bomb"
});
}
@EventHandler
public void ShootWeb(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;
if (!Recharge.Instance.use(player, GetName(), 3000, true))
return;
event.setCancelled(true);
UtilInv.Update(player);
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.FIREWORK_CHARGE, (byte)6));
UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
null, 1f, 1f,
null, 1, UpdateType.SLOW,
2d);
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
//Effect
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_DEATH, 2f, 1.5f);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
Explode(data);
if (target == null)
return;
//Damage Event
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
DamageCause.PROJECTILE, 4, true, true, false,
UtilEnt.getName(data.GetThrower()), GetName());
}
@Override
public void Idle(ProjectileUser data)
{
Explode(data);
}
@Override
public void Expire(ProjectileUser data)
{
Explode(data);
}
public void Explode(ProjectileUser data)
{
data.GetThrown().getWorld().createExplosion(data.GetThrown().getLocation(), 0.5f);
data.GetThrown().remove();
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return;
event.AddKnockback(GetName(), 2);
}
}

View File

@ -88,7 +88,7 @@ public class PerkFirefly extends Perk
//Teleport
if (!UtilTime.elapsed(data.Time, 1000))
{
data.Player.teleport(data.Location);
data.Player.setVelocity(new Vector(0,0,0));//.teleport(data.Location);
data.Player.getWorld().playSound(data.Location, Sound.EXPLODE, 0.2f, 0.6f);
if (_tick == 0)

View File

@ -91,7 +91,7 @@ public class PerkInferno extends Perk
continue;
}
cur.setExp(cur.getExp()-0.03f);
cur.setExp(cur.getExp()-0.035f);
if (cur.getExp() <= 0)
{

View File

@ -66,7 +66,6 @@ public class PerkInkBlast extends Perk implements IThrown
event.setCancelled(true);
UtilInv.remove(player, Material.WEB, (byte)0, 1);
UtilInv.Update(player);
for (int i=0 ; i<5 ; i++)

View File

@ -59,7 +59,7 @@ public class PerkNeedler extends Perk
if (!Recharge.Instance.use(player, GetName(), 1800, true))
return;
_active.put(player, 7);
_active.put(player, 8);
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}

View File

@ -0,0 +1,15 @@
package nautilus.game.arcade.kit.perks;
import mineplex.core.common.util.C;
import nautilus.game.arcade.kit.Perk;
public class PerkNotFinished extends Perk
{
public PerkNotFinished()
{
super("Not Completed", new String[]
{
C.cRed + C.Bold + "KIT IS NOT FINISHED",
});
}
}

View File

@ -0,0 +1,163 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityTargetEvent;
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 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 PerkWitherImage extends Perk
{
private HashMap<Player, Skeleton> _images = new HashMap<Player, Skeleton>();
public PerkWitherImage()
{
super("Wither Image", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Wither Image"
});
}
@EventHandler
public void Leap(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;
if (!_images.containsKey(player))
{
if (!Recharge.Instance.use(player, GetName(), 12000, true))
return;
//Spawn
Manager.GetGame().CreatureAllowOverride = true;
Skeleton skel = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Skeleton.class);
Manager.GetGame().CreatureAllowOverride = false;
skel.setSkeletonType(SkeletonType.WITHER);
skel.getEquipment().setArmorContents(player.getInventory().getArmorContents());
skel.getEquipment().setItemInHand(player.getItemInHand());
skel.setCustomName(C.cYellow + player.getName());
skel.setCustomNameVisible(true);
//skel.setLeashHolder(player);
UtilAction.velocity(skel, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, true);
_images.put(player, skel);
Recharge.Instance.use(player, "Wither Swap", 500, false);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.WITHER_SPAWN, 1f, 1f);
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
else
{
if (!Recharge.Instance.use(player, "Wither Swap", 1000, true))
return;
Skeleton skel = _images.get(player);
Location loc = skel.getLocation();
skel.teleport(player.getLocation());
player.teleport(loc);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.WITHER_SPAWN, 1f, 2f);
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Wither Swap") + "."));
}
}
@EventHandler
public void EntityTarget(EntityTargetEvent event)
{
if (_images.containsKey(event.getTarget()))
if (_images.get(event.getTarget()).equals(event.getEntity()))
event.setCancelled(true);
}
@EventHandler
public void Damage(CustomDamageEvent event)
{
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
if (!_images.containsKey(damagee))
return;
LivingEntity damager = event.GetDamagerEntity(false);
if (damager == null) return;
if (_images.get(damagee).equals(damager))
event.SetCancelled("Wither Image");
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
Iterator<Player> playerIterator = _images.keySet().iterator();
while (playerIterator.hasNext())
{
Player player = playerIterator.next();
Skeleton skel = _images.get(player);
if (!player.isValid() || !skel.isValid() || skel.getTicksLived() > 160)
{
//Effect
Manager.GetBlood().Effects(skel.getLocation().add(0, 0.5, 0), 12, 0.3, Sound.WITHER_HURT, 1f, 0.75f, Material.BONE, (byte)0, 40, false);
playerIterator.remove();
skel.remove();
continue;
}
}
}
}

View File

@ -0,0 +1,197 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.WitherSkull;
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.entity.EntityExplodeEvent;
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.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
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 PerkWitherSkull extends Perk
{
private HashMap<WitherSkull, Player> _active = new HashMap<WitherSkull, Player>();
public PerkWitherSkull()
{
super("Wither Skull", new String[]
{
C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Wither Skull"
});
}
@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("_SWORD"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 6000, true))
return;
//Fire
WitherSkull skull = player.launchProjectile(WitherSkull.class);
skull.setDirection(player.getLocation().getDirection());
_active.put(skull, player);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 1f, 1f);
//Inform
UtilPlayer.message(player, F.main("Skill", "You launched " + F.skill(GetName()) + "."));
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<WitherSkull> skullIterator = _active.keySet().iterator();
while (skullIterator.hasNext())
{
WitherSkull skull = skullIterator.next();
Player player = _active.get(skull);
if (!skull.isValid())
{
skullIterator.remove();
skull.remove();
continue;
}
if (player.isBlocking())
{
skull.setDirection(player.getLocation().getDirection());
skull.setVelocity(player.getLocation().getDirection().multiply(0.6));
}
else
{
Explode(skull, skull.getLocation(), player);
skullIterator.remove();
skull.remove();
continue;
}
}
}
@EventHandler
public void Explode(EntityExplodeEvent event)
{
if (!_active.containsKey(event.getEntity()))
return;
event.setCancelled(true);
WitherSkull skull = (WitherSkull)event.getEntity();
Explode(skull, event.getLocation(), skull.getShooter());
}
@EventHandler(priority = EventPriority.LOWEST)
public void ExplodeDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetProjectile() != null && event.GetProjectile() instanceof WitherSkull)
event.SetCancelled("Wither Skull Cancel");
}
@EventHandler(priority = EventPriority.LOWEST)
public void DirectHitDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
if (event.GetDamageInitial() != 7)
return;
Player damager = event.GetDamagerPlayer(false);
if (damager == null) return;
if (!Kit.HasKit(damager))
return;
if (!Manager.IsAlive(damager))
return;
event.SetCancelled("Wither Skull Direct Hit");
}
private void Explode(WitherSkull skull, Location loc, LivingEntity shooter)
{
double scale = 0.4 + 0.6 * Math.min(1, skull.getTicksLived()/20d);
//Damage
for (Entity ent : skull.getWorld().getEntities())
{
if (!(ent instanceof LivingEntity))
continue;
if (UtilMath.offset(loc, ent.getLocation()) > 2)
continue;
if (ent instanceof Player)
if (!Manager.GetGame().IsAlive((Player)ent))
continue;
LivingEntity livingEnt = (LivingEntity)ent;
//Damage Event
Manager.GetDamage().NewDamageEvent(livingEnt, shooter, null,
DamageCause.CUSTOM, 12 * scale, false, true, false,
UtilEnt.getName(shooter), GetName());
UtilAction.velocity(livingEnt, UtilAlg.getTrajectory2d(loc, livingEnt.getLocation()), 1.6 * scale, true, 0.8 * scale, 0, 10, true);
}
//Explosion
loc.getWorld().createExplosion(loc, (float) 2.5);
}
}