Did things

This commit is contained in:
Mysticate 2015-07-30 04:30:19 -06:00
parent a5d73d791a
commit f02924987e
21 changed files with 630 additions and 221 deletions

View File

@ -13,11 +13,20 @@ import org.bukkit.entity.Player;
public abstract class EvoKit extends Kit
{
private EntityType _entity;
public EvoKit(ArcadeManager manager, String name, String[] kitDesc, Perk[] kitPerks, EntityType type)
{
super(manager, name, KitAvailability.Hide, 0, kitDesc, kitPerks, type, null);
_entity = type;
}
public EntityType getEntity()
{
return _entity;
}
public void upgradeGive(Player player)
{
UtilPlayer.message(player, C.Line);

View File

@ -1,22 +1,16 @@
package nautilus.game.arcade.game.games.evolution;
import nautilus.game.arcade.kit.Kit;
import org.bukkit.entity.Player;
public class EvoToken implements Comparable<EvoToken>
{
public final Player Player;
public final Kit BuffKit;
public int Kills = 0;
public EvoToken(Player player, Kit kit)
public EvoToken(Player player)
{
Player = player;
BuffKit = kit;
}
@Override

View File

@ -6,6 +6,7 @@ import java.util.Collections;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap;
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.combat.event.CombatDeathEvent;
@ -14,13 +15,12 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent;
import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent;
import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent;
import nautilus.game.arcade.game.games.evolution.evolve.EvolveManager;
import nautilus.game.arcade.game.games.evolution.kits.KitAgility;
import nautilus.game.arcade.game.games.evolution.kits.KitHealth;
import nautilus.game.arcade.game.games.evolution.kits.KitRecharge;
import nautilus.game.arcade.game.games.evolution.kits.KitPlayer;
import nautilus.game.arcade.game.games.evolution.mobs.KitBlaze;
import nautilus.game.arcade.game.games.evolution.mobs.KitChicken;
import nautilus.game.arcade.game.games.evolution.mobs.KitCreeper;
@ -38,6 +38,8 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
@ -45,7 +47,6 @@ public class Evolution extends SoloGame
{
private EvolveManager _evolve;
private ArrayList<Kit> _boosterKits = new ArrayList<Kit>();
private ArrayList<EvoKit> _mobKits = new ArrayList<EvoKit>();
private NautHashMap<String, EvoToken> _tokens = new NautHashMap<String, EvoToken>();
@ -58,7 +59,9 @@ public class Evolution extends SoloGame
{
super(manager, GameType.Evolution,
new Kit[0],
new Kit[]
{
},
new String[]
{
"You evolve when you get a kill.",
@ -66,11 +69,7 @@ public class Evolution extends SoloGame
"First to get through 10 evolutions wins!"
});
//Custom kit stuff to make other things easier
_boosterKits.add(new KitHealth(manager));
_boosterKits.add(new KitAgility(manager));
_boosterKits.add(new KitRecharge(manager));
//Custom kit stuff to make other things easiet
_mobKits.add(new KitGolem(manager));
_mobKits.add(new KitBlaze(manager));
_mobKits.add(new KitSlime(manager));
@ -82,17 +81,16 @@ public class Evolution extends SoloGame
_mobKits.add(new KitChicken(manager));
_mobKits.add(new KitSkeleton(manager));
ArrayList<Kit> allKits = new ArrayList<Kit>();
allKits.addAll(_boosterKits);
allKits.addAll(_mobKits);
Kit[] kits = new Kit[_mobKits.size() + 1];
Kit[] kits = new Kit[allKits.size()];
for (int i = 0 ; i < allKits.size() ; i++)
for (int i = 0 ; i < _mobKits.size() ; i++)
{
kits[i] = allKits.get(i);
}
if (i == 0)
kits[0] = new KitPlayer(manager);
kits[i] = _mobKits.get(i);
}
setKits(kits);
DamageTeamSelf = true;
@ -128,7 +126,7 @@ public class Evolution extends SoloGame
@Override
public void ParseData()
{
for (Location loc : WorldData.GetCustomLocs("RED"))
for (Location loc : WorldData.GetDataLocs("RED"))
{
loc.getBlock().setType(Material.AIR);
_evoPlatforms.add(loc);
@ -144,7 +142,7 @@ public class Evolution extends SoloGame
for (Player player : GetPlayers(true))
{
_tokens.put(player.getName(), new EvoToken(player, GetKit(player)));
_tokens.put(player.getName(), new EvoToken(player));
upgradeKit(player, false);
@ -174,7 +172,7 @@ public class Evolution extends SoloGame
if (!IsLive())
return;
if (event.getType() != UpdateType.FASTER)
if (event.getType() != UpdateType.TICK)
return;
_evolve.tick();
@ -188,15 +186,12 @@ public class Evolution extends SoloGame
if (GetKit(player) == (kit))
return true;
if (_tokens.get(player.getName()).BuffKit == kit)
return true;
return false;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onEvolveDamage(CustomDamageEvent event)
public void onEvolveDamageRecieve(CustomDamageEvent event)
{
if (!IsLive())
return;
@ -208,10 +203,58 @@ public class Evolution extends SoloGame
event.SetCancelled("Player is evolving!");
}
@EventHandler(priority = EventPriority.MONITOR)
public void onEvolveDamageDeal(CustomDamageEvent event)
{
if (!IsLive())
return;
if (!(event.GetDamagerEntity(true) instanceof Player))
return;
if (_evolve.isEvolving(event.GetDamagerPlayer(true)))
event.SetCancelled("Player is evolving!");
}
@EventHandler
public void onEvolveMove(PlayerMoveEvent event)
{
if (!IsLive())
return;
if (_evolve.isEvolving(event.getPlayer()))
event.getPlayer().teleport(event.getFrom());
}
@EventHandler
public void onEvolveAbility(EvolutionAbilityUseEvent event)
{
if (!IsLive())
return;
if (_evolve.isEvolving(event.getPlayer()))
event.setCancelled(true);
}
@EventHandler
public void onEvolveDismount(VehicleExitEvent event)
{
if (!IsLive())
return;
if (!(event.getExited() instanceof Player))
return;
if (_evolve.isEvolving((Player) event.getExited()))
event.setCancelled(true);
}
@EventHandler
public void startEvolve(EvolutionBeginEvent event)
{
Manager.GetCondition().Factory().Cloak("Evolution", event.getPlayer(), null, Double.MAX_VALUE, false, false);
Recharge.Instance.Get(event.getPlayer()).clear();
}
@EventHandler
@ -224,6 +267,8 @@ public class Evolution extends SoloGame
public void endEvolve(EvolutionPostEvolveEvent event)
{
Manager.GetCondition().Clean(event.getPlayer());
event.getPlayer().setAllowFlight(false);
event.getPlayer().setFlying(false);
event.getPlayer().teleport(GetTeam(event.getPlayer()).GetSpawn());
}
@ -257,6 +302,21 @@ public class Evolution extends SoloGame
End();
return;
}
EvoToken token = _tokens.get(killer.getName());
try
{
EvoKit from = _mobKits.get(token.Kills - 1); //Account for the score increase
EvoKit to = _mobKits.get(token.Kills);
_evolve.addEvolve(killer, from, to);
}
catch (IndexOutOfBoundsException ex)
{
End();
return;
}
}
//Boolean ending
@ -329,7 +389,7 @@ public class Evolution extends SoloGame
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (!IsLive())
if (GetState() != GameState.Prepare && !IsLive())
return;
if (event.getType() != UpdateType.FAST)

View File

@ -0,0 +1,41 @@
package nautilus.game.arcade.game.games.evolution.events;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class EvolutionAbilityUseEvent extends PlayerEvent implements Cancellable
{
private static HandlerList _handlers = new HandlerList();
private boolean _cancelled = false;
public EvolutionAbilityUseEvent(Player who)
{
super(who);
}
@Override
public boolean isCancelled()
{
return _cancelled;
}
@Override
public void setCancelled(boolean cancelled)
{
_cancelled = cancelled;
}
public static HandlerList getHandlerList()
{
return _handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
}

View File

@ -1,12 +1,20 @@
package nautilus.game.arcade.game.games.evolution.evolve;
import java.util.ArrayList;
import java.util.Iterator;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
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.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge;
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;
import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent;
@ -28,15 +36,17 @@ import net.minecraft.server.v1_7_R4.World;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.FireworkEffect.Type;
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.util.Vector;
public class EvolveData
{
private long _curtime = System.currentTimeMillis();
private final long _timestamp = System.currentTimeMillis();
private long _endTime = System.currentTimeMillis();
private final EvolveManager _manager;
@ -44,90 +54,161 @@ public class EvolveData
private final Player _player;
private final EntityType _from;
private final EntityType _to;
private final EvoKit _to;
private boolean _switch = true;
private int _stage;
private EntityInsentient _eFrom;
private final EntityInsentient _eFrom;
private EntityInsentient _eTo;
public EvolveData(EvolveManager manager, Player player, EntityType from, EntityType to)
private String _evolveTop;
private int _descIndex = 0;
private ArrayList<Location> _rotateLocs = new ArrayList<Location>();
private Iterator<Location> _rotateIterator;
private double _radius = 4.0;
// private Bat _ride;
public EvolveData(EvolveManager manager, Player player, EvoKit from, EvoKit to)
{
_manager = manager;
_player = player;
_from = from;
_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());
setupLocs();
// spawnBat();
Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player));
}
private void setupLocs()
{
for (double i = 0 ; i < 50.0 ; i+= .02)
{
Location loc = _manager.getLocation().clone().add(Math.cos(i) * _radius, 3.0, Math.sin(i) * _radius);
Vector pyRef = UtilAlg.getTrajectory(loc, _manager.getLocation());
loc.setPitch(UtilAlg.GetPitch(pyRef));
loc.setYaw(UtilAlg.GetYaw(pyRef));
_rotateLocs.add(loc);
}
_rotateIterator = _rotateLocs.iterator();
_player.teleport(_rotateIterator.next());
_player.setAllowFlight(true);
_player.setFlying(true);
}
// private void spawnBat()
// {
// _manager.Host.CreatureAllowOverride = true;
// _ride = _player.getWorld().spawn(_rotateLocs.get(0), Bat.class);
//
// UtilEnt.Vegetate(_ride);
// UtilEnt.silence(_ride, true);
// UtilEnt.ghost(_ride, false, true);
//
// _manager.Host.CreatureAllowOverride = false;
//
// _ride.setPassenger(_player);
// ((CraftPlayer) _player).getHandle().spectating = true;
// }
//Boolean completed
public boolean tick()
{
teleport();
if (!_active)
{
if (!UtilTime.elapsed(_curtime, 4000))
return false;
Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player));
return true;
}
_stage++;
if (_stage > 12)
{
_active = false;
Bukkit.getServer().getPluginManager().callEvent(new EvolutionEndEvent(_player));
_curtime = System.currentTimeMillis();
UtilFirework.playFirework(_manager.getLocation().clone().add(0.0, 1.5, 0.0), Type.BALL, Color.GREEN, false, false);
//Hasn't ended yet
if (_active)
{
//If 2 seconds past
if (UtilTime.elapsed(_timestamp, 2400))
{
_active = false;
_endTime = System.currentTimeMillis();
_eTo = spawn(_to.getEntity());
despawn(_eFrom);
UtilFirework.playFirework(_manager.getLocation().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
{
//Play particles
if (UtilTime.elapsed(_timestamp, 500))
{
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, new Location(_eFrom.world.getWorld(), _eFrom.locX, _eFrom.locY + 1.0, _eFrom.locZ), 0.5F, 1.0F, 0.5F, 0, 5, ViewDist.SHORT, _player);
}
}
return false;
}
if (!UtilTime.elapsed(_curtime, 1000 * (6 - (_stage / 2))))
return false;
_curtime = System.currentTimeMillis();
_switch = !_switch;
if (_switch)
{
despawn(_eTo);
_eFrom = spawn(_from);
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, new Location(_eFrom.world.getWorld(), _eFrom.locX, _eFrom.locY, _eFrom.locZ), 0.5F, 0.5F, 0.5F, 0, 5, ViewDist.SHORT, _player);
}
else
{
despawn(_eFrom);
_eTo = spawn(_to);
//If no desc to display
if (_to.GetDesc().length <= 0)
{
//Don't start displaying desc until after 1 second from evolve
if (!UtilTime.elapsed(_endTime, 4000))
return false;
despawn(_eTo);
// _ride.eject();
// _ride.remove();
//
// ((CraftPlayer) _player).getHandle().spectating = false;
Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player));
return true;
}
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, new Location(_eTo.world.getWorld(), _eTo.locX, _eTo.locY, _eTo.locZ), 0.5F, 0.5F, 0.5F, 0, 5, ViewDist.SHORT, _player);
//Don't start displaying until 1 second after evolve
if (!UtilTime.elapsed(_endTime, 1500))
return false;
if (_descIndex >= _to.GetDesc().length)
{
if (!Recharge.Instance.usable(_player, "EvolveDesc"))
return false;
despawn(_eTo);
Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player));
return true;
}
if (!Recharge.Instance.use(_player, "EvolveDesc", 2200, false, false))
return false;
UtilTextBottom.display(_to.GetDesc()[_descIndex], _player);
_descIndex++;
return false;
}
return false;
}
private void teleport()
{
_player.setFlying(true);
{
_player.setFireTicks(0);
_player.setHealth(20.0);
_player.setAllowFlight(true);
_player.setFlying(true);
Location newLoc = UtilAlg.getTrajectory(_player.getLocation(), _manager.getLocation()).normalize().toLocation(_player.getWorld());
newLoc.add(Math.cos((Math.PI / 14) * _player.getTicksLived()) * 4.0, .1, Math.sin((Math.PI / 14) * _player.getTicksLived()) * 4.0);
_player.teleport(_manager.getLocation());
if (!_rotateIterator.hasNext())
_rotateIterator = _rotateLocs.iterator();
_player.teleport(_rotateIterator.next());
}
private EntityInsentient spawn(EntityType type)
@ -139,6 +220,11 @@ public class EvolveData
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(entity);
entity.setCustomNameVisible(false);
if (entity instanceof EntitySlime)
{
((EntitySlime) entity).setSize(4);
}
UtilPlayer.sendPacket(_player, packet);
return entity;
}

View File

@ -5,15 +5,15 @@ import java.util.Map.Entry;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.game.games.evolution.EvoKit;
import nautilus.game.arcade.game.games.evolution.Evolution;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class EvolveManager
{
private final Evolution _host;
public final Evolution Host;
private final Location _evolveLoc;
@ -21,7 +21,7 @@ public class EvolveManager
public EvolveManager(Evolution evolution, Location evolveLoc)
{
_host = evolution;
Host = evolution;
_evolveLoc = evolveLoc;
}
@ -31,13 +31,13 @@ public class EvolveManager
}
public boolean isEvolving(Player player)
{
{
return _data.containsKey(player.getName());
}
public void addEvolve(Player player, EntityType from, EntityType to)
public void addEvolve(Player player, EvoKit from, EvoKit to)
{
if (!_data.containsKey(player.getName()))
if (_data.containsKey(player.getName()))
return;
_data.put(player.getName(), new EvolveData(this, player, from, to));
@ -58,7 +58,7 @@ public class EvolveManager
continue;
}
if (!_host.IsAlive(player))
if (!Host.IsAlive(player))
{
iterator.remove();
continue;

View File

@ -1,40 +0,0 @@
package nautilus.game.arcade.game.games.evolution.kits;
import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkSpeed;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class KitAgility extends Kit
{
public KitAgility(ArcadeManager manager)
{
super(manager, "Agility", KitAvailability.Free,
new String[]
{
"Before you dedicated your life to Evolution,",
"you were an extremely agile circus star!"
},
new Perk[]
{
new PerkDoubleJump("Double Jump", 0.8, 0.8, false),
new PerkSpeed(0),
},
EntityType.ZOMBIE, new ItemBuilder(Material.FEATHER).build());
}
@Override
public void GiveItems(Player player)
{
player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build());
}
}

View File

@ -1,39 +0,0 @@
package nautilus.game.arcade.game.games.evolution.kits;
import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkRegeneration;
import nautilus.game.arcade.kit.perks.PerkVampire;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class KitHealth extends Kit
{
public KitHealth(ArcadeManager manager)
{
super(manager, "Vitality", KitAvailability.Free,
new String[]
{
"You're better at surviving than a cockroach!"
},
new Perk[]
{
new PerkVampire(6),
new PerkRegeneration(0)
},
EntityType.ZOMBIE, new ItemBuilder(Material.POTION, 1, (short) 8197).build());
}
@Override
public void GiveItems(Player player)
{
player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build());
}
}

View File

@ -0,0 +1,30 @@
package nautilus.game.arcade.game.games.evolution.kits;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class KitPlayer extends Kit
{
public KitPlayer(ArcadeManager manager)
{
super(manager, "Player", KitAvailability.Free, 0, new String[]
{
"They grow up so fast :')"
}, new Perk[]
{
}, EntityType.SKELETON, null);
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -1,41 +0,0 @@
package nautilus.game.arcade.game.games.evolution.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkRecharge;
public class KitRecharge extends Kit
{
public KitRecharge(ArcadeManager manager)
{
super(manager, "Stamina", KitAvailability.Free,
new String[]
{
"You focus your mind before every game ",
"allowing you to perform skills more often!"
},
new Perk[]
{
new PerkRecharge(0.5),
},
EntityType.ZOMBIE,
null);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build());
}
}

View File

@ -6,8 +6,8 @@ import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.evolution.EvoKit;
import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkFlamingSwordEVO;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkFlamingSword;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -26,7 +26,7 @@ public class KitBlaze extends EvoKit
},
new Perk[]
{
new PerkFlamingSword()
new PerkFlamingSwordEVO()
}, EntityType.BLAZE);
}

View File

@ -1,20 +1,27 @@
package nautilus.game.arcade.game.games.evolution.mobs;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
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.PerkConstructor;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Egg;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
public class KitChicken extends EvoKit
{
@ -44,6 +51,40 @@ public class KitChicken extends EvoKit
player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build());
}
@EventHandler
public void onInteract(final PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R))
return;
if (!Manager.GetGame().IsLive())
return;
if (!HasKit(event.getPlayer()))
return;
if (!UtilGear.isMat(event.getItem(), Material.EGG))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer());
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
{
event.setCancelled(true);
Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
@Override
public void run()
{
UtilInv.Update(event.getPlayer());
}
}, 10);
return;
}
}
@EventHandler
public void EggHit(CustomDamageEvent event)

View File

@ -1,19 +1,24 @@
package nautilus.game.arcade.game.games.evolution.mobs;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseSkeleton;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
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 org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityShootBowEvent;
public class KitSkeleton extends EvoKit
{
@ -49,4 +54,37 @@ public class KitSkeleton extends EvoKit
player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build());
}
@EventHandler
public void onBowShoot(final EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
return;
if (!Manager.GetGame().IsLive())
return;
final Player player = (Player) event.getEntity();
if (!HasKit(player))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
{
event.setCancelled(true);
Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
@Override
public void run()
{
UtilInv.Update(player);
}
}, 10);
return;
}
}
}

View File

@ -1,21 +1,28 @@
package nautilus.game.arcade.game.games.evolution.mobs;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseSnowman;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
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.PerkArcticAura;
import nautilus.game.arcade.kit.perks.PerkConstructor;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
public class KitSnowman extends EvoKit
{
@ -50,6 +57,40 @@ public class KitSnowman extends EvoKit
player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build());
}
@EventHandler
public void onInteract(final PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R))
return;
if (!Manager.GetGame().IsLive())
return;
if (!HasKit(event.getPlayer()))
return;
if (!UtilGear.isMat(event.getItem(), Material.SNOW_BALL))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer());
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
{
event.setCancelled(true);
Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
@Override
public void run()
{
UtilInv.Update(event.getPlayer());
}
}, 10);
return;
}
}
@EventHandler
public void SnowballHit(CustomDamageEvent event)
{
@ -73,6 +114,6 @@ public class KitSnowman extends EvoKit
if (!(event.GetProjectile() instanceof Snowball))
return;
event.AddMod("Snowman Kit", "Egg", 3, true);
event.AddMod("Snowman Kit", "Snowball", 3, true);
}
}

View File

@ -18,11 +18,13 @@ 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.games.evolution.events.EvolutionAbilityUseEvent;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.data.BlockTossData;
import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent;
import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -68,6 +70,12 @@ public class PerkBlockTossEVO extends Perk implements IThrown
if (!Kit.HasKit(player))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
return;
if (!UtilInv.IsItem(event.getItem(), Material.IRON_SWORD, (byte) 0))
return;

View File

@ -14,8 +14,10 @@ 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.games.evolution.events.EvolutionAbilityUseEvent;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -55,6 +57,12 @@ public class PerkBounceEVO extends Perk
if (!Kit.HasKit(player))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
return;
if (!Recharge.Instance.use(player, GetName(), 6000, true, true))
return;

View File

@ -0,0 +1,141 @@
package nautilus.game.arcade.game.games.evolution.mobs.perks;
import java.util.HashMap;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemStackFactory;
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.games.evolution.events.EvolutionAbilityUseEvent;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
public class PerkFlamingSwordEVO extends Perk
{
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
public PerkFlamingSwordEVO()
{
super("Flaming Sword", new String[]
{
"Attacks ignite opponents for 4 seconds.",
C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Inferno"
});
}
@EventHandler(priority = EventPriority.HIGH)
public void IgniteTarget(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
Player damager = event.GetDamagerPlayer(false);
if (damager == null) return;
if (!Kit.HasKit(damager))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(damager);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
return;
Manager.GetCondition().Factory().Ignite("Flaming Sword", event.GetDamageeEntity(), damager, 4, false, false);
}
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
return;
if (!Recharge.Instance.use(player, "Inferno", 4000, true, true))
return;
_active.put(player, System.currentTimeMillis());
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill("Inferno") + "."));
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : UtilServer.getPlayers())
{
if (!_active.containsKey(cur))
continue;
if (!cur.isBlocking())
{
_active.remove(cur);
continue;
}
if (UtilTime.elapsed(_active.get(cur), 1500))
{
_active.remove(cur);
continue;
}
//Fire
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 1, "Inferno");
fire.teleport(cur.getEyeLocation());
double x = 0.07 - (UtilMath.r(14)/100d);
double y = 0.07 - (UtilMath.r(14)/100d);
double z = 0.07 - (UtilMath.r(14)/100d);
fire.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(1.6));
//Effect
cur.getWorld().playSound(cur.getLocation(), Sound.GHAST_FIREBALL, 0.1f, 1f);
}
}
}

View File

@ -14,8 +14,10 @@ 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.games.evolution.events.EvolutionAbilityUseEvent;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -55,6 +57,12 @@ public class PerkPounceEVO extends Perk
if (!Kit.HasKit(player))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
return;
if (!Recharge.Instance.use(player, GetName(), 6000, true, true))
return;

View File

@ -15,8 +15,10 @@ 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.games.evolution.events.EvolutionAbilityUseEvent;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -77,6 +79,12 @@ public class PerkSiesmicSlamEVO extends Perk
if (!Kit.HasKit(player))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
return;
if (!Recharge.Instance.use(player, GetName(), 7000, true, false))
return;

View File

@ -17,8 +17,10 @@ import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
@ -56,6 +58,12 @@ public class PerkSulphurBombEVO extends Perk implements IThrown
if (!Kit.HasKit(player))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
return;
if (!Recharge.Instance.use(player, GetName(), 3000, true, false))
return;

View File

@ -9,8 +9,10 @@ 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.evolution.events.EvolutionAbilityUseEvent;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -76,6 +78,12 @@ public class PerkWebEVO extends Perk implements IThrown
if (!Kit.HasKit(player))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
return;
event.setCancelled(true);
UtilInv.remove(player, Material.WEB, (byte)0, 1);