Merge branch 'feature/moba' into develop

This commit is contained in:
cnr 2017-06-28 20:39:27 -07:00
commit ed67a44fef
28 changed files with 393 additions and 81 deletions

View File

@ -176,7 +176,7 @@ public class ClientArmorStand implements ArmorStand
@Override
public Location getLocation()
{
return new Location(getWorld(), _armorStand.locX, _armorStand.locY, _armorStand.locZ);
return new Location(getWorld(), _armorStand.locX, _armorStand.locY, _armorStand.locZ, _armorStand.yaw, _armorStand.pitch);
}
@Override
@ -240,6 +240,20 @@ public class ClientArmorStand implements ArmorStand
return false;
}
public boolean teleport(Location location, Player player)
{
double pX = _armorStand.locX;
double pY = _armorStand.locY;
double pZ = _armorStand.locZ;
float pYaw = _armorStand.yaw;
float pPitch = _armorStand.pitch;
_armorStand.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
UtilPlayer.sendPacket(player, new PacketPlayOutEntityTeleport(_armorStand));
_armorStand.setPositionRotation(pX, pY, pZ, pYaw, pPitch);
return false;
}
@Override
public boolean teleport(Location loc)
{

View File

@ -41,8 +41,7 @@ import nautilus.game.arcade.game.games.moba.kit.hp.HPManager;
import nautilus.game.arcade.game.games.moba.kit.larissa.HeroLarissa;
import nautilus.game.arcade.game.games.moba.kit.rowena.HeroRowena;
import nautilus.game.arcade.game.games.moba.minion.MinionManager;
import nautilus.game.arcade.game.games.moba.prepare.PrepareManager;
import nautilus.game.arcade.game.games.moba.prepare.PrepareSelection;
import nautilus.game.arcade.game.games.moba.overtime.OvertimeManager;
import nautilus.game.arcade.game.games.moba.shop.MobaShop;
import nautilus.game.arcade.game.games.moba.structure.point.CapturePointManager;
import nautilus.game.arcade.game.games.moba.structure.tower.TowerManager;
@ -75,12 +74,13 @@ public class Moba extends TeamGame
private final HeroKit[] _kits;
private final Set<MobaPlayer> _playerData = new HashSet<>();
protected final Set<MobaPlayer> _playerData = new HashSet<>();
private final Set<Listener> _listeners = new HashSet<>();
protected final MobaShop _shop;
protected final GoldManager _goldManager;
protected final BossManager _boss;
protected final OvertimeManager _overtimeManager;
protected final BuffManager _buffs;
protected final ArrowKBManager _arrowKb;
protected final TowerManager _tower;
@ -116,6 +116,7 @@ public class Moba extends TeamGame
_shop = registerManager(new MobaShop(this));
_goldManager = registerManager(new GoldManager(this));
_boss = registerManager(new BossManager(this));
_overtimeManager = registerManager(new OvertimeManager(this));
_buffs = registerManager(new BuffManager());
_arrowKb = registerManager(new ArrowKBManager(this));
_minion = registerManager(new MinionManager(this));
@ -496,6 +497,11 @@ public class Moba extends TeamGame
return _goldManager;
}
public OvertimeManager getOvertimeManager()
{
return _overtimeManager;
}
public BuffManager getBuffManager()
{
return _buffs;
@ -520,4 +526,9 @@ public class Moba extends TeamGame
{
return _arrowKb;
}
public MinionManager getMinionManager()
{
return _minion;
}
}

View File

@ -23,11 +23,11 @@ public class MobaAI
private final float _speedHome;
private final Polygon2D _boundaries;
private LivingEntity _entity;
protected LivingEntity _entity;
private LivingEntity _target;
private Location _home;
private MobaAIMethod _aiMethod;
protected MobaAIMethod _aiMethod;
public MobaAI(Moba host, GameTeam owner, LivingEntity entity, Location home, float speedTarget, float speedHome, MobaAIMethod aiMethod)
{

View File

@ -40,12 +40,13 @@ public class WitherBoss extends MobaBoss
private static final String NAME = "Wither Boss";
private static final float SPEED_TARGET = 4F;
private static final float SPEED_HOME = 6F;
private static final int INITIAL_HEALTH = 125;
private static final int INITIAL_HEALTH = 275;
private static final MobaAIMethod AI_METHOD = new MobaDirectAIMethod();
private static final int MIN_INFORM_TIME = (int) TimeUnit.SECONDS.toMillis(30);
private final GameTeam _team;
private MobaAI _ai;
private MobaAI _aiOvertime;
private DisguiseWither _disguise;
private boolean _damageable;
private long _lastInform;
@ -65,11 +66,11 @@ public class WitherBoss extends MobaBoss
{
ArmorStand stand = _location.getWorld().spawn(_location, ArmorStand.class);
// Reducing the wither's health to 10% gives a shield like effect.
stand.setMaxHealth(INITIAL_HEALTH);
stand.setHealth(INITIAL_HEALTH * 0.1);
stand.setHealth(INITIAL_HEALTH);
stand.setGravity(false);
MobaUtil.setTeamEntity(stand, _team);
UtilEnt.setBoundingBox(stand, 3, 5);
_disguise = new DisguiseWither(stand);
@ -87,10 +88,31 @@ public class WitherBoss extends MobaBoss
{
_ai = new MobaAI(_host, _team, _entity, _location, SPEED_TARGET, SPEED_HOME, AI_METHOD);
}
else if (_host.getOvertimeManager().isOvertime())
{
if (_aiOvertime == null)
{
_aiOvertime = new WitherBossOvertimeAI(_host, _team, _entity, _location, SPEED_TARGET, SPEED_HOME, AI_METHOD);
}
return _aiOvertime;
}
return _ai;
}
@Override
@EventHandler
public void updateMovement(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK || !_host.IsLive())
{
return;
}
getAi().updateTarget();
}
@Override
public String getName()
{
@ -125,20 +147,6 @@ public class WitherBoss extends MobaBoss
return;
}
// If not damageable
if (!_damageable)
{
Player damager = event.GetDamagerPlayer(true);
if (damager != null)
{
damager.sendMessage(F.main("Game", "You must destroy both towers before attacking the Wither!"));
damager.playSound(damager.getLocation(), Sound.NOTE_BASS, 1, 0.8F);
}
return;
}
LivingEntity damagee = event.GetDamageeEntity();
Player damager = event.GetDamagerPlayer(true);
@ -152,6 +160,18 @@ public class WitherBoss extends MobaBoss
}
}
// If not damageable
if (!_damageable)
{
if (damager != null)
{
damager.sendMessage(F.main("Game", "You must destroy both towers before attacking the Wither!"));
damager.playSound(damager.getLocation(), Sound.NOTE_BASS, 1, 0.8F);
}
return;
}
// Inform the team
if (UtilTime.elapsed(_lastInform, MIN_INFORM_TIME))
{
@ -191,11 +211,14 @@ public class WitherBoss extends MobaBoss
return;
}
// Here we can remove the shield effect, as the wither is no longer invincible
if (!tower.isFirstTower())
if (tower.isFirstTower())
{
_entity.setHealth(_entity.getHealth() - 50);
}
else
{
_entity.setHealth(_entity.getHealth() - 100);
_damageable = true;
_entity.setHealth(INITIAL_HEALTH);
updateDisplay();
}
}
@ -212,13 +235,13 @@ public class WitherBoss extends MobaBoss
for (Player player : _team.GetPlayers(true))
{
UtilTextTop.displayTextBar(player, percent, _team.GetColor() + "Your Wither");
UtilTextTop.displayTextBar(player, percent, _team.GetColor() + "Your Wither");
}
}
public double getHealthPercentage()
{
return _damageable ? (_entity.getHealth() / _entity.getMaxHealth()) : 1;
return _entity.getHealth() / _entity.getMaxHealth();
}
private void updateDisplay()
@ -230,4 +253,9 @@ public class WitherBoss extends MobaBoss
{
return _team;
}
public void setDamageable(boolean damageable)
{
_damageable = damageable;
}
}

View File

@ -0,0 +1,55 @@
package nautilus.game.arcade.game.games.moba.boss.wither;
import mineplex.core.common.geom.Polygon2D;
import mineplex.core.common.util.UtilMath;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.ai.MobaAI;
import nautilus.game.arcade.game.games.moba.ai.goal.MobaAIMethod;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import java.util.List;
public class WitherBossOvertimeAI extends MobaAI
{
private List<Location> _path;
private Location _target;
private int _targetIndex;
public WitherBossOvertimeAI(Moba host, GameTeam owner, LivingEntity entity, Location home, float speedTarget, float speedHome, MobaAIMethod aiMethod)
{
super(host, owner, entity, home, speedTarget, speedHome, aiMethod);
_path = host.getMinionManager().getPath(owner.GetColor() == ChatColor.RED);
_path = _path.subList(0, (int) (_path.size() / 2D));
}
@Override
public void updateTarget()
{
if (_target == null)
{
_target = _path.get(0);
_targetIndex = 0;
}
double dist = UtilMath.offsetSquared(_target, _entity.getLocation());
if (dist < 16 && _targetIndex < _path.size() - 1)
{
_targetIndex++;
_target = _path.get(_targetIndex);
}
_aiMethod.updateMovement(_entity, _target, 2);
}
@Override
public Polygon2D getBoundaries()
{
return null;
}
}

View File

@ -148,7 +148,7 @@ public class GoldManager implements Listener
if (amount > 20 && reason != null)
{
_host.AddGems(player, (double) amount / 2D, reason, true, true);
_host.AddGems(player, (double) amount / 3D, reason, true, true);
player.sendMessage(F.main("Game", C.cGold + "+" + amount + " gold (" + reason + ")" + C.cGray + "."));
}
}

View File

@ -166,6 +166,9 @@ public class HeroKit extends Kit
{
PlayerInventory inventory = player.getInventory();
// This is important
inventory.clear();
// Give standard items
inventory.setItem(AMMO_SLOT, _ammo);
inventory.setItem(SHOP_SLOT, SHOP_ITEM);

View File

@ -6,9 +6,9 @@ import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
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;
@ -107,13 +107,15 @@ public class HeroSkill extends Perk
_item = new ItemBuilder(_item)
.setTitle((action != null ? C.cYellowB + action + C.cGray + " - " : "") + C.cGreenB + GetName())
.setLore(GetDesc())
.setLore()
.addLore(GetDesc())
.setUnbreakable(true)
.build();
_cooldownItem = new ItemBuilder(Material.INK_SACK, (byte) 8)
.setTitle(C.cRed + GetName())
.setLore(GetDesc())
.setLore()
.addLore(GetDesc())
.setUnbreakable(true)
.build();
}
@ -314,12 +316,31 @@ public class HeroSkill extends Perk
public void useActiveSkill(Runnable complete, Player player, long time)
{
long now = System.currentTimeMillis();
long ticks = (long) (time / 1000D);
ItemStack itemStack = player.getInventory().getItem(getSlot());
itemStack.setAmount((int) (ticks / 20D));
UtilInv.addDullEnchantment(itemStack);
Recharge.Instance.useForce(player, GetName(), time, true);
Recharge.Instance.setDisplayForce(player, GetName(), true);
Manager.runSyncTimer(new BukkitRunnable()
{
@Override
public void run()
{
long timeLeft = now + time - System.currentTimeMillis();
double percentage = (double) timeLeft / (double) time;
if (percentage <= 0)
{
UtilTextBottom.display(C.cRedB + GetName(), player);
cancel();
return;
}
UtilTextBottom.displayProgress(C.cWhiteB + GetName(), percentage, UtilTime.MakeStr(timeLeft), player);
}
}, 0, 1);
Manager.runSyncTimer(new BukkitRunnable()
{
@ -335,6 +356,7 @@ public class HeroSkill extends Perk
complete.run();
}
useSkill(player);
Kit.GiveItems(player);
cancel();
return;
}

View File

@ -96,7 +96,7 @@ public class HeroBardolf extends HeroKit
if (UtilMath.offsetSquared(wolf.getTarget(), wolf) < 9 && Recharge.Instance.use(data.getOwner(), "Wolf" + wolf.getTarget().getUniqueId(), 500, false, false))
{
Manager.GetDamage().NewDamageEvent(wolf.getTarget(), data.getOwner(), null, DamageCause.CUSTOM, 2, true, true, false, data.getOwner().getName(), "Wolf");
Manager.GetDamage().NewDamageEvent(wolf.getTarget(), data.getOwner(), null, DamageCause.CUSTOM, 1, true, true, false, data.getOwner().getName(), "Wolf");
}
}
else if (ownerOffset > MAX_DIST_SQUARED)

View File

@ -32,7 +32,7 @@ public class SkillSummonWolf extends HeroSkill
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.BONE);
private static final int MAX_WOLVES = 5;
private static final int HEALTH = 6;
private static final int HEALTH = 8;
public SkillSummonWolf(int slot)
{

View File

@ -133,7 +133,7 @@ public class SkillWarHorse extends HeroSkill
}
owner.sendMessage(F.main("Game", "You hit " + F.name(player.getName()) + "."));
Manager.GetDamage().NewDamageEvent(player, owner, null, DamageCause.CUSTOM, 10, false, true, false, UtilEnt.getName(owner), GetName());
Manager.GetDamage().NewDamageEvent(player, owner, null, DamageCause.CUSTOM, 4, false, true, false, UtilEnt.getName(owner), GetName());
buffManager.apply(new BuffRooting(game, player, 1000));
}
}

View File

@ -60,12 +60,12 @@ public class SkillDanaDash extends DashSkill
if (entity instanceof Player)
{
damage = 10;
damage = 12;
UtilAction.velocity(entity, new Vector(Math.random() / 2 - 0.25, 1, Math.random() / 2 - 0.25));
}
else
{
damage = 6;
damage = 8;
UtilAction.velocity(entity, new Vector(Math.random() - 0.5, 0.5, Math.random() - 0.5));
}

View File

@ -43,7 +43,7 @@ public class SkillPulseHeal extends HeroSkill
Player player = event.getPlayer();
useSkill(player);
for (LivingEntity entity : UtilEnt.getInRadius(player.getLocation(), 5).keySet())
for (LivingEntity entity : UtilEnt.getInRadius(player.getLocation(), 7).keySet())
{
// Don't heal enemies
if (!isTeamDamage(entity, player))
@ -68,7 +68,7 @@ public class SkillPulseHeal extends HeroSkill
@Override
public void run()
{
if (radius > 5)
if (radius > 7)
{
cancel();
return;

View File

@ -151,7 +151,7 @@ public class SkillRally extends HeroSkill
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());
Manager.GetDamage().NewDamageEvent(nearby, player, null, DamageCause.CUSTOM, 7, true, true, false, UtilEnt.getName(player), GetName());
}
}
}

View File

@ -140,7 +140,7 @@ public class SkillLightArrows extends HeroSkill
for (LivingEntity entity : UtilEnt.getInRadius(lineParticle.getLastLocation(), 1.5).keySet())
{
if (Recharge.Instance.use(player, GetName() + entity.getUniqueId(), 500, false, false))
if (!isTeamDamage(entity, player) && Recharge.Instance.use(player, GetName() + entity.getUniqueId(), 500, false, false))
{
player.playSound(player.getLocation(), Sound.SUCCESSFUL_HIT, 1, 0.8F);
Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, damage, true, true, false, player.getName(), GetName());

View File

@ -22,6 +22,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@ -181,4 +182,16 @@ public class MinionManager implements Listener
// sign.update();
// }
}
public List<Location> getPath(boolean redTeam)
{
List<Location> path = new ArrayList<>(_path);
if (redTeam)
{
Collections.reverse(path);
}
return path;
}
}

View File

@ -359,7 +359,7 @@ public class MinionWave implements Listener
for (MobaBoss boss : bosses)
{
// Dead, not close enough
if (boss.isDead() || UtilMath.offsetSquared(minion.getEntity(), boss.getEntity()) > DAMAGE_RANGE_SQUARED)
if (boss.isDead() || MobaUtil.isTeamEntity(boss.getEntity(), _owner) || UtilMath.offsetSquared(minion.getEntity(), boss.getEntity()) > DAMAGE_RANGE_SQUARED)
{
continue;
}

View File

@ -0,0 +1,70 @@
package nautilus.game.arcade.game.games.moba.overtime;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.boss.MobaBoss;
import nautilus.game.arcade.game.games.moba.boss.wither.WitherBoss;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import java.util.concurrent.TimeUnit;
public class OvertimeManager implements Listener
{
private static final long OVERTIME = TimeUnit.MINUTES.toMillis(15);
private final Moba _host;
private boolean _enabled;
private boolean _overtime;
public OvertimeManager(Moba host)
{
_host = host;
_enabled = true;
}
public void disableOvertime()
{
_enabled = false;
}
@EventHandler
public void updateOvertime(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST || !_host.IsLive() || !UtilTime.elapsed(_host.GetStateTime(), OVERTIME) || _overtime || !_enabled)
{
return;
}
_overtime = true;
UtilTextMiddle.display(C.cRedB + "OVERTIME", "Victory or Death, Withers are moving to the center!");
_host.Announce(F.main("Game", "Victory or Death, Withers are moving to the center!"), false);
for (MobaBoss boss : _host.getBossManager().getBosses())
{
if (boss instanceof WitherBoss)
{
((WitherBoss) boss).setDamageable(true);
}
}
for (Player player : Bukkit.getOnlinePlayers())
{
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 1.2F);
}
}
public boolean isOvertime()
{
return _enabled && _overtime;
}
}

View File

@ -1,9 +1,14 @@
package nautilus.game.arcade.game.games.moba.prepare;
import mineplex.core.common.entity.ClientArmorStand;
import mineplex.core.common.util.*;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
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.UtilTextMiddle;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketHandler.ListenerPriority;
@ -17,7 +22,7 @@ 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.RoleSelectEvent;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -40,6 +45,7 @@ public class PrepareSelection implements Listener, IPacketHandler
private final Moba _host;
private final Map<ClientArmorStand, MobaRole> _roleStands = new HashMap<>();
private final Map<ClientArmorStand, HeroKit> _kitStands = new HashMap<>();
private final Map<Player, ClientArmorStand> _goBackStands = new HashMap<>();
public PrepareSelection(Moba host)
{
@ -84,18 +90,24 @@ public class PrepareSelection implements Listener, IPacketHandler
location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, average)));
MobaRole role = MobaRole.valueOf(entry.getKey().split(" ")[2]);
ClientArmorStand stand = ClientArmorStand.spawn(prepareLocation(location), players);
try
{
MobaRole role = MobaRole.valueOf(entry.getKey().split(" ")[2]);
ClientArmorStand stand = ClientArmorStand.spawn(prepareLocation(location), players);
stand.setCustomNameVisible(true);
stand.setCustomName(C.cGreenB + role.getName() + C.cGray + " - " + C.cGreenB + "AVAILABLE");
stand.setArms(true);
stand.setHelmet(head);
stand.setChestplate(buildColouredStack(Material.LEATHER_CHESTPLATE, role));
stand.setLeggings(buildColouredStack(Material.LEATHER_LEGGINGS, role));
stand.setBoots(buildColouredStack(Material.LEATHER_BOOTS, role));
stand.setCustomNameVisible(true);
stand.setCustomName(C.cGreenB + role.getName() + C.cGray + " - " + C.cGreenB + "AVAILABLE");
stand.setArms(true);
stand.setHelmet(head);
stand.setChestplate(buildColouredStack(Material.LEATHER_CHESTPLATE, role));
stand.setLeggings(buildColouredStack(Material.LEATHER_LEGGINGS, role));
stand.setBoots(buildColouredStack(Material.LEATHER_BOOTS, role));
_roleStands.put(stand, role);
_roleStands.put(stand, role);
}
catch (IllegalArgumentException e)
{
}
}
// Only spawn the NPCs once all players have been loaded into the world.
}, _host.GetPlayers(true).size() * _host.TickPerTeleport + 10);
@ -109,9 +121,21 @@ public class PrepareSelection implements Listener, IPacketHandler
Location average = UtilAlg.getAverageLocation(team.GetSpawns());
MobaPlayer mobaPlayer = _host.getMobaData(player);
List<HeroKit> heroKits = _host.getKits(mobaPlayer.getRole());
Location goBack = spawns.remove("KIT " + team.GetName().toUpperCase() + " GO_BACK");
ClientArmorStand goBackStand = ClientArmorStand.spawn(goBack.clone().add(0, 1, 0), player);
goBackStand.setCustomNameVisible(true);
goBackStand.setCustomName(C.cGreenB + "Go Back");
goBackStand.setArms(true);
goBackStand.setHelmet(new ItemStack(Material.SKULL_ITEM));
goBackStand.setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.MAROON).build());
goBackStand.setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.MAROON).build());
goBackStand.setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.MAROON).build());
_goBackStands.put(player, goBackStand);
UtilServer.runSyncLater(() ->
{
for (Location location : spawns.values())
@ -169,6 +193,26 @@ public class PrepareSelection implements Listener, IPacketHandler
Player player = packetInfo.getPlayer();
int entityId = packet.a;
ClientArmorStand goBackStand = _goBackStands.get(player);
if (goBackStand != null && goBackStand.getEntityId() == entityId)
{
packetInfo.setCancelled(true);
_host.getMobaData(player).setRole(null);
_goBackStands.remove(player).remove();
for (ClientArmorStand stand2 : _kitStands.keySet())
{
stand2.remove(player);
}
for (ClientArmorStand stand2 : _roleStands.keySet())
{
stand2.teleport(stand2.getLocation(), player);
}
return;
}
for (ClientArmorStand stand : _roleStands.keySet())
{
if (stand.getEntityId() != entityId)
@ -189,7 +233,7 @@ public class PrepareSelection implements Listener, IPacketHandler
for (ClientArmorStand stand2 : _roleStands.keySet())
{
stand2.remove(player);
stand2.teleport(stand2.getLocation().add(0, 100, 0), player);
}
GameTeam team = _host.GetTeam(player);
@ -199,15 +243,7 @@ public class PrepareSelection implements Listener, IPacketHandler
return;
}
if (team.GetColor() == ChatColor.RED)
{
spawnKitUI(player);
}
else
{
spawnKitUI(player);
}
spawnKitUI(player);
displayKitInformation(player, role);
}
@ -222,6 +258,11 @@ public class PrepareSelection implements Listener, IPacketHandler
HeroKit kit = _kitStands.get(stand);
if (goBackStand != null)
{
_goBackStands.remove(player).remove();
}
for (ClientArmorStand stand2 : _kitStands.keySet())
{
stand2.remove(player);
@ -266,6 +307,14 @@ public class PrepareSelection implements Listener, IPacketHandler
stand.remove();
}
for (ClientArmorStand stand : _goBackStands.values())
{
stand.remove();
}
_roleStands.clear();
_kitStands.clear();
_goBackStands.clear();
removePodiums();
_host.getArcadeManager().getPacketHandler().removePacketHandler(this);
}

View File

@ -54,7 +54,7 @@ public abstract class MobaItemEffect
{
}
protected void onRespawn(PlayerGameRespawnEvent event)
protected void onRespawn(PlayerGameRespawnEvent event, boolean fake)
{
}

View File

@ -4,6 +4,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -42,6 +43,7 @@ import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.HashMap;
@ -219,7 +221,7 @@ public class MobaShop implements Listener
{
if (ownedItem.getEffects() != null)
{
ownedItem.getEffects().forEach(effect -> effect.onRespawn(fakeEvent));
ownedItem.getEffects().forEach(effect -> effect.onRespawn(fakeEvent, true));
}
}
@ -296,11 +298,16 @@ public class MobaShop implements Listener
Remove empty potions
*/
@EventHandler
public void removeEmptyPotions(PlayerItemConsumeEvent event)
public void removeEmptyPotions(UpdateEvent event)
{
if (event.getItem().getType() == Material.POTION)
if (event.getType() != UpdateType.FAST)
{
_host.getArcadeManager().runSyncLater(() -> event.getPlayer().setItemInHand(null), 1);
return;
}
for (Player player : _host.GetPlayers(true))
{
player.getInventory().remove(Material.GLASS_BOTTLE);
}
}
@ -523,7 +530,7 @@ public class MobaShop implements Listener
for (MobaItemEffect effect : item.getEffects())
{
effect.onRespawn(event);
effect.onRespawn(event, false);
}
}
}

View File

@ -16,7 +16,7 @@ public class MobaSpeedEffect extends MobaItemEffect
}
@Override
public void onRespawn(PlayerGameRespawnEvent event)
public void onRespawn(PlayerGameRespawnEvent event, boolean fake)
{
Player player = event.GetPlayer();

View File

@ -17,12 +17,16 @@ public class MobaTotalHealthEffect extends MobaItemEffect
}
@Override
public void onRespawn(PlayerGameRespawnEvent event)
public void onRespawn(PlayerGameRespawnEvent event, boolean fake)
{
Player player = event.GetPlayer();
player.setMaxHealth(player.getMaxHealth() + _health);
player.setHealth(player.getMaxHealth());
if (!fake)
{
player.setHealth(player.getMaxHealth());
}
}
@Override

View File

@ -10,6 +10,7 @@ import nautilus.game.arcade.game.games.moba.shop.MobaShop;
import nautilus.game.arcade.game.games.moba.shop.MobaShopCategory;
import nautilus.game.arcade.game.games.moba.shop.MobaShopMenu;
import nautilus.game.arcade.game.games.moba.shop.effects.*;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
@ -74,18 +75,21 @@ public class MobaHunterShop extends MobaShopMenu
),
new MobaItem(new ItemBuilder(Material.LEATHER_HELMET)
.setTitle(C.cGreen + "Leather Cap of Nimble Fingers")
.setColor(Color.GREEN)
.build(), 400)
.addEffects(
new MobaCDRAmmoEffect(0.05)
),
new MobaItem(new ItemBuilder(Material.LEATHER_HELMET)
.setTitle(C.cGreen + "Focused Cap")
.setColor(Color.PURPLE)
.build(), 500)
.addEffects(
new MobaCDREffect(0.05)
),
new MobaItem(new ItemBuilder(Material.LEATHER_HELMET)
.setTitle(C.cGreen + "Vampiric Helmet")
.setColor(Color.RED)
.build(), 500)
.addEffects(
new MobaHPRegenEffect(0.2)
@ -101,18 +105,21 @@ public class MobaHunterShop extends MobaShopMenu
.build(), 250),
new MobaItem(new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setTitle(C.cGreen + "Leather Chestplate of Nimble Fingers")
.setColor(Color.GREEN)
.build(), 750)
.addEffects(
new MobaCDRAmmoEffect(0.15)
),
new MobaItem(new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setTitle(C.cGreen + "Focused Chestplate")
.setColor(Color.PURPLE)
.build(), 750)
.addEffects(
new MobaCDREffect(0.1)
),
new MobaItem(new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setTitle(C.cGreen + "Vampiric Chestplate")
.setColor(Color.RED)
.build(), 750)
.addEffects(
new MobaKillHealEffect(3)
@ -128,18 +135,21 @@ public class MobaHunterShop extends MobaShopMenu
.build(), 250),
new MobaItem(new ItemBuilder(Material.LEATHER_LEGGINGS)
.setTitle(C.cGreen + "Leather Leggings of Nimble Fingers")
.setColor(Color.GREEN)
.build(), 750)
.addEffects(
new MobaCDRAmmoEffect(0.1)
),
new MobaItem(new ItemBuilder(Material.LEATHER_LEGGINGS)
.setTitle(C.cGreen + "Focused Leggings")
.setColor(Color.PURPLE)
.build(), 750)
.addEffects(
new MobaCDREffect(0.1)
),
new MobaItem(new ItemBuilder(Material.LEATHER_LEGGINGS)
.setTitle(C.cGreen + "Vampiric Leggings")
.setColor(Color.RED)
.build(), 700)
.addEffects(
new MobaKillHealEffect(3)
@ -155,18 +165,21 @@ public class MobaHunterShop extends MobaShopMenu
.build(), 250),
new MobaItem(new ItemBuilder(Material.LEATHER_BOOTS)
.setTitle(C.cGreen + "Leather Boots of Nimble Fingers")
.setColor(Color.GREEN)
.build(), 400)
.addEffects(
new MobaCDRAmmoEffect(0.05)
),
new MobaItem(new ItemBuilder(Material.LEATHER_BOOTS)
.setTitle(C.cGreen + "Focused Boots")
.setColor(Color.PURPLE)
.build(), 600)
.addEffects(
new MobaCDREffect(0.05)
),
new MobaItem(new ItemBuilder(Material.LEATHER_BOOTS)
.setTitle(C.cGreen + "Vampiric Boots")
.setColor(Color.RED)
.build(), 500)
.addEffects(
new MobaKillHealEffect(1)

View File

@ -281,7 +281,9 @@ public class TowerManager implements Listener
for (Tower tower : _towers)
{
if (tower.isDead() || tower.getOwner().equals(team) || UtilMath.offsetSquared(tower.getCrystal().getLocation(), location) > PROJECTILE_RANGE_SQUARED)
Location crystalLocation = tower.getCrystal().getLocation();
if (tower.isDead() || tower.getOwner().equals(team) || UtilMath.offsetSquared(crystalLocation, location) > PROJECTILE_RANGE_SQUARED || shouldCancelDamage(tower, shooter))
{
continue;
}

View File

@ -34,6 +34,7 @@ import org.bukkit.entity.Villager;
import org.bukkit.entity.Villager.Profession;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import java.util.HashMap;
import java.util.List;
@ -75,7 +76,7 @@ public class MobaTraining extends Moba
C.cYellow + "of " + C.cGold + "Gold" + C.cYellow + " your team earns."
},
{
C.cYellow + "The is the " + C.cDRedB + "Pumpkin King",
C.cYellow + "This is the " + C.cDRedB + "Pumpkin King",
C.cYellow + "He spawns at " + C.cGreen + "10 minutes" + C.cYellow + " into the game.",
C.cYellow + "The team that kills him will be given increased",
C.cYellow + "regeneration and damage."
@ -91,7 +92,7 @@ public class MobaTraining extends Moba
C.cYellow + "They will fight each other and help destroy enemy Towers."
},
{
C.cYellow + "With the " + C.cGold + "Gold" + C.cYellow + "you earn you can",
C.cYellow + "With the " + C.cGold + "Gold" + C.cYellow + " you earn you can",
C.cYellow + "spend it on upgrades for your weapons and armor.",
C.cYellow + "You can do this via the gold ingot in your inventory",
C.cYellow + "during the game or by clicking on the Villager."
@ -119,7 +120,7 @@ public class MobaTraining extends Moba
DamageTeamSelf = true;
DamageFall = false;
DeathOut = false;
DeathSpectateSecs = 0;
DeathSpectateSecs = 2;
PrepareTime = 500;
GiveClock = false;
HideTeamSheep = true;
@ -127,6 +128,7 @@ public class MobaTraining extends Moba
// Prevent the wither from being damaged as well as to not spawn the pumpkin king
_boss.setDummyBosses(true);
_overtimeManager.disableOvertime();
// Disable minions
_minion.disableMinions();
@ -171,7 +173,7 @@ public class MobaTraining extends Moba
{
suffix = C.cYellow + " Unknown";
}
else if (mobaPlayer.getKit() == null)
else if (mobaPlayer == null || mobaPlayer.getKit() == null)
{
suffix = C.cYellow + " Selecting";
}
@ -333,6 +335,15 @@ public class MobaTraining extends Moba
}
}
@EventHandler
public void plaeyrJoin(PlayerJoinEvent event)
{
if (InProgress())
{
_playerData.add(new MobaPlayer(event.getPlayer()));
}
}
@EventHandler
public void spawnTutorial(GameStateChangeEvent event)
{

View File

@ -31,6 +31,11 @@ public class SelectKitMenu extends Menu<ArcadeManager>
for (int slot : slots)
{
HeroKit kit = (HeroKit) moba.GetKits()[i++];
if (!kit.isVisible())
{
continue;
}
ItemBuilder builder = new ItemBuilder(kit.getSkinData().getSkull());
builder.setTitle(C.cGreen + kit.GetName());

View File

@ -72,6 +72,11 @@ public class MobaUtil
public static boolean isInBoundary(GameTeam owner, LivingEntity source, Location center, Polygon2D boundaries, LivingEntity target)
{
if (boundaries == null)
{
return true;
}
return getEntitiesInBoundary(owner, source, center, boundaries).contains(target);
}