Ready for full on testing.
This commit is contained in:
parent
5298fa341e
commit
b9edb92c1e
@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.evolution;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import nautilus.game.arcade.ArcadeFormat;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
@ -15,6 +16,10 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class EvoKit extends Kit
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private EntityType _entity;
|
||||
|
||||
public EvoKit(ArcadeManager manager, String name, String[] kitDesc, Perk[] kitPerks, EntityType type)
|
||||
@ -31,12 +36,14 @@ public abstract class EvoKit extends Kit
|
||||
|
||||
public void upgradeGive(Player player)
|
||||
{
|
||||
String def = C.cWhite + C.Bold + "You evolved into " + ("aeiou".indexOf(GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + F.elem(C.cGreen + C.Bold + GetName());
|
||||
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1.0F, 0.1F);
|
||||
|
||||
UtilPlayer.message(player, C.Line);
|
||||
UtilPlayer.message(player, C.Line);
|
||||
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||
UtilPlayer.message(player, C.Bold + "You evolved into " + ("aeiou".indexOf(GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + F.elem(C.cGreen + C.Bold + GetName()));
|
||||
UtilPlayer.message(player, def);
|
||||
|
||||
UtilPlayer.message(player, C.Line);
|
||||
|
||||
@ -45,7 +52,9 @@ public abstract class EvoKit extends Kit
|
||||
|
||||
UtilPlayer.message(player, C.Line);
|
||||
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||
}
|
||||
|
||||
UtilTextMiddle.display(null, def, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract void GiveItems(Player player);
|
||||
|
@ -4,6 +4,10 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class EvoToken implements Comparable<EvoToken>
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public final Player Player;
|
||||
|
||||
public int Kills = 0;
|
||||
|
@ -42,13 +42,21 @@ import nautilus.game.arcade.kit.perks.event.PerkConstructorEvent;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Evolution extends SoloGame
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
* Reworked from Original Code.
|
||||
*/
|
||||
|
||||
private EvolveManager _evolve;
|
||||
|
||||
private ArrayList<EvoKit> _mobKits = new ArrayList<EvoKit>();
|
||||
@ -148,7 +156,7 @@ public class Evolution extends SoloGame
|
||||
|
||||
private Location loadAngle(Location platform, Location viewing)
|
||||
{
|
||||
Vector b = UtilAlg.getTrajectory(viewing, platform).normalize();
|
||||
Vector b = UtilAlg.getTrajectory(viewing, platform.clone().subtract(0.0, 1.0, 0.0)).normalize();
|
||||
|
||||
viewing.setPitch(UtilAlg.GetPitch(b));
|
||||
viewing.setYaw(UtilAlg.GetYaw(b));
|
||||
@ -167,7 +175,24 @@ public class Evolution extends SoloGame
|
||||
{
|
||||
_tokens.put(player.getName(), new EvoToken(player));
|
||||
|
||||
upgradeKit(player, true);
|
||||
upgradeKit(player, false);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void showKit(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
Kit kit = GetKit(player);
|
||||
|
||||
if (!(kit instanceof EvoKit))
|
||||
continue;
|
||||
|
||||
((EvoKit) kit).upgradeGive(player);
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,14 +291,40 @@ public class Evolution extends SoloGame
|
||||
if (_evolve.isEvolving(event.getPlayer()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEvolveMove(PlayerMoveEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (_evolve.isEvolving(event.getPlayer()))
|
||||
event.getPlayer().teleport(event.getFrom());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void startEvolve(EvolutionBeginEvent event)
|
||||
{
|
||||
Recharge.Instance.Get(event.getPlayer()).clear();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
event.getPlayer().teleport(GetTeam(event.getPlayer()).GetSpawn());
|
||||
Manager.GetCondition().Factory().Cloak("Evolving", event.getPlayer(), null, 10, true, true);
|
||||
Recharge.Instance.Get(player).clear();
|
||||
|
||||
player.setSprinting(false);
|
||||
player.setSneaking(false);
|
||||
|
||||
player.setHealth(player.getMaxHealth());
|
||||
|
||||
player.setFireTicks(0);
|
||||
player.setFallDistance(0);
|
||||
|
||||
player.eject();
|
||||
player.leaveVehicle();
|
||||
|
||||
((CraftPlayer) player).getHandle().p(0);
|
||||
|
||||
Manager.GetCondition().Factory().Cloak("Evolving", player, null, 20, false, false);
|
||||
|
||||
((Player) player).playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 1.25f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -291,18 +342,19 @@ public class Evolution extends SoloGame
|
||||
}
|
||||
|
||||
upgradeKit(event.getPlayer(), true);
|
||||
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.LEVEL_UP, 1, 0.6F);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void endEvolve(final EvolutionPostEvolveEvent event)
|
||||
public void endEvolve(EvolutionPostEvolveEvent event)
|
||||
{
|
||||
try
|
||||
{
|
||||
Manager.GetCondition().GetActiveCondition(event.getPlayer(), ConditionType.CLOAK).Expire();
|
||||
}
|
||||
catch (NullPointerException ex)
|
||||
{
|
||||
}
|
||||
catch (NullPointerException ex){}
|
||||
|
||||
event.getPlayer().teleport(GetTeam(event.getPlayer()).GetSpawn());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -7,6 +7,10 @@ import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class EvolutionAbilityUseEvent extends PlayerEvent implements Cancellable
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private static HandlerList _handlers = new HandlerList();
|
||||
|
||||
private boolean _cancelled = false;
|
||||
|
@ -6,6 +6,10 @@ import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class EvolutionBeginEvent extends PlayerEvent
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private static HandlerList _handlers = new HandlerList();
|
||||
|
||||
public EvolutionBeginEvent(Player who)
|
||||
|
@ -6,6 +6,9 @@ import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class EvolutionEndEvent extends PlayerEvent
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
private static HandlerList _handlers = new HandlerList();
|
||||
|
||||
public EvolutionEndEvent(Player who)
|
||||
|
@ -6,6 +6,10 @@ import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class EvolutionPostEvolveEvent extends PlayerEvent
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private static HandlerList _handlers = new HandlerList();
|
||||
|
||||
public EvolutionPostEvolveEvent(Player who)
|
||||
|
@ -1,15 +1,11 @@
|
||||
package nautilus.game.arcade.game.games.evolution.evolve;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
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.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.packethandler.PacketPlayOutCamera;
|
||||
import nautilus.game.arcade.game.games.evolution.EvoKit;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent;
|
||||
@ -37,16 +33,18 @@ import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Zombie;
|
||||
|
||||
public class EvolveData
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private boolean _ended = false;
|
||||
|
||||
private final long _timestamp = System.currentTimeMillis();
|
||||
private long _endTime = System.currentTimeMillis();
|
||||
|
||||
private final EvolveManager _manager;
|
||||
private final PlatformToken _token;
|
||||
|
||||
private boolean _active = true;
|
||||
@ -54,65 +52,28 @@ public class EvolveData
|
||||
private final Player _player;
|
||||
|
||||
private final EvoKit _to;
|
||||
private String _evolveTop;
|
||||
|
||||
private final EntityInsentient _eFrom;
|
||||
private EntityInsentient _eTo;
|
||||
|
||||
private Zombie _zombie;
|
||||
|
||||
public EvolveData(EvolveManager manager, PlatformToken token, Player player, EvoKit from, EvoKit to)
|
||||
public EvolveData(PlatformToken token, Player player, EvoKit from, EvoKit to)
|
||||
{
|
||||
_manager = manager;
|
||||
_token = token;
|
||||
|
||||
_player = player;
|
||||
|
||||
_to = to;
|
||||
_evolveTop = C.cWhite + "You evolved into " + ("aeiou".indexOf(_to.GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + C.cGreen + C.Bold + _to.GetName();
|
||||
|
||||
_eFrom = spawn(from.getEntity(), token.Platform, false);
|
||||
|
||||
_zombie = setupZombie();
|
||||
|
||||
Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player));
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(_manager.Host.Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
setupPlayer();
|
||||
}
|
||||
}, 2);
|
||||
}
|
||||
|
||||
private Zombie setupZombie()
|
||||
{
|
||||
_manager.Host.CreatureAllowOverride = true;
|
||||
Zombie zombie = _token.Viewing.getWorld().spawn(_token.Viewing, Zombie.class);
|
||||
_manager.Host.CreatureAllowOverride = false;
|
||||
|
||||
UtilEnt.Vegetate(zombie, true);
|
||||
UtilEnt.ghost(zombie, true, true);
|
||||
|
||||
zombie.teleport(_token.Viewing);
|
||||
|
||||
return zombie;
|
||||
setupPlayer();
|
||||
}
|
||||
|
||||
private void setupPlayer()
|
||||
{
|
||||
//Spectate
|
||||
PacketPlayOutCamera packet = new PacketPlayOutCamera(_zombie);
|
||||
UtilPlayer.sendPacket(_player, packet);
|
||||
}
|
||||
|
||||
private void endPlayer()
|
||||
{
|
||||
//Stop spectating
|
||||
PacketPlayOutCamera packet = new PacketPlayOutCamera(_player);
|
||||
UtilPlayer.sendPacket(_player, packet);
|
||||
_player.teleport(_token.Viewing);
|
||||
}
|
||||
|
||||
//Boolean completed
|
||||
@ -124,13 +85,13 @@ public class EvolveData
|
||||
return true;
|
||||
}
|
||||
|
||||
teleport();
|
||||
|
||||
//Hasn't ended yet
|
||||
if (_active)
|
||||
{
|
||||
handleAnimation(_eFrom);
|
||||
|
||||
//If 2 seconds past
|
||||
if (UtilTime.elapsed(_timestamp, 2400))
|
||||
{
|
||||
//If 3 seconds past
|
||||
if (UtilTime.elapsed(_timestamp, 3200))
|
||||
{
|
||||
_active = false;
|
||||
_endTime = System.currentTimeMillis();
|
||||
@ -139,9 +100,7 @@ public class EvolveData
|
||||
despawn(_eFrom);
|
||||
|
||||
UtilFirework.playFirework(_token.Platform.clone().add(0.0, 1.5, 0.0), Type.BALL, Color.GREEN, false, false);
|
||||
|
||||
UtilTextMiddle.display(null, _evolveTop, _player);
|
||||
|
||||
|
||||
Bukkit.getServer().getPluginManager().callEvent(new EvolutionEndEvent(_player));
|
||||
}
|
||||
else
|
||||
@ -155,17 +114,11 @@ public class EvolveData
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
handleAnimation(_eTo);
|
||||
|
||||
if (!UtilTime.elapsed(_endTime, 2400))
|
||||
{
|
||||
if (!UtilTime.elapsed(_endTime, 3000))
|
||||
return false;
|
||||
|
||||
despawn(_eTo);
|
||||
|
||||
endPlayer();
|
||||
|
||||
_zombie.remove();
|
||||
|
||||
Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player));
|
||||
return true;
|
||||
@ -183,21 +136,12 @@ public class EvolveData
|
||||
if (_eTo != null)
|
||||
despawn(_eTo);
|
||||
|
||||
endPlayer();
|
||||
|
||||
_zombie.remove();
|
||||
|
||||
_ended = true;
|
||||
}
|
||||
|
||||
private void handleAnimation(EntityInsentient entity)
|
||||
public void teleport()
|
||||
{
|
||||
setupPlayer();
|
||||
// float yaw = entity.yaw;
|
||||
// yaw += 2;
|
||||
//
|
||||
// _token.Platform.setYaw(yaw);
|
||||
// entity.setLocation(_token.Platform.getX(), _token.Platform.getY(), _token.Platform.getZ(), yaw, entity.pitch);
|
||||
}
|
||||
|
||||
private EntityInsentient spawn(EntityType type, Location loc, boolean invisible)
|
||||
|
@ -15,6 +15,10 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class EvolveManager
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public final Evolution Host;
|
||||
|
||||
private final NautHashMap<Location, Location> _evolveLocs;
|
||||
@ -45,7 +49,7 @@ public class EvolveManager
|
||||
if (_data.containsKey(player.getName()))
|
||||
return;
|
||||
|
||||
_data.put(player.getName(), new EvolveData(this, getLocation(), player, from, to));
|
||||
_data.put(player.getName(), new EvolveData(getLocation(), player, from, to));
|
||||
}
|
||||
|
||||
public EvolveData getEvolve(Player player)
|
||||
|
@ -12,9 +12,13 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class KitEvolutionist extends Kit
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public KitEvolutionist(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Evolutionist", KitAvailability.Free, 0, new String[]
|
||||
super(manager, "Darwinist", KitAvailability.Free, 0, new String[]
|
||||
{
|
||||
"They grow up so fast :')"
|
||||
}, new Perk[]
|
||||
|
@ -10,7 +10,7 @@ import nautilus.game.arcade.game.games.evolution.EvoKit;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkBarrage;
|
||||
import nautilus.game.arcade.kit.perks.PerkFletcher;
|
||||
import nautilus.game.arcade.kit.perks.PerkConstructor;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -32,7 +32,7 @@ public class KitSkeleton extends EvoKit
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkFletcher(3, 2, false),
|
||||
new PerkConstructor("Fletcher", 3, 2, Material.ARROW, "Fletched Arrow", false),
|
||||
new PerkBarrage(5, 250, true, false)
|
||||
}, EntityType.SKELETON);
|
||||
}
|
||||
@ -44,7 +44,7 @@ public class KitSkeleton extends EvoKit
|
||||
player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build());
|
||||
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.getWorld().playSound(player.getLocation(), Sound.SKELETON_IDLE, 4f, 1f);
|
||||
|
@ -39,6 +39,10 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class PerkBlockTossEVO extends Perk implements IThrown
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private HashMap<Player, BlockTossData> _hold = new HashMap<Player, BlockTossData>();
|
||||
private HashMap<Player, Long> _charge = new HashMap<Player, Long>();
|
||||
private HashSet<Player> _charged = new HashSet<Player>();
|
||||
|
@ -27,6 +27,10 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class PerkBounceEVO extends Perk
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private NautHashMap<LivingEntity, Long> _live = new NautHashMap<LivingEntity, Long>();
|
||||
|
||||
public PerkBounceEVO()
|
||||
|
@ -31,6 +31,10 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class PerkFlamingSwordEVO extends Perk
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
|
||||
|
||||
public PerkFlamingSwordEVO()
|
||||
|
@ -27,6 +27,10 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class PerkPounceEVO extends Perk
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private NautHashMap<LivingEntity, Long> _live = new NautHashMap<LivingEntity, Long>();
|
||||
|
||||
public PerkPounceEVO()
|
||||
|
@ -34,6 +34,10 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class PerkSiesmicSlamEVO extends Perk
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private HashMap<LivingEntity, Long> _live = new HashMap<LivingEntity, Long>();
|
||||
|
||||
public PerkSiesmicSlamEVO()
|
||||
|
@ -33,6 +33,10 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class PerkSulphurBombEVO extends Perk implements IThrown
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public PerkSulphurBombEVO()
|
||||
{
|
||||
super("Sulphur Bomb", new String[]
|
||||
|
@ -21,6 +21,10 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class PerkWebEVO extends Perk implements IThrown
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public PerkWebEVO()
|
||||
{
|
||||
super("Web Shot", new String[]
|
||||
|
Loading…
Reference in New Issue
Block a user