Convert old perks to new perks

This commit is contained in:
Sam 2016-08-28 09:06:07 +01:00
parent 88f4813534
commit ec8ed76270
7 changed files with 28 additions and 22 deletions

View File

@ -68,7 +68,7 @@ public class PerkDash extends Perk
return; return;
} }
if (!Kit.HasKit(player)) if (!hasPerk(player))
{ {
return; return;
} }
@ -118,7 +118,7 @@ public class PerkDash extends Perk
curRange = 0; curRange = 0;
// Destination // Destination
Location loc = player.getLocation().add(player.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0))); Location location = player.getLocation().add(player.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0)));
if (curRange > 0) if (curRange > 0)
{ {
@ -126,7 +126,7 @@ public class PerkDash extends Perk
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.WHITE, false, false); UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.WHITE, false, false);
player.playSound(player.getLocation(), Sound.SHOOT_ARROW, 1, 1); player.playSound(player.getLocation(), Sound.SHOOT_ARROW, 1, 1);
player.teleport(loc); player.teleport(location);
player.playSound(player.getLocation(), Sound.SHOOT_ARROW, 1, 1); player.playSound(player.getLocation(), Sound.SHOOT_ARROW, 1, 1);
// Firework // Firework

View File

@ -30,7 +30,7 @@ public class PerkFireArrows extends Perk
Player player = (Player) event.getEntity().getShooter(); Player player = (Player) event.getEntity().getShooter();
Projectile projectile = event.getEntity(); Projectile projectile = event.getEntity();
if (!Kit.HasKit(player)) if (!hasPerk(player))
{ {
return; return;
} }

View File

@ -38,6 +38,7 @@ public class PerkFletcher extends Perk
private boolean _remove; private boolean _remove;
private int _slot; private int _slot;
private boolean _instant = true; private boolean _instant = true;
private String _name;
public PerkFletcher(int time, int max, boolean remove) public PerkFletcher(int time, int max, boolean remove)
{ {
@ -55,6 +56,11 @@ public class PerkFletcher extends Perk
} }
public PerkFletcher(int time, int max, boolean remove, int slot, boolean instant) public PerkFletcher(int time, int max, boolean remove, int slot, boolean instant)
{
this(time, max, remove, slot, instant, "Fletcted Arrow");
}
public PerkFletcher(int time, int max, boolean remove, int slot, boolean instant, String name)
{ {
super("Fletcher", new String[] super("Fletcher", new String[]
{ {
@ -66,6 +72,7 @@ public class PerkFletcher extends Perk
_remove = remove; _remove = remove;
_slot = slot; _slot = slot;
_instant = instant; _instant = instant;
_name = name;
} }
public boolean isFletchedArrow(ItemStack stack) public boolean isFletchedArrow(ItemStack stack)
@ -78,7 +85,7 @@ public class PerkFletcher extends Perk
if (meta.getDisplayName() == null) if (meta.getDisplayName() == null)
return false; return false;
if (!meta.getDisplayName().contains("Fletched Arrow")) if (!meta.getDisplayName().contains(_name))
return false; return false;
return true; return true;
@ -92,7 +99,7 @@ public class PerkFletcher extends Perk
Player player = (Player)event.getEntity(); Player player = (Player)event.getEntity();
if (!Kit.HasKit(player)) if (!hasPerk(player))
return; return;
for (int i=0 ; i<=8 ; i++) for (int i=0 ; i<=8 ; i++)
@ -129,7 +136,7 @@ public class PerkFletcher extends Perk
if (Manager.isSpectator(cur)) if (Manager.isSpectator(cur))
continue; continue;
if (!Kit.HasKit(cur)) if (!hasPerk(cur))
continue; continue;
if (!Manager.GetGame().IsAlive(cur)) if (!Manager.GetGame().IsAlive(cur))
@ -145,17 +152,17 @@ public class PerkFletcher extends Perk
if (!Recharge.Instance.use(cur, GetName(), _time * 1000, false, false)) if (!Recharge.Instance.use(cur, GetName(), _time * 1000, false, false))
continue; continue;
if (UtilInv.contains(cur, "Fletched Arrow", Material.ARROW, (byte)0, _max)) if (UtilInv.contains(cur, _name, Material.ARROW, (byte)0, _max))
continue; continue;
//Add //Add
if (_slot == -1) if (_slot == -1)
{ {
cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Fletched Arrow"))); cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item(_name)));
} }
else else
{ {
cur.getInventory().setItem(_slot, ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Fletched Arrow"))); cur.getInventory().setItem(_slot, ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item(_name)));
} }
cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f); cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f);
@ -175,7 +182,7 @@ public class PerkFletcher extends Perk
event.setCancelled(true); event.setCancelled(true);
//Inform //Inform
UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot drop " + F.item("Fletched Arrow") + ".")); UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot drop " + F.item(_name) + "."));
} }
@EventHandler @EventHandler
@ -194,7 +201,7 @@ public class PerkFletcher extends Perk
@EventHandler @EventHandler
public void FletchInvClick(InventoryClickEvent event) public void FletchInvClick(InventoryClickEvent event)
{ {
UtilInv.DisallowMovementOf(event, "Fletched Arrow", Material.ARROW, (byte)0, true); UtilInv.DisallowMovementOf(event, _name, Material.ARROW, (byte)0, true);
} }
@EventHandler @EventHandler

View File

@ -32,13 +32,15 @@ public class PerkLifestealArrows extends Perk
Player player = event.GetDamagerPlayer(true); Player player = event.GetDamagerPlayer(true);
if (!Kit.HasKit(player)) if (!hasPerk(player))
{ {
return; return;
} }
player.setHealth(Math.min(player.getMaxHealth(), player.getHealth() + _health)); player.setHealth(Math.min(player.getMaxHealth(), player.getHealth() + _health));
UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation().add(0, 1, 0), 1, 1, 1, 1, 10, ViewDist.NORMAL); UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation().add(0, 1, 0), 1, 1, 1, 1, 5, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.HEART, event.GetDamageeEntity().getLocation().add(0, 1, 0), 1, 1, 1, 1, 5, ViewDist.NORMAL);
} }
} }

View File

@ -26,15 +26,12 @@ import nautilus.game.arcade.kit.Perk;
public class PerkSeismicSlamOITQ extends Perk public class PerkSeismicSlamOITQ extends Perk
{ {
private long _cooldown; public PerkSeismicSlamOITQ()
public PerkSeismicSlamOITQ(long cooldown)
{ {
super("Ground Pound", new String[] super("Ground Pound", new String[]
{ {
C.cYellow + "Right-Click" + C.cGray + " with " + "SPADE" + " to " + C.cGreen + "Ground Pound" C.cYellow + "Right-Click" + C.cGray + " with " + "SPADE" + " to " + C.cGreen + "Ground Pound"
}); });
_cooldown = cooldown;
} }
@EventHandler @EventHandler
@ -60,7 +57,7 @@ public class PerkSeismicSlamOITQ extends Perk
if (!Kit.HasKit(player)) if (!Kit.HasKit(player))
return; return;
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true)) if (!Recharge.Instance.use(player, GetName(), 10000, true, true))
return; return;
//Action //Action

View File

@ -33,7 +33,7 @@ public class PerkSpeed extends Perk
for (Player player : Manager.GetGame().GetPlayers(true)) for (Player player : Manager.GetGame().GetPlayers(true))
{ {
if (!Kit.HasKit(player)) if (!hasPerk(player))
continue; continue;
Manager.GetCondition().Factory().Speed(GetName(), player, player, 8, _level, false, false, true); Manager.GetCondition().Factory().Speed(GetName(), player, player, 8, _level, false, false, true);

View File

@ -31,7 +31,7 @@ public class PerkStrength extends Perk
Player damager = event.GetDamagerPlayer(true); Player damager = event.GetDamagerPlayer(true);
if (damager == null) return; if (damager == null) return;
if (!Kit.HasKit(damager)) if (!hasPerk(damager))
return; return;
event.AddMod(damager.getName(), GetName(), _power, false); event.AddMod(damager.getName(), GetName(), _power, false);