Convert old perks to new perks
This commit is contained in:
parent
88f4813534
commit
ec8ed76270
@ -68,7 +68,7 @@ public class PerkDash extends Perk
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
if (!hasPerk(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -118,7 +118,7 @@ public class PerkDash extends Perk
|
||||
curRange = 0;
|
||||
|
||||
// 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)
|
||||
{
|
||||
@ -126,7 +126,7 @@ public class PerkDash extends Perk
|
||||
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.WHITE, false, false);
|
||||
|
||||
player.playSound(player.getLocation(), Sound.SHOOT_ARROW, 1, 1);
|
||||
player.teleport(loc);
|
||||
player.teleport(location);
|
||||
player.playSound(player.getLocation(), Sound.SHOOT_ARROW, 1, 1);
|
||||
|
||||
// Firework
|
||||
|
@ -30,7 +30,7 @@ public class PerkFireArrows extends Perk
|
||||
Player player = (Player) event.getEntity().getShooter();
|
||||
Projectile projectile = event.getEntity();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
if (!hasPerk(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ public class PerkFletcher extends Perk
|
||||
private boolean _remove;
|
||||
private int _slot;
|
||||
private boolean _instant = true;
|
||||
private String _name;
|
||||
|
||||
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)
|
||||
{
|
||||
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[]
|
||||
{
|
||||
@ -66,8 +72,9 @@ public class PerkFletcher extends Perk
|
||||
_remove = remove;
|
||||
_slot = slot;
|
||||
_instant = instant;
|
||||
_name = name;
|
||||
}
|
||||
|
||||
|
||||
public boolean isFletchedArrow(ItemStack stack)
|
||||
{
|
||||
if (!UtilGear.isMat(stack, Material.ARROW))
|
||||
@ -78,7 +85,7 @@ public class PerkFletcher extends Perk
|
||||
if (meta.getDisplayName() == null)
|
||||
return false;
|
||||
|
||||
if (!meta.getDisplayName().contains("Fletched Arrow"))
|
||||
if (!meta.getDisplayName().contains(_name))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@ -92,7 +99,7 @@ public class PerkFletcher extends Perk
|
||||
|
||||
Player player = (Player)event.getEntity();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
if (!hasPerk(player))
|
||||
return;
|
||||
|
||||
for (int i=0 ; i<=8 ; i++)
|
||||
@ -129,7 +136,7 @@ public class PerkFletcher extends Perk
|
||||
if (Manager.isSpectator(cur))
|
||||
continue;
|
||||
|
||||
if (!Kit.HasKit(cur))
|
||||
if (!hasPerk(cur))
|
||||
continue;
|
||||
|
||||
if (!Manager.GetGame().IsAlive(cur))
|
||||
@ -145,17 +152,17 @@ public class PerkFletcher extends Perk
|
||||
if (!Recharge.Instance.use(cur, GetName(), _time * 1000, false, false))
|
||||
continue;
|
||||
|
||||
if (UtilInv.contains(cur, "Fletched Arrow", Material.ARROW, (byte)0, _max))
|
||||
if (UtilInv.contains(cur, _name, Material.ARROW, (byte)0, _max))
|
||||
continue;
|
||||
|
||||
//Add
|
||||
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
|
||||
{
|
||||
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);
|
||||
@ -175,7 +182,7 @@ public class PerkFletcher extends Perk
|
||||
event.setCancelled(true);
|
||||
|
||||
//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
|
||||
@ -194,7 +201,7 @@ public class PerkFletcher extends Perk
|
||||
@EventHandler
|
||||
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
|
||||
|
@ -32,13 +32,15 @@ public class PerkLifestealArrows extends Perk
|
||||
|
||||
Player player = event.GetDamagerPlayer(true);
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
if (!hasPerk(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,15 +26,12 @@ import nautilus.game.arcade.kit.Perk;
|
||||
public class PerkSeismicSlamOITQ extends Perk
|
||||
{
|
||||
|
||||
private long _cooldown;
|
||||
|
||||
public PerkSeismicSlamOITQ(long cooldown)
|
||||
public PerkSeismicSlamOITQ()
|
||||
{
|
||||
super("Ground Pound", new String[]
|
||||
{
|
||||
C.cYellow + "Right-Click" + C.cGray + " with " + "SPADE" + " to " + C.cGreen + "Ground Pound"
|
||||
});
|
||||
_cooldown = cooldown;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -60,7 +57,7 @@ public class PerkSeismicSlamOITQ extends Perk
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
|
||||
if (!Recharge.Instance.use(player, GetName(), 10000, true, true))
|
||||
return;
|
||||
|
||||
//Action
|
||||
|
@ -33,7 +33,7 @@ public class PerkSpeed extends Perk
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!Kit.HasKit(player))
|
||||
if (!hasPerk(player))
|
||||
continue;
|
||||
|
||||
Manager.GetCondition().Factory().Speed(GetName(), player, player, 8, _level, false, false, true);
|
||||
|
@ -31,7 +31,7 @@ public class PerkStrength extends Perk
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
if (damager == null) return;
|
||||
|
||||
if (!Kit.HasKit(damager))
|
||||
if (!hasPerk(damager))
|
||||
return;
|
||||
|
||||
event.AddMod(damager.getName(), GetName(), _power, false);
|
||||
|
Loading…
Reference in New Issue
Block a user