Add a go-back button to kit selection
This commit is contained in:
parent
82182c5d50
commit
85007820d2
@ -79,12 +79,6 @@ public class ClientArmorStand implements ArmorStand
|
|||||||
_observers = players;
|
_observers = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendSpawnPacket(Player player)
|
|
||||||
{
|
|
||||||
Packet<?> packet = new PacketPlayOutSpawnEntityLiving(_armorStand);
|
|
||||||
UtilPlayer.sendPacket(player, packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
public EntityArmorStand getHandle()
|
public EntityArmorStand getHandle()
|
||||||
{
|
{
|
||||||
return _armorStand;
|
return _armorStand;
|
||||||
@ -182,7 +176,7 @@ public class ClientArmorStand implements ArmorStand
|
|||||||
@Override
|
@Override
|
||||||
public Location getLocation()
|
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
|
@Override
|
||||||
@ -246,6 +240,20 @@ public class ClientArmorStand implements ArmorStand
|
|||||||
return false;
|
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
|
@Override
|
||||||
public boolean teleport(Location loc)
|
public boolean teleport(Location loc)
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ public class WitherBoss extends MobaBoss
|
|||||||
private static final String NAME = "Wither Boss";
|
private static final String NAME = "Wither Boss";
|
||||||
private static final float SPEED_TARGET = 4F;
|
private static final float SPEED_TARGET = 4F;
|
||||||
private static final float SPEED_HOME = 6F;
|
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 MobaAIMethod AI_METHOD = new MobaDirectAIMethod();
|
||||||
private static final int MIN_INFORM_TIME = (int) TimeUnit.SECONDS.toMillis(30);
|
private static final int MIN_INFORM_TIME = (int) TimeUnit.SECONDS.toMillis(30);
|
||||||
|
|
||||||
@ -66,9 +66,8 @@ public class WitherBoss extends MobaBoss
|
|||||||
{
|
{
|
||||||
ArmorStand stand = _location.getWorld().spawn(_location, ArmorStand.class);
|
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.setMaxHealth(INITIAL_HEALTH);
|
||||||
stand.setHealth(INITIAL_HEALTH * 0.1);
|
stand.setHealth(INITIAL_HEALTH);
|
||||||
stand.setGravity(false);
|
stand.setGravity(false);
|
||||||
|
|
||||||
MobaUtil.setTeamEntity(stand, _team);
|
MobaUtil.setTeamEntity(stand, _team);
|
||||||
@ -148,20 +147,6 @@ public class WitherBoss extends MobaBoss
|
|||||||
return;
|
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();
|
LivingEntity damagee = event.GetDamageeEntity();
|
||||||
Player damager = event.GetDamagerPlayer(true);
|
Player damager = event.GetDamagerPlayer(true);
|
||||||
|
|
||||||
@ -175,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
|
// Inform the team
|
||||||
if (UtilTime.elapsed(_lastInform, MIN_INFORM_TIME))
|
if (UtilTime.elapsed(_lastInform, MIN_INFORM_TIME))
|
||||||
{
|
{
|
||||||
@ -214,11 +211,14 @@ public class WitherBoss extends MobaBoss
|
|||||||
return;
|
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;
|
_damageable = true;
|
||||||
_entity.setHealth(INITIAL_HEALTH);
|
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -235,13 +235,13 @@ public class WitherBoss extends MobaBoss
|
|||||||
|
|
||||||
for (Player player : _team.GetPlayers(true))
|
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()
|
public double getHealthPercentage()
|
||||||
{
|
{
|
||||||
return _damageable ? (_entity.getHealth() / _entity.getMaxHealth()) : 1;
|
return _entity.getHealth() / _entity.getMaxHealth();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDisplay()
|
private void updateDisplay()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package nautilus.game.arcade.game.games.moba.boss.wither;
|
package nautilus.game.arcade.game.games.moba.boss.wither;
|
||||||
|
|
||||||
|
import mineplex.core.common.geom.Polygon2D;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import nautilus.game.arcade.game.GameTeam;
|
import nautilus.game.arcade.game.GameTeam;
|
||||||
import nautilus.game.arcade.game.games.moba.Moba;
|
import nautilus.game.arcade.game.games.moba.Moba;
|
||||||
@ -45,4 +46,10 @@ public class WitherBossOvertimeAI extends MobaAI
|
|||||||
|
|
||||||
_aiMethod.updateMovement(_entity, _target, 2);
|
_aiMethod.updateMovement(_entity, _target, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Polygon2D getBoundaries()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -328,17 +328,17 @@ public class HeroSkill extends Perk
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
long timeLeft = System.currentTimeMillis() + time - now;
|
long timeLeft = now + time - System.currentTimeMillis();
|
||||||
double percentage = (double) timeLeft / (double) time;
|
double percentage = (double) timeLeft / (double) time;
|
||||||
|
|
||||||
if (percentage >= 1)
|
if (percentage <= 0)
|
||||||
{
|
{
|
||||||
UtilTextBottom.display(C.cRedB + GetName(), player);
|
UtilTextBottom.display(C.cRedB + GetName(), player);
|
||||||
cancel();
|
cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilTextBottom.displayProgress(GetName(), percentage, player);
|
UtilTextBottom.displayProgress(C.cWhiteB + GetName(), percentage, UtilTime.MakeStr(timeLeft), player);
|
||||||
}
|
}
|
||||||
}, 0, 1);
|
}, 0, 1);
|
||||||
|
|
||||||
@ -356,6 +356,7 @@ public class HeroSkill extends Perk
|
|||||||
complete.run();
|
complete.run();
|
||||||
}
|
}
|
||||||
useSkill(player);
|
useSkill(player);
|
||||||
|
Kit.GiveItems(player);
|
||||||
cancel();
|
cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ 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.HeroKit;
|
||||||
import nautilus.game.arcade.game.games.moba.kit.RoleSelectEvent;
|
import nautilus.game.arcade.game.games.moba.kit.RoleSelectEvent;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -91,18 +90,24 @@ public class PrepareSelection implements Listener, IPacketHandler
|
|||||||
|
|
||||||
location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, average)));
|
location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, average)));
|
||||||
|
|
||||||
MobaRole role = MobaRole.valueOf(entry.getKey().split(" ")[2]);
|
try
|
||||||
ClientArmorStand stand = ClientArmorStand.spawn(prepareLocation(location), players);
|
{
|
||||||
|
MobaRole role = MobaRole.valueOf(entry.getKey().split(" ")[2]);
|
||||||
|
ClientArmorStand stand = ClientArmorStand.spawn(prepareLocation(location), players);
|
||||||
|
|
||||||
stand.setCustomNameVisible(true);
|
stand.setCustomNameVisible(true);
|
||||||
stand.setCustomName(C.cGreenB + role.getName() + C.cGray + " - " + C.cGreenB + "AVAILABLE");
|
stand.setCustomName(C.cGreenB + role.getName() + C.cGray + " - " + C.cGreenB + "AVAILABLE");
|
||||||
stand.setArms(true);
|
stand.setArms(true);
|
||||||
stand.setHelmet(head);
|
stand.setHelmet(head);
|
||||||
stand.setChestplate(buildColouredStack(Material.LEATHER_CHESTPLATE, role));
|
stand.setChestplate(buildColouredStack(Material.LEATHER_CHESTPLATE, role));
|
||||||
stand.setLeggings(buildColouredStack(Material.LEATHER_LEGGINGS, role));
|
stand.setLeggings(buildColouredStack(Material.LEATHER_LEGGINGS, role));
|
||||||
stand.setBoots(buildColouredStack(Material.LEATHER_BOOTS, 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.
|
// Only spawn the NPCs once all players have been loaded into the world.
|
||||||
}, _host.GetPlayers(true).size() * _host.TickPerTeleport + 10);
|
}, _host.GetPlayers(true).size() * _host.TickPerTeleport + 10);
|
||||||
@ -124,7 +129,7 @@ public class PrepareSelection implements Listener, IPacketHandler
|
|||||||
goBackStand.setCustomNameVisible(true);
|
goBackStand.setCustomNameVisible(true);
|
||||||
goBackStand.setCustomName(C.cGreenB + "Go Back");
|
goBackStand.setCustomName(C.cGreenB + "Go Back");
|
||||||
goBackStand.setArms(true);
|
goBackStand.setArms(true);
|
||||||
goBackStand.setHelmet(new ItemStack(Material.SKULL_ITEM, (byte) 2));
|
goBackStand.setHelmet(new ItemStack(Material.SKULL_ITEM));
|
||||||
goBackStand.setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.MAROON).build());
|
goBackStand.setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.MAROON).build());
|
||||||
goBackStand.setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).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());
|
goBackStand.setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.MAROON).build());
|
||||||
@ -190,11 +195,21 @@ public class PrepareSelection implements Listener, IPacketHandler
|
|||||||
|
|
||||||
ClientArmorStand goBackStand = _goBackStands.get(player);
|
ClientArmorStand goBackStand = _goBackStands.get(player);
|
||||||
|
|
||||||
if (goBackStand != null)
|
if (goBackStand != null && goBackStand.getEntityId() == entityId)
|
||||||
{
|
{
|
||||||
packetInfo.setCancelled(true);
|
packetInfo.setCancelled(true);
|
||||||
_host.getMobaData(player).setRole(null);
|
_host.getMobaData(player).setRole(null);
|
||||||
_goBackStands.remove(player).remove();
|
_goBackStands.remove(player).remove();
|
||||||
|
|
||||||
|
for (ClientArmorStand stand2 : _kitStands.keySet())
|
||||||
|
{
|
||||||
|
stand2.remove(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ClientArmorStand stand2 : _roleStands.keySet())
|
||||||
|
{
|
||||||
|
stand2.teleport(stand2.getLocation(), player);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +233,7 @@ public class PrepareSelection implements Listener, IPacketHandler
|
|||||||
|
|
||||||
for (ClientArmorStand stand2 : _roleStands.keySet())
|
for (ClientArmorStand stand2 : _roleStands.keySet())
|
||||||
{
|
{
|
||||||
stand2.remove(player);
|
stand2.teleport(stand2.getLocation().add(0, 100, 0), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameTeam team = _host.GetTeam(player);
|
GameTeam team = _host.GetTeam(player);
|
||||||
@ -243,6 +258,11 @@ public class PrepareSelection implements Listener, IPacketHandler
|
|||||||
|
|
||||||
HeroKit kit = _kitStands.get(stand);
|
HeroKit kit = _kitStands.get(stand);
|
||||||
|
|
||||||
|
if (goBackStand != null)
|
||||||
|
{
|
||||||
|
_goBackStands.remove(player).remove();
|
||||||
|
}
|
||||||
|
|
||||||
for (ClientArmorStand stand2 : _kitStands.keySet())
|
for (ClientArmorStand stand2 : _kitStands.keySet())
|
||||||
{
|
{
|
||||||
stand2.remove(player);
|
stand2.remove(player);
|
||||||
@ -287,6 +307,14 @@ public class PrepareSelection implements Listener, IPacketHandler
|
|||||||
stand.remove();
|
stand.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (ClientArmorStand stand : _goBackStands.values())
|
||||||
|
{
|
||||||
|
stand.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
_roleStands.clear();
|
||||||
|
_kitStands.clear();
|
||||||
|
_goBackStands.clear();
|
||||||
removePodiums();
|
removePodiums();
|
||||||
_host.getArcadeManager().getPacketHandler().removePacketHandler(this);
|
_host.getArcadeManager().getPacketHandler().removePacketHandler(this);
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,11 @@ public class MobaUtil
|
|||||||
|
|
||||||
public static boolean isInBoundary(GameTeam owner, LivingEntity source, Location center, Polygon2D boundaries, LivingEntity target)
|
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);
|
return getEntitiesInBoundary(owner, source, center, boundaries).contains(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user