More progress
This commit is contained in:
parent
23d924f137
commit
5398bf5e81
@ -31,10 +31,16 @@ public class LineParticle
|
||||
private double _maxRange;
|
||||
|
||||
private Set<Material> _ignoredTypes;
|
||||
private boolean _ignoreAllBlocks;
|
||||
|
||||
private ParticleType _particleType;
|
||||
private Player[] _toDisplay;
|
||||
|
||||
public LineParticle(Location start, Vector direction, double incrementedRange, double maxRange, ParticleType particleType, Player... toDisplay)
|
||||
{
|
||||
this(start, null, direction, incrementedRange, maxRange, null, particleType, toDisplay);
|
||||
}
|
||||
|
||||
public LineParticle(Location start, Vector direction, double incrementedRange, double maxRange, Set<Material> ignoredTypes, ParticleType particleType, Player... toDisplay)
|
||||
{
|
||||
this(start, null, direction, incrementedRange, maxRange, ignoredTypes, particleType, toDisplay);
|
||||
@ -56,7 +62,7 @@ public class LineParticle
|
||||
|
||||
if (_direction == null)
|
||||
{
|
||||
direction = UtilAlg.getTrajectory(start, end).normalize();
|
||||
_direction = UtilAlg.getTrajectory(start, end).normalize();
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +79,7 @@ public class LineParticle
|
||||
Location newTarget = _start.clone().add(new Vector(0, 0.2, 0)).add(_direction.clone().multiply(_curRange));
|
||||
_lastLocation = newTarget;
|
||||
|
||||
if (!(UtilBlock.airFoliage(newTarget.getBlock()) || UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP))))
|
||||
if (!_ignoreAllBlocks && (!(UtilBlock.airFoliage(newTarget.getBlock()) || UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP)))))
|
||||
{
|
||||
if (_ignoredTypes == null || !_ignoredTypes.contains(newTarget.getBlock().getType()))
|
||||
{
|
||||
@ -87,7 +93,12 @@ public class LineParticle
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
|
||||
public void setIgnoreAllBlocks(boolean b)
|
||||
{
|
||||
_ignoreAllBlocks = b;
|
||||
}
|
||||
|
||||
public Location getLastLocation()
|
||||
{
|
||||
return _lastLocation;
|
||||
|
@ -19,7 +19,7 @@ public class KitEnderman
|
||||
// @Override
|
||||
// protected void giveItems(Player player)
|
||||
// {
|
||||
// player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
|
||||
// player.getInventory().addSkillItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
|
||||
//
|
||||
// player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_IDLE, 4f, 1f);
|
||||
//
|
||||
|
@ -34,7 +34,7 @@ public class KitSkeleton
|
||||
// player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build());
|
||||
// player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build());
|
||||
//
|
||||
// player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
|
||||
// player.getInventory().addSkillItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
|
||||
//
|
||||
// player.getWorld().playSound(player.getLocation(), Sound.SKELETON_IDLE, 4f, 1f);
|
||||
//
|
||||
|
@ -42,9 +42,9 @@ public class KitJetpack extends ProgressingKit
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
//player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SHEARS, (byte)0, 1, "Block Cannon"));
|
||||
//player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, "Space Shooter"));
|
||||
//player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 64, "Space Arrows"));
|
||||
//player.getInventory().addSkillItem(ItemStackFactory.Instance.CreateStack(Material.SHEARS, (byte)0, 1, "Block Cannon"));
|
||||
//player.getInventory().addSkillItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, "Space Shooter"));
|
||||
//player.getInventory().addSkillItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 64, "Space Arrows"));
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
player.getInventory().setArmorContents(PLAYER_ARMOR);
|
||||
}
|
||||
|
@ -1470,7 +1470,7 @@ public class MinecraftLeague extends RankedTeamGame
|
||||
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.BLUE).setUnbreakable(true).build());
|
||||
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
|
||||
player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
|
||||
//player.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 5));
|
||||
//player.getInventory().addSkillItem(new ItemStack(Material.COOKED_BEEF, 5));
|
||||
_blockLock.put(player, new BlockProtection(this, player));
|
||||
_noFall.add(player);
|
||||
}
|
||||
@ -1482,7 +1482,7 @@ public class MinecraftLeague extends RankedTeamGame
|
||||
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.RED).setUnbreakable(true).build());
|
||||
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
|
||||
player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
|
||||
//player.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 5));
|
||||
//player.getInventory().addSkillItem(new ItemStack(Material.COOKED_BEEF, 5));
|
||||
_blockLock.put(player, new BlockProtection(this, player));
|
||||
_noFall.add(player);
|
||||
}
|
||||
|
@ -1,19 +1,25 @@
|
||||
package nautilus.game.arcade.game.games.moba;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.entity.ClientArmorStand;
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.explosion.ExplosionEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.combat.DeathMessageType;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GamePrepareCountdownCommence;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.DebugCommand;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.moba.kit.*;
|
||||
import nautilus.game.arcade.game.games.moba.kit.anath.HeroAnath;
|
||||
import nautilus.game.arcade.game.games.moba.kit.dana.HeroDana;
|
||||
import nautilus.game.arcade.game.games.moba.kit.devon.HeroDevon;
|
||||
import nautilus.game.arcade.game.games.moba.kit.hattori.HeroHattori;
|
||||
import nautilus.game.arcade.game.games.moba.recall.Recall;
|
||||
@ -23,11 +29,12 @@ import nautilus.game.arcade.game.modules.compass.CompassModule;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
@ -58,7 +65,9 @@ public class Moba extends TeamGame
|
||||
|
||||
_kits = new HeroKit[] {
|
||||
new HeroHattori(Manager),
|
||||
new HeroDevon(Manager)
|
||||
new HeroDevon(Manager),
|
||||
new HeroAnath(Manager),
|
||||
new HeroDana(Manager),
|
||||
};
|
||||
|
||||
PrepareAutoAnnounce = false;
|
||||
@ -67,7 +76,7 @@ public class Moba extends TeamGame
|
||||
DeathOut = false;
|
||||
DeathSpectateSecs = 10;
|
||||
HungerSet = 20;
|
||||
DontAllowOverfill = false;
|
||||
DontAllowOverfill = true;
|
||||
|
||||
DamageFall = false;
|
||||
|
||||
@ -82,6 +91,33 @@ public class Moba extends TeamGame
|
||||
|
||||
Listener recall = new Recall(this);
|
||||
_listeners.add(recall);
|
||||
|
||||
registerDebugCommand(new DebugCommand("kit", Rank.ADMIN)
|
||||
{
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
String kit = "";
|
||||
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
kit += args[i] + " ";
|
||||
}
|
||||
|
||||
kit = kit.trim();
|
||||
|
||||
for (Kit kits : _kits)
|
||||
{
|
||||
if (kit.equalsIgnoreCase(kits.GetName()))
|
||||
{
|
||||
SetKit(caller, kits, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
caller.sendMessage(F.main("Kit", "Sorry that is not a kit!"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -213,7 +249,7 @@ public class Moba extends TeamGame
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void prepare(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
@ -368,21 +404,64 @@ public class Moba extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
//TODO announce to all
|
||||
@Override
|
||||
public void RespawnPlayer(Player player)
|
||||
public DeathMessageType GetDeathMessageType()
|
||||
{
|
||||
MobaPlayer mobaPlayer = getData(player);
|
||||
|
||||
player.eject();
|
||||
Manager.Clear(player);
|
||||
GetTeam(player).SpawnTeleport(player);
|
||||
SetKit(player, mobaPlayer.Kit, false);
|
||||
return DeathMessageType.Detailed;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void combatDeath(CombatDeathEvent event)
|
||||
public void preventTeamDamage(CustomDamageEvent event)
|
||||
{
|
||||
event.SetBroadcastType(DeathMessageType.Detailed);
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
|
||||
if (damagee == null || damager == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GameTeam damageeTeam = GetTeam(damagee);
|
||||
GameTeam damagerTeam = GetTeam(damager);
|
||||
|
||||
if (damageeTeam == null || damagerTeam == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (damageeTeam.equals(damagerTeam))
|
||||
{
|
||||
event.SetCancelled("Team Damage");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void preventTeamFire(ConditionApplyEvent event)
|
||||
{
|
||||
Condition condition = event.GetCondition();
|
||||
|
||||
if (condition.GetType() != ConditionType.BURNING)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (condition.GetEnt() == null || condition.GetSource() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(condition.GetEnt() instanceof Player && condition.GetSource() instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetTeam((Player) condition.GetEnt()).equals(GetTeam((Player) condition.GetSource())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
// Clear up memory
|
||||
@ -394,7 +473,16 @@ public class Moba extends TeamGame
|
||||
_playerData.removeIf(mobaPlayer -> mobaPlayer.Player.equals(player));
|
||||
}
|
||||
|
||||
private Map<String, Location> getLocationStartsWith(String s)
|
||||
@EventHandler
|
||||
public void projectileHit(ProjectileHitEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Arrow)
|
||||
{
|
||||
event.getEntity().remove();
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, Location> getLocationStartsWith(String s)
|
||||
{
|
||||
Map<String, Location> map = new HashMap<>();
|
||||
|
||||
|
@ -48,6 +48,11 @@ public class HeroKit extends Kit
|
||||
return _role;
|
||||
}
|
||||
|
||||
public ItemStack getAmmo()
|
||||
{
|
||||
return _ammo;
|
||||
}
|
||||
|
||||
public void setAmmo(ItemStack ammo, long giveTime)
|
||||
{
|
||||
_ammo = ammo;
|
||||
@ -59,17 +64,30 @@ public class HeroKit extends Kit
|
||||
_maxAmmo = max;
|
||||
}
|
||||
|
||||
protected boolean useAmmo(Player player, int amount)
|
||||
public boolean useAmmo(Player player, int amount)
|
||||
{
|
||||
ItemStack itemStack = player.getInventory().getItem(AMMO_SLOT);
|
||||
|
||||
if (itemStack == null || itemStack.getAmount() < amount)
|
||||
if (itemStack == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
itemStack.setAmount(itemStack.getAmount() - amount);
|
||||
player.updateInventory();
|
||||
int newAmount = itemStack.getAmount() - amount;
|
||||
|
||||
if (itemStack.getAmount() < amount)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (newAmount == 0)
|
||||
{
|
||||
player.getInventory().remove(itemStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemStack.setAmount(newAmount);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -122,9 +140,6 @@ public class HeroKit extends Kit
|
||||
inventory.setItem(AMMO_SLOT, _ammo);
|
||||
inventory.setItem(RECALL_SLOT, RECALL_ITEM);
|
||||
|
||||
Bukkit.broadcastMessage("");
|
||||
Bukkit.broadcastMessage(player.getName());
|
||||
|
||||
for (Perk perk : GetPerks())
|
||||
{
|
||||
if (!(perk instanceof HeroSkill))
|
||||
@ -134,11 +149,7 @@ public class HeroKit extends Kit
|
||||
|
||||
HeroSkill skill = (HeroSkill) perk;
|
||||
|
||||
if (skill.getItemStack() != null)
|
||||
{
|
||||
Bukkit.broadcastMessage("Giving kit " + GetName() + ", perk " + skill.GetName() + ", item " + skill.getItemStack().getItemMeta().getDisplayName());
|
||||
inventory.setItem(skill.getSlot(), skill.isOnCooldown(player) ? skill.getCooldownItemStack() : skill.getItemStack());
|
||||
}
|
||||
skill.giveItem(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,18 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.events.PlayerKitGiveEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
@ -18,20 +20,21 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class HeroSkill extends Perk
|
||||
{
|
||||
|
||||
private ItemStack _item;
|
||||
protected List<ItemStack> _items;
|
||||
private ItemStack _cooldownItem;
|
||||
private final int _slot;
|
||||
private final ActionType _actionType;
|
||||
private final boolean _sneakActivate;
|
||||
|
||||
protected HeroKit _kit;
|
||||
private long _cooldown;
|
||||
|
||||
private final Map<UUID, Long> _lastSkill = new HashMap<>();
|
||||
@ -50,12 +53,13 @@ public class HeroSkill extends Perk
|
||||
{
|
||||
super(name, perkDesc);
|
||||
|
||||
_item = itemStack;
|
||||
_items = new ArrayList<>(2);
|
||||
_items.add(itemStack);
|
||||
_slot = slot;
|
||||
_actionType = actionType;
|
||||
_sneakActivate = sneakActivate;
|
||||
|
||||
prettifyItem();
|
||||
prettifyItems();
|
||||
}
|
||||
|
||||
protected void setCooldown(long cooldown)
|
||||
@ -63,10 +67,14 @@ public class HeroSkill extends Perk
|
||||
_cooldown = cooldown;
|
||||
}
|
||||
|
||||
private void prettifyItem()
|
||||
private void prettifyItems()
|
||||
{
|
||||
String action = "Click";
|
||||
String action = null;
|
||||
|
||||
if (_actionType == ActionType.ANY)
|
||||
{
|
||||
action = "Click";
|
||||
}
|
||||
if (_actionType == ActionType.L)
|
||||
{
|
||||
action = "Left Click";
|
||||
@ -81,28 +89,57 @@ public class HeroSkill extends Perk
|
||||
action += "/Sneak";
|
||||
}
|
||||
|
||||
_item = new ItemBuilder(_item)
|
||||
.setTitle(C.cYellowB + action + C.cGray + " - " + C.cGreenB + GetName())
|
||||
.addLore(GetDesc())
|
||||
.build();
|
||||
List<ItemStack> items = new ArrayList<>(2);
|
||||
|
||||
for (ItemStack itemStack : _items)
|
||||
{
|
||||
items.add(new ItemBuilder(itemStack)
|
||||
.setTitle((action != null ? C.cYellowB + action + C.cGray + " - " : "") + C.cGreenB + GetName())
|
||||
.addLore(GetDesc())
|
||||
.setUnbreakable(true)
|
||||
.build());
|
||||
}
|
||||
|
||||
_items = items;
|
||||
_cooldownItem = new ItemBuilder(Material.INK_SACK, (byte) 8)
|
||||
.setTitle(C.cRed + GetName())
|
||||
.addLore(GetDesc())
|
||||
.setUnbreakable(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void SetHost(Kit kit)
|
||||
// {
|
||||
// super.SetHost(kit);
|
||||
//
|
||||
// _kit = (HeroKit) kit;
|
||||
// }
|
||||
protected void addSkillItem(ItemStack itemStack)
|
||||
{
|
||||
_items.add(itemStack);
|
||||
prettifyItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SetHost(Kit kit)
|
||||
{
|
||||
super.SetHost(kit);
|
||||
|
||||
_kit = (HeroKit) kit;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void giveItem(PlayerKitGiveEvent event)
|
||||
{
|
||||
event.getPlayer().getInventory().setItem(_slot, isOnCooldown(event.getPlayer()) ? _cooldownItem : _item);
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!hasPerk(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (isOnCooldown(player))
|
||||
{
|
||||
player.getInventory().setItem(_slot, _cooldownItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
giveItem(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -131,12 +168,20 @@ public class HeroSkill extends Perk
|
||||
Player player = event.getPlayer();
|
||||
ItemStack itemStack = event.getItem();
|
||||
|
||||
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || itemStack == null || !itemStack.isSimilar(_item))
|
||||
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || itemStack == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
for (ItemStack correctItem : _items)
|
||||
{
|
||||
if (itemStack.isSimilar(correctItem))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isSkillSneak(PlayerToggleSneakEvent event)
|
||||
@ -147,13 +192,22 @@ public class HeroSkill extends Perk
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
ItemStack itemStack = player.getInventory().getItem(_slot);
|
||||
|
||||
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || !player.getInventory().getItem(_slot).isSimilar(_item))
|
||||
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || itemStack == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
for (ItemStack correctItem : _items)
|
||||
{
|
||||
if (itemStack.isSimilar(correctItem))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void useSkill(Player player)
|
||||
@ -168,7 +222,7 @@ public class HeroSkill extends Perk
|
||||
@EventHandler
|
||||
public void updateCooldowns(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTEST || _item == null)
|
||||
if (event.getType() != UpdateType.FASTEST || _items == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -193,26 +247,90 @@ public class HeroSkill extends Perk
|
||||
if (done)
|
||||
{
|
||||
_lastSkill.remove(player.getUniqueId());
|
||||
player.getInventory().setItem(_slot, _item);
|
||||
giveItem(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
long timeDiff = current - start;
|
||||
double amount = (int) (cooldown / 1000) - Math.ceil((double) timeDiff / 1000);
|
||||
|
||||
if (itemStack == null)
|
||||
{
|
||||
itemStack = _cooldownItem;
|
||||
}
|
||||
|
||||
itemStack.setAmount((int) amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getItemStack()
|
||||
public void giveItem(Player player)
|
||||
{
|
||||
return _item;
|
||||
if (_items.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.getInventory().setItem(_slot, _items.get(0));
|
||||
}
|
||||
|
||||
public ItemStack getCooldownItemStack()
|
||||
public void useActiveSkill(Player player, long time)
|
||||
{
|
||||
return _cooldownItem;
|
||||
useActiveSkill(null, player, time);
|
||||
}
|
||||
|
||||
public void useActiveSkill(Runnable complete, Player player, long time)
|
||||
{
|
||||
long ticks = (long) (time / 1000D);
|
||||
ItemStack itemStack = player.getInventory().getItem(getSlot());
|
||||
itemStack.setAmount((int) (ticks / 20D));
|
||||
UtilInv.addDullEnchantment(itemStack);
|
||||
Recharge.Instance.useForce(player, GetName(), ticks, true);
|
||||
Recharge.Instance.setDisplayForce(player, GetName(), true);
|
||||
|
||||
Manager.runSyncTimer(new BukkitRunnable()
|
||||
{
|
||||
int iterations = 0;
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (iterations++ > ticks)
|
||||
{
|
||||
if (complete != null)
|
||||
{
|
||||
complete.run();
|
||||
}
|
||||
useSkill(player);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
itemStack.setAmount(itemStack.getAmount() - 1);
|
||||
}
|
||||
}, 0, 20);
|
||||
}
|
||||
|
||||
protected boolean isTeamDamage(LivingEntity damagee, LivingEntity damager)
|
||||
{
|
||||
if (!(damagee instanceof Player || damager instanceof Player))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player damageePlayer = (Player) damagee;
|
||||
Player damagerPlayer = (Player) damager;
|
||||
|
||||
Game game = Manager.GetGame();
|
||||
GameTeam damageeTeam = game.GetTeam(damageePlayer);
|
||||
GameTeam damagerTeam = game.GetTeam(damagerPlayer);
|
||||
|
||||
if (damageeTeam == null || damagerTeam == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return damageeTeam.equals(damagerTeam);
|
||||
}
|
||||
|
||||
public int getSlot()
|
||||
|
@ -2,6 +2,8 @@ package nautilus.game.arcade.game.games.moba.kit;
|
||||
|
||||
import mineplex.core.common.entity.ClientArmorStand;
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketHandler.ListenerPriority;
|
||||
@ -130,8 +132,7 @@ public class PregameSelection implements Listener, IPacketHandler
|
||||
// stand.setChestplate(buildColouredStack(Material.LEATHER_CHESTPLATE, role));
|
||||
// stand.setLeggings(buildColouredStack(Material.LEATHER_LEGGINGS, role));
|
||||
// stand.setBoots(buildColouredStack(Material.LEATHER_BOOTS, role));
|
||||
FireworkEffect effect = FireworkEffect.builder().with(Type.BURST).withColor(Color.LIME).withFade(Color.WHITE).withFlicker().build();
|
||||
UtilFirework.playFirework(stand.getLocation(), effect);
|
||||
UtilParticle.PlayParticle(ParticleType.CLOUD, location.clone().add(0, 1, 0), 0.5F, 0.5F, 0.5F, 0.01F, 1, ViewDist.LONG, player);
|
||||
|
||||
_kitStands.put(stand, kit);
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.anath;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.moba.MobaRole;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class HeroAnath extends HeroKit
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Something something"
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new SkillFireProjectile(0),
|
||||
new SkillBurnBeam(1),
|
||||
new SkillFlameDash(2),
|
||||
new SkillMeteor(3)
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.BLAZE_ROD);
|
||||
|
||||
private static final ItemStack AMMO = new ItemBuilder(Material.BLAZE_POWDER)
|
||||
.setTitle(C.cYellowB + "Embers")
|
||||
.build();
|
||||
|
||||
public HeroAnath(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Anath the Unsworn", DESCRIPTION, PERKS, IN_HAND, MobaRole.MAGE);
|
||||
|
||||
setAmmo(AMMO, 1000);
|
||||
setMaxAmmo(4);
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.anath;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.particles.effects.LineParticle;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class SkillBurnBeam extends HeroSkill
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Fires an Ember at high speed in front of you.",
|
||||
"Any enemies it collides with take damage and are set on fire."
|
||||
};
|
||||
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FIREBALL);
|
||||
|
||||
public SkillBurnBeam(int slot)
|
||||
{
|
||||
super("Burn Beam", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
|
||||
|
||||
setCooldown(10000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interact(PlayerInteractEvent event)
|
||||
{
|
||||
if (!isSkillItem(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Vector direction = player.getLocation().getDirection().setY(0);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2, 0.5F);
|
||||
|
||||
useSkill(player);
|
||||
|
||||
LineParticle particle = new LineParticle(player.getLocation().add(direction), direction, 0.2, 9, null, ParticleType.LAVA, UtilServer.getPlayers());
|
||||
|
||||
particle.setIgnoreAllBlocks(true);
|
||||
|
||||
Manager.runSyncTimer(new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (particle.update())
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FLAME, particle.getLastLocation().clone().add(0, 5, 0), 0.4F, 5, 0.4F, 0.05F, 30, ViewDist.LONG);
|
||||
}
|
||||
}
|
||||
|
||||
if (Math.random() < 0.1)
|
||||
{
|
||||
particle.getLastLocation().getWorld().playSound(particle.getLastLocation(), Sound.GHAST_FIREBALL, 2, 0.5F);
|
||||
}
|
||||
|
||||
for (LivingEntity entity : UtilEnt.getInRadius(particle.getLastLocation(), 2).keySet())
|
||||
{
|
||||
if (entity.equals(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
entity.getLocation().getWorld().playSound(entity.getLocation(), Sound.EXPLODE, 2, 0.5F);
|
||||
Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, 20, true, true, false, UtilEnt.getName(player), GetName());
|
||||
}
|
||||
}
|
||||
}, 0, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.anath;
|
||||
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class SkillFireProjectile extends HeroSkill
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Fires an Ember at high speed in front of you.",
|
||||
"Any enemies it collides with take damage and are set on fire."
|
||||
};
|
||||
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.BLAZE_ROD);
|
||||
|
||||
public SkillFireProjectile(int slot)
|
||||
{
|
||||
super("Fire Item", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interact(PlayerInteractEvent event)
|
||||
{
|
||||
if (!isSkillItem(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!_kit.useAmmo(player, 1))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector direction = player.getLocation().getDirection().multiply(1.25);
|
||||
Item item = player.getWorld().dropItem(player.getEyeLocation().add(direction), _kit.getAmmo());
|
||||
item.setVelocity(direction);
|
||||
|
||||
Manager.GetFire().Add(item, player, 3, 0, 1, 5, GetName(), false);
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.anath;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import nautilus.game.arcade.game.games.moba.kit.common.DashSkill;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SkillFlameDash extends DashSkill
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Dash along the ground, leaving fire behind you.",
|
||||
};
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
|
||||
|
||||
public SkillFlameDash(int slot)
|
||||
{
|
||||
super("Flame Dash", DESCRIPTION, SKILL_ITEM, slot);
|
||||
|
||||
setCooldown(12000);
|
||||
|
||||
_collide = false;
|
||||
_velocityTime = 600;
|
||||
_velocityStopOnEnd = true;
|
||||
_horizontial = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dashTick(Player player)
|
||||
{
|
||||
Block block = player.getLocation().getBlock();
|
||||
|
||||
while (!UtilBlock.solid(block))
|
||||
{
|
||||
block = block.getRelative(BlockFace.DOWN);
|
||||
}
|
||||
|
||||
Block fBlock = block;
|
||||
Manager.runSyncLater(() -> Manager.GetBlockRestore().add(fBlock.getRelative(BlockFace.UP), Material.FIRE.getId(), (byte) 0, 5000), 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDash(Player player)
|
||||
{
|
||||
Manager.GetBlockRestore().restore(player.getLocation().getBlock());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,164 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.anath;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import nautilus.game.arcade.kit.perks.data.MeteorShowerData;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class SkillMeteor extends HeroSkill implements IThrown
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"It doesn't blow up the map :)",
|
||||
};
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
|
||||
|
||||
private final Set<MeteorShowerData> _data = new HashSet<>();
|
||||
|
||||
public SkillMeteor(int slot)
|
||||
{
|
||||
super("Meteor Shower", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
|
||||
|
||||
setCooldown(60000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interact(PlayerInteractEvent event)
|
||||
{
|
||||
if (!isSkillItem(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Recharge.Instance.use(player, GetName() + " Trigger", 10000, false, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation().add(player.getLocation().getDirection()), Material.NETHERRACK, (byte) 0);
|
||||
block.setVelocity(player.getLocation().getDirection());
|
||||
|
||||
Manager.GetProjectile().AddThrow(block, player, this, 2000, true, true, true, false, 0.5F);
|
||||
|
||||
useActiveSkill(player, 7000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void entityChangeBlock(EntityChangeBlockEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof FallingBlock)
|
||||
{
|
||||
event.getEntity().remove();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateShower(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_data.removeIf(MeteorShowerData::update);
|
||||
|
||||
for (MeteorShowerData data : _data)
|
||||
{
|
||||
Location location = data.Target;
|
||||
|
||||
for (double theta = 0; theta < 2 * Math.PI; theta += Math.PI / 100)
|
||||
{
|
||||
double x = 10 * Math.sin(theta);
|
||||
double z = 10 * Math.cos(theta);
|
||||
|
||||
location.add(x, 0.25, z);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FLAME, location, 0, 0, 0, 0.001F, 1, ViewDist.LONG);
|
||||
|
||||
location.subtract(x, 0.25, z);
|
||||
}
|
||||
|
||||
for (LivingEntity nearby : UtilEnt.getInRadius(location, 10).keySet())
|
||||
{
|
||||
if (isTeamDamage(data.Shooter, nearby))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
nearby.setFireTicks(20);
|
||||
Manager.GetDamage().NewDamageEvent(nearby, data.Shooter, null, DamageCause.CUSTOM, 2, true, true, false, UtilEnt.getName(data.Shooter), GetName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void projectileHit(EntityExplodeEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof LargeFireball)
|
||||
{
|
||||
event.blockList().clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
Entity thrown = data.getThrown();
|
||||
|
||||
startShower(data);
|
||||
|
||||
thrown.remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Expire(ProjectileUser data)
|
||||
{
|
||||
for (MeteorShowerData showerData : _data)
|
||||
{
|
||||
if (showerData.Shooter.equals(data.getThrower()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
startShower(data);
|
||||
}
|
||||
|
||||
private void startShower(ProjectileUser data)
|
||||
{
|
||||
Manager.GetBlockRestore().add(data.getThrown().getLocation().getBlock(), Material.NETHERRACK.getId(), (byte) 0, 6000);
|
||||
_data.add(new MeteorShowerData((Player) data.getThrower(), data.getThrown().getLocation(), 6000));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,226 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.common;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.particles.effects.LineParticle;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class DashSkill extends HeroSkill
|
||||
{
|
||||
|
||||
// Teleport Only
|
||||
protected boolean _teleport = false;
|
||||
protected boolean _horizontial = false;
|
||||
protected double _range = 10;
|
||||
protected ParticleType _particleType = ParticleType.FIREWORKS_SPARK;
|
||||
|
||||
// Velocity
|
||||
protected long _velocityTime;
|
||||
protected double _velocityMagnitude = 1;
|
||||
protected boolean _velocityStopOnEnd = false;
|
||||
|
||||
// Collisions
|
||||
protected boolean _collide = true;
|
||||
protected double _collideRange = 2;
|
||||
protected boolean _collideTeammates = false;
|
||||
protected boolean _collidePlayers = true;
|
||||
protected boolean _collideEntities = true;
|
||||
protected boolean _collideOnce = true;
|
||||
|
||||
private final Map<Player, Long> _startTime;
|
||||
|
||||
public DashSkill(String name, String[] perkDesc, ItemStack itemStack, int slot)
|
||||
{
|
||||
super(name, perkDesc, itemStack, slot, ActionType.ANY, true);
|
||||
|
||||
_startTime = new HashMap<>();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interact(PlayerInteractEvent event)
|
||||
{
|
||||
if (!isSkillItem(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
useSkill(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void toggleSneak(PlayerToggleSneakEvent event)
|
||||
{
|
||||
if (!isSkillSneak(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
useSkill(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void useSkill(Player player)
|
||||
{
|
||||
super.useSkill(player);
|
||||
|
||||
preDash(player);
|
||||
|
||||
if (_teleport)
|
||||
{
|
||||
Vector direction = player.getLocation().getDirection();
|
||||
|
||||
if (_horizontial)
|
||||
{
|
||||
direction.setY(0);
|
||||
}
|
||||
|
||||
LineParticle particle = new LineParticle(player.getEyeLocation(), direction, 0.8, _range, null, _particleType, UtilServer.getPlayers());
|
||||
|
||||
while (!particle.update())
|
||||
{
|
||||
dashTick(player);
|
||||
checkCollisions(player, particle.getLastLocation());
|
||||
}
|
||||
|
||||
player.teleport(particle.getDestination());
|
||||
postDash(player);
|
||||
}
|
||||
// Otherwise we set their velocity.
|
||||
else if (_velocityTime > 0)
|
||||
{
|
||||
_startTime.put(player, System.currentTimeMillis());
|
||||
}
|
||||
else
|
||||
{
|
||||
setVelocity(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateVelocity(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Entry<Player, Long> entry : _startTime.entrySet())
|
||||
{
|
||||
Player player = entry.getKey();
|
||||
long start = entry.getValue();
|
||||
|
||||
if (UtilTime.elapsed(start, _velocityTime))
|
||||
{
|
||||
if (_velocityStopOnEnd)
|
||||
{
|
||||
UtilAction.zeroVelocity(player);
|
||||
}
|
||||
_startTime.remove(player);
|
||||
postDash(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
checkCollisions(player, player.getLocation());
|
||||
setVelocity(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setVelocity(Player player)
|
||||
{
|
||||
Vector direction = player.getLocation().getDirection().multiply(_velocityMagnitude);
|
||||
|
||||
if (_horizontial)
|
||||
{
|
||||
direction.setY(0);
|
||||
}
|
||||
|
||||
dashTick(player);
|
||||
UtilAction.velocity(player, direction);
|
||||
}
|
||||
|
||||
private void checkCollisions(Player player, Location location)
|
||||
{
|
||||
// No colliding
|
||||
if (!_collide || !_collideEntities && !_collidePlayers)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// All Living entities within the range
|
||||
for (Entry<LivingEntity, Double> entry : UtilEnt.getInRadius(location, _collideRange).entrySet())
|
||||
{
|
||||
LivingEntity entity = entry.getKey();
|
||||
double scale = entry.getValue();
|
||||
|
||||
// If player hit themselves or the entity has already been hit
|
||||
if (player.equals(entity) || !Recharge.Instance.use(player, GetName() + " by " + player.getName(), 500, false, false) && _collideOnce)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// If allowing collisions with players
|
||||
if (entity instanceof Player)
|
||||
{
|
||||
if (!_collidePlayers)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean sameTeam = isTeamDamage(entity, player);
|
||||
|
||||
// If their teams are the same and we don't allow collisions with teammates, ignore
|
||||
if (sameTeam && !_collideTeammates)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
collideEntity(entity, player, scale, sameTeam);
|
||||
}
|
||||
// Any other entities and if we allow collisions with them
|
||||
else if (_collideEntities)
|
||||
{
|
||||
collideEntity(entity, player, scale, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void preDash(Player player)
|
||||
{
|
||||
}
|
||||
|
||||
public void dashTick(Player player)
|
||||
{
|
||||
}
|
||||
|
||||
public void collideEntity(LivingEntity entity, Player damager, double scale, boolean sameTeam)
|
||||
{
|
||||
}
|
||||
|
||||
public void postDash(Player player)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.common;
|
||||
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SkillBow extends HeroSkill
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Please work"
|
||||
};
|
||||
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.BOW);
|
||||
|
||||
public SkillBow(int slot)
|
||||
{
|
||||
super("Bow", DESCRIPTION, SKILL_ITEM, slot, null);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.common;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SkillSword extends HeroSkill
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Please work"
|
||||
};
|
||||
|
||||
private static final ItemStack SKILL_ITEM = new ItemBuilder(Material.WOOD_SWORD)
|
||||
.setTitle(C.cGreenB + "Sword")
|
||||
.setUnbreakable(true)
|
||||
.build();
|
||||
|
||||
public SkillSword(int slot)
|
||||
{
|
||||
super("Sword", DESCRIPTION, SKILL_ITEM, slot, null);
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.dana;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.moba.MobaRole;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
|
||||
import nautilus.game.arcade.game.games.moba.kit.common.SkillSword;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class HeroDana extends HeroKit
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Something something"
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new SkillSword(0),
|
||||
new SkillPulseHeal(1),
|
||||
new SkillDanaDash(2),
|
||||
new SkillRally(3),
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD);
|
||||
|
||||
public HeroDana(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Dana", DESCRIPTION, PERKS, IN_HAND, MobaRole.WARRIOR);
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.dana;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
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.UtilParticle.ViewDist;
|
||||
import nautilus.game.arcade.game.games.moba.kit.common.DashSkill;
|
||||
import org.bukkit.Effect;
|
||||
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.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class SkillDanaDash extends DashSkill
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Dash along the ground, leaving fire behind you.",
|
||||
};
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
|
||||
|
||||
public SkillDanaDash(int slot)
|
||||
{
|
||||
super("Knock up", DESCRIPTION, SKILL_ITEM, slot);
|
||||
|
||||
setCooldown(10000);
|
||||
|
||||
_velocityTime = 600;
|
||||
_horizontial = true;
|
||||
_velocityStopOnEnd = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preDash(Player player)
|
||||
{
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_HIT, 2, 0.4F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dashTick(Player player)
|
||||
{
|
||||
Random random = UtilMath.random;
|
||||
Location location = player.getLocation().add(random.nextInt(5) - 2.5, random.nextInt(3), random.nextInt(5) - 2.5);
|
||||
UtilParticle.PlayParticle(ParticleType.CLOUD, location.add(0, 1, 0), 0.5F, 0.5F, 0.5f, 0.1F, 10, ViewDist.LONG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collideEntity(LivingEntity entity, Player damager, double scale, boolean sameTeam)
|
||||
{
|
||||
double damage;
|
||||
|
||||
if (entity instanceof Player)
|
||||
{
|
||||
damage = 10;
|
||||
UtilAction.velocity(entity, new Vector(Math.random() / 2 - 0.25, 2, Math.random() / 2 - 0.25));
|
||||
}
|
||||
else
|
||||
{
|
||||
damage = 6;
|
||||
UtilAction.velocity(entity, new Vector(Math.random() - 0.5, 1, Math.random() - 0.5));
|
||||
}
|
||||
|
||||
entity.getWorld().playSound(entity.getLocation(), Sound.IRONGOLEM_HIT, 1, 0.5F);
|
||||
Manager.GetDamage().NewDamageEvent(entity, damager, null, DamageCause.CUSTOM, damage, false, false, false, UtilEnt.getName(damager), GetName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDash(Player player)
|
||||
{
|
||||
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 2, 0.4F);
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, player.getLocation().add(0, 1, 0), 0.5F, 0.5F, 0.5f, 0.1F, 3, ViewDist.LONG);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,164 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.dana;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class SkillPulseHeal extends HeroSkill
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Fires an Ember at high speed in front of you.",
|
||||
"Any enemies it collides with take damage and are set on fire."
|
||||
};
|
||||
|
||||
private static final ItemStack SKILL_ITEM = new ItemBuilder(Material.INK_SACK, (byte) 10).build();
|
||||
private static final ItemStack SKILL_ITEM_TOGGLED = new ItemBuilder(Material.INK_SACK, (byte) 12).build();
|
||||
|
||||
private Set<Player> _toggled = new HashSet<>();
|
||||
|
||||
public SkillPulseHeal(int slot)
|
||||
{
|
||||
super("Pulse Heal", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
|
||||
addSkillItem(SKILL_ITEM_TOGGLED);
|
||||
setCooldown(2000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveItem(Player player)
|
||||
{
|
||||
if (_toggled.contains(player))
|
||||
{
|
||||
player.getInventory().setItem(getSlot(), _items.get(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.getInventory().setItem(getSlot(), _items.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interact(PlayerInteractEvent event)
|
||||
{
|
||||
if (!isSkillItem(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (_toggled.contains(player))
|
||||
{
|
||||
_toggled.remove(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
_toggled.add(player);
|
||||
}
|
||||
|
||||
useSkill(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updatePulse(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || !Recharge.Instance.use(player, GetName(), 10000, false, false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Location location = player.getLocation();
|
||||
|
||||
if (_toggled.contains(player))
|
||||
{
|
||||
for (LivingEntity entity : UtilEnt.getInRadius(player.getLocation(), 5).keySet())
|
||||
{
|
||||
// Don't heal self or enemies
|
||||
if (entity.equals(player) || !isTeamDamage(entity, player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
entity.setHealth(Math.min(entity.getHealth() + 2, entity.getMaxHealth()));
|
||||
}
|
||||
|
||||
displayPulse(location, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setHealth(Math.min(player.getHealth() + 2, player.getMaxHealth()));
|
||||
|
||||
displayPulse(location, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_toggled.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
private void displayPulse(Location location, boolean inwards)
|
||||
{
|
||||
Manager.runSyncTimer(new BukkitRunnable()
|
||||
{
|
||||
|
||||
double theta = 0;
|
||||
double radius = inwards ? 5 : 0;
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (inwards && radius < 0 || !inwards && radius > 5)
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
double increment = inwards ? -0.2 : 0.2;
|
||||
for (double theta2 = 0; theta2 < 2 * Math.PI; theta2 += Math.PI / 3)
|
||||
{
|
||||
double x = radius * Math.sin(theta + theta2);
|
||||
double z = radius * Math.cos(theta + theta2);
|
||||
|
||||
location.add(x, 0.5, z);
|
||||
|
||||
UtilParticle.PlayParticleToAll(inwards ? ParticleType.HAPPY_VILLAGER : ParticleType.DRIP_WATER, location, 0, 0, 0, 0.1F, 1, ViewDist.LONG);
|
||||
|
||||
location.subtract(x, 0.5, z);
|
||||
}
|
||||
|
||||
theta += Math.PI / 100;
|
||||
radius += increment;
|
||||
}
|
||||
}, 0, 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,205 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.dana;
|
||||
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Banner;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.banner.Pattern;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
public class SkillRally extends HeroSkill
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Fires an Ember at high speed in front of you.",
|
||||
"Any enemies it collides with take damage and are set on fire."
|
||||
};
|
||||
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
|
||||
|
||||
private Set<RallyData> _data = new HashSet<>();
|
||||
|
||||
public SkillRally(int slot)
|
||||
{
|
||||
super("Rally", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
|
||||
|
||||
setCooldown(40000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interact(PlayerInteractEvent event)
|
||||
{
|
||||
if (!isSkillItem(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Vector vector = player.getLocation().getDirection();
|
||||
|
||||
for (RallyData data : _data)
|
||||
{
|
||||
if (data.Owner.equals(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
vector.setY(Math.min(vector.getY(), 1));
|
||||
vector.setY(Math.max(vector.getY(), 1.5));
|
||||
|
||||
UtilAction.velocity(player, vector);
|
||||
_data.add(new RallyData(player));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateLand(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTEST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<RallyData> iterator = _data.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
RallyData data = iterator.next();
|
||||
Player player = data.Owner;
|
||||
|
||||
if (data.Landed)
|
||||
{
|
||||
if (UtilTime.elapsed(data.LandTime, 7000))
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player nearby : UtilPlayer.getNearby(data.Banner, 5))
|
||||
{
|
||||
// Only heal allies
|
||||
if (!isTeamDamage(nearby, player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HEART, nearby.getLocation().add(0, 1, 0), 0.5F, 0.5F, 0.5F, 0.01F, 1, ViewDist.LONG);
|
||||
Manager.GetCondition().Factory().Regen(GetName(), nearby, data.Owner, 3, 1, false, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (UtilTime.elapsed(data.LaunchTime, 1000) && UtilEnt.isGrounded(data.Owner))
|
||||
{
|
||||
data.LandTime = System.currentTimeMillis();
|
||||
data.Landed = true;
|
||||
Location location = data.Owner.getLocation();
|
||||
data.Banner = location;
|
||||
|
||||
useActiveSkill(player, 7000);
|
||||
|
||||
GameTeam team = Manager.GetGame().GetTeam(player);
|
||||
Block block = location.getBlock();
|
||||
|
||||
Manager.GetBlockRestore().add(block, Material.STANDING_BANNER.getId(), (byte) 0, 7500);
|
||||
|
||||
Banner banner = (Banner) block.getState();
|
||||
banner.setBaseColor(team.GetColor() == ChatColor.RED ? DyeColor.RED : DyeColor.BLUE);
|
||||
banner.addPattern(getPattern(team));
|
||||
banner.update();
|
||||
|
||||
for (Block nearby : UtilBlock.getBlocksInRadius(banner.getLocation(), 5))
|
||||
{
|
||||
if (UtilBlock.airFoliage(nearby))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Manager.GetBlockRestore().add(nearby, Material.STAINED_CLAY.getId(), team.GetColorData(), (long) (7000 + (Math.random() * 500)));
|
||||
if (Math.random() > 0.9)
|
||||
{
|
||||
nearby.getWorld().playEffect(nearby.getLocation(), Effect.STEP_SOUND, Material.STAINED_CLAY, team.GetColorData());
|
||||
}
|
||||
}
|
||||
|
||||
for (LivingEntity nearby : UtilEnt.getInRadius(player.getLocation(), 3).keySet())
|
||||
{
|
||||
Manager.GetDamage().NewDamageEvent(nearby, player, null, DamageCause.CUSTOM, 5, true, true, false, UtilEnt.getName(player), GetName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateParticles(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (RallyData data : _data)
|
||||
{
|
||||
if (!data.Landed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Location banner = data.Banner;
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
double x = 5 * Math.sin(data.ParticleTheta);
|
||||
double z = 5 * Math.cos(data.ParticleTheta);
|
||||
|
||||
banner.add(x, 0.25, z);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, banner, 0, 0, 0, 0.1F, 1, ViewDist.LONG);
|
||||
|
||||
banner.subtract(x, 0.25, z);
|
||||
|
||||
data.ParticleTheta += Math.PI / 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Pattern getPattern(GameTeam team)
|
||||
{
|
||||
return team.GetColor() == ChatColor.RED ? new Pattern(DyeColor.WHITE, PatternType.CROSS) : new Pattern(DyeColor.WHITE, PatternType.CIRCLE_MIDDLE);
|
||||
}
|
||||
|
||||
private class RallyData
|
||||
{
|
||||
|
||||
Player Owner;
|
||||
Location Banner;
|
||||
boolean Landed;
|
||||
long LaunchTime;
|
||||
long LandTime;
|
||||
double ParticleTheta;
|
||||
|
||||
RallyData(Player owner)
|
||||
{
|
||||
Owner = owner;
|
||||
LaunchTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -5,15 +5,10 @@ import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.moba.MobaRole;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
|
||||
import nautilus.game.arcade.game.games.moba.kit.hattori.SkillDash;
|
||||
import nautilus.game.arcade.game.games.moba.kit.hattori.SkillNinjaBlade;
|
||||
import nautilus.game.arcade.game.games.moba.kit.hattori.SkillSnowball;
|
||||
import nautilus.game.arcade.game.games.moba.kit.common.SkillBow;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkFletcher;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
public class HeroDevon extends HeroKit
|
||||
{
|
||||
@ -23,6 +18,7 @@ public class HeroDevon extends HeroKit
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new SkillBow(0),
|
||||
new SkillTNTArrows(1),
|
||||
new SkillBoost(2),
|
||||
new SkillInfinity(3)
|
||||
@ -30,11 +26,6 @@ public class HeroDevon extends HeroKit
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.BOW);
|
||||
|
||||
private static final ItemStack BOW = new ItemBuilder(Material.BOW)
|
||||
.setTitle(C.cGreenB + "Bow")
|
||||
.setUnbreakable(true)
|
||||
.build();
|
||||
|
||||
private static final ItemStack AMMO = new ItemBuilder(Material.ARROW)
|
||||
.setTitle(C.cYellowB + "Hunting Arrow")
|
||||
.build();
|
||||
@ -46,14 +37,4 @@ public class HeroDevon extends HeroKit
|
||||
setAmmo(AMMO, 3000);
|
||||
setMaxAmmo(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
// TODO remove this when shop is implemented
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
inventory.setItem(0, BOW);
|
||||
|
||||
super.GiveItems(player);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.devon;
|
||||
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.minecraft.game.core.condition.ConditionFactory;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import org.bukkit.Material;
|
||||
@ -19,7 +20,7 @@ public class SkillBoost extends HeroSkill
|
||||
|
||||
public SkillBoost(int slot)
|
||||
{
|
||||
super("Hunters Boost", DESCRIPTION, SKILL_ITEM, slot, null, true);
|
||||
super("Hunters Boost", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY, true);
|
||||
|
||||
setCooldown(10000);
|
||||
}
|
||||
|
@ -1,12 +1,17 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.devon;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
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.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -17,10 +22,13 @@ import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
public class SkillInfinity extends HeroSkill
|
||||
{
|
||||
@ -32,10 +40,11 @@ public class SkillInfinity extends HeroSkill
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
|
||||
|
||||
private final Map<Entity, Player> _arrows = new HashMap<>();
|
||||
private final Set<Player> _active = new HashSet<>();
|
||||
|
||||
public SkillInfinity(int slot)
|
||||
{
|
||||
super("Infinity", DESCRIPTION, SKILL_ITEM, slot, null);
|
||||
super("Infinity", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
|
||||
|
||||
setCooldown(60000);
|
||||
}
|
||||
@ -56,10 +65,14 @@ public class SkillInfinity extends HeroSkill
|
||||
return;
|
||||
}
|
||||
|
||||
bow.addEnchantment(Enchantment.ARROW_INFINITE, 0);
|
||||
Recharge.Instance.useForce(player, GetName(), 7000, false);
|
||||
bow.addEnchantment(Enchantment.ARROW_INFINITE, 1);
|
||||
_active.add(player);
|
||||
|
||||
Manager.runSyncLater(() -> bow.removeEnchantment(Enchantment.ARROW_INFINITE), 7 * 20);
|
||||
useActiveSkill(() ->
|
||||
{
|
||||
bow.removeEnchantment(Enchantment.ARROW_INFINITE);
|
||||
_active.remove(player);
|
||||
}, player, 7000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -72,13 +85,18 @@ public class SkillInfinity extends HeroSkill
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
if (!hasPerk(player) || !_active.contains(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_arrows.put(event.getProjectile(), player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateArrowTarget(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTEST || !Manager.isGameInProgress())
|
||||
if (event.getType() != UpdateType.FASTEST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -89,22 +107,37 @@ public class SkillInfinity extends HeroSkill
|
||||
Player player = entry.getValue();
|
||||
GameTeam team = Manager.GetGame().GetTeam(player);
|
||||
|
||||
for (LivingEntity nearby : UtilEnt.getInRadius(entity.getLocation(), 3).keySet())
|
||||
for (LivingEntity nearby : UtilEnt.getInRadius(entity.getLocation(), 6).keySet())
|
||||
{
|
||||
if (nearby instanceof Player)
|
||||
{
|
||||
// If the target is on the same team
|
||||
if (team.equals(Manager.GetGame().GetTeam((Player) nearby)))
|
||||
if (UtilPlayer.isSpectator(player) || team.equals(Manager.GetGame().GetTeam((Player) nearby)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
entity.setVelocity(UtilAlg.getTrajectory(entity.getLocation(), nearby.getLocation()));
|
||||
UtilAction.velocity(nearby, UtilAlg.getTrajectory(entity.getLocation(), nearby.getLocation().add(0, 1.5, 0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void arrowDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetProjectile() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_arrows.containsKey(event.GetProjectile()))
|
||||
{
|
||||
Bukkit.broadcastMessage("Wither");
|
||||
Manager.GetCondition().Factory().Wither(GetName(), event.GetDamageeEntity(), event.GetDamagerEntity(true), 3, 0, false, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void projectileHit(ProjectileHitEvent event)
|
||||
{
|
||||
|
@ -1,23 +1,32 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.devon;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import nautilus.game.arcade.game.games.moba.kit.hattori.SkillSnowball;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class SkillTNTArrows extends HeroSkill implements IThrown
|
||||
{
|
||||
@ -28,11 +37,11 @@ public class SkillTNTArrows extends HeroSkill implements IThrown
|
||||
};
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.TNT);
|
||||
|
||||
private final Map<UUID, Integer> _arrows = new HashMap<>();
|
||||
private final Map<Player, Integer> _arrows = new HashMap<>();
|
||||
|
||||
public SkillTNTArrows(int slot)
|
||||
{
|
||||
super("TNT Infusion", DESCRIPTION, SKILL_ITEM, slot, null);
|
||||
super("TNT Infusion", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
|
||||
|
||||
setCooldown(17000);
|
||||
}
|
||||
@ -47,8 +56,9 @@ public class SkillTNTArrows extends HeroSkill implements IThrown
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
_arrows.put(player.getUniqueId(), 3);
|
||||
_arrows.put(player, 3);
|
||||
player.getItemInHand().addEnchantment(UtilInv.getDullEnchantment(), 1);
|
||||
player.getItemInHand().setAmount(3);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -61,31 +71,74 @@ public class SkillTNTArrows extends HeroSkill implements IThrown
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
if (!hasPerk(player) || !_arrows.containsKey(player.getUniqueId()))
|
||||
if (!hasPerk(player) || !_arrows.containsKey(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int arrows = _arrows.get(player.getUniqueId());
|
||||
ItemStack itemStack = player.getInventory().getItem(getSlot());
|
||||
int arrows = _arrows.get(player);
|
||||
|
||||
if (arrows == 1)
|
||||
{
|
||||
_arrows.remove(player.getUniqueId());
|
||||
_arrows.remove(player);
|
||||
useSkill(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
_arrows.put(player.getUniqueId(), arrows - 1);
|
||||
arrows--;
|
||||
_arrows.put(player, arrows);
|
||||
itemStack.setAmount(arrows);
|
||||
}
|
||||
|
||||
Manager.GetProjectile().AddThrow(event.getProjectile(), player, this, -1, true, true, true, false, 0.5F);
|
||||
Manager.GetProjectile().AddThrow(event.getProjectile(), player, this, -1, true, true, true, false, 0);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerDeath(CombatDeathEvent event)
|
||||
{
|
||||
_arrows.remove(event.GetEvent().getEntity());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_arrows.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
LivingEntity thrower = data.getThrower();
|
||||
Location location = data.getThrown().getLocation();
|
||||
location.getWorld().createExplosion(location.getX(), location.getY(), location.getZ(), 4, false, false);
|
||||
|
||||
location.getWorld().playSound(location, Sound.EXPLODE, 1, 0.9F);
|
||||
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 0.1F, 1, ViewDist.LONG);
|
||||
double damage = 10;
|
||||
|
||||
// Scale damage with the damage on the player's bow
|
||||
if (thrower instanceof Player)
|
||||
{
|
||||
Player throwerPlayer = (Player) thrower;
|
||||
ItemStack itemStack = throwerPlayer.getInventory().getItem(0);
|
||||
|
||||
// Player has a bow
|
||||
if (itemStack != null && itemStack.getType() == Material.BOW)
|
||||
{
|
||||
damage += damage * itemStack.getEnchantmentLevel(Enchantment.ARROW_DAMAGE) * 0.25;
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<LivingEntity, Double> entry : UtilEnt.getInRadius(location, 5).entrySet())
|
||||
{
|
||||
if (entry.getKey().equals(thrower))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Manager.GetDamage().NewDamageEvent(entry.getKey(), thrower, null, DamageCause.BLOCK_EXPLOSION, (entry.getValue() + 0.5) * damage, true, true, false, UtilEnt.getName(data.getThrower()), GetName());
|
||||
}
|
||||
|
||||
data.getThrown().remove();
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,13 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.hattori;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.moba.MobaRole;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
|
||||
import nautilus.game.arcade.game.games.moba.kit.common.SkillSword;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
public class HeroHattori extends HeroKit
|
||||
{
|
||||
@ -23,32 +19,16 @@ public class HeroHattori extends HeroKit
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkDoubleJump("Double Jump", 1, 1, true),
|
||||
new SkillSnowball(0),
|
||||
new SkillDash(2),
|
||||
new SkillSword(1),
|
||||
new SkillNinjaDash(2),
|
||||
new SkillNinjaBlade(3)
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.NETHER_STAR);
|
||||
|
||||
private static final ItemStack SWORD = new ItemBuilder(Material.WOOD_SWORD)
|
||||
.setTitle(C.cGreenB + "Sword")
|
||||
.setUnbreakable(true)
|
||||
.build();
|
||||
|
||||
public HeroHattori(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Hattori", DESCRIPTION, PERKS, IN_HAND, MobaRole.ASSASSIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
Bukkit.broadcastMessage("Hello " + player.getName());
|
||||
|
||||
// TODO remove this when shop is implemented
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
inventory.setItem(1, SWORD);
|
||||
|
||||
Bukkit.broadcastMessage("Now call the super for " + player.getName());
|
||||
super.GiveItems(player);
|
||||
}
|
||||
}
|
||||
|
@ -1,105 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.hattori;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.particles.effects.LineParticle;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SkillDash extends HeroSkill
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Dash forward dealing damage to any enemy",
|
||||
"you collide with."
|
||||
};
|
||||
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
|
||||
|
||||
public SkillDash(int slot)
|
||||
{
|
||||
super("Dash", DESCRIPTION, SKILL_ITEM, slot, null, true);
|
||||
|
||||
setCooldown(7000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interact(PlayerInteractEvent event)
|
||||
{
|
||||
if (!isSkillItem(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
useSkill(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void toggleSneak(PlayerToggleSneakEvent event)
|
||||
{
|
||||
if (!isSkillSneak(event))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
useSkill(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void useSkill(Player player)
|
||||
{
|
||||
super.useSkill(player);
|
||||
|
||||
LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), 0.8, 10, null, ParticleType.FIREWORKS_SPARK,
|
||||
UtilServer.getPlayers());
|
||||
Set<UUID> hitPlayers = new HashSet<>();
|
||||
Game game = Manager.GetGame();
|
||||
GameTeam team = game.GetTeam(player);
|
||||
|
||||
while (!lineParticle.update())
|
||||
{
|
||||
for (Player other : UtilPlayer.getNearby(lineParticle.getLastLocation(), 2))
|
||||
{
|
||||
if (hitPlayers.contains(other.getUniqueId()) || player.equals(other) || team.equals(game.GetTeam(other)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
hitPlayers.add(other.getUniqueId());
|
||||
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, 8, true, true, false, player.getName(), GetName());
|
||||
player.sendMessage(F.main("Game", "You hit " + F.elem(other.getName()) + " with " + F.skill(GetName()) + "."));
|
||||
}
|
||||
}
|
||||
|
||||
Location location = lineParticle.getDestination();
|
||||
FireworkEffect effect = FireworkEffect.builder().with(Type.BALL).withColor(team.GetColorBase()).withFlicker().build();
|
||||
|
||||
UtilFirework.playFirework(player.getLocation(), effect);
|
||||
player.teleport(location.add(0, 0.5, 0));
|
||||
UtilFirework.playFirework(player.getLocation(), effect);
|
||||
|
||||
player.sendMessage(F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.hattori;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
@ -37,7 +38,7 @@ public class SkillNinjaBlade extends HeroSkill
|
||||
|
||||
public SkillNinjaBlade(int slot)
|
||||
{
|
||||
super("Ninja Blade", DESCRIPTION, SKILL_ITEM, slot, null);
|
||||
super("Ninja Blade", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
|
||||
|
||||
setCooldown(60000);
|
||||
}
|
||||
@ -54,15 +55,8 @@ public class SkillNinjaBlade extends HeroSkill
|
||||
|
||||
player.getInventory().setItem(getSlot(), ACTIVE_ITEM);
|
||||
_active.add(player.getUniqueId());
|
||||
Recharge.Instance.useForce(player, GetName(), 7000, true);
|
||||
|
||||
Manager.runSyncLater(() ->
|
||||
{
|
||||
|
||||
_active.remove(player.getUniqueId());
|
||||
useSkill(player);
|
||||
|
||||
}, 7 * 20);
|
||||
useActiveSkill(() -> _active.remove(player.getUniqueId()), player, 7000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -81,7 +75,7 @@ public class SkillNinjaBlade extends HeroSkill
|
||||
}
|
||||
}
|
||||
|
||||
if (player == null || !_active.contains(player.getUniqueId()))
|
||||
if (player == null || !_active.contains(player.getUniqueId()) || player.getItemInHand() == null || player.getItemInHand().getType() != Material.DIAMOND_SWORD)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.hattori;
|
||||
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.particles.effects.LineParticle;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import nautilus.game.arcade.game.games.moba.kit.common.DashSkill;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SkillNinjaDash extends DashSkill
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Dash forward dealing damage to any enemy",
|
||||
"you collide with."
|
||||
};
|
||||
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
|
||||
|
||||
public SkillNinjaDash(int slot)
|
||||
{
|
||||
super("Dash", DESCRIPTION, SKILL_ITEM, slot);
|
||||
|
||||
setCooldown(7000);
|
||||
|
||||
_teleport = true;
|
||||
_range = 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preDash(Player player)
|
||||
{
|
||||
playFirework(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collideEntity(LivingEntity entity, Player player, double scale, boolean sameTeam)
|
||||
{
|
||||
Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, 8, true, true, false, UtilEnt.getName(player), GetName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDash(Player player)
|
||||
{
|
||||
playFirework(player);
|
||||
}
|
||||
|
||||
private void playFirework(Player player)
|
||||
{
|
||||
GameTeam team = Manager.GetGame().GetTeam(player);
|
||||
FireworkEffect effect = FireworkEffect.builder().with(Type.BALL).withColor(team.GetColorBase()).withFlicker().build();
|
||||
UtilFirework.playFirework(player.getLocation(), effect);
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.hattori;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
@ -28,7 +29,7 @@ public class SkillSnowball extends HeroSkill implements IThrown
|
||||
|
||||
public SkillSnowball(int slot)
|
||||
{
|
||||
super("Snowball", DESCRIPTION, SKILL_ITEM, slot, null);
|
||||
super("Snowball", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
|
||||
|
||||
setCooldown(1000);
|
||||
}
|
||||
@ -41,6 +42,8 @@ public class SkillSnowball extends HeroSkill implements IThrown
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
useSkill(player);
|
||||
|
@ -0,0 +1,89 @@
|
||||
package nautilus.game.arcade.game.games.moba.shop;
|
||||
|
||||
import mineplex.core.common.util.UtilUI;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.menu.Button;
|
||||
import mineplex.core.menu.Menu;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.moba.MobaPlayer;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroKit;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import nautilus.game.arcade.game.games.moba.kit.common.SkillSword;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MobaMainMenu extends Menu<ArcadeManager>
|
||||
{
|
||||
|
||||
private static final int SLOTS = 27;
|
||||
|
||||
private final MobaPlayer _player;
|
||||
|
||||
public MobaMainMenu(MobaPlayer player, ArcadeManager plugin)
|
||||
{
|
||||
super(player.Kit.GetName() + " Shop", plugin);
|
||||
|
||||
_player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Button[] setUp(Player player)
|
||||
{
|
||||
Button[] buttons = new Button[SLOTS];
|
||||
HeroKit kit = _player.Kit;
|
||||
List<HeroSkill> skills = new ArrayList<>(3);
|
||||
|
||||
for (Perk perk : kit.GetPerks())
|
||||
{
|
||||
if (!(perk instanceof HeroSkill))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
skills.add((HeroSkill) perk);
|
||||
}
|
||||
|
||||
int slots[] = UtilUI.getIndicesFor(skills.size(), 1, 3);
|
||||
|
||||
for (HeroSkill skill : skills)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return buttons;
|
||||
}
|
||||
|
||||
private ItemStack getMainMenuItem(HeroSkill skill)
|
||||
{
|
||||
ItemBuilder builder;
|
||||
|
||||
if (skill instanceof SkillSword)
|
||||
{
|
||||
builder =
|
||||
}
|
||||
}
|
||||
|
||||
class MobaMainButton extends Button<ArcadeManager>
|
||||
{
|
||||
|
||||
private MobaPlayer _player;
|
||||
|
||||
public MobaMainButton(MobaPlayer player, ArcadeManager plugin)
|
||||
{
|
||||
super(item, plugin);
|
||||
|
||||
_player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,104 @@
|
||||
package nautilus.game.arcade.game.games.moba.shop;
|
||||
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.moba.Moba;
|
||||
import nautilus.game.arcade.game.games.moba.MobaPlayer;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.entity.Villager.Profession;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class MobaShop implements Listener
|
||||
{
|
||||
|
||||
private final Moba _host;
|
||||
private final List<LivingEntity> _entities;
|
||||
private final Map<Player, Map<MobaUpgradeType, MobaUpgrade>> _upgrades;
|
||||
|
||||
public MobaShop(Moba host)
|
||||
{
|
||||
_host = host;
|
||||
_entities = new ArrayList<>(2);
|
||||
_upgrades = new HashMap<>();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void spawnNpc(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<Location> locations = _host.WorldData.GetDataLocs("CYAN");
|
||||
|
||||
for (Location location : locations)
|
||||
{
|
||||
Villager villager = location.getWorld().spawn(location, Villager.class);
|
||||
|
||||
villager.setProfession(Profession.LIBRARIAN);
|
||||
villager.setAgeLock(true);
|
||||
villager.setRemoveWhenFarAway(false);
|
||||
|
||||
_entities.add(villager);
|
||||
}
|
||||
}
|
||||
|
||||
public void purchaseUpgrade(Player player, MobaUpgrade upgrade)
|
||||
{
|
||||
_upgrades.putIfAbsent(player, new HashSet<>(3));
|
||||
_upgrades.get(player).add(upgrade);
|
||||
}
|
||||
|
||||
private void openShop(MobaPlayer player)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void entityDamage(EntityDamageByEntityEvent event)
|
||||
{
|
||||
npcInteract(event.getEntity(), event.getDamager());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void entityInteract(PlayerInteractAtEntityEvent event)
|
||||
{
|
||||
npcInteract(event.getRightClicked(), event.getPlayer());
|
||||
}
|
||||
|
||||
private void npcInteract(Entity clicked, Entity clicker)
|
||||
{
|
||||
if (!(clicker instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) clicked;
|
||||
|
||||
for (LivingEntity shop : _entities)
|
||||
{
|
||||
if (clicked.equals(shop))
|
||||
{
|
||||
MobaPlayer data = _host.getData(player);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
openShop(data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
package nautilus.game.arcade.game.games.moba.shop;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class MobaUpgrade
|
||||
{
|
||||
|
||||
private ItemStack _item;
|
||||
|
||||
public MobaUpgrade(ItemStack item)
|
||||
{
|
||||
_item = item;
|
||||
}
|
||||
|
||||
public ItemStack getItem()
|
||||
{
|
||||
return _item;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package nautilus.game.arcade.game.games.moba.shop;
|
||||
|
||||
public enum MobaUpgradeType
|
||||
{
|
||||
|
||||
SWORD,
|
||||
BOW,
|
||||
HELMET,
|
||||
CHEST,
|
||||
LEGS,
|
||||
BOOTS
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package nautilus.game.arcade.game.games.moba.shop.common;
|
||||
|
||||
import nautilus.game.arcade.game.games.moba.shop.MobaUpgrade;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class CooldownUpgrade extends MobaUpgrade
|
||||
{
|
||||
|
||||
private double _reductionFactor;
|
||||
|
||||
public CooldownUpgrade(ItemStack item, double reductionFactor)
|
||||
{
|
||||
super(item);
|
||||
|
||||
_reductionFactor = reductionFactor;
|
||||
}
|
||||
|
||||
public double getReductionFactor()
|
||||
{
|
||||
return _reductionFactor;
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ import nautilus.game.arcade.ArcadeFormat;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.events.PlayerKitGiveEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.*;
|
||||
|
Loading…
Reference in New Issue
Block a user