Moremissing stuff.
This commit is contained in:
parent
aad017690e
commit
7dbfe9d0dc
@ -0,0 +1,52 @@
|
||||
package nautilus.game.arcade.kit;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.ArcadeFormat;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public abstract class SmashKit extends Kit
|
||||
{
|
||||
|
||||
public SmashKit(ArcadeManager manager, String name,
|
||||
KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks,
|
||||
EntityType entityType, ItemStack itemInHand)
|
||||
{
|
||||
super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand);
|
||||
}
|
||||
|
||||
public void DisplayDesc(Player player)
|
||||
{
|
||||
for (int i=0 ; i<3 ; i++)
|
||||
UtilPlayer.message(player, "");
|
||||
|
||||
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||
|
||||
UtilPlayer.message(player, "§aKit - §f§l" + GetName());
|
||||
|
||||
//Desc
|
||||
for (String line : GetDesc())
|
||||
{
|
||||
UtilPlayer.message(player, C.cGray + " " + line);
|
||||
}
|
||||
|
||||
//Perk Descs
|
||||
for (Perk perk : GetPerks())
|
||||
{
|
||||
if (!perk.IsVisible())
|
||||
continue;
|
||||
|
||||
for (String line : perk.GetDesc())
|
||||
{
|
||||
UtilPlayer.message(player, C.cGray + " " + line);
|
||||
}
|
||||
}
|
||||
|
||||
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.core.common.util.C;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkKnockbackArrow extends Perk
|
||||
{
|
||||
private double _power;
|
||||
|
||||
public PerkKnockbackArrow(double power)
|
||||
{
|
||||
super("Arrow Knockback", new String[]
|
||||
{
|
||||
C.cGray + "Arrows deal " + (int)(power*100) + "% Knockback.",
|
||||
});
|
||||
|
||||
_power = power;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetProjectile() == null)
|
||||
return;
|
||||
|
||||
if (!(event.GetProjectile() instanceof Arrow))
|
||||
return;
|
||||
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
if (damager == null) return;
|
||||
|
||||
if (!Kit.HasKit(damager))
|
||||
return;
|
||||
|
||||
if (!Manager.IsAlive(damager))
|
||||
return;
|
||||
|
||||
event.AddKnockback("Knockback Arrow", _power);
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.core.common.util.C;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkKnockbackMultiplier extends Perk
|
||||
{
|
||||
private double _power;
|
||||
|
||||
public PerkKnockbackMultiplier(double power)
|
||||
{
|
||||
super("Knockback", new String[]
|
||||
{
|
||||
C.cGray + "You take " + (int)(power*100) + "% Knockback.",
|
||||
});
|
||||
|
||||
_power = power;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
{
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
if (damagee == null) return;
|
||||
|
||||
if (!Kit.HasKit(damagee))
|
||||
return;
|
||||
|
||||
if (!Manager.IsAlive(damagee))
|
||||
return;
|
||||
|
||||
event.AddKnockback("Knockback Multiplier", _power);
|
||||
}
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
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.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkRopedArrow extends Perk
|
||||
{
|
||||
private HashSet<Entity> _arrows = new HashSet<Entity>();
|
||||
|
||||
private String _name;
|
||||
private double _power;
|
||||
private long _recharge;
|
||||
|
||||
public PerkRopedArrow(String name, double power, long recharge)
|
||||
{
|
||||
super(name, new String[]
|
||||
{
|
||||
C.cYellow + "Left-Click" + C.cGray + " with Bow to " + C.cGreen + name
|
||||
});
|
||||
|
||||
_name = name;
|
||||
_power = power;
|
||||
_recharge = recharge;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Fire(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
if (event.getPlayer().getItemInHand() == null)
|
||||
return;
|
||||
|
||||
if (event.getPlayer().getItemInHand().getType() != Material.BOW)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, _name, _recharge, true))
|
||||
return;
|
||||
|
||||
Arrow arrow = player.launchProjectile(Arrow.class);
|
||||
arrow.setVelocity(player.getLocation().getDirection().multiply(2.4 * _power));
|
||||
_arrows.add(arrow);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You fired " + F.skill(_name) + "."));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Hit(ProjectileHitEvent event)
|
||||
{
|
||||
if (!_arrows.remove(event.getEntity()))
|
||||
return;
|
||||
|
||||
Projectile proj = event.getEntity();
|
||||
|
||||
if (proj.getShooter() == null)
|
||||
return;
|
||||
|
||||
if (!(proj.getShooter() instanceof Player))
|
||||
return;
|
||||
|
||||
Vector vec = UtilAlg.getTrajectory(proj.getShooter(), proj);
|
||||
double mult = (proj.getVelocity().length() / 3d);
|
||||
|
||||
//Action
|
||||
UtilAction.velocity(proj.getShooter(), vec,
|
||||
0.4 + mult * _power, false, 0, 0.6 * mult * _power, 1.2 * mult * _power, true);
|
||||
|
||||
//Effect
|
||||
proj.getWorld().playSound(proj.getLocation(), Sound.ARROW_HIT, 2.5f, 0.5f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Clean(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
for (Iterator<Entity> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
|
||||
{
|
||||
Entity arrow = arrowIterator.next();
|
||||
|
||||
if (!arrow.isValid())
|
||||
arrowIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user