Super Smash Mobs Update (#243)

Update/ssm
This commit is contained in:
Shaun Bennett 2016-10-26 22:03:43 -04:00 committed by GitHub
commit f06325d972
164 changed files with 11796 additions and 8336 deletions

View File

@ -180,6 +180,17 @@ public class UtilEnt
return list;
}
/**
* @return Returns true if the entities boundinbox collides or is inside the given bounding box
*/
public static boolean isInsideBoundingBox(Entity ent, Vector a, Vector b)
{
AxisAlignedBB box = ((CraftEntity)ent).getHandle().getBoundingBox();
AxisAlignedBB box2 = new AxisAlignedBB(a.getX(), a.getY(), a.getZ(), b.getX(), b.getY(), b.getZ());
return box.b(box2);
}
public static void Vegetate(Entity entity)
{
Vegetate(entity, false);

View File

@ -75,12 +75,7 @@ public class LineParticle
if (!(UtilBlock.airFoliage(newTarget.getBlock()) || UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP))))
{
if (_ignoredTypes == null)
{
done = true;
}
if (!_ignoredTypes.contains(newTarget.getBlock().getType()))
if (_ignoredTypes == null || !_ignoredTypes.contains(newTarget.getBlock().getType()))
{
done = true;
}

View File

@ -1,5 +1,11 @@
package nautilus.game.arcade.game.games.barbarians.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
@ -7,11 +13,6 @@ import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import nautilus.game.arcade.kit.perks.PerkRopedArrow;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitArcher extends ProgressingKit
{

View File

@ -6,13 +6,10 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory;
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.PerkFletcher;
import nautilus.game.arcade.kit.perks.PerkRopedArrow;
public class KitPlayer extends Kit
{

View File

@ -1,19 +1,19 @@
package nautilus.game.arcade.game.games.bridge.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBarrage;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkBarrage;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitArcher extends ProgressingKit
{

View File

@ -1,14 +1,5 @@
package nautilus.game.arcade.game.games.castlesiege.kits;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkBarrage;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
@ -16,6 +7,16 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBarrage;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkFletcher;
public class KitHumanMarksman extends KitHuman
{

View File

@ -1,19 +1,20 @@
package nautilus.game.arcade.game.games.dragons.kits;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkBarrage;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBarrage;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkFletcher;
public class KitMarksman extends ProgressingKit
{
@ -46,7 +47,7 @@ public class KitMarksman extends ProgressingKit
{
super(manager, "Marksman", "dragonsmarksman", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
}
@Override
public void GiveItems(Player player)
{

View File

@ -43,7 +43,6 @@ public class PerkBlockTossEVO extends Perk implements IThrown
*/
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>();
private HashMap<FallingBlock, Player> _falling = new HashMap<FallingBlock, Player>();
@ -107,10 +106,8 @@ public class PerkBlockTossEVO extends Perk implements IThrown
//Manager.GetBlockRestore().Add(event.getClickedBlock(), 0, (byte)0, 10000);
event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, event.getClickedBlock().getType());
_hold.put(player, new BlockTossData(id, data));
_hold.put(player, new BlockTossData(id, data, System.currentTimeMillis()));
_charge.put(player, System.currentTimeMillis());
//Effect
player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, id);
}
@ -132,7 +129,7 @@ public class PerkBlockTossEVO extends Perk implements IThrown
//Charged Tick
if (!_charged.contains(cur))
if (System.currentTimeMillis() - _charge.get(cur) > 1200)
if (System.currentTimeMillis() - _hold.get(cur).Time > 1200)
{
_charged.add(cur);
cur.playEffect(cur.getLocation(), Effect.CLICK1, 0);
@ -149,7 +146,7 @@ public class PerkBlockTossEVO extends Perk implements IThrown
_charged.remove(cur);
long charge = System.currentTimeMillis() - _charge.remove(cur);
long charge = System.currentTimeMillis() - data.Time;
//Throw
double mult = 1.4;

View File

@ -1,5 +1,12 @@
package nautilus.game.arcade.game.games.halloween.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
@ -8,18 +15,12 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBarrage;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkBarrage;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import nautilus.game.arcade.kit.perks.PerkQuickshotRobinHood;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
public class KitRobinHood extends ProgressingKit
{

View File

@ -20,7 +20,6 @@ import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkBlinkMonsterLeague extends Perk
{

View File

@ -1,19 +1,20 @@
package nautilus.game.arcade.game.games.sheep.kits;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkBarrage;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBarrage;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkFletcher;
public class KitArcher extends ProgressingKit
{
private static final String[] DESCRIPTION = {

View File

@ -82,7 +82,7 @@ public class SoloSuperSmash extends SuperSmash
_players = GetTeamList().get(0);
_players.SetColor(ChatColor.YELLOW);
_players.SetName("Players");
_players.setDisplayName(C.cYellow + C.Bold + "Players");
_players.setDisplayName(C.cYellowB + "Players");
}
@Override
@ -95,34 +95,29 @@ public class SoloSuperSmash extends SuperSmash
//Wipe Last
Scoreboard.reset();
if (GetPlayers(true).size() > 14)
boolean minimise = false;
if (GetPlayers(false).size() > 14)
{
minimise = true;
Scoreboard.writeNewLine();
Scoreboard.write(C.cGreen + "Players Alive");
Scoreboard.write(C.cGreenB + "Players Alive");
Scoreboard.write(GetPlayers(true).size() + " ");
Scoreboard.writeNewLine();
Scoreboard.write(C.cRed + "Players Dead");
Scoreboard.write(C.cRedB + "Players Dead");
Scoreboard.write((GetPlayers(false).size() - GetPlayers(true).size()) + " ");
}
else
{
Scoreboard.writeNewLine();
Scoreboard.writeGroup(GetPlayers(true), player ->
Scoreboard.writeGroup(GetPlayers(minimise), player ->
{
int lives = GetLives(player);
int lives = getLives(player);
String out;
if (lives >= 4) out = C.cGreen + player.getName();
else if (lives == 3) out = C.cYellow + player.getName();
else if (lives == 2) out = C.cGold + player.getName();
else if (lives == 1) out = C.cRed + player.getName();
else if (lives == 0) out = C.cRed + player.getName();
else
return null;
return Pair.create(out, lives);
return Pair.create(getLiveColour(lives) + player.getName(), lives);
}, true);
}

View File

@ -1,26 +1,19 @@
package nautilus.game.arcade.game.games.smash;
import mineplex.core.common.block.BlockData;
import mineplex.core.common.util.*;
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.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.smash.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.SmashKit;
import org.bukkit.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.BlockFace;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -30,192 +23,325 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.HashMap;
import java.util.HashSet;
import com.google.common.collect.Sets;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.hologram.Hologram;
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.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
import nautilus.game.arcade.game.games.smash.kits.KitChicken;
import nautilus.game.arcade.game.games.smash.kits.KitCow;
import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
import nautilus.game.arcade.game.games.smash.kits.KitGolem;
import nautilus.game.arcade.game.games.smash.kits.KitGuardian;
import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube;
import nautilus.game.arcade.game.games.smash.kits.KitPig;
import nautilus.game.arcade.game.games.smash.kits.KitSheep;
import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse;
import nautilus.game.arcade.game.games.smash.kits.KitSkeleton;
import nautilus.game.arcade.game.games.smash.kits.KitSkySquid;
import nautilus.game.arcade.game.games.smash.kits.KitSlime;
import nautilus.game.arcade.game.games.smash.kits.KitSnowman;
import nautilus.game.arcade.game.games.smash.kits.KitSpider;
import nautilus.game.arcade.game.games.smash.kits.KitWitch;
import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton;
import nautilus.game.arcade.game.games.smash.kits.KitWolf;
import nautilus.game.arcade.game.games.smash.kits.KitZombie;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.Perk;
public abstract class SuperSmash extends Game
{
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
private static final int MAX_LIVES = 4;
private static final int POWERUP_SPAWN_Y_INCREASE = 120;
private static final int HUNGER_DELAY = 250;
private static final String DATA_POINT_POWERUP = "RED";
private Map<Player, Integer> _lives = new HashMap<>();
private Location _powerupCurrent = null;
private Location _powerupTarget = null;
private EnderCrystal _powerup = null;
private Hologram _powerupHologram = null;
private boolean _powerupHologramColour;
private long _nextPowerup = 0;
private HashSet<BlockData> _restoreBlock = new HashSet<BlockData>();
public SuperSmash(ArcadeManager manager, GameType type, String[] description)
private static final Set<Material> REMOVE_ON_ITEM_SPAWN = Sets.newHashSet(Material.CACTUS, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.YELLOW_FLOWER, Material.RED_ROSE);
public SuperSmash(ArcadeManager manager, GameType type, String[] description)
{
this(manager,
new Kit[]
{
new Kit[] {
new KitSkeleton(manager),
new KitGolem(manager),
new KitSpider(manager),
new KitSlime(manager),
new KitSkeleton(manager), new KitGolem(manager), new KitSpider(manager), new KitSlime(manager), new KitCreeper(manager), new KitEnderman(manager), new KitSnowman(manager),
new KitWolf(manager), new KitBlaze(manager), new KitWitch(manager), new KitChicken(manager), new KitSkeletalHorse(manager), new KitPig(manager), new KitSkySquid(manager),
new KitWitherSkeleton(manager), new KitMagmaCube(manager), new KitZombie(manager), new KitCow(manager), new KitSheep(manager), new KitGuardian(manager)
new KitCreeper(manager),
new KitEnderman(manager),
new KitSnowman(manager),
new KitWolf(manager),
new KitBlaze(manager),
new KitWitch(manager),
new KitChicken(manager),
new KitSkeletalHorse(manager),
new KitPig(manager),
new KitSkySquid(manager),
new KitWitherSkeleton(manager),
new KitMagmaCube(manager),
new KitZombie(manager),
new KitCow(manager),
new KitSheep(manager)
}, type, description);
}, type, description);
}
public SuperSmash(ArcadeManager manager, Kit[] kits, GameType type, String[] description)
public SuperSmash(ArcadeManager manager, Kit[] kits, GameType type, String[] description)
{
super(manager, type, kits, description);
this.DeathOut = false;
this.CompassEnabled = true;
this.DeathSpectateSecs = 4;
this.WorldWaterDamage = 1000;
this.HideTeamSheep = true;
this.ReplaceTeamsWithKits = true;
// Add stat table here
// Example
// Manager.GetStatsManager().addTable("SuperSmashMobStats", "Kills", "Deaths", "Wins", "Losses");
DeathOut = false;
CompassEnabled = true;
DeathSpectateSecs = 4;
WorldWaterDamage = 1000;
HideTeamSheep = true;
ReplaceTeamsWithKits = true;
}
@EventHandler(priority = EventPriority.HIGH)
public void GameStateChange(GameStateChangeEvent event)
public void gameStart(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
{
return;
}
for (Player player : GetPlayers(true))
_lives.put(player, 4);
_nextPowerup = (long) (System.currentTimeMillis() + 240000 + 360000 * Math.random());
{
_lives.put(player, MAX_LIVES);
}
_nextPowerup = getNewSmashTime();
}
@EventHandler(priority = EventPriority.LOWEST)
public void playerDeath(PlayerDeathEvent event)
{
if (!loseLife(event.getEntity()))
{
SetPlayerState(event.getEntity(), PlayerState.OUT);
}
// I think this causes players to sometimes be invisible
// DisguiseManager disguiseManager = Manager.GetDisguise();
// DisguiseBase disguise =
// disguiseManager.getActiveDisguise(event.getEntity());
//
// if (disguise == null)
// {
// return;
// }
//
// disguiseManager.undisguise(disguise);
}
@EventHandler
public void PlayerOut(PlayerDeathEvent event)
public void playerQuit(PlayerQuitEvent event)
{
if (!LoseLife(event.getEntity()))
{
this.SetPlayerState(event.getEntity(), PlayerState.OUT);
}
_lives.remove(event.getPlayer());
}
public int GetLives(Player player)
public int getLives(Player player)
{
if (!_lives.containsKey(player))
{
return 0;
}
if (!IsAlive(player))
{
return 0;
}
return _lives.get(player);
}
public boolean LoseLife(Player player)
public boolean loseLife(Player player)
{
int lives = GetLives(player) - 1;
int lives = getLives(player) - 1;
if (lives > 0)
{
UtilPlayer.message(player, C.cRed + C.Bold + "You have died!");
UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " " + (lives == 1 ? "life" : "lives") + " left!");
String livesString = (lives == 1 ? "life" : "lives");
UtilPlayer.message(player, C.cRedB + "You have died!");
UtilPlayer.message(player, C.cRedB + "You have " + lives + " " + livesString + " left!");
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f);
_lives.put(player, lives);
new BukkitRunnable()
{
@Override
public void run()
{
UtilTextMiddle.display(null, getLiveColour(lives) + lives + " " + livesString + " left!", 10, 30, 10, player);
}
}.runTaskLater(Manager.getPlugin(), (long) DeathSpectateSecs * 20 + 2);
return true;
}
else
{
UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!");
player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f);
return false;
String gameOver = "You ran out of lives!";
UtilTextMiddle.display(C.cRedB + "GAME OVER", gameOver, 10, 50, 10, player);
UtilPlayer.message(player, C.cRedB + gameOver);
player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f);
return false;
}
@EventHandler
public void triggerSuper(PlayerInteractEvent event)
{
if (!IsLive())
{
return;
}
if (event.getMaterial() != Material.NETHER_STAR)
{
return;
}
Player player = event.getPlayer();
for (Perk perk : GetKit(player).GetPerks())
{
if (perk instanceof SmashUltimate)
{
SmashUltimate ultimate = (SmashUltimate) perk;
String name = ultimate.GetName();
if (ultimate.isUsingUltimate(player) || !ultimate.isUsable(player))
{
continue;
}
UtilInv.remove(player, Material.NETHER_STAR, (byte) 0, 1);
player.setHealth(player.getMaxHealth());
player.playSound(player.getLocation(), ultimate.getSound(), 10, 1);
Announce(C.Bold + event.getPlayer().getName() + " activated " + C.cGreenB + name + ChatColor.RESET + C.Bold + "!");
UtilTextMiddle.display("Smash Crystal", event.getPlayer().getName() + " used " + C.cGreen + name, 5, 50, 5, UtilServer.getPlayers());
ultimate.activate(player);
}
}
}
@SuppressWarnings("deprecation")
@EventHandler
public void powerupSpawn(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
{
return;
}
if (!IsLive())
{
return;
}
if (_powerupHologram != null)
{
_powerupHologram.setText((_powerupHologramColour ? C.cGreenB : C.cWhiteB) + "SMASH CRYSTAL");
_powerupHologramColour = !_powerupHologramColour;
}
if (_powerup == null)
{
if (System.currentTimeMillis() < _nextPowerup)
{
return;
}
if (WorldData.GetDataLocs("RED").isEmpty())
if (WorldData.GetDataLocs(DATA_POINT_POWERUP).isEmpty())
{
return;
}
if (_powerupTarget == null)
{
Location newTarget = UtilAlg.Random(WorldData.GetDataLocs("RED"));
_powerupTarget = newTarget;
_powerupCurrent = _powerupTarget.clone().add(0, 120, 0);
//Blocks
for (int x=-1 ; x<=1 ; x++)
for (int z=-1 ; z<=1 ; z++)
BlockRestore blockRestore = Manager.GetBlockRestore();
Location newTarget = UtilAlg.Random(WorldData.GetDataLocs(DATA_POINT_POWERUP));
Block targetBlock = newTarget.getBlock();
// This relies on this method being called 4 times a second (5
// ticks, UpdateType.FASTER).
long restoreTime = (POWERUP_SPAWN_Y_INCREASE / 4 / 2) * 1000 + 500;
_powerupTarget = newTarget.clone();
_powerupCurrent = newTarget.clone().add(0, POWERUP_SPAWN_Y_INCREASE, 0);
// Blocks
for (int x = -1; x <= 1; x++)
{
for (int z = -1; z <= 1; z++)
{
_restoreBlock.add(new BlockData(_powerupTarget.getBlock().getRelative(x, -2, z)));
_restoreBlock.add(new BlockData(_powerupTarget.getBlock().getRelative(x, -1, z)));
_powerupTarget.getBlock().getRelative(x, -2, z).setType(Material.IRON_BLOCK);
_powerupTarget.getBlock().getRelative(x, -1, z).setType(Material.QUARTZ_BLOCK);
blockRestore.add(targetBlock.getRelative(x, -3, z), Material.IRON_BLOCK.getId(), (byte) 0, restoreTime);
if (x == 0 && z == 0)
{
continue;
}
blockRestore.add(targetBlock.getRelative(x, -1, z), Material.QUARTZ_BLOCK.getId(), (byte) 0, restoreTime);
}
_powerupTarget.getBlock().getRelative(BlockFace.DOWN).setType(Material.BEACON);
}
blockRestore.add(targetBlock.getRelative(0, -2, 0), Material.BEACON.getId(), (byte) 0, restoreTime);
blockRestore.add(targetBlock.getRelative(0, -1, 0), Material.STAINED_GLASS.getId(), (byte) 5, restoreTime);
}
if (_powerupTarget.getY() < _powerupCurrent.getY())
{
_powerupCurrent.add(0, -2, 0);
UtilFirework.playFirework(_powerupCurrent, Type.BURST, Color.RED, false, true);
_powerupCurrent.subtract(0, 2, 0);
UtilFirework.playFirework(_powerupCurrent, Type.BURST, Color.LIME, false, true);
}
else
{
CreatureAllowOverride = true;
_powerup = _powerupTarget.getWorld().spawn(_powerupTarget, EnderCrystal.class);
_powerupHologram = new Hologram(Manager.getHologramManager(), _powerupTarget.add(0, 2, 0), true, "SMASH CRYSTAL").start();
CreatureAllowOverride = false;
_powerupTarget.getBlock().getRelative(BlockFace.DOWN).setType(Material.GLASS);
UtilFirework.playFirework(_powerupTarget, Type.BURST, Color.YELLOW, false, true);
_powerupTarget = null;
_powerupCurrent = null;
//Restore Blocks
for (BlockData block : _restoreBlock)
block.restore(true);
_restoreBlock.clear();
}
}
}
@ -223,24 +349,37 @@ public abstract class SuperSmash extends Game
@EventHandler
public void powerupPickup(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
if (event.getType() != UpdateType.FASTEST)
{
return;
}
if (!IsLive())
{
return;
}
if (_powerup == null)
{
return;
}
Player best = null;
double bestDist = 0;
for (Player player : GetPlayers(true))
{
if (UtilPlayer.isSpectator(player))
{
continue;
}
double dist = UtilMath.offset(player, _powerup);
if (dist > 2)
{
continue;
}
if (best == null || dist < bestDist)
{
@ -251,68 +390,98 @@ public abstract class SuperSmash extends Game
if (best != null)
{
_powerupHologram.stop();
_powerupHologram = null;
_powerup.remove();
_powerup = null;
best.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, ((SmashKit)GetKit(best)).getSuperCharges(),
C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + ((SmashKit)GetKit(best)).getSuperName()));
_nextPowerup = (long) (System.currentTimeMillis() + 240000 + 360000 * Math.random());
Manager.GetGame().Announce(C.Bold + best.getName() + " collected " + C.cGreen + C.Bold + "Smash Crystal" + ChatColor.RESET + C.Bold + "!");
giveSmashItem(best);
_nextPowerup = getNewSmashTime();
}
}
private void giveSmashItem(Player player)
{
int amount = 1;
if(GetKit(player) instanceof KitSnowman)
{
amount = 3;
}
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, amount, C.cYellowB + "Click" + C.cWhiteB + " - " + C.cGreenB + "Smash"));
Manager.GetGame().Announce(C.Bold + player.getName() + " collected " + C.cGreen + C.Bold + "Smash Crystal" + ChatColor.RESET + C.Bold + "!");
}
@EventHandler(priority = EventPriority.LOWEST)
public void powerupDamage(EntityDamageEvent event)
{
if (_powerup != null && _powerup.equals(event.getEntity()))
{
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void FallDamage(CustomDamageEvent event)
public void fallDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
{
return;
}
if (event.GetCause() == DamageCause.FALL)
{
event.SetCancelled("No Fall Damage");
}
}
@EventHandler(priority = EventPriority.HIGH)
public void Knockback(CustomDamageEvent event)
public void knockback(CustomDamageEvent event)
{
if (event.IsCancelled())
{
return;
}
if (event.GetDamageePlayer() != null)
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
{
Player player = event.GetDamageePlayer();
event.AddKnockback("Smash Knockback", 1 + 0.1 * (player.getMaxHealth() - player.getHealth()));
}
}
@EventHandler(priority = EventPriority.HIGH)
public void ArenaWalls(CustomDamageEvent event)
public void arenaBoundry(CustomDamageEvent event)
{
if (event.IsCancelled())
{
return;
}
if (event.GetCause() == DamageCause.VOID || event.GetCause() == DamageCause.LAVA)
{
event.GetDamageeEntity().eject();
event.GetDamageeEntity().leaveVehicle();
LivingEntity entity = event.GetDamageeEntity();
entity.eject();
entity.leaveVehicle();
if (event.GetDamageePlayer() != null)
event.GetDamageeEntity().getWorld().strikeLightningEffect(event.GetDamageeEntity().getLocation());
{
entity.getWorld().strikeLightningEffect(entity.getLocation());
}
event.AddMod("Smash", "Super Smash Mobs", 5000, false);
}
}
}
@EventHandler
public void HealthChange(EntityRegainHealthEvent event)
public void healthRegen(EntityRegainHealthEvent event)
{
if (event.getRegainReason() == RegainReason.SATIATED)
{
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.MONITOR)
@ -322,7 +491,7 @@ public abstract class SuperSmash extends Game
}
@Override
public void SetKit(Player player, Kit kit, boolean announce)
public void SetKit(Player player, Kit kit, boolean announce)
{
GameTeam team = GetTeam(player);
if (team != null)
@ -348,36 +517,53 @@ public abstract class SuperSmash extends Game
}
@EventHandler(priority = EventPriority.LOWEST)
public void AbilityDescription(PlayerInteractEvent event)
public void abilityDescription(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
Player player = event.getPlayer();
ItemStack itemStack = player.getItemInHand();
if (player.getItemInHand() == null)
if (itemStack == null)
{
return;
}
if (player.getItemInHand().getItemMeta() == null)
if (itemStack.getItemMeta() == null)
{
return;
}
if (player.getItemInHand().getItemMeta().getDisplayName() == null)
ItemMeta itemMeta = itemStack.getItemMeta();
if (itemMeta.getDisplayName() == null)
{
return;
}
if (player.getItemInHand().getItemMeta().getLore() == null)
if (itemMeta.getLore() == null)
{
return;
}
if (Manager.GetGame() == null || Manager.GetGame().GetState() != GameState.Recruit)
if (GetState() != GameState.Recruit)
{
return;
}
for (int i=player.getItemInHand().getItemMeta().getLore().size() ; i<=7 ; i++)
UtilPlayer.message(player, " ");
for (int i = player.getItemInHand().getItemMeta().getLore().size(); i <= 7; i++)
{
UtilPlayer.message(player, "");
}
UtilPlayer.message(player, ArcadeFormat.Line);
UtilPlayer.message(player, "§aAbility - §f§l" + player.getItemInHand().getItemMeta().getDisplayName());
//Perk Descs
// Perk Descs
for (String line : player.getItemInHand().getItemMeta().getLore())
{
UtilPlayer.message(player, line);
@ -397,67 +583,191 @@ public abstract class SuperSmash extends Game
}
@EventHandler
public void BlockFade(BlockFadeEvent event)
public void blockFade(BlockFadeEvent event)
{
event.setCancelled(true);
}
private int hungerTick = 0;
@EventHandler
public void Hunger(UpdateEvent event)
public void hunger(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
}
if (!IsLive())
{
return;
}
hungerTick = (hungerTick + 1)%10;
hungerTick = (hungerTick + 1) % 10;
for (Player player : GetPlayers(true))
{
player.setSaturation(3f);
player.setSaturation(3f);
player.setExhaustion(0f);
if (player.getFoodLevel() <= 0)
{
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.STARVATION, 1, false, true, false,
"Starvation", GetName());
Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.STARVATION, 1, false, true, false, "Starvation", GetName());
UtilPlayer.message(player, F.main("Game", "Attack other players to restore hunger!"));
}
if (hungerTick == 0)
{
UtilPlayer.hunger(player, -1);
}
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void HungerRestore(CustomDamageEvent event)
public void hungerRestore(CustomDamageEvent event)
{
if (event.IsCancelled())
{
return;
}
Player damager = event.GetDamagerPlayer(true);
if (damager == null)
{
return;
}
if (damager.equals(event.GetDamageeEntity()))
{
return;
}
if (!(event.GetDamageeEntity() instanceof Player))
return;
if (!Recharge.Instance.use(damager, "Hunger Restore", 250, false, false))
{
return;
}
int amount = Math.max(1, (int)(event.GetDamage()/2));
if (!Recharge.Instance.use(damager, "Hunger Restore", HUNGER_DELAY, false, false))
{
return;
}
int amount = Math.max(1, (int) (event.GetDamage() / 2));
UtilPlayer.hunger(damager, amount);
}
public HashMap<Player, Integer> getLiveMap()
@EventHandler
public void itemSpawn(ItemSpawnEvent event)
{
if (REMOVE_ON_ITEM_SPAWN.contains(event.getEntity().getItemStack().getType()))
{
event.setCancelled(true);
}
}
public long getNewSmashTime()
{
return (long) (System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(3) + TimeUnit.MINUTES.toMillis(5) * Math.random());
}
public String getLiveColour(int lives)
{
switch (lives)
{
case 3:
return C.cYellow;
case 2:
return C.cGold;
case 1:
return C.cRed;
case 0:
return C.cGray + C.Strike;
default:
return C.cGreen;
}
}
public Map<Player, Integer> getLiveMap()
{
return _lives;
}
@EventHandler
public void debugCommands(PlayerCommandPreprocessEvent event)
{
if (!UtilServer.isTestServer())
{
return;
}
String message = event.getMessage();
Player player = event.getPlayer();
if (message.startsWith("/cooldown"))
{
event.setCancelled(true);
for (Player other : UtilServer.getPlayers())
{
Recharge.Instance.Reset(other);
}
Announce(C.cWhiteB + player.getName() + C.cAquaB + " reset cooldowns!");
}
else if (message.startsWith("/nextsmash"))
{
event.setCancelled(true);
_nextPowerup = System.currentTimeMillis() + 1000;
Announce(C.cWhiteB + player.getName() + C.cAquaB + " spawned a smash crystal!");
}
else if (message.startsWith("/smash"))
{
event.setCancelled(true);
giveSmashItem(player);
}
else if (message.startsWith("/kit"))
{
event.setCancelled(true);
String[] args = message.split(" ");
String kit = "";
for (int i = 1; i < args.length; i++)
{
kit += args[i] + " ";
}
kit = kit.trim();
for (Kit kits : GetKits())
{
if (kit.equalsIgnoreCase(kits.GetName()))
{
SetKit(player, kits, true);
return;
}
}
player.sendMessage(F.main("Kit", "Sorry that is not a kit!"));
}
else if (message.startsWith("/lives"))
{
event.setCancelled(true);
Announce(C.cWhiteB + player.getName() + C.cAquaB + " reset their lives!");
if (!IsAlive(player))
{
SetPlayerState(player, PlayerState.IN);
RespawnPlayer(player);
player.sendMessage(F.main("Revive", "You are back in the game!"));
}
_lives.put(player, MAX_LIVES);
}
}
}

View File

@ -3,11 +3,21 @@ package nautilus.game.arcade.game.games.smash;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.scheduler.BukkitRunnable;
import mineplex.core.common.Pair;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.modules.TeamModule;
import nautilus.game.arcade.managers.chat.ChatStatData;
@ -17,55 +27,31 @@ import nautilus.game.arcade.stats.OneVThreeStatTracker;
import nautilus.game.arcade.stats.RecoveryMasterStatTracker;
import nautilus.game.arcade.stats.WinWithoutDyingStatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class TeamSuperSmash extends SuperSmash
{
public TeamSuperSmash(ArcadeManager manager)
public TeamSuperSmash(ArcadeManager manager)
{
super(manager, GameType.SmashTeams,
new String[]
{
"Each player has 3 respawns",
"Attack to restore hunger!",
"Last team alive wins!"
});
super(manager, GameType.SmashTeams, new String[] { "Each player has 3 respawns", "Attack to restore hunger!", "Last team alive wins!" });
PlayersPerTeam = 2;
FillTeamsInOrderToCount = 2;
SpawnNearAllies = true;
DamageTeamSelf = false;
TeamArmorHotbar = true;
DontAllowOverfill = true;
TeamMode = true;
registerModule(new TeamModule());
registerStatTrackers(
new WinWithoutDyingStatTracker(this, "MLGPro"),
new FreeKitWinStatTracker(this),
new OneVThreeStatTracker(this),
new KillFastStatTracker(this, 3, 10, "TripleKill"),
new RecoveryMasterStatTracker(this)
);
registerStatTrackers(new WinWithoutDyingStatTracker(this, "MLGPro"), new FreeKitWinStatTracker(this), new OneVThreeStatTracker(this), new KillFastStatTracker(this, 3, 10, "TripleKill"),
new RecoveryMasterStatTracker(this));
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt,
BlankLine,
new ChatStatData("kit", "Kit", true)
);
registerChatStats(Kills, Deaths, KDRatio, BlankLine, Assists, DamageTaken, DamageDealt, BlankLine, new ChatStatData("kit", "Kit", true));
}
@Override
@ -75,53 +61,120 @@ public class TeamSuperSmash extends SuperSmash
if (event.getType() != UpdateType.FAST)
return;
ArrayList<GameTeam> alive = new ArrayList<GameTeam>();
for (GameTeam team : GetTeamList())
{
if (team.IsTeamAlive())
alive.add(team);
}
//Wipe Last
Scoreboard.reset();
Scoreboard.writeNewLine();
List<GameTeam> aliveTeams = new ArrayList<>();
if (GetPlayers(true).size() < 16)
for (GameTeam team : GetTeamList())
{
for (GameTeam team : GetTeamList())
if (team.GetPlayers(true).isEmpty())
{
for (Player player : team.GetPlayers(true))
{
int lives = GetLives(player);
Scoreboard.write(C.cWhite + lives + " " + team.GetColor() + player.getName());
}
continue;
}
aliveTeams.add(team);
}
else if (alive.size() < 16)
if (aliveTeams.size() > 7)
{
for (GameTeam team : alive)
{
int lives = 0;
for (Player player : team.GetPlayers(true))
{
lives += GetLives(player);
}
Scoreboard.write(C.cWhite + lives + " " + team.GetColor() + team.GetName());
}
Scoreboard.writeNewLine();
Scoreboard.write(C.cYellowB + "Teams Alive");
Scoreboard.write(aliveTeams.size() + " ");
}
else
{
Scoreboard.write(C.cYellow + C.Bold + "Teams Alive");
Scoreboard.write(C.cWhite + alive.size());
Scoreboard.writeNewLine();
for (GameTeam team : GetTeamList())
{
Scoreboard.writeGroup(team.GetPlayers(false), player ->
{
int lives = getLives(player);
return Pair.create(team.GetColor() + (IsAlive(player) ? "" : C.Strike) + player.getName(), lives);
}, true);
}
}
Scoreboard.draw();
}
@Override
@EventHandler
public void gameStart(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
{
return;
}
super.gameStart(event);
new BukkitRunnable()
{
@Override
public void run()
{
for (Player player : GetPlayers(true))
{
GameTeam team = GetTeam(player);
Player bestTeamMember = null;
if (team == null)
{
continue;
}
for (Player teamMember : team.GetPlayers(true))
{
if (player.equals(teamMember))
{
continue;
}
bestTeamMember = teamMember;
}
if (bestTeamMember == null)
{
UtilTextMiddle.display(C.cRedB + "No one", "You don\'t have a teammate :(", 10, 50, 10, player);
return;
}
UtilTextMiddle.display(null, team.GetColor() + bestTeamMember.getName() + " is your teammate", 10, 50, 10, player);
}
}
}.runTaskLater(Manager.getPlugin(), 40);
}
@EventHandler
public void onCustomDamage(CustomDamageEvent event)
{
if (!(event.GetDamagerEntity(true) instanceof Player || event.GetDamageeEntity() instanceof Player))
{
return;
}
Player damager = event.GetDamagerPlayer(true);
Player damagee = event.GetDamageePlayer();
if (GetTeam(damager) == null || GetTeam(damagee) == null)
{
return;
}
if (GetTeam(damager).equals(GetTeam(damagee)))
{
if (event.GetCause() == DamageCause.FIRE)
{
damagee.setFireTicks(0);
}
event.SetCancelled("Team Damage");
}
}
@Override
public void EndCheck()
{
@ -136,7 +189,7 @@ public class TeamSuperSmash extends SuperSmash
if (teamsAlive.size() <= 1)
{
//Announce
// Announce
if (teamsAlive.size() > 0)
AnnounceEnd(teamsAlive.get(0));
@ -153,7 +206,7 @@ public class TeamSuperSmash extends SuperSmash
AddGems(player, 10, "Participation", false, false);
}
//End
// End
SetState(GameState.End);
}
}
@ -183,10 +236,41 @@ public class TeamSuperSmash extends SuperSmash
return players;
}
@Override
public String GetMode()
{
return "Team Mode";
}
/**
* @param manager The arcade manager
* @param player The player to check
* @param includeSelf If true, then the list will contain the given player in addition to team mates. If false then it will
* not include the player. If the given player is a spectator then this will always return empty.
* @return Returns a list of players who the given player should not be able to damage as they are
* the player's team mates. If the given player is a spectator the list will return empty. If the game is Solo Super Smash Mobs
* or any other game than Team Super Smash Mob then the list will return only the player or empty depending on <code>includeSelf</code>
*/
public static List<Player> getTeam(ArcadeManager manager, Player player, boolean includeSelf)
{
List<Player> list = new ArrayList<>();
if(!manager.IsAlive(player))
{
return list;
}
else if(manager.GetGame() instanceof TeamSuperSmash)
{
list.addAll(manager.GetGame().GetTeam(player).GetPlayers(true));
if(!includeSelf) list.remove(player);
}
else
{
if(includeSelf)
{
list.add(player);
}
}
return list;
}
}

View File

@ -1,5 +1,12 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseBlaze;
@ -8,31 +15,27 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.blaze.PerkFirefly;
import nautilus.game.arcade.game.games.smash.perks.blaze.PerkInferno;
import nautilus.game.arcade.game.games.smash.perks.blaze.SmashBlaze;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor;
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.inventory.ItemStack;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkKnockbackFire;
import nautilus.game.arcade.kit.perks.PerkSpeed;
public class KitBlaze extends SmashKit
{
private static final String[] DESCRIPTION = {
DOUBLE_JUMP,
};
private static final Perk[] PERKS = {
new PerkSmashStats(6, 1.5, 0.15, 5),
new PerkSmashStats(6, 1.5, 0.25, 5),
new PerkDoubleJump("Double Jump", 1, 1, false),
new PerkKnockbackFire(1.50),
new PerkSpeed(0),
new PerkInferno(),
new PerkFirefly()
new PerkFirefly(),
new SmashBlaze()
};
private static final ItemStack IN_HAND = new ItemStack(Material.BLAZE_ROD);
@ -64,20 +67,22 @@ public class KitBlaze extends SmashKit
};
private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.CHAINMAIL_BOOTS),
new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE),
};
public KitBlaze(ArcadeManager manager)
{
super(manager, "Blaze", KitAvailability.Gem, 8000, DESCRIPTION, PERKS, EntityType.BLAZE, IN_HAND, "Phoenix", 18000, Sound.BLAZE_DEATH);
super(manager, "Blaze", KitAvailability.Gem, 8000, PERKS, EntityType.BLAZE, IN_HAND, DisguiseBlaze.class);
}
@Override
public void giveCoreItems(Player player)
{
public void GiveItems(Player player)
{
disguise(player);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -86,51 +91,30 @@ public class KitBlaze extends SmashKit
player.getInventory().addItem(PLAYER_ITEMS[2]);
}
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SWORD);
player.getInventory().remove(Material.IRON_AXE);
UtilInv.Update(player);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise
DisguiseBlaze disguise = new DisguiseBlaze(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@EventHandler
public void FireItemResist(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
if (Manager.GetGame() == null)
{
return;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
{
continue;
}
Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false);
}
}

View File

@ -1,35 +1,35 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.chicken.PerkChickenRocket;
import nautilus.game.arcade.game.games.smash.perks.chicken.PerkEggGun;
import nautilus.game.arcade.game.games.smash.perks.chicken.PerkFlap;
import nautilus.game.arcade.game.games.smash.perks.chicken.SmashChicken;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkChickenRocket;
import nautilus.game.arcade.kit.perks.PerkEggGun;
import nautilus.game.arcade.kit.perks.PerkFlap;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitChicken extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(4, 2.0, 0.15, 2),
new PerkSmashStats(4.5, 2.0, 0.2, 2),
new PerkFlap(0.8, 0.8, false),
new PerkEggGun(),
new PerkChickenRocket()
new PerkChickenRocket(),
new SmashChicken()
};
private static final ItemStack IN_HAND = new ItemStack(Material.EGG);
@ -71,19 +71,21 @@ public class KitChicken extends SmashKit
private static final ItemStack[] PLAYER_ARMOR = {
null,
null,
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.CHAINMAIL_CHESTPLATE),
null
};
public KitChicken(ArcadeManager manager)
{
super(manager, "Chicken", KitAvailability.Gem, 8000, DESCRIPTION, PERKS, EntityType.CHICKEN, IN_HAND, "Aerial Gunner", 20000, Sound.CHICKEN_HURT);
super(manager, "Chicken", KitAvailability.Gem, 8000, PERKS, EntityType.CHICKEN, IN_HAND, DisguiseChicken.class);
}
@Override
public void giveCoreItems(Player player)
public void GiveItems(Player player)
{
disguise(player);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -93,39 +95,6 @@ public class KitChicken extends SmashKit
player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]);
}
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SWORD);
player.getInventory().remove(Material.IRON_AXE);
UtilInv.Update(player);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise
DisguiseChicken disguise = new DisguiseChicken(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@Override
public void activateSuperCustom(Player player)
{
player.setExp(0.99f);
}
}

View File

@ -1,38 +1,37 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseCow;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkCowAngryHerd;
import nautilus.game.arcade.game.games.smash.perks.PerkCowMilkSpiral;
import nautilus.game.arcade.game.games.smash.perks.PerkCowMooshroomMadness;
import nautilus.game.arcade.game.games.smash.perks.PerkCowStampede;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowAngryHerd;
import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowMilkSpiral;
import nautilus.game.arcade.game.games.smash.perks.cow.SmashCow;
import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowStampede;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitCow extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(6, 0.9, 0.25, 7.5),
new PerkSmashStats(6, 1.1, 0.25, 6.5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkCowStampede(),
new PerkCowStampede(),
new PerkCowAngryHerd(),
new PerkCowMilkSpiral(),
new PerkCowMooshroomMadness()
new SmashCow()
};
private static final ItemStack IN_HAND = new ItemStack(Material.MILK_BUCKET);
@ -70,57 +69,34 @@ public class KitCow extends SmashKit
ChatColor.RESET + "and abilities, halves ability cooldowns,",
ChatColor.RESET + "and increases your health to 15 hearts.",
ChatColor.RESET + "",
ChatColor.RESET + "You remain a Mooshroom until you die.",
ChatColor.RESET + "You remain a Mooshroom for 30 seconds.",
})
};
private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET),
new ItemStack(Material.IRON_BOOTS),
new ItemStack(Material.IRON_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.IRON_HELMET),
};
public KitCow(ArcadeManager manager)
{
super(manager, "Cow", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, EntityType.COW, IN_HAND, "Mooshroom Madness", 0, null);
super(manager, "Cow", KitAvailability.Gem, 6000, PERKS, EntityType.COW, IN_HAND, DisguiseCow.class);
}
@Override
public void giveCoreItems(Player player)
public void GiveItems(Player player)
{
disguise(player);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]);
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise
DisguiseCow disguise = new DisguiseCow(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
}

View File

@ -1,33 +1,36 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseCreeper;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.creeper.PerkCreeperElectricity;
import nautilus.game.arcade.game.games.smash.perks.creeper.PerkCreeperExplode;
import nautilus.game.arcade.game.games.smash.perks.creeper.PerkCreeperSulphurBomb;
import nautilus.game.arcade.game.games.smash.perks.creeper.SmashCreeper;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitCreeper extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(6, 1.65, 0.4, 3.5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkCreeperElectricity(),
new PerkCreeperSulphurBomb(),
new PerkCreeperExplode(),
new SmashCreeper()
};
private static final ItemStack IN_HAND = new ItemStack(Material.TNT);
@ -72,21 +75,22 @@ public class KitCreeper extends SmashKit
};
private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET),
new ItemStack(Material.LEATHER_BOOTS),
new ItemStack(Material.LEATHER_LEGGINGS),
new ItemStack(Material.LEATHER_CHESTPLATE),
new ItemStack(Material.LEATHER_HELMET),
};
public KitCreeper(ArcadeManager manager)
{
super(manager, "Creeper", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.CREEPER, IN_HAND, "Atomic Blast", 0, Sound.CREEPER_DEATH);
super(manager, "Creeper", KitAvailability.Gem, 4000, PERKS, EntityType.CREEPER, IN_HAND, DisguiseCreeper.class);
}
@Override
public void giveCoreItems(Player player)
public void GiveItems(Player player)
{
disguise(player);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -95,27 +99,4 @@ public class KitCreeper extends SmashKit
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise
DisguiseCreeper disguise = new DisguiseCreeper(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
}

View File

@ -1,5 +1,17 @@
package nautilus.game.arcade.game.games.smash.kits;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseEnderman;
@ -8,30 +20,20 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkEndermanTeleport;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.enderman.PerkBlink;
import nautilus.game.arcade.game.games.smash.perks.enderman.PerkBlockToss;
import nautilus.game.arcade.game.games.smash.perks.enderman.PerkEndermanTeleport;
import nautilus.game.arcade.game.games.smash.perks.enderman.SmashEnderman;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent;
import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent;
import org.bukkit.ChatColor;
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.PlayerDeathEvent;
import org.bukkit.inventory.ItemStack;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
public class KitEnderman extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(7, 1.3, 0.25, 6),
@ -39,7 +41,7 @@ public class KitEnderman extends SmashKit
new PerkBlink("Blink", 16, 6000),
new PerkBlockToss(),
new PerkEndermanTeleport(),
new PerkEndermanDragon()
new SmashEnderman()
};
private static final ItemStack IN_HAND = new ItemStack(Material.ENDER_PEARL);
@ -73,10 +75,10 @@ public class KitEnderman extends SmashKit
};
private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET),
new ItemStack(Material.CHAINMAIL_BOOTS),
new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.CHAINMAIL_HELMET),
};
@ -84,49 +86,26 @@ public class KitEnderman extends SmashKit
public KitEnderman(ArcadeManager manager)
{
super(manager, "Enderman", KitAvailability.Gem, 3000, DESCRIPTION, PERKS, EntityType.ENDERMAN, IN_HAND, "Dragon Rider", 30000, Sound.ENDERDRAGON_GROWL);
}
@Override
public void giveCoreItems(Player player)
{
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[2]);
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SWORD);
player.getInventory().remove(Material.IRON_AXE);
UtilInv.Update(player);
super(manager, "Enderman", KitAvailability.Gem, 3000, PERKS, EntityType.ENDERMAN, IN_HAND, DisguiseEnderman.class);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
disguise(player);
_disguises.put(player, (DisguiseEnderman) Manager.GetDisguise().getActiveDisguise(player));
UtilInv.Clear(player);
//Disguise
DisguiseEnderman disguise = new DisguiseEnderman(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
disguise.a(false);
Manager.GetDisguise().disguise(disguise);
_disguises.put(player, disguise);
if (Manager.GetGame().GetState() == GameState.Recruit)
{
player.getInventory().addItem(PLAYER_ITEMS[2]);
}
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@EventHandler
@ -150,8 +129,10 @@ public class KitEnderman extends SmashKit
public void SetBlock(DisguiseEnderman disguise, int id, byte data)
{
if (disguise == null)
{
return;
}
disguise.SetCarriedId(id);
disguise.SetCarriedData(data);
@ -162,16 +143,19 @@ public class KitEnderman extends SmashKit
public void cleanDisguises(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
for (Iterator<Entry<Player, DisguiseEnderman>> iterator = _disguises.entrySet().iterator(); iterator.hasNext(); )
}
for (Iterator<Entry<Player, DisguiseEnderman>> iterator = _disguises.entrySet().iterator(); iterator.hasNext();)
{
Entry<Player, DisguiseEnderman> current = iterator.next();
if (!Manager.GetDisguise().isDisguised(current.getKey()))
{
iterator.remove();
} else if (Manager.GetDisguise().getDisguise(current.getKey()) != current.getValue())
}
else if (Manager.GetDisguise().getActiveDisguise(current.getKey()) != current.getValue())
{
iterator.remove();
}

View File

@ -1,26 +1,30 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseIronGolem;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.golem.PerkFissure;
import nautilus.game.arcade.game.games.smash.perks.golem.SmashGolem;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkIronHook;
import nautilus.game.arcade.kit.perks.PerkSeismicSlam;
import nautilus.game.arcade.kit.perks.PerkSlow;
public class KitGolem extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(7, 1.0, 0.2, 8),
@ -29,7 +33,7 @@ public class KitGolem extends SmashKit
new PerkFissure(),
new PerkIronHook(),
new PerkSeismicSlam(),
new PerkEarthquake()
new SmashGolem()
};
private static final ItemStack IN_HAND = new ItemStack(Material.IRON_BLOCK);
@ -66,20 +70,22 @@ public class KitGolem extends SmashKit
};
private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET),
new ItemStack(Material.DIAMOND_BOOTS),
new ItemStack(Material.IRON_LEGGINGS),
new ItemStack(Material.IRON_CHESTPLATE),
new ItemStack(Material.IRON_HELMET),
};
public KitGolem(ArcadeManager manager)
{
super(manager, "Iron Golem", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.IRON_GOLEM, IN_HAND, "Earthquake", 0, Sound.IRONGOLEM_DEATH);
super(manager, "Iron Golem", KitAvailability.Free, PERKS, EntityType.IRON_GOLEM, IN_HAND, DisguiseIronGolem.class);
}
@Override
public void giveCoreItems(Player player)
public void GiveItems(Player player)
{
disguise(player);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1], PLAYER_ITEMS[2]);
@ -89,27 +95,4 @@ public class KitGolem extends SmashKit
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise
DisguiseIronGolem disguise = new DisguiseIronGolem(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
}

View File

@ -0,0 +1,108 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseGuardian;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.guardian.PerkTargetLazer;
import nautilus.game.arcade.game.games.smash.perks.guardian.PerkThorns;
import nautilus.game.arcade.game.games.smash.perks.guardian.PerkWaterSplash;
import nautilus.game.arcade.game.games.smash.perks.guardian.PerkWhirlpoolBlade;
import nautilus.game.arcade.game.games.smash.perks.guardian.SmashGuardian;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitGuardian extends SmashKit
{
private static final Perk[] PERKS = {
new PerkSmashStats(4, 1.25, 0.25, 4.5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkWhirlpoolBlade(),
new PerkWaterSplash(),
new PerkTargetLazer(),
new PerkThorns(),
new SmashGuardian()
};
private static final ItemStack IN_HAND = new ItemStack(Material.PRISMARINE_SHARD);
private static final ItemStack[] PLAYER_ITEMS = {
ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1,
C.cYellowB + "Right-Click" + C.cWhiteB + " - " + C.cGreenB + "Whirlpool Axe",
new String[] {
C.Reset + "Fires a Prismarine Shard that deals damage to",
C.Reset + "the first player it collides with.",
C.Reset + "The player is then drawn towards you."
}),
ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1,
C.cYellowB + "Right-Click" + C.cWhiteB + " - " + C.cGreenB + "Water Splash",
new String[] {
C.Reset + "You bounce into the air and pull all nearby players",
C.Reset + "towards you.",
C.Reset + "Blocking with the sword while bouncing increases the height.",
C.Reset + "Landing causes a water splash dealing damage and knockback",
C.Reset + "to nearby players."
}),
ItemStackFactory.Instance.CreateStack(Material.IRON_PICKAXE, (byte) 0, 1,
C.cYellowB + "Right-Click" + C.cWhiteB + " - " + C.cGreenB + "Target Laser",
new String[] {
C.Reset + "You target the nearest player with your laser.",
C.Reset + "That player takes increased damage and knockback from you.",
C.Reset + "Your laser breaks if you get too far away or after some time."
}),
ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte) 0, 1,
C.cYellowB + "Passive" + C.cWhiteB + " - " + C.cGreenB + "Thorns",
new String[] {
C.Reset + "Takes 66% less damage and knockback from projectiles",
C.Reset + "when under 10 health.",
}),
ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1,
C.cYellowB + "Smash Crystal" + C.cWhiteB + " - " + C.cGreenB + "Rise of the Guardian",
new String[] {
C.Reset + "You call upon Gwen who begins to charge her laser.",
C.Reset + "Any player near the laser is drawn to it and cannot",
C.Reset + "escape from it.",
C.Reset + "Once the laser has charged all players nearby get hit",
C.Reset + "with HUGE damage and knockback!"
}),
};
private static final ItemStack[] PLAYER_ARMOR = {
new ItemStack(Material.DIAMOND_BOOTS),
new ItemStack(Material.DIAMOND_LEGGINGS),
null,
null,
};
public KitGuardian(ArcadeManager manager)
{
super(manager, "Guardian", KitAvailability.Gem, 8000, PERKS, EntityType.GUARDIAN, IN_HAND, DisguiseGuardian.class);
}
@Override
public void GiveItems(Player player)
{
disguise(player);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1], PLAYER_ITEMS[2]);
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[3], PLAYER_ITEMS[4]);
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
}

View File

@ -1,291 +0,0 @@
package nautilus.game.arcade.game.games.smash.kits;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Horse.Color;
import org.bukkit.entity.Horse.Style;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Horse.Variant;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguiseSkeleton;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkNotFinished;
import nautilus.game.arcade.kit.perks.PerkDoubleJumpHorse;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import nautilus.game.arcade.kit.perks.PerkHorseKick;
import nautilus.game.arcade.kit.perks.PerkKnockbackArrow;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
public class KitKnight extends SmashKit
{
private HashMap<Player, Horse> _mounts = new HashMap<Player, Horse>();
private HashSet<Horse> _horses = new HashSet<Horse>();
private HashSet<CustomDamageEvent> _calledEvents = new HashSet<CustomDamageEvent>();
public KitKnight(ArcadeManager manager)
{
super(manager, "Undead Knight", KitAvailability.Gem, 5000,
new String[]
{
},
new Perk[]
{
new PerkSmashStats(6, 1.2, 0.25, 7.5),
new PerkFletcher(1, 2, false),
new PerkKnockbackArrow(2),
new PerkDoubleJumpHorse(),
new PerkHorseKick(),
new PerkNotFinished()
},
EntityType.HORSE,
new ItemStack(Material.IRON_BARDING),
"", 0, null);
}
@Override
public void giveCoreItems(Player player)
{
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Horse Kick",
new String[]
{
}));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Coming Soon...",
new String[]
{
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
//Disguise
DisguiseSkeleton disguise = new DisguiseSkeleton(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
//Horse
Manager.GetGame().CreatureAllowOverride = true;
final Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
Manager.GetGame().CreatureAllowOverride = false;
//Owner
horse.setTamed(true);
horse.setOwner(player);
horse.setMaxDomestication(1);
//Visual
horse.setColor(Color.DARK_BROWN);
horse.setStyle(Style.WHITE_DOTS);
horse.setVariant(Variant.UNDEAD_HORSE);
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
horse.getInventory().setArmor(new ItemStack(Material.IRON_BARDING));
//Stats
horse.setAdult();
horse.setJumpStrength(1);
horse.setMaxHealth(100);
horse.setHealth(horse.getMaxHealth());
_horses.add(horse);
_mounts.put(player, horse);
/*
final Player fPlayer = player;
Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
public void run()
{
horse.setPassenger(fPlayer);
}
}, 1);
*/
}
@EventHandler
public void HorseUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Horse> horseIterator = _horses.iterator();
while (horseIterator.hasNext())
{
Horse horse = horseIterator.next();
if (horse.isValid() && _mounts.containsValue(horse))
continue;
horseIterator.remove();
horse.remove();
}
}
@EventHandler
public void HorseUpdate(PlayerInteractEntityEvent event)
{
if (!(event.getRightClicked() instanceof Horse))
return;
Player player = event.getPlayer();
Horse horse = (Horse)event.getRightClicked();
if (_mounts.containsKey(player) && _mounts.get(player).equals(horse))
return;
UtilPlayer.message(player, F.main("Game", "This is not your " + F.elem("Skeletal Horse") + "!"));
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
public void PlayerDamage(CustomDamageEvent event)
{
if (_calledEvents.contains(event))
return;
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
if (damagee.getVehicle() == null)
return;
if (!(damagee.getVehicle() instanceof Horse))
return;
if (event.GetCause() == DamageCause.SUFFOCATION)
{
event.SetCancelled("Horse Suffocation");
return;
}
Horse horse = (Horse)damagee.getVehicle();
//Damage Event
CustomDamageEvent newEvent = new CustomDamageEvent(horse, event.GetDamagerEntity(true), event.GetProjectile(), null,
event.GetCause(), event.GetDamageInitial(), true, false, false,
UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false);
// _calledEvents.add(newEvent);
// Manager.getPlugin().getServer().getPluginManager().callEvent(newEvent);
// _calledEvents.remove(newEvent);
}
@EventHandler(priority = EventPriority.LOWEST)
public void HorseDamage(CustomDamageEvent event)
{
if (_calledEvents.contains(event))
return;
if (event.GetCause() == DamageCause.THORNS)
return;
if (!(event.GetDamageeEntity() instanceof Horse))
return;
Horse horse = (Horse)event.GetDamageeEntity();
if (horse.getPassenger() == null)
return;
if (!(horse.getPassenger() instanceof Player))
return;
Player player = (Player)horse.getPassenger();
//Damage Event
final CustomDamageEvent newEvent = new CustomDamageEvent(player, event.GetDamagerEntity(true), event.GetProjectile(), null,
event.GetCause(), event.GetDamageInitial(), true, false, false,
UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false);
_calledEvents.add(newEvent);
Manager.getPlugin().getServer().getPluginManager().callEvent(newEvent);
_calledEvents.remove(newEvent);
//Add Knockback
event.AddKnockback("Knockback Multiplier", 1.2);
}
@Override
public Entity SpawnEntity(Location loc)
{
EntityType type = _entityType;
if (type == EntityType.PLAYER)
type = EntityType.ZOMBIE;
LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type);
entity.setRemoveWhenFarAway(false);
entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit");
entity.setCustomNameVisible(true);
entity.getEquipment().setItemInHand(_itemInHand);
if (type == EntityType.HORSE)
{
Horse horse = (Horse)entity;
horse.setAdult();
horse.setColor(Color.DARK_BROWN);
horse.setStyle(Style.WHITE_DOTS);
horse.setVariant(Variant.UNDEAD_HORSE);
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
horse.getInventory().setArmor(new ItemStack(Material.IRON_BARDING));
}
UtilEnt.Vegetate(entity);
SpawnCustom(entity);
return entity;
}
}

View File

@ -1,26 +1,33 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseMagmaCube;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.magmacube.PerkFlameDash;
import nautilus.game.arcade.game.games.smash.perks.magmacube.PerkMagmaBlast;
import nautilus.game.arcade.game.games.smash.perks.magmacube.PerkMagmaBoost;
import nautilus.game.arcade.game.games.smash.perks.magmacube.SmashMagmacube;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitMagmaCube extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(5, 1.75, 0.35, 5),
@ -28,7 +35,7 @@ public class KitMagmaCube extends SmashKit
new PerkMagmaBoost(),
new PerkMagmaBlast(),
new PerkFlameDash(),
new PerkMeteorShower()
new SmashMagmacube()
};
private static final ItemStack IN_HAND = new ItemStack(Material.MAGMA_CREAM);
@ -67,20 +74,26 @@ public class KitMagmaCube extends SmashKit
};
private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS),
new ItemStack(Material.CHAINMAIL_BOOTS),
null,
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET),
new ItemStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.CHAINMAIL_HELMET),
};
public KitMagmaCube(ArcadeManager manager)
{
super(manager, "Magma Cube", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.MAGMA_CUBE, IN_HAND, "Meteor Shower", 0, Sound.AMBIENCE_THUNDER);
super(manager, "Magma Cube", KitAvailability.Gem, 5000, PERKS, EntityType.MAGMA_CUBE, IN_HAND, DisguiseMagmaCube.class);
}
@Override
public void giveCoreItems(Player player)
public void GiveItems(Player player)
{
disguise(player);
DisguiseMagmaCube disguise = (DisguiseMagmaCube) Manager.GetDisguise().getActiveDisguise(player);
disguise.SetSize(1);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -88,31 +101,30 @@ public class KitMagmaCube extends SmashKit
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[2]);
player.getInventory().setArmorContents(PLAYER_ARMOR);
player.getInventory().setArmorContents(PLAYER_ARMOR);;
}
@Override
public void giveSuperItems(Player player)
@EventHandler
public void fireResistance(UpdateEvent event)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise
DisguiseMagmaCube disguise = new DisguiseMagmaCube(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
disguise.SetSize(1);
if (event.getType() != UpdateType.FAST)
{
return;
}
if (Manager.GetGame() == null)
{
return;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
{
continue;
}
player.setFireTicks(0);
}
}
}

View File

@ -1,5 +1,12 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguisePig;
@ -8,29 +15,30 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.pig.PerkPigBaconBomb;
import nautilus.game.arcade.game.games.smash.perks.pig.PerkPigBaconBounce;
import nautilus.game.arcade.game.games.smash.perks.pig.PerkPigZombie;
import nautilus.game.arcade.game.games.smash.perks.pig.SmashPig;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor;
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.inventory.ItemStack;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitPig extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final float MAX_ENERGY = 0.99F;
private static final float ENERGY_PER_TICK_NORMAL = 0.005F;
private static final float ENERGY_PER_TICK_SMASH = 0.02F;
private static final Perk[] PERKS = {
new PerkSmashStats(5, 1.5, 0.25, 5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkPigBaconBounce(),
new PerkPigBaconBomb(),
new PerkPigZombie(),
new SmashPig()
};
private static final ItemStack IN_HAND = new ItemStack(Material.PORK);
@ -75,21 +83,23 @@ public class KitPig extends SmashKit
};
private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.CHAINMAIL_BOOTS),
new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE),
null,
};
public KitPig(ArcadeManager manager)
{
super(manager, "Pig", KitAvailability.Gem, 7000, DESCRIPTION, PERKS, EntityType.PIG, IN_HAND, "Pig Stink", 40000, Sound.PIG_DEATH);
super(manager, "Pig", KitAvailability.Gem, 7000, PERKS, EntityType.PIG, IN_HAND, DisguisePig.class);
}
@Override
public void giveCoreItems(Player player)
public void GiveItems(Player player)
{
disguise(player);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -97,59 +107,30 @@ public class KitPig extends SmashKit
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]);
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise
DisguisePig disguise = new DisguisePig(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@EventHandler
public void EnergyUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
if(Manager.GetGame() == null)
{
return;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
{
continue;
player.setExp((float) Math.min(0.999, player.getExp() + (isSuperActive(player) ? 0.02 : 0.005)));
}
player.setExp((float) Math.min(MAX_ENERGY, player.getExp() + (isSmashActive(player) ? ENERGY_PER_TICK_SMASH : ENERGY_PER_TICK_NORMAL)));
}
}
@Override
public void activateSuperCustom(Player player)
{
for (Player other : Manager.GetGame().GetPlayers(true))
if (!player.equals(other))
Manager.GetCondition().Factory().Confuse("Pig Stink " + player.getName(), other, player, 40, 0, false, false, false);
}
@Override
public void deactivateSuperCustom(Player player)
{
}
}

View File

@ -1,5 +1,11 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.achievement.Achievement;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
@ -7,37 +13,33 @@ import mineplex.core.disguise.disguises.DisguiseSheep;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.sheep.SmashSheep;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkLazer;
import nautilus.game.arcade.kit.perks.PerkWoolBomb;
import nautilus.game.arcade.kit.perks.PerkWoolCloud;
public class KitSheep extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(5, 1.7, 0.25, 5),
new PerkDoubleJump("Double Jump", 1, 1, false),
new PerkLazer(40, 6000),
new PerkLazer(40, 7000),
new PerkWoolBomb(),
new PerkWoolCloud(),
new PerkSheepHoming()
new SmashSheep()
};
private static final ItemStack IN_HAND = new ItemStack(Material.WOOL);
private static final ItemStack[] PLAYER_ITEMS = {
ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Static Lazer",
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Static Laser",
new String[]{
ChatColor.RESET + "Charge up static electricity in your",
ChatColor.RESET + "wooly coat, and then unleash it upon",
@ -89,14 +91,16 @@ public class KitSheep extends SmashKit
public KitSheep(ArcadeManager manager)
{
super(manager, "Sir. Sheep", KitAvailability.Achievement, 99999, DESCRIPTION, PERKS, EntityType.SHEEP, IN_HAND, "Homing Sheeples", 0, Sound.SHEEP_IDLE);
super(manager, "Sir. Sheep", KitAvailability.Achievement, 99999, PERKS, EntityType.SHEEP, IN_HAND, DisguiseSheep.class);
this.setAchievementRequirements(ACHIEVEMENTS);
}
@Override
public void giveCoreItems(Player player)
public void GiveItems(Player player)
{
disguise(player);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1], PLAYER_ITEMS[2]);
@ -106,29 +110,4 @@ public class KitSheep extends SmashKit
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise
DisguiseSheep disguise = new DisguiseSheep(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setColor(DyeColor.WHITE);
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
}

View File

@ -1,35 +1,41 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Horse.Variant;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseHorse;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.skeletalhorse.PerkBoneRush;
import nautilus.game.arcade.game.games.smash.perks.skeletalhorse.PerkDeadlyBones;
import nautilus.game.arcade.game.games.smash.perks.skeletalhorse.PerkHorseKick;
import nautilus.game.arcade.game.games.smash.perks.skeletalhorse.SmashSkeletalHorse;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.*;
import org.bukkit.entity.Horse.Variant;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitSkeletalHorse extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(6, 1.4, 0.3, 6),
new PerkSmashStats(6, 1.4, 0.3, 6.5),
new PerkDoubleJump("Double Jump", 1, 1, false),
new PerkHorseKick(),
new PerkBoneRush(),
new PerkDeadlyBones()
new PerkDeadlyBones(),
new SmashSkeletalHorse()
};
private static final ItemStack IN_HAND = new ItemStack(Material.BONE);
@ -71,20 +77,26 @@ public class KitSkeletalHorse extends SmashKit
};
private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET),
new ItemStack(Material.IRON_BOOTS),
new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.CHAINMAIL_HELMET),
};
public KitSkeletalHorse(ArcadeManager manager)
{
super(manager, "Skeletal Horse", KitAvailability.Gem, 7000, DESCRIPTION, PERKS, EntityType.HORSE, IN_HAND, "Bone Storm", 20000, Sound.HORSE_SKELETON_DEATH);
super(manager, "Skeletal Horse", KitAvailability.Gem, 7000, PERKS, EntityType.HORSE, IN_HAND, DisguiseHorse.class);
}
@Override
public void giveCoreItems(Player player)
public void GiveItems(Player player)
{
disguise(player);
DisguiseHorse disguise = (DisguiseHorse) Manager.GetDisguise().getActiveDisguise(player);
disguise.setType(Variant.SKELETON_HORSE);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -92,62 +104,16 @@ public class KitSkeletalHorse extends SmashKit
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]);
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SPADE);
player.getInventory().remove(Material.IRON_AXE);
UtilInv.Update(player);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise
DisguiseHorse disguise = new DisguiseHorse(player);
disguise.setType(Variant.SKELETON_HORSE);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@Override
public Entity SpawnEntity(Location loc)
{
EntityType type = _entityType;
if (type == EntityType.PLAYER)
type = EntityType.ZOMBIE;
LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type);
entity.setRemoveWhenFarAway(false);
entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit");
entity.setCustomNameVisible(true);
entity.getEquipment().setItemInHand(_itemInHand);
if (type == EntityType.HORSE)
{
Horse horse = (Horse) entity;
horse.setAdult();
horse.setVariant(Variant.SKELETON_HORSE);
}
UtilEnt.Vegetate(entity);
SpawnCustom(entity);
return entity;
Horse horse = (Horse) super.SpawnEntity(loc);
horse.setVariant(Variant.SKELETON_HORSE);
return horse;
}
}

View File

@ -1,36 +1,48 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseSkeleton;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBarrage;
import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBoneExplosion;
import nautilus.game.arcade.game.games.smash.perks.skeleton.SmashSkeleton;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import nautilus.game.arcade.kit.perks.PerkKnockbackArrow;
import nautilus.game.arcade.kit.perks.PerkRopedArrow;
public class KitSkeleton extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static double ARROW_DAMAGE = 6;
private static final Perk[] PERKS = {
new PerkSmashStats(5, 1.25, 0.15, 6),
new PerkSmashStats(5, 1.25, 0.2, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkFletcher(3, 3, false),
new PerkKnockbackArrow(1.5),
new PerkBoneExplosion(),
new PerkRopedArrow("Roped Arrow", 1, 5000),
new PerkBarrage(5, 300, true, false, true),
new PerkSkeletonArrowStorm()
new SmashSkeleton()
};
private static final ItemStack IN_HAND = new ItemStack(Material.BOW);
@ -69,21 +81,23 @@ public class KitSkeleton extends SmashKit
};
private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET),
new ItemStack(Material.CHAINMAIL_BOOTS),
new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.CHAINMAIL_HELMET),
};
public KitSkeleton(ArcadeManager manager)
{
super(manager, "Skeleton", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND, "Arrow Storm", 8000, Sound.SKELETON_HURT);
super(manager, "Skeleton", KitAvailability.Free, PERKS, EntityType.SKELETON, IN_HAND, DisguiseSkeleton.class);
}
@Override
public void giveCoreItems(Player player)
public void GiveItems(Player player)
{
disguise(player);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -95,31 +109,31 @@ public class KitSkeleton extends SmashKit
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
@EventHandler(priority = EventPriority.HIGHEST)
public void arrowDamage(CustomDamageEvent event)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise
DisguiseSkeleton disguise = new DisguiseSkeleton(player);
if (Manager.GetGame().GetTeam(player) != null)
Player player = event.GetDamagerPlayer(true);
Projectile proj = event.GetProjectile();
if (player == null || proj == null)
{
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
} else
{
disguise.setName(player.getName());
return;
}
disguise.setCustomNameVisible(true);
disguise.hideArmor();
Manager.GetDisguise().disguise(disguise);
if (!(proj instanceof Arrow))
{
return;
}
if (!HasKit(player))
{
return;
}
//Try making arrows deal static damage
double diff = ARROW_DAMAGE - event.GetDamage();
event.AddMod("Arrow Nerf", diff);
}
}

View File

@ -1,35 +1,37 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseSquid;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkFishFlurry;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.squid.PerkFishFlurry;
import nautilus.game.arcade.game.games.smash.perks.squid.PerkInkBlast;
import nautilus.game.arcade.game.games.smash.perks.squid.SmashSquid;
import nautilus.game.arcade.game.games.smash.perks.squid.PerkSuperSquid;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitSkySquid extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(6, 1.5, 0.25, 5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkSuperSquid(),
new PerkInkBlast(7, 2),
new PerkFishFlurry(),
new PerkStormSquid()
new SmashSquid()
};
private static final ItemStack IN_HAND = new ItemStack(Material.INK_SACK);
@ -73,36 +75,23 @@ public class KitSkySquid extends SmashKit
};
private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.CHAINMAIL_BOOTS),
new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE),
null
};
public KitSkySquid(ArcadeManager manager)
{
super(manager, "Sky Squid", KitAvailability.Gem, 3000, DESCRIPTION, PERKS, EntityType.SQUID, IN_HAND, "Storm Squid", 24000, Sound.SPLASH2);
super(manager, "Sky Squid", KitAvailability.Gem, 3000, PERKS, EntityType.SQUID, IN_HAND, DisguiseSquid.class);
}
@Override
public void giveCoreItems(Player player)
{
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1], PLAYER_ITEMS[2]);
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[3]);
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
public void giveSmashItems(Player player)
{
player.getInventory().remove(Material.IRON_SWORD);
player.getInventory().remove(Material.IRON_AXE);
player.getInventory().remove(Material.IRON_SPADE);
player.getInventory().addItem(PLAYER_ITEMS[4]);
@ -112,32 +101,15 @@ public class KitSkySquid extends SmashKit
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
disguise(player);
UtilInv.Clear(player);
//Disguise
DisguiseSquid disguise = new DisguiseSquid(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1], PLAYER_ITEMS[2]);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[3]);
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@Override
public void activateSuperCustom(Player player)
{
Manager.GetGame().WorldWeatherEnabled = true;
Manager.GetGame().WorldData.World.setStorm(true);
Manager.GetGame().WorldData.World.setThundering(true);
Manager.GetGame().WorldData.World.setThunderDuration(9999);
}
@Override
public void deactivateSuperCustom(Player player)
{
Manager.GetGame().WorldWeatherEnabled = false;
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
}

View File

@ -1,43 +1,35 @@
package nautilus.game.arcade.game.games.smash.kits;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseSlime;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkSlimeRocket;
import nautilus.game.arcade.kit.perks.PerkSlimeSlam;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
import org.bukkit.ChatColor;
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.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseSlime;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.slime.PerkSlimeRocket;
import nautilus.game.arcade.game.games.smash.perks.slime.PerkSlimeSlam;
import nautilus.game.arcade.game.games.smash.perks.slime.SmashSlime;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitSlime extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(6, 1.75, 0.5, 3),
new PerkSmashStats(6, 1.75, 0.35, 3),
new PerkDoubleJump("Double Jump", 1.2, 1, false),
new PerkSlimeSlam(),
new PerkSlimeRocket()
new PerkSlimeRocket(),
new SmashSlime()
};
private static final ItemStack IN_HAND = new ItemStack(Material.SLIME_BALL);
@ -76,18 +68,24 @@ public class KitSlime extends SmashKit
private static final ItemStack[] PLAYER_ARMOR = {
null,
null,
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET),
new ItemStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.CHAINMAIL_HELMET),
};
public KitSlime(ArcadeManager manager)
{
super(manager, "Slime", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND, "Giga Slime", 24000, Sound.SLIME_ATTACK);
super(manager, "Slime", KitAvailability.Free, PERKS, EntityType.SLIME, IN_HAND, DisguiseSlime.class);
}
@Override
public void giveCoreItems(Player player)
public void GiveItems(Player player)
{
disguise(player);
DisguiseSlime disguise = (DisguiseSlime) Manager.GetDisguise().getActiveDisguise(player);
disguise.SetSize(3);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -98,103 +96,4 @@ public class KitSlime extends SmashKit
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SWORD);
player.getInventory().remove(Material.IRON_AXE);
UtilInv.Update(player);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise
DisguiseSlime disguise = new DisguiseSlime(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
disguise.SetSize(3);
}
@Override
public void activateSuperCustom(Player player)
{
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise != null && disguise instanceof DisguiseSlime)
{
DisguiseSlime slime = (DisguiseSlime) disguise;
slime.SetSize(14);
Manager.GetDisguise().updateDisguise(slime);
}
player.setExp(0.99f);
Manager.GetCondition().Factory().Speed("Giga Slime", player, player, 20, 2, false, false, false);
}
@Override
public void deactivateSuperCustom(Player player)
{
Manager.GetCondition().EndCondition(player, ConditionType.SPEED, "Giga Slime");
}
@EventHandler(priority = EventPriority.LOW)
public void immunityDamagee(CustomDamageEvent event)
{
if (event.GetDamageePlayer() == null || event.GetDamagerEntity(true) == null)
return;
if (this.isSuperActive(event.GetDamageePlayer()))
event.SetCancelled(getSuperName());
}
@EventHandler(priority = EventPriority.LOW)
public void immunityDamager(CustomDamageEvent event)
{
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
if (event.GetDamagerPlayer(true) == null)
return;
if (isSuperActive(event.GetDamagerPlayer(true)))
event.SetCancelled(getSuperName());
}
@EventHandler
public void collide(UpdateEvent event)
{
for (Player player : getSuperActive())
for (Player other : Manager.GetGame().GetPlayers(true))
{
if (player.equals(other))
continue;
if (Manager.isSpectator(other))
continue;
if (UtilMath.offset(player.getLocation().add(0, 3, 0), other.getLocation()) < 5)
{
Manager.GetDamage().NewDamageEvent(other, player, null,
DamageCause.CUSTOM, 8, true, false, false,
player.getName(), GetName());
UtilParticle.PlayParticle(ParticleType.SLIME, other.getLocation().add(0, 0.6, 0), 1f, 1f, 1f, 0, 20,
ViewDist.LONG, UtilServer.getPlayers());
player.getWorld().playSound(other.getLocation(), Sound.SLIME_ATTACK, 3f, 1f);
}
}
}
}

View File

@ -1,35 +1,39 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseSnowman;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.snowman.PerkArcticAura;
import nautilus.game.arcade.game.games.smash.perks.snowman.PerkIcePath;
import nautilus.game.arcade.game.games.smash.perks.snowman.SmashSnowman;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.kit.perks.PerkBlizzard;
import nautilus.game.arcade.kit.perks.PerkDamageSnow;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitSnowman extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(5.5, 1.4, 0.3, 6),
new PerkSmashStats(6, 1.4, 0.3, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkDamageSnow(1, 0.4),
new PerkArcticAura(),
new PerkBlizzard(),
new PerkIcePath(),
new PerkSnowTurret()
new SmashSnowman()
};
private static final ItemStack IN_HAND = new ItemStack(Material.SNOW_BALL);
@ -68,33 +72,22 @@ public class KitSnowman extends SmashKit
};
private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET),
new ItemStack(Material.CHAINMAIL_BOOTS),
new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.CHAINMAIL_HELMET),
};
public KitSnowman(ArcadeManager manager)
{
super(manager, "Snowman", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.SNOWMAN, IN_HAND, "Snow Turret", 0, Sound.STEP_SNOW);
setSuperCharges(3);
}
@Override
public void giveCoreItems(Player player)
{
}
@Override
public void giveSuperItems(Player player)
{
super(manager, "Snowman", KitAvailability.Gem, 5000, PERKS, EntityType.SNOWMAN, IN_HAND, DisguiseSnowman.class);
}
@Override
public void GiveItems(Player player)
{
disguise(player);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -102,16 +95,5 @@ public class KitSnowman extends SmashKit
player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]);
player.getInventory().setArmorContents(PLAYER_ARMOR);
//Disguise
DisguiseSnowman disguise = new DisguiseSnowman(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
}

View File

@ -1,33 +1,36 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseSpider;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.spider.PerkNeedler;
import nautilus.game.arcade.game.games.smash.perks.spider.PerkSpiderLeap;
import nautilus.game.arcade.game.games.smash.perks.spider.PerkWebShot;
import nautilus.game.arcade.game.games.smash.perks.spider.SmashSpider;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitSpider extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(6, 1.5, 0.25, 6),
new PerkSpiderLeap(),
new PerkNeedler(),
new PerkWebShot(),
new PerkSpidersNest()
new SmashSpider()
};
private static final ItemStack IN_HAND = new ItemStack(Material.WEB);
@ -77,50 +80,32 @@ public class KitSpider extends SmashKit
};
private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET),
new ItemStack(Material.CHAINMAIL_BOOTS),
new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.CHAINMAIL_HELMET),
};
public KitSpider(ArcadeManager manager)
{
super(manager, "Spider", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SPIDER, IN_HAND, "Spider Nest", 30000, Sound.SPIDER_DEATH);
}
@Override
public void giveCoreItems(Player player)
{
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3], PLAYER_ITEMS[4]);
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
{
super(manager, "Spider", KitAvailability.Free, PERKS, EntityType.SPIDER, IN_HAND, DisguiseSpider.class);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
disguise(player);
UtilInv.Clear(player);
//Disguise
DisguiseSpider disguise = new DisguiseSpider(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
if (Manager.GetGame().GetState() == GameState.Recruit)
{
player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3], PLAYER_ITEMS[4]);
}
player.getInventory().setArmorContents(PLAYER_ARMOR);
player.setExp(0.99F);
}
}

View File

@ -1,33 +1,35 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseWitch;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.witch.PerkBatWave;
import nautilus.game.arcade.game.games.smash.perks.witch.PerkWitchPotion;
import nautilus.game.arcade.game.games.smash.perks.witch.SmashWitch;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitWitch extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(6, 1.5, 0.3, 5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkWitchPotion(),
new PerkBatWave(),
new PerkBatForm()
new SmashWitch()
};
private static final ItemStack IN_HAND = new ItemStack(Material.POTION);
@ -73,35 +75,21 @@ public class KitWitch extends SmashKit
};
private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.CHAINMAIL_BOOTS),
new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE),
null
};
public KitWitch(ArcadeManager manager)
{
super(manager, "Witch", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, EntityType.WITCH, IN_HAND, "Bat Form", 20000, Sound.BAT_HURT);
super(manager, "Witch", KitAvailability.Gem, 6000, PERKS, EntityType.WITCH, IN_HAND, DisguiseWitch.class);
}
@Override
public void giveCoreItems(Player player)
public void giveSmashItems(Player player)
{
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]);
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SPADE);
player.getInventory().remove(Material.IRON_AXE);
player.getInventory().remove(Material.IRON_SPADE);
player.getInventory().addItem(PLAYER_ITEMS[4]);
@ -111,33 +99,15 @@ public class KitWitch extends SmashKit
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
disguise(player);
UtilInv.Clear(player);
//Disguise
DisguiseWitch disguise = new DisguiseWitch(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]);
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@Override
public void activateSuperCustom(Player player)
{
for (Perk perk : GetPerks())
if (perk instanceof PerkDoubleJump)
((PerkDoubleJump) perk).disableForPlayer(player);
}
@Override
public void deactivateSuperCustom(Player player)
{
for (Perk perk : GetPerks())
if (perk instanceof PerkDoubleJump)
((PerkDoubleJump) perk).enableForPlayer(player);
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
}

View File

@ -1,143 +0,0 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
import nautilus.game.arcade.kit.perks.PerkSkullShot;
public class KitWither extends SmashKit
{
public KitWither(ArcadeManager manager)
{
super(manager, "Wither", KitAvailability.Gem, 5000,
new String[]
{
},
new Perk[]
{
new PerkSmashStats(6, 1.2, 0.3, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkSkullShot(),
},
EntityType.ZOMBIE,
new ItemStack(Material.BOW),
"", 0, null);
}
@Override
public void giveCoreItems(Player player)
{
UtilInv.Clear(player);
player.getInventory().addItem(new ItemStack(Material.ARROW));
ItemStack head = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte)1, 1);
player.getInventory().setHelmet(head);
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(Color.BLACK);
armor.setItemMeta(meta);
player.getInventory().setChestplate(armor);
ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS);
LeatherArmorMeta metaLegs = (LeatherArmorMeta)armor.getItemMeta();
metaLegs.setColor(Color.BLACK);
armor.setItemMeta(metaLegs);
player.getInventory().setLeggings(legs);
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
LeatherArmorMeta metaBoots = (LeatherArmorMeta)armor.getItemMeta();
metaBoots.setColor(Color.BLACK);
boots.setItemMeta(metaBoots);
player.getInventory().setBoots(boots);
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
}
@EventHandler
public void InvisibilityUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player player : UtilServer.getPlayers())
{
if (!HasKit(player))
continue;
if (player.getInventory().getChestplate() == null)
continue;
Manager.GetCondition().Factory().Invisible("Wither Invis", player, player, 1.9, 0, false, false, false);
}
}
@Override
public Entity SpawnEntity(Location loc)
{
EntityType type = _entityType;
if (type == EntityType.PLAYER)
type = EntityType.ZOMBIE;
LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type);
entity.setRemoveWhenFarAway(false);
entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit");
entity.setCustomNameVisible(true);
entity.getEquipment().setItemInHand(_itemInHand);
Manager.GetCondition().Factory().Invisible("Kit Invis", entity, entity, 7777, 0, false, false, false);
UtilEnt.Vegetate(entity);
SpawnCustom(entity);
return entity;
}
@Override
public void SpawnCustom(LivingEntity ent)
{
ItemStack head = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte)1, 1);
ent.getEquipment().setHelmet(head);
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(Color.BLACK);
armor.setItemMeta(meta);
ent.getEquipment().setChestplate(armor);
}
}

View File

@ -1,34 +1,37 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseSkeleton;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.witherskeleton.PerkWitherImage;
import nautilus.game.arcade.game.games.smash.perks.witherskeleton.PerkWitherSkull;
import nautilus.game.arcade.game.games.smash.perks.witherskeleton.SmashWitherSkeleton;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitWitherSkeleton extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(6, 1.2, 0.3, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkWitherSkull(),
new PerkWitherImage(),
new PerkWitherForm()
new SmashWitherSkeleton()
};
private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD);
@ -67,21 +70,32 @@ public class KitWitherSkeleton extends SmashKit
private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)
new ItemStack(Material.CHAINMAIL_BOOTS),
new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.CHAINMAIL_HELMET)
};
public KitWitherSkeleton(ArcadeManager manager)
{
super(manager, "Wither Skeleton", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND, "Wither Form", 18000, Sound.WITHER_SPAWN);
super(manager, "Wither Skeleton", KitAvailability.Gem, 6000, PERKS, EntityType.SKELETON, IN_HAND, DisguiseSkeleton.class);
}
public void giveSmashItems(Player player)
{
player.getInventory().remove(Material.IRON_SWORD);
player.getInventory().remove(Material.IRON_AXE);
player.getInventory().addItem(PLAYER_ITEMS[3]);
UtilInv.Update(player);
}
@Override
public void giveCoreItems(Player player)
public void GiveItems(Player player)
{
disguise(player);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -91,31 +105,23 @@ public class KitWitherSkeleton extends SmashKit
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SWORD);
player.getInventory().remove(Material.IRON_AXE);
player.getInventory().addItem(PLAYER_ARMOR[3]);
UtilInv.Update(player);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
public void disguise(Player player)
{
//Disguise
DisguiseSkeleton disguise = new DisguiseSkeleton(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
GameTeam gameTeam = Manager.GetGame().GetTeam(player);
if (gameTeam != null)
{
disguise.setName(gameTeam.GetColor() + player.getName());
}
else
{
disguise.setName(player.getName());
}
disguise.setCustomNameVisible(true);
disguise.SetSkeletonType(SkeletonType.WITHER);
disguise.hideArmor();

View File

@ -1,34 +1,33 @@
package nautilus.game.arcade.game.games.smash.kits;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseWolf;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
import nautilus.game.arcade.kit.perks.PerkWolf;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseWolf;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.wolf.PerkWolf;
import nautilus.game.arcade.game.games.smash.perks.wolf.SmashWolf;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitWolf extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(5, 1.6, 0.25, 4.5),
new PerkSmashStats(5, 1.6, 0.25, 5),
new PerkDoubleJump("Wolf Jump", 1.0, 1.0, true),
new PerkWolf()
new PerkWolf(),
new SmashWolf()
};
private static final ItemStack IN_HAND = new ItemStack(Material.BONE);
@ -66,23 +65,24 @@ public class KitWolf extends SmashKit
})
};
private static final ItemStack[] PLAYER_ARMOR = {
null,
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.IRON_CHESTPLATE),
null
};
public KitWolf(ArcadeManager manager)
{
super(manager, "Wolf", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.WOLF, IN_HAND, "Frenzy", 30000, Sound.WOLF_HOWL);
super(manager, "Wolf", KitAvailability.Gem, 4000, PERKS, EntityType.WOLF, IN_HAND, DisguiseWolf.class);
}
@Override
public void giveCoreItems(Player player)
public void GiveItems(Player player)
{
disguise(player);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -92,53 +92,4 @@ public class KitWolf extends SmashKit
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise
DisguiseWolf disguise = new DisguiseWolf(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@Override
public void activateSuperCustom(Player player)
{
Manager.GetCondition().Factory().Strength(GetName(), player, player, 30, 1, false, false, false);
Manager.GetCondition().Factory().Speed(GetName(), player, player, 30, 2, false, false, false);
Manager.GetCondition().Factory().Regen(GetName(), player, player, 30, 2, false, false, false);
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise instanceof DisguiseWolf)
{
((DisguiseWolf) disguise).setAngry(true);
Manager.GetDisguise().updateDisguise(disguise);
}
}
@Override
public void deactivateSuperCustom(Player player)
{
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise instanceof DisguiseWolf)
{
((DisguiseWolf) disguise).setAngry(false);
Manager.GetDisguise().updateDisguise(disguise);
}
}
}

View File

@ -1,26 +1,35 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseZombie;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.zombie.SmashZombie;
import nautilus.game.arcade.game.games.smash.perks.zombie.PerkOvercharge;
import nautilus.game.arcade.game.games.smash.perks.zombie.PerkZombieBile;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.kit.perks.PerkDeathsGrasp;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import nautilus.game.arcade.kit.perks.PerkKnockbackArrow;
public class KitZombie extends SmashKit
{
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = {
new PerkSmashStats(6, 1.25, 0.25, 5),
@ -30,7 +39,7 @@ public class KitZombie extends SmashKit
new PerkOvercharge(6, 250, true),
new PerkZombieBile(),
new PerkDeathsGrasp(),
new PerkNightLivingDead()
new SmashZombie()
};
private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE);
@ -68,21 +77,23 @@ public class KitZombie extends SmashKit
};
private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
new ItemStack(Material.CHAINMAIL_BOOTS),
new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE),
null,
};
public KitZombie(ArcadeManager manager)
{
super(manager, "Zombie", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND, "Night of the Living Dead", 0, Sound.AMBIENCE_CAVE);
super(manager, "Zombie", KitAvailability.Gem, 6000, PERKS, EntityType.ZOMBIE, IN_HAND, DisguiseZombie.class);
}
@Override
public void giveCoreItems(Player player)
public void GiveItems(Player player)
{
disguise(player);
UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -90,30 +101,30 @@ public class KitZombie extends SmashKit
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]);
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void giveSuperItems(Player player)
@EventHandler
public void arrowDamage(CustomDamageEvent event)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise
DisguiseZombie disguise = new DisguiseZombie(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
Player player = event.GetDamagerPlayer(true);
Projectile proj = event.GetProjectile();
if (player == null || proj == null)
{
return;
}
if (!(proj instanceof Arrow))
{
return;
}
if (!HasKit(player))
{
return;
}
event.AddMod("Arrow Nerf", -1);
}
}

View File

@ -18,6 +18,7 @@ import nautilus.game.arcade.game.games.smash.kits.KitCow;
import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
import nautilus.game.arcade.game.games.smash.kits.KitGolem;
import nautilus.game.arcade.game.games.smash.kits.KitGuardian;
import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube;
import nautilus.game.arcade.game.games.smash.kits.KitPig;
import nautilus.game.arcade.game.games.smash.kits.KitSheep;
@ -60,13 +61,10 @@ public class RandomKitSSM extends SoloSuperSmash
new KitGolem(manager),
new KitSpider(manager),
new KitSlime(manager),
new KitCreeper(manager),
new KitEnderman(manager),
new KitSnowman(manager),
new KitWolf(manager),
new KitBlaze(manager),
new KitWitch(manager),
new KitChicken(manager),
@ -77,17 +75,17 @@ public class RandomKitSSM extends SoloSuperSmash
new KitMagmaCube(manager),
new KitZombie(manager),
new KitCow(manager),
new KitSheep(manager)
new KitSheep(manager),
new KitGuardian(manager)
};
}
@Override
@EventHandler(priority = EventPriority.HIGH)
public void GameStateChange(GameStateChangeEvent event)
public void gameStart(GameStateChangeEvent event)
{
super.GameStateChange(event);
super.gameStart(event);
if (event.GetState() != GameState.Prepare)
return;

View File

@ -1,15 +1,14 @@
package nautilus.game.arcade.game.games.smash.modes.kits;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
/**
* KitPlayer
@ -21,27 +20,13 @@ public class KitHipster extends SmashKit
public KitHipster(ArcadeManager manager)
{
super(manager, "Hipster", KitAvailability.Free, 0,
new String[]{"Always get another kit!"}, new Perk[]{}, EntityType.ZOMBIE, new ItemStack(Material.RECORD_10), "Super",
1, Sound.BURP);
}
@Override
public void giveCoreItems(Player player)
{
}
@Override
public void giveSuperItems(Player player)
{
super(manager, "Hipster", KitAvailability.Free, 0, new Perk[] {}, EntityType.ZOMBIE, new ItemStack(Material.RECORD_10), null);
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -1,77 +0,0 @@
package nautilus.game.arcade.game.games.smash.perks;
import java.util.HashSet;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseMooshroom;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkCowMooshroomMadness extends SmashPerk
{
private HashSet<String> _cowSuperActive = new HashSet<String>();
public PerkCowMooshroomMadness()
{
super("Mooshroom Madness", new String[]
{
}, false);
}
@Override
public void addSuperCustom(Player player)
{
_cowSuperActive.add(player.getName());
//Disguise
DisguiseMooshroom disguise = new DisguiseMooshroom(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
//Armor
player.setMaxHealth(30);
player.setHealth(30);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.COW_HURT, 5f, 0.25f);
//Recharges
Recharge.Instance.recharge(player, "Angry Herd");
Recharge.Instance.recharge(player, "Milk Spiral");
}
@EventHandler
public void damageBuff(CustomDamageEvent event)
{
Player player = event.GetDamagerPlayer(true);
if (player == null)
return;
if (_cowSuperActive.contains(player.getName()))
{
event.AddMod(player.getName(), GetName(), 1, false);
}
}
@Override
public boolean isSuperActive(Player player)
{
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
return disguise != null && disguise instanceof DisguiseMooshroom;
}
}

View File

@ -1,4 +1,4 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;

View File

@ -0,0 +1,133 @@
package nautilus.game.arcade.game.games.smash.perks;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseInsentient;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
public abstract class SmashKit extends ProgressingKit
{
protected static final String DOUBLE_JUMP = C.cYellow + "Double tap " + C.cWhite + "your jump key to " + C.cGreen + "Double Jump";
private Class<? extends DisguiseInsentient> _clazz;
private String[] _description;
public SmashKit(ArcadeManager manager, String name, KitAvailability kitAvailability, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand, Class<? extends DisguiseInsentient> clazz)
{
this(manager, name, kitAvailability, 0, kitPerks, entityType, itemInHand, clazz);
}
public SmashKit(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand,
Class<? extends DisguiseInsentient> clazz)
{
super(manager, name, "smash" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, null, kitPerks, entityType, itemInHand);
_clazz = clazz;
}
public boolean isSmashActive(Player player)
{
for (Perk perk : GetPerks())
{
if (!(perk instanceof SmashUltimate))
{
continue;
}
SmashUltimate ultimate = (SmashUltimate) perk;
if (ultimate.isUsingUltimate(player))
{
return true;
}
}
return false;
}
public void disguise(Player player)
{
disguise(player, _clazz);
}
public void disguise(Player player, Class<? extends DisguiseInsentient> clazz)
{
if (_clazz == null)
{
return;
}
DisguiseManager disguiseManager = Manager.GetDisguise();
try
{
DisguiseInsentient disguise = clazz.getConstructor(Entity.class).newInstance(player);
GameTeam gameTeam = Manager.GetGame().GetTeam(player);
if (gameTeam != null)
{
disguise.setName(gameTeam.GetColor() + player.getName());
}
else
{
disguise.setName(player.getName());
}
disguise.setCustomNameVisible(true);
disguiseManager.disguise(disguise);
}
catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e)
{
e.printStackTrace();
}
}
@Override
public String[] getDescription()
{
return GetDesc();
}
@Override
public String[] GetDesc()
{
if (_description == null)
{
List<String> description = new ArrayList<>();
description.add(C.cGreen + "Kit - " + C.cWhiteB + GetName());
for (Perk perk : GetPerks())
{
if (!perk.IsVisible())
{
continue;
}
for (String line : perk.GetDesc())
{
description.add(C.cGray + " " + line);
}
}
_description = description.toArray(new String[description.size()]);
}
return _description;
}
}

View File

@ -0,0 +1,65 @@
package nautilus.game.arcade.game.games.smash.perks;
import org.bukkit.entity.Player;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.kit.Perk;
public class SmashPerk extends Perk
{
public SmashPerk(String name, String[] perkDesc)
{
super(name, perkDesc);
}
/**
* @param player
* The player that you need to check.
*
* @return true when the player is currently using a SmashUltimate.
*/
public boolean isSuperActive(Player player)
{
if (Kit instanceof SmashKit)
{
SmashKit kit = (SmashKit) Kit;
if (kit.isSmashActive(player))
{
return true;
}
}
return false;
}
/**
* Checks to see if an attack would count as team damage.
* Always returns false if the game is not {@link TeamSuperSmash}.
*
* @param player1
* @param player2
* @return true when the team of player1 equals the team of player2.
* @see GameTeam
*/
public boolean isTeamDamage(Player player1, Player player2)
{
Game game = Manager.GetGame();
if (!(game instanceof TeamSuperSmash))
{
return false;
}
if (game.GetTeam(player1).equals(game.GetTeam(player2)))
{
return true;
}
return false;
}
}

View File

@ -0,0 +1,158 @@
package nautilus.game.arcade.game.games.smash.perks;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.Perk;
public class SmashUltimate extends Perk
{
private static final int MIN_ULTIAMTE_DISPLAY_TIME = 1000;
private Map<UUID, Long> _lastUltimate = new HashMap<>();
private Sound _sound;
private int _length;
public SmashUltimate(String name, String[] perkDesc, Sound sound, int length)
{
super(name, perkDesc);
_sound = sound;
_length = length;
}
public void activate(Player player)
{
_lastUltimate.put(player.getUniqueId(), System.currentTimeMillis());
if (_length > MIN_ULTIAMTE_DISPLAY_TIME)
{
Recharge recharge = Recharge.Instance;
recharge.recharge(player, GetName());
recharge.use(player, GetName(), _length, false, false);
recharge.setDisplayForce(player, GetName(), true);
recharge.setCountdown(player, GetName(), true);
}
}
public void cancel(Player player)
{
_lastUltimate.remove(player.getUniqueId());
if (_length > MIN_ULTIAMTE_DISPLAY_TIME)
{
player.sendMessage(F.main("Game", "Deactivated " + F.skill(GetName()) + "."));
player.playSound(player.getLocation(), Sound.BLAZE_DEATH, 1, 0);
}
player.getInventory().clear();
Kit.GiveItems(player);
}
public boolean isUsable(Player player)
{
return true;
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST || _length == 0)
{
return;
}
List<UUID> list = new ArrayList<>();
list.addAll(_lastUltimate.keySet());
for (UUID uuid : list)
{
Player player = UtilPlayer.searchExact(uuid);
if (player == null)
{
continue;
}
if (UtilTime.elapsed(_lastUltimate.get(uuid), _length))
{
cancel(player);
}
}
}
@EventHandler
public void onCombatDeath(CombatDeathEvent event)
{
if (!(event.GetEvent().getEntity() instanceof Player))
{
return;
}
Player player = (Player) event.GetEvent().getEntity();
if (!isUsingUltimate(player))
{
return;
}
cancel(player);
}
@EventHandler
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
{
for (UUID uuid : _lastUltimate.keySet())
{
cancel(UtilPlayer.searchExact(uuid));
}
}
}
public boolean isUsingUltimate(Player player)
{
return isUsingUltimate(player.getUniqueId());
}
public boolean isUsingUltimate(UUID uuid)
{
return _lastUltimate.containsKey(uuid);
}
public Map<UUID, Long> getLastUltimate()
{
return _lastUltimate;
}
public Sound getSound()
{
return _sound;
}
public int getLength()
{
return _length;
}
}

View File

@ -0,0 +1,262 @@
package nautilus.game.arcade.game.games.smash.perks.blaze;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.EntityEffect;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
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.UtilTime;
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.smash.perks.SmashPerk;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.data.FireflyData;
public class PerkFirefly extends SmashPerk
{
private static final int COOLDOWN = 12000;
private static final int DURATION = 2750;
private static final int DAMAGE = 7;
private static final int RADIUS_NORMAL = 4;
private static final float VELOCITY_NORMAL = 0.7F;
private static final int RADIUS_SMASH = 7;
private static final float VELOCITY_SMASH = 0.79F;
private static final int HIT_FREQUENCY = 2000;
private static final int WARMUP_TIME = 1500;
private static final int MIN_CANCEL_DAMAGE = 4;
private static final int KNOCKBACK_MAGNITUDE = 2;
private Set<FireflyData> _data = new HashSet<FireflyData>();
private int _tick = 0;
public PerkFirefly()
{
super("Firefly", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Firefly" });
}
@EventHandler
public void Skill(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
}
Player player = event.getPlayer();
if (!UtilItem.isAxe(player.getItemInHand().getType()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (isSuperActive(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
activate(player, this);
}
/*
* It is split like this so Blaze's Smash can be called without the need to
* copy code.
*/
public void activate(Player player, Perk caller)
{
_data.add(new FireflyData(player));
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(caller.GetName()) + "."));
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
_tick++;
Iterator<FireflyData> dataIterator = _data.iterator();
//There are a lot of magic numbers here, they are all arbitrary sound and particle values.
while (dataIterator.hasNext())
{
FireflyData data = dataIterator.next();
Player player = data.Player;
boolean superActive = isSuperActive(data.Player);
String skillName = superActive ? "Phoenix" : GetName();
if (UtilPlayer.isSpectator(player))
{
dataIterator.remove();
continue;
}
// Warmup
if (!UtilTime.elapsed(data.Time, WARMUP_TIME) && !superActive)
{
UtilAction.zeroVelocity(player);
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.2f, 0.6f);
data.Location = player.getLocation();
// Sound and Effect
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 10, ViewDist.LONG);
float progress = (float) (System.currentTimeMillis() - data.Time) / WARMUP_TIME;
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 0.5f, 1f + progress);
}
// Velocity
else if (!UtilTime.elapsed(data.Time, DURATION) || superActive)
{
UtilAction.velocity(player, player.getLocation().getDirection().multiply(superActive ? VELOCITY_SMASH : VELOCITY_NORMAL).add(new Vector(0, 0.15, 0)));
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.6f, 1.2f);
// Sound and Effect
if (!superActive)
{
UtilParticle.PlayParticleToAll(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 40, ViewDist.LONG);
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.5f, 1.25f);
}
else
{
UtilParticle.PlayParticleToAll(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 60, ViewDist.LONG);
UtilParticle.PlayParticleToAll(ParticleType.LAVA, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 40, ViewDist.LONG);
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.75f, 0.75f);
}
for (Player other : UtilPlayer.getNearby(player.getLocation(), superActive ? RADIUS_SMASH : RADIUS_NORMAL))
{
if (other.equals(player))
{
continue;
}
if (UtilPlayer.isSpectator(other))
{
continue;
}
other.playEffect(EntityEffect.HURT);
if (_tick % 12 == 0)
{
if (Recharge.Instance.use(other, GetName() + " hit by " + player.getName(), HIT_FREQUENCY, false, false))
{
// Damage Event
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, true, false, player.getName(), skillName);
UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(player) + player.getName()) + " hit you with " + F.elem(skillName) + "."));
}
}
}
}
else
{
dataIterator.remove();
}
}
}
@EventHandler
public void FireflyDamage(CustomDamageEvent event)
{
if (event.GetDamage() < MIN_CANCEL_DAMAGE)
{
return;
}
if (!(event.GetDamagerEntity(true) instanceof Player))
{
return;
}
Iterator<FireflyData> dataIterator = _data.iterator();
while (dataIterator.hasNext())
{
FireflyData data = dataIterator.next();
if (!data.Player.equals(event.GetDamageeEntity()))
{
continue;
}
if (!UtilTime.elapsed(data.Time, 1250) && !isSuperActive(data.Player))
{
if (isTeamDamage(data.Player, event.GetDamagerPlayer(true)))
{
continue;
}
dataIterator.remove();
}
else
{
event.SetCancelled("Firefly Immunity");
}
}
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
}

View File

@ -0,0 +1,161 @@
package nautilus.game.arcade.game.games.smash.perks.blaze;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
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.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkInferno extends SmashPerk
{
private static final float MAX_ENERGY = 0.999F;
private static final float ENERGY_PER_TICK = 0.025F;
private static final float ENERGY_PER_ITEM = 0.035F;
private static final double ITEM_EXPIRE_TIME = 0.7;
private static final double ITEM_BURN_TIME = 0.5;
private static final double ITEM_DAMAGE = 0.25;
private static final float ITEM_VELOCITY_MAGNITUDE = 1.6F;
private Map<UUID, Long> _active = new HashMap<>();
public PerkInferno()
{
super("Inferno", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Inferno" });
}
@EventHandler
public void EnergyUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!hasPerk(player))
{
continue;
}
if (!player.isBlocking())
{
player.setExp(Math.min(MAX_ENERGY, player.getExp() + ENERGY_PER_TICK));
}
}
}
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
}
Player player = event.getPlayer();
if (!UtilItem.isSword(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (isSuperActive(player))
{
return;
}
_active.put(player.getUniqueId(), System.currentTimeMillis());
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (Player cur : UtilServer.getPlayers())
{
UUID key = cur.getUniqueId();
if (!_active.containsKey(key))
{
continue;
}
if (!cur.isBlocking())
{
_active.remove(key);
continue;
}
cur.setExp(cur.getExp() - ENERGY_PER_ITEM);
if (cur.getExp() <= 0)
{
_active.remove(key);
continue;
}
// Fire
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), new ItemStack(Material.BLAZE_POWDER));
Manager.GetFire().Add(fire, cur, ITEM_EXPIRE_TIME, 0, ITEM_BURN_TIME, ITEM_DAMAGE, GetName(), false);
fire.teleport(cur.getEyeLocation());
fire.setVelocity(cur.getLocation().getDirection().add(getRandomVector()).multiply(ITEM_VELOCITY_MAGNITUDE));
// Effect
cur.getWorld().playSound(cur.getLocation(), Sound.GHAST_FIREBALL, 0.1f, 1f);
}
}
private Vector getRandomVector()
{
double x = 0.07 - (UtilMath.r(14) / 100);
double y = 0.07 - (UtilMath.r(14) / 100);
double z = 0.07 - (UtilMath.r(14) / 100);
return new Vector(x, y, z);
}
}

View File

@ -0,0 +1,40 @@
package nautilus.game.arcade.game.games.smash.perks.blaze;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
import nautilus.game.arcade.kit.Perk;
public class SmashBlaze extends SmashUltimate
{
private static final int DURATION = 18000;
public SmashBlaze()
{
super("Phoenix", new String[] {}, Sound.BLAZE_DEATH, DURATION);
}
@Override
public void activate(Player player)
{
super.activate(player);
player.getInventory().remove(Material.IRON_SWORD);
player.getInventory().remove(Material.IRON_AXE);
for (Perk perk : Kit.GetPerks())
{
if (!(perk instanceof PerkFirefly))
{
continue;
}
PerkFirefly firefly = (PerkFirefly) perk;
firefly.activate(player, this);
}
}
}

View File

@ -1,10 +1,11 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.chicken;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
@ -13,7 +14,6 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
@ -23,62 +23,81 @@ import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilItem;
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.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
import nautilus.game.arcade.kit.perks.data.ChickenMissileData;
public class PerkChickenRocket extends SmashPerk
{
private HashSet<ChickenMissileData> _data = new HashSet<ChickenMissileData>();
public PerkChickenRocket()
private static final int COOLDOWN = 7000;
private static final int MIN_TIME = 200;
private static final int MAX_TIME = 4000;
private static final int HIT_BOX_RADIUS = 2;
private static final int DAMAGE_RADIUS = 3;
private static final int DAMAGE = 8;
private Set<ChickenMissileData> _data = new HashSet<>();
public PerkChickenRocket()
{
super("Chicken Missile", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Chicken Missile",
C.cGreen + "Chicken Missile" + C.cGray + " instantly recharges if you hit a player."
});
super("Chicken Missile", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Chicken Missile", C.cGreen + "Chicken Missile" + C.cGray
+ " instantly recharges if you hit a player." });
}
@EventHandler
public void Missile(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
}
Player player = event.getPlayer();
if (!UtilItem.isAxe(player.getItemInHand()))
{
return;
}
if (isSuperActive(player))
{
return;
}
if (!Kit.HasKit(player))
if (!hasPerk(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), 7000, true, true))
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
Manager.GetGame().CreatureAllowOverride = true;
Chicken ent = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Chicken.class);
@ -88,10 +107,10 @@ public class PerkChickenRocket extends SmashPerk
ent.setAgeLock(true);
UtilEnt.Vegetate(ent);
Manager.GetGame().CreatureAllowOverride = false;
_data.add(new ChickenMissileData(player, ent));
//Inform
// Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
@ -99,7 +118,9 @@ public class PerkChickenRocket extends SmashPerk
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<ChickenMissileData> dataIterator = _data.iterator();
@ -109,90 +130,99 @@ public class PerkChickenRocket extends SmashPerk
data.Chicken.setVelocity(data.Direction);
data.Chicken.getWorld().playSound(data.Chicken.getLocation(), Sound.CHICKEN_HURT, 0.3f, 1.5f);
if (!UtilTime.elapsed(data.Time, 200))
if (!UtilTime.elapsed(data.Time, MIN_TIME))
{
continue;
}
boolean detonate = false;
if (UtilTime.elapsed(data.Time, 4000))
if (UtilTime.elapsed(data.Time, MAX_TIME))
{
detonate = true;
}
else
{
//Hit Entity
for (Entity ent : data.Player.getWorld().getEntities())
List<Player> team = TeamSuperSmash.getTeam(Manager, data.Player, true);
// Hit Entity
for (Entity ent : UtilEnt.getInRadius(data.Chicken.getLocation(), HIT_BOX_RADIUS).keySet())
{
if (ent instanceof Arrow)
if (((Arrow)ent).isOnGround())
continue;
if (ent.equals(data.Player))
continue;
if (ent.equals(data.Chicken))
continue;
if (UtilMath.offset(data.Chicken.getLocation(), ent.getLocation().add(0, 0.5, 0)) > 2)
continue;
if (ent instanceof Player)
if (!Manager.GetGame().IsAlive((Player)ent))
{
if (((Arrow) ent).isOnGround())
{
continue;
//Recharge
}
}
if (ent.equals(data.Player) || ent.equals(data.Chicken))
{
continue;
}
if (ent instanceof Player)
{
if (UtilPlayer.isSpectator(ent))
{
continue;
}
if(team.contains(ent))
{
continue;
}
}
// Recharge
Recharge.Instance.useForce(data.Player, GetName(), -1);
detonate = true;
break;
}
//Hit Block
// Hit Block
if (!detonate && data.HasHitBlock())
{
detonate = true;
}
}
if (detonate)
{
//Damage
for (Entity ent : data.Player.getWorld().getEntities())
List<Player> team = TeamSuperSmash.getTeam(Manager, data.Player, true);
// Damage
for (LivingEntity ent : UtilEnt.getInRadius(data.Chicken.getLocation(), DAMAGE_RADIUS).keySet())
{
if (!(ent instanceof LivingEntity))
continue;
if (ent.equals(data.Player))
{
continue;
if (UtilMath.offset(data.Chicken.getLocation(), ent.getLocation().add(0, 0.5, 0)) > 3)
continue;
}
if (ent instanceof Player)
if (!Manager.GetGame().IsAlive((Player)ent))
{
if (UtilPlayer.isSpectator(ent))
{
continue;
LivingEntity livingEnt = (LivingEntity)ent;
//Damage Event
Manager.GetDamage().NewDamageEvent(livingEnt, data.Player, null,
DamageCause.PROJECTILE, 8, false, true, false,
data.Player.getName(), GetName());
UtilAction.velocity(livingEnt, UtilAlg.getTrajectory2d(data.Chicken, livingEnt), 1.6, true, 0.8, 0, 10, true);
}
if (team.contains(ent))
{
continue;
}
}
// Damage Event
Manager.GetDamage().NewDamageEvent(ent, data.Player, null, DamageCause.PROJECTILE, DAMAGE, false, true, false, data.Player.getName(), GetName());
UtilAction.velocity(ent, UtilAlg.getTrajectory2d(data.Chicken, ent), 1.6, true, 0.8, 0, 10, true);
}
//Effect
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Chicken.getLocation(), 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
// Effect
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Chicken.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers());
data.Chicken.getWorld().playSound(data.Chicken.getLocation(), Sound.EXPLODE, 2f, 1.2f);
//Firework
// Firework
UtilFirework.playFirework(data.Chicken.getLocation().add(0, 0.6, 0), Type.BALL, Color.WHITE, false, false);
data.Chicken.remove();
dataIterator.remove();

View File

@ -1,13 +1,14 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.chicken;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Sound;
import org.bukkit.entity.Egg;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
@ -17,6 +18,9 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
@ -24,113 +28,141 @@ 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.kit.Perk;
import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkEggGun extends SmashPerk
{
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
public PerkEggGun()
private static final int COOLDOWN = 2500;
private static final int DURATION = 750;
private static final int DAMAGE = 1;
private Map<UUID, Long> _active = new HashMap<>();
public PerkEggGun()
{
super("Egg Blaster", new String[]
{
C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Egg Blaster"
});
super("Egg Blaster", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Egg Blaster" });
}
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
}
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD"))
return;
}
Player player = event.getPlayer();
if (!UtilItem.isSword(player.getItemInHand()))
{
return;
}
if (isSuperActive(event.getPlayer()))
{
return;
if (!Kit.HasKit(player))
}
if (!hasPerk(player))
{
return;
if (!Recharge.Instance.use(player, GetName(), 2500, true, true))
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
_active.put(player, System.currentTimeMillis());
}
_active.put(player.getUniqueId(), System.currentTimeMillis());
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void Update(UpdateEvent event)
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (Player cur : UtilServer.getPlayers())
{
UUID key = cur.getUniqueId();
if (!isSuperActive(cur))
{
if (!_active.containsKey(cur))
continue;
if (!cur.isBlocking())
if (!_active.containsKey(key))
{
_active.remove(cur);
continue;
}
if (UtilTime.elapsed(_active.get(cur), 750))
if (!cur.isBlocking())
{
_active.remove(cur);
_active.remove(key);
continue;
}
if (UtilTime.elapsed(_active.get(key), DURATION))
{
_active.remove(key);
continue;
}
}
Vector offset = cur.getLocation().getDirection();
if (offset.getY() < 0)
{
offset.setY(0);
}
Egg egg = cur.getWorld().spawn(cur.getLocation().add(0, 0.5, 0).add(offset), Egg.class);
egg.setVelocity(cur.getLocation().getDirection().add(new Vector(0,0.2,0)));
egg.setVelocity(cur.getLocation().getDirection().add(new Vector(0, 0.2, 0)));
egg.setShooter(cur);
//Effect
// Effect
cur.getWorld().playSound(cur.getLocation(), Sound.CHICKEN_EGG_POP, 0.5f, 1f);
}
}
@EventHandler
public void EggHit(CustomDamageEvent event)
{
if (event.GetProjectile() == null)
{
return;
}
if (!(event.GetProjectile() instanceof Egg))
{
return;
}
if (event.GetDamage() >= 1)
if (event.GetDamage() >= DAMAGE)
{
return;
}
event.SetCancelled("Egg Blaster");
Egg egg = (Egg)event.GetProjectile();
//Damage Event
Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), (LivingEntity)egg.getShooter(), egg,
DamageCause.PROJECTILE, 1, true, true, false,
UtilEnt.getName((LivingEntity)egg.getShooter()), GetName());
Egg egg = (Egg) event.GetProjectile();
// Damage Event
Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), (LivingEntity) egg.getShooter(), egg, DamageCause.PROJECTILE, DAMAGE, true, true, false, UtilEnt.getName((LivingEntity) egg
.getShooter()), GetName());
UtilAction.zeroVelocity(event.GetDamageeEntity());
}
}

View File

@ -1,8 +1,7 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.chicken;
import org.bukkit.GameMode;
import org.bukkit.Sound;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerToggleFlightEvent;
@ -11,25 +10,28 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkFlap extends SmashPerk
{
private static final float MAX_ENERGY = 0.999F;
private static final float ENERGY_PER_TICK = 0.03F;
private static final float ENERGY_PER_FLAP = 0.17F;
private static final int COOLDOWN = 80;
private double _power;
private boolean _control;
public PerkFlap(double power, double heightLimit, boolean control)
public PerkFlap(double power, double heightLimit, boolean control)
{
super("Flap", new String[]
{
C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Flap"
});
super("Flap", new String[] { C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Flap" });
_power = power;
_control = control;
}
@ -38,25 +40,31 @@ public class PerkFlap extends SmashPerk
public void FlightHop(PlayerToggleFlightEvent event)
{
Player player = event.getPlayer();
if (Manager.isSpectator(player))
if (UtilPlayer.isSpectator(player))
{
return;
}
if (!Kit.HasKit(player))
if (!hasPerk(player))
{
return;
}
if (player.getGameMode() == GameMode.CREATIVE)
{
return;
}
event.setCancelled(true);
player.setFlying(false);
//Disable Flight
// Disable Flight
player.setAllowFlight(false);
double power = 0.4 + 0.6 * (_power * player.getExp());
//Velocity
// Velocity
if (_control)
{
UtilAction.velocity(player, power, 0.2, 10, true);
@ -65,35 +73,43 @@ public class PerkFlap extends SmashPerk
{
UtilAction.velocity(player, player.getLocation().getDirection(), power, true, power, 0, 10, true);
}
//Sound
player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float)(0.3 + player.getExp()), (float)(Math.random()/2+1));
//Set Recharge
Recharge.Instance.use(player, GetName(), 80, false, false);
//Energy
// Sound
player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float) (0.3 + player.getExp()), (float) (Math.random() / 2 + 1));
// Set Recharge
Recharge.Instance.use(player, GetName(), COOLDOWN, false, false);
// Energy
if (!isSuperActive(player))
player.setExp(Math.max(0f, player.getExp() - (1f/6f)));
{
player.setExp(Math.max(0f, player.getExp() - ENERGY_PER_FLAP));
}
}
@EventHandler
public void FlightUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (Player player : UtilServer.getPlayers())
{
if (player.getGameMode() == GameMode.CREATIVE)
continue;
if (!Kit.HasKit(player))
continue;
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
{
player.setExp(Math.min(0.9999f, player.getExp() + 0.03f));
continue;
}
if (!hasPerk(player))
{
continue;
}
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().subtract(0, 2, 0).getBlock()))
{
player.setExp(Math.min(MAX_ENERGY, player.getExp() + ENERGY_PER_TICK));
player.setAllowFlight(true);
}
else if (Recharge.Instance.usable(player, GetName()) && player.getExp() > 0)

View File

@ -0,0 +1,30 @@
package nautilus.game.arcade.game.games.smash.perks.chicken;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
public class SmashChicken extends SmashUltimate
{
private static final int DURATION = 20000;
public SmashChicken()
{
super("Aerial Gunner", new String[] {}, Sound.CHICKEN_IDLE, DURATION);
}
/**
* See {@link PerkEggGun} for smash code.
*/
@Override
public void activate(Player player)
{
super.activate(player);
player.getInventory().remove(Material.IRON_SWORD);
player.getInventory().remove(Material.IRON_AXE);
}
}

View File

@ -1,4 +1,4 @@
package nautilus.game.arcade.game.games.smash.perks;
package nautilus.game.arcade.game.games.smash.perks.cow;
import org.bukkit.Location;
import org.bukkit.entity.Cow;

View File

@ -1,4 +1,4 @@
package nautilus.game.arcade.game.games.smash.perks;
package nautilus.game.arcade.game.games.smash.perks.cow;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
@ -12,7 +12,6 @@ import mineplex.core.common.util.UtilParticle.ViewDist;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;

View File

@ -1,7 +1,8 @@
package nautilus.game.arcade.game.games.smash.perks;
package nautilus.game.arcade.game.games.smash.perks.cow;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.Sound;
@ -9,7 +10,6 @@ import org.bukkit.entity.Cow;
import org.bukkit.entity.MushroomCow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
@ -19,135 +19,149 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseMooshroom;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
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.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkCowAngryHerd extends SmashPerk
public class PerkCowAngryHerd extends SmashPerk
{
private ArrayList<DataCowCharge> _active = new ArrayList<DataCowCharge>();
public PerkCowAngryHerd()
private static final int COOLDOWN_NORMAL = 13000;
private static final int COOLDOWN_SMASH = 6000;
private static final int MAX_TIME = 2500;
private static final int STUCK_TIME = 300;
private static final int FORCE_MOVE = 350;
private static final float HIT_BOX_RADIUS = 2.2F;
private static final int HIT_FREQUENCY = 600;
private static final int DAMAGE = 5;
private List<DataCowCharge> _active = new ArrayList<>();
public PerkCowAngryHerd()
{
super("Angry Herd", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Angry Herd"
});
super("Angry Herd", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Angry Herd" });
}
@EventHandler
public void shoot(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
}
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 6000 : 12000, true, true))
if (!UtilItem.isAxe(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? COOLDOWN_SMASH : COOLDOWN_NORMAL, true, true))
{
return;
}
event.setCancelled(true);
for (double i=-2 ; i<3 ; i++)
for (double i = -2; i < 3; i++)
{
Vector dir = player.getLocation().getDirection();
dir.setY(0);
dir.normalize();
Location loc = player.getLocation();
loc.add(dir);
loc.add(UtilAlg.getLeft(dir).multiply(i*1.5));
loc.add(UtilAlg.getLeft(dir).multiply(i * 1.5));
Manager.GetGame().CreatureAllowOverride = true;
Class<? extends Cow> clazz = isSuperActive(player) ? MushroomCow.class : Cow.class;
Cow cow = player.getWorld().spawn(loc, clazz);
Manager.GetGame().CreatureAllowOverride = false;
_active.add(new DataCowCharge(player, cow));
}
//Sound
// Sound
player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, 2f, 0.6f);
//Inform
// Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<DataCowCharge> activeIter = _active.iterator();
while (activeIter.hasNext())
{
DataCowCharge data = activeIter.next();
//Expire
if (UtilTime.elapsed(data.Time, 3000))
// Expire
if (UtilTime.elapsed(data.Time, MAX_TIME))
{
if (data.Cow.isValid())
{
data.Cow.remove();
UtilParticle.PlayParticle(ParticleType.EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers());
UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL);
}
activeIter.remove();
continue;
}
//Set Moved
// Set Moved
if (UtilMath.offset(data.Cow.getLocation(), data.LastLoc) > 1)
{
data.LastLoc = data.Cow.getLocation();
data.LastMoveTime = System.currentTimeMillis();
}
//Stuck Remove
if (UtilTime.elapsed(data.LastMoveTime, 1000))
// Stuck Remove
if (UtilTime.elapsed(data.LastMoveTime, STUCK_TIME))
{
if (data.Cow.isValid())
{
data.Cow.remove();
UtilParticle.PlayParticle(ParticleType.EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers());
UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL);
}
activeIter.remove();
continue;
}
//Gravity
// Gravity
if (UtilEnt.isGrounded(data.Cow))
{
data.Direction.setY(-0.1);
@ -156,35 +170,44 @@ public class PerkCowAngryHerd extends SmashPerk
{
data.Direction.setY(Math.max(-1, data.Direction.getY() - 0.03));
}
//Move
if (UtilTime.elapsed(data.LastMoveTime, 350) && UtilEnt.isGrounded(data.Cow))
data.Cow.setVelocity(data.Direction.clone().add(new Vector(0,0.75,0)));
// Move
if (UtilTime.elapsed(data.LastMoveTime, FORCE_MOVE) && UtilEnt.isGrounded(data.Cow))
{
data.Cow.setVelocity(data.Direction.clone().add(new Vector(0, 0.75, 0)));
}
else
{
data.Cow.setVelocity(data.Direction);
}
if (Math.random() > 0.99)
{
data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_IDLE, 1f, 1f);
}
if (Math.random() > 0.97)
{
data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_WALK, 1f, 1.2f);
}
//Hit
// Hit
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (player.equals(data.Player))
continue;
if (UtilMath.offset(player, data.Cow) < 2.2)
{
if (Recharge.Instance.use(player, "Hit by " + data.Player.getName(), 600, false, false))
continue;
}
if (UtilMath.offset(player, data.Cow) < HIT_BOX_RADIUS)
{
if (Recharge.Instance.use(player, "Hit by " + data.Player.getName(), HIT_FREQUENCY, false, false))
{
// Damage Event
Manager.GetDamage().NewDamageEvent(player, data.Player, null, data.Cow.getLocation(), DamageCause.CUSTOM,
5, true, true, false, UtilEnt.getName(data.Player), GetName());
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Cow.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers());
Manager.GetDamage().NewDamageEvent(player, data.Player, null, data.Cow.getLocation(), DamageCause.CUSTOM, DAMAGE, true, true, false, UtilEnt.getName(data.Player), GetName());
UtilParticle.PlayParticleToAll(ParticleType.LARGE_EXPLODE, data.Cow.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG);
data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.ZOMBIE_WOOD, 0.75f, 0.8f);
data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_HURT, 1.5f, 0.75f);
}
@ -192,21 +215,15 @@ public class PerkCowAngryHerd extends SmashPerk
}
}
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
}
event.AddKnockback(GetName(), 1.25);
}
@Override
public boolean isSuperActive(Player player)
{
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
return disguise != null && disguise instanceof DisguiseMooshroom;
}
}

View File

@ -1,111 +1,123 @@
package nautilus.game.arcade.game.games.smash.perks;
package nautilus.game.arcade.game.games.smash.perks.cow;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseMooshroom;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkCowMilkSpiral extends SmashPerk
{
private HashMap<Player, DataCowMilkSpiral> _active = new HashMap<Player, DataCowMilkSpiral>();
public PerkCowMilkSpiral()
private static final int COOLDOWN_NORMAL = 11000;
private static final int COOLDOWN_SMASH = 6000;
private static final int HIT_BOX_RADIUS = 2;
private static final int DAMAGE = 6;
private Set<DataCowMilkSpiral> _active = new HashSet<>();
public PerkCowMilkSpiral()
{
super("Milk Spiral", new String[]
{
C.cYellow + "Right Click" + C.cGray + " with Spade to " + C.cGreen + "Milk Spiral",
C.cGray + "Crouch to cancel movement for Milk Spiral"
});
super("Milk Spiral", new String[] { C.cYellow + "Right Click" + C.cGray + " with Spade to " + C.cGreen + "Milk Spiral", C.cGray + "Crouch to cancel movement for Milk Spiral" });
}
@EventHandler
public void activate(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
}
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE"))
return;
}
Player player = event.getPlayer();
if (!Kit.HasKit(player))
if (!UtilItem.isSpade(player.getItemInHand()))
{
return;
if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 6000 : 12000, true, true))
}
if (!hasPerk(player))
{
return;
_active.put(player, new DataCowMilkSpiral(player, isSuperActive(player)));
//Inform
}
if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? COOLDOWN_SMASH : COOLDOWN_NORMAL, true, true))
{
return;
}
_active.add(new DataCowMilkSpiral(player, isSuperActive(player)));
// Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void update(UpdateEvent event)
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<DataCowMilkSpiral> activeIter = _active.iterator();
Iterator<DataCowMilkSpiral> activeIter = _active.values().iterator();
while (activeIter.hasNext())
{
DataCowMilkSpiral data = activeIter.next();
if (data.update())
{
activeIter.remove();
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (player.equals(data.Player))
continue;
if (UtilMath.offset(player.getLocation().add(0, 1, 0), data.Spiral) < 2)
{
Manager.GetDamage().NewDamageEvent(player, data.Player, null,
DamageCause.CUSTOM, 6, true, false, false,
player.getName(), GetName());
UtilParticle.PlayParticle(isSuperActive(player) ? ParticleType.RED_DUST : ParticleType.FIREWORKS_SPARK, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0.3f, 30, ViewDist.LONG, UtilServer.getPlayers());
continue;
}
if (UtilMath.offset(player.getLocation().add(0, 1, 0), data.Spiral) < HIT_BOX_RADIUS)
{
Manager.GetDamage().NewDamageEvent(player, data.Player, null, DamageCause.CUSTOM, DAMAGE, true, false, false, player.getName(), GetName());
UtilParticle.PlayParticle(isSuperActive(player) ? ParticleType.RED_DUST : ParticleType.FIREWORKS_SPARK, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0.3f, 30,
ViewDist.LONG, UtilServer.getPlayers());
player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 0.25f, 2f);
}
}
}
}
@Override
public boolean isSuperActive(Player player)
{
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
return disguise != null && disguise instanceof DisguiseMooshroom;
}
}

View File

@ -1,28 +1,10 @@
package nautilus.game.arcade.game.games.smash.perks;
package nautilus.game.arcade.game.games.smash.perks.cow;
import java.util.WeakHashMap;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseMooshroom;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.ISkill.SkillType;
import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -31,74 +13,95 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
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.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkCowStampede extends SmashPerk
{
private WeakHashMap<Player, Long> _sprintTime = new WeakHashMap<Player, Long>();
private WeakHashMap<Player, Integer> _sprintStr = new WeakHashMap<Player, Integer>();
public PerkCowStampede()
private Map<UUID, Long> _sprintTime = new HashMap<>();
private Map<UUID, Integer> _sprintStr = new HashMap<>();
public PerkCowStampede()
{
super("Stampede", new String[]
{
C.cGray + "Build up Speed Levels as you sprint.",
C.cGray + "+1 damage for each Speed Level.",
});
}
super("Stampede", new String[] { C.cGray + "Build up Speed Levels as you sprint.", C.cGray + "+1 damage for each Speed Level.", });
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
{
return;
}
for (Player cur : UtilServer.getPlayers())
{
if (!Kit.HasKit(cur))
continue;
//Active - Check for Disable
if (_sprintTime.containsKey(cur))
if (!hasPerk(cur))
{
//Stopped
continue;
}
UUID key = cur.getUniqueId();
// Active - Check for Disable
if (_sprintTime.containsKey(key))
{
// Stopped
if (!cur.isSprinting() || cur.getLocation().getBlock().isLiquid())
{
_sprintTime.remove(cur);
_sprintStr.remove(cur);
_sprintTime.remove(key);
_sprintStr.remove(key);
cur.removePotionEffect(PotionEffectType.SPEED);
continue;
}
long time = _sprintTime.get(cur);
int str = _sprintStr.get(cur);
long time = _sprintTime.get(key);
int str = _sprintStr.get(key);
//Apply Speed
// Apply Speed
if (str > 0)
Manager.GetCondition().Factory().Speed(GetName(), cur, cur, 1.9, !isSuperActive(cur) ? str-1 : str, false, true, true);
{
Manager.GetCondition().Factory().Speed(GetName(), cur, cur, 1.9, !isSuperActive(cur) ? str - 1 : str, false, true, true);
}
//Upgrade Speed
// Upgrade Speed
if (!UtilTime.elapsed(time, 3000))
{
continue;
}
_sprintTime.put(cur, System.currentTimeMillis());
_sprintTime.put(key, System.currentTimeMillis());
if (str < 3)
{
_sprintStr.put(cur, str+1);
{
_sprintStr.put(key, str + 1);
//Effect
// Effect
cur.getWorld().playSound(cur.getLocation(), Sound.COW_HURT, 2f, 0.75f + 0.25f * str);
}
//Event
// Event
UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(cur, GetName(), ClassType.Brute));
}
else if (cur.isSprinting() || !cur.getLocation().getBlock().isLiquid())
{
//Start Timer
if (!_sprintTime.containsKey(cur))
// Start Timer
if (!_sprintTime.containsKey(key))
{
_sprintTime.put(cur, System.currentTimeMillis());
_sprintStr.put(cur, 0);
_sprintTime.put(key, System.currentTimeMillis());
_sprintStr.put(key, 0);
}
}
}
@ -108,16 +111,26 @@ public class PerkCowStampede extends SmashPerk
public void particle(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player ent : _sprintStr.keySet())
{
if (_sprintStr.get(ent) <= 0)
return;
}
for (UUID key : _sprintStr.keySet())
{
if (_sprintStr.get(key) <= 0)
{
continue;
UtilParticle.PlayParticle(isSuperActive(ent) ? ParticleType.RED_DUST : ParticleType.CRIT, ent.getLocation(),
(float)(Math.random() - 0.5), 0.2f + (float)Math.random(), (float)(Math.random() - 0.5), 0, _sprintStr.get(ent) * 2,
ViewDist.NORMAL, UtilServer.getPlayers());
}
Player player = UtilPlayer.searchExact(key);
if (player == null)
{
continue;
}
UtilParticle.PlayParticle(isSuperActive(player) ? ParticleType.RED_DUST : ParticleType.CRIT, player.getLocation(), (float) (Math.random() - 0.5), 0.2f + (float) Math.random(),
(float) (Math.random() - 0.5), 0, _sprintStr.get(key) * 2, ViewDist.NORMAL, UtilServer.getPlayers());
}
}
@ -125,73 +138,89 @@ public class PerkCowStampede extends SmashPerk
public void damage(CustomDamageEvent event)
{
if (event.IsCancelled())
{
return;
}
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
{
return;
}
Player damager = event.GetDamagerPlayer(false);
if (damager == null) return;
if (!_sprintStr.containsKey(damager))
if (damager == null)
{
return;
}
UUID key = damager.getUniqueId();
if (_sprintStr.get(damager) == 0)
if (!_sprintStr.containsKey(key))
{
return;
}
if (_sprintStr.get(key) == 0)
{
return;
}
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return;
//Remove
_sprintTime.remove(damager);
int str = _sprintStr.remove(damager);
if (damagee == null)
{
return;
}
// Remove
_sprintTime.remove(key);
int str = _sprintStr.remove(key);
damager.removePotionEffect(PotionEffectType.SPEED);
//Damage
// Damage
event.AddMod(damager.getName(), GetName(), str, true);
event.AddKnockback(GetName(), 1 + (0.1 * str));
//Inform
// Inform
UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + "."));
//Effect
damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_WOOD, 1f, 2f);
damager.getWorld().playSound(damager.getLocation(), Sound.COW_HURT, 2f, 2f);
//Event
// Effect
damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_WOOD, 1f, 2f);
damager.getWorld().playSound(damager.getLocation(), Sound.COW_HURT, 2f, 2f);
// Event
UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(damager, GetName(), ClassType.Brute, damagee));
}
@EventHandler(priority = EventPriority.HIGH)
public void damageCancel(CustomDamageEvent event)
{
if (event.IsCancelled())
{
return;
}
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
if (damagee == null)
{
return;
}
clean(damagee);
Manager.GetCondition().EndCondition(damagee, null, GetName());
}
@EventHandler
public void quit(PlayerQuitEvent event)
public void quit(PlayerQuitEvent event)
{
clean(event.getPlayer());
}
public void clean(Player player)
public void clean(Player player)
{
_sprintTime.remove(player);
_sprintStr.remove(player);
}
@Override
public boolean isSuperActive(Player player)
{
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
return disguise != null && disguise instanceof DisguiseMooshroom;
_sprintTime.remove(player.getUniqueId());
_sprintStr.remove(player.getUniqueId());
}
}

View File

@ -0,0 +1,73 @@
package nautilus.game.arcade.game.games.smash.perks.cow;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.disguise.disguises.DisguiseCow;
import mineplex.core.disguise.disguises.DisguiseMooshroom;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
public class SmashCow extends SmashUltimate
{
private static final int DURATION = 30000;
private static final int DAMAGE_BUFF = 1;
private static final int HEALTH = 30;
public SmashCow()
{
super("Mooshroom Madness", new String[] {}, Sound.COW_IDLE, DURATION);
}
@Override
public void activate(Player player)
{
super.activate(player);
SmashKit kit = (SmashKit) Kit;
kit.disguise(player, DisguiseMooshroom.class);
// Health
player.setMaxHealth(HEALTH);
player.setHealth(HEALTH);
// Sound
player.getWorld().playSound(player.getLocation(), Sound.COW_HURT, 5f, 0.25f);
// Recharges
Recharge.Instance.recharge(player, "Angry Herd");
Recharge.Instance.recharge(player, "Milk Spiral");
}
@Override
public void cancel(Player player)
{
super.cancel(player);
SmashKit kit = (SmashKit) Kit;
kit.disguise(player, DisguiseCow.class);
player.setMaxHealth(20);
}
@EventHandler
public void damageBuff(CustomDamageEvent event)
{
Player player = event.GetDamagerPlayer(true);
if (player == null)
{
return;
}
if (isUsingUltimate(player))
{
event.AddMod(player.getName(), GetName(), DAMAGE_BUFF, false);
}
}
}

View File

@ -1,7 +1,9 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.creeper;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
@ -22,57 +24,77 @@ import nautilus.game.arcade.kit.Perk;
public class PerkCreeperElectricity extends Perk
{
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
public PerkCreeperElectricity()
{
super("Lightning Shield", new String[]
{
"When hit by a non-melee attack, you gain " + C.cGreen + "Lightning Shield"
});
}
private static final int DURATION = 2000;
private static final int SHOCK = 1;
private static final int DAMAGE = 4;
private static final float KNOCKBACK_MAGNITUDE = 2.5F;
private Map<UUID, Long> _active = new HashMap<>();
public PerkCreeperElectricity()
{
super("Lightning Shield", new String[] { "When hit by a non-melee attack, you gain " + C.cGreen + "Lightning Shield" });
}
@EventHandler
public void Shield(CustomDamageEvent event)
{
if (event.IsCancelled())
{
return;
if (event.GetCause() == DamageCause.ENTITY_ATTACK || event.GetCause() == DamageCause.FIRE_TICK || event.GetCause() == DamageCause.STARVATION)
}
if (event.GetCause() == DamageCause.ENTITY_ATTACK || event.GetCause() == DamageCause.FIRE_TICK || event.GetCause() == DamageCause.STARVATION || event.GetCause() == DamageCause.POISON)
{
return;
}
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
if (!Kit.HasKit(damagee))
if (damagee == null)
{
return;
}
_active.put(damagee, System.currentTimeMillis());
if (!hasPerk(damagee))
{
return;
}
_active.put(damagee.getUniqueId(), System.currentTimeMillis());
SetPowered(damagee, true);
Manager.GetCondition().Factory().Speed(GetName(), damagee, damagee, 4, 1, false, false, false);
//Sound
// Sound
damagee.getWorld().playSound(damagee.getLocation(), Sound.CREEPER_HISS, 3f, 1.25f);
//Inform
// Inform
UtilPlayer.message(damagee, F.main("Skill", "You gained " + F.skill(GetName()) + "."));
}
@EventHandler
public void Update(UpdateEvent event)
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
Iterator<Player> shieldIterator = _active.keySet().iterator();
}
Iterator<UUID> shieldIterator = _active.keySet().iterator();
while (shieldIterator.hasNext())
{
Player player = shieldIterator.next();
UUID key = shieldIterator.next();
Player player = UtilPlayer.searchExact(key);
if (player == null)
{
shieldIterator.remove();
continue;
}
if (!IsPowered(player))
{
@ -80,14 +102,14 @@ public class PerkCreeperElectricity extends Perk
SetPowered(player, false);
continue;
}
if (UtilTime.elapsed(_active.get(player), 2000))
if (UtilTime.elapsed(_active.get(key), DURATION))
{
shieldIterator.remove();
SetPowered(player, false);
//Sound
// Sound
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 3f, 0.75f);
}
}
@ -97,64 +119,87 @@ public class PerkCreeperElectricity extends Perk
public void Damage(CustomDamageEvent event)
{
if (event.IsCancelled())
{
return;
}
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
{
return;
}
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
if (!Kit.HasKit(damagee))
if (damagee == null)
{
return;
}
if (!hasPerk(damagee))
{
return;
}
if (!IsPowered(damagee))
{
return;
}
event.SetCancelled("Lightning Shield");
//Inform
// Inform
UtilPlayer.message(damagee, F.main("Skill", "You hit " + F.elem(UtilEnt.getName(event.GetDamagerPlayer(false))) + " with " + F.skill(GetName()) + "."));
//Elec
// Elec
damagee.getWorld().strikeLightningEffect(damagee.getLocation());
Manager.GetCondition().Factory().Shock(GetName(), event.GetDamagerEntity(false), event.GetDamageeEntity(), 1, false, false);
Manager.GetCondition().Factory().Shock(GetName(), event.GetDamagerEntity(false), event.GetDamageeEntity(), SHOCK, false, false);
SetPowered(damagee, false);
//Damage Event
Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), damagee, null,
DamageCause.LIGHTNING, 4, true, true, false,
damagee.getName(), GetName());
// Damage Event
Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), damagee, null, DamageCause.LIGHTNING, DAMAGE, true, true, false, damagee.getName(), GetName());
}
public DisguiseCreeper GetDisguise(Player player)
{
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
if (disguise == null)
{
return null;
}
if (!(disguise instanceof DisguiseCreeper))
{
return null;
}
return (DisguiseCreeper)disguise;
return (DisguiseCreeper) disguise;
}
public void SetPowered(Player player, boolean powered)
{
DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null) return;
if (creeper == null)
{
return;
}
creeper.SetPowered(powered);
Manager.GetDisguise().updateDisguise(creeper);
}
public boolean IsPowered(Player player)
{
DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null) return false;
if (creeper == null)
{
return false;
}
return creeper.IsPowered();
}
@ -162,8 +207,10 @@ public class PerkCreeperElectricity extends Perk
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
event.AddKnockback(GetName(), 2.5);
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
}

View File

@ -1,174 +1,205 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.creeper;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseCreeper;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.kit.SmashPerk;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkCreeperExplode extends SmashPerk
{
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
private HashSet<Player> _super = new HashSet<Player>();
public PerkCreeperExplode()
private static final int COOLDOWN = 8000;
private static final int WARMUP = 1500;
private static final int RADIUS_NORMAL = 8;
private static final int RADIUS_SMASH = 24;
private static final int DAMAGE_NORMAL = 20;
private static final int DAMAGE_SMASH = 30;
private static final int SPAWN_REMOVAL_RADIUS = 14;
private static final float KNOCKBACK_MAGNITUDE = 2.5F;
private Map<UUID, Long> _active = new HashMap<>();
public PerkCreeperExplode()
{
super("Explode", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Shovel use " + C.cGreen + "Explosive Leap"
});
super("Explode", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Shovel use " + C.cGreen + "Explosive Leap" });
}
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE"))
return;
}
Player player = event.getPlayer();
if (!UtilItem.isSpade(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (isSuperActive(player))
{
return;
}
if (!Kit.HasKit(player))
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), 8000, true, true))
return;
_active.put(player, System.currentTimeMillis());
_active.put(player.getUniqueId(), System.currentTimeMillis());
IncreaseSize(player);
UtilPlayer.message(player, F.main("Skill", "You are charging " + F.skill(GetName()) + "."));
}
@Override
public void addSuperCustom(Player player)
{
_active.put(player, System.currentTimeMillis());
_super.add(player);
IncreaseSize(player);
}
@EventHandler
public void Update(UpdateEvent event)
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<Player> chargeIterator = _active.keySet().iterator();
Iterator<UUID> chargeIterator = _active.keySet().iterator();
while (chargeIterator.hasNext())
{
Player player = chargeIterator.next();
UUID key = chargeIterator.next();
Player player = UtilPlayer.searchExact(key);
double elapsed = (System.currentTimeMillis() - _active.get(player))/1000d;
if (player == null)
{
chargeIterator.remove();
continue;
}
//Idle in Air
long elapsed = (System.currentTimeMillis() - _active.get(key));
// Idle in Air
UtilAction.zeroVelocity(player);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, (float)(0.5 + elapsed), (float)(0.5 + elapsed));
// Sound
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, (float) (0.5 + elapsed), (float) (0.5 + elapsed));
IncreaseSize(player);
player.setExp(Math.min(0.99f, (float)(elapsed/1.5)));
//Not Detonated
if (elapsed < 1.5)
player.setExp(Math.min(0.999f, elapsed / (float) WARMUP));
// Not Detonated
if (!UtilTime.elapsed(_active.get(key), WARMUP))
{
continue;
}
player.setExp(0);
chargeIterator.remove();
//Unpower
// Unpower
DecreaseSize(player);
boolean isSuper = _super.remove(player);
//Explode
if (!isSuper)
// Explode
if (!isSuperActive(player))
{
//Effect
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
// Effect
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers());
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f);
}
else
{
//Particles
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 5f, 5f, 5f, 0, 20,
ViewDist.MAX, UtilServer.getPlayers());
//Sound
for (int i=0 ; i<4 ; i++)
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, (float)(2 + Math.random()*4), (float)(Math.random() + 0.2));
//Blocks
// Particles
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 5f, 5f, 5f, 0, 20, ViewDist.MAX, UtilServer.getPlayers());
// Sound
for (int i = 0; i < 4; i++)
{
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, (float) (2 + Math.random() * 4), (float) (Math.random() + 0.2));
}
// Blocks
Collection<Block> blocks = UtilBlock.getInRadius(player.getLocation(), 12).keySet();
Iterator<Block> iter = blocks.iterator();
while (iter.hasNext()) {
Block b = iter.next();
while (iter.hasNext())
{
Block b = iter.next();
if(b.getType() == Material.STATIONARY_LAVA || b.getType() == Material.LAVA || b.getType() == Material.BEDROCK) iter.remove();;
if (b.getType() == Material.STATIONARY_LAVA || b.getType() == Material.LAVA || b.getType() == Material.BEDROCK)
{
iter.remove();
}
}
Manager.GetExplosion().BlockExplosion(blocks, player.getLocation(), false);
//Remove Spawns
// Remove Spawns
Iterator<Location> spawnIterator = Manager.GetGame().GetTeam(player).GetSpawns().iterator();
while (spawnIterator.hasNext())
{
Location spawn = spawnIterator.next();
if (UtilMath.offset(player.getLocation(), spawn) < 14)
if (UtilMath.offset(player.getLocation(), spawn) < SPAWN_REMOVAL_RADIUS)
{
spawnIterator.remove();
}
}
//If all spawns have been destroyed revert to using the spectator spawn
// If all spawns have been destroyed revert to using the
// spectator spawn
for (GameTeam team : Manager.GetGame().GetTeamList())
{
if (team.GetSpawns().isEmpty())
@ -177,110 +208,134 @@ public class PerkCreeperExplode extends SmashPerk
}
}
}
//Damage
for (Entity ent : player.getWorld().getEntities())
double maxRange = isSuperActive(player) ? RADIUS_SMASH : RADIUS_NORMAL;
double damage = isSuperActive(player) ? DAMAGE_SMASH : DAMAGE_NORMAL;
// Damage
for (LivingEntity ent : UtilEnt.getInRadius(player.getLocation(), maxRange).keySet())
{
if (!(ent instanceof LivingEntity))
continue;
if (ent.equals(player))
{
continue;
}
double dist = UtilMath.offset(player.getLocation(), ent.getLocation());
double maxRange = 8;
if (isSuper)
maxRange = 24;
double damage = 20;
if (isSuper)
damage = 30;
if (dist > maxRange)
if (UtilPlayer.isSpectator(player))
{
continue;
}
if (ent instanceof Player)
if (!Manager.GetGame().IsAlive((Player)ent))
continue;
LivingEntity livingEnt = (LivingEntity) ent;
LivingEntity livingEnt = (LivingEntity)ent;
double scale = 0.1 + 0.9 * ((maxRange-dist)/maxRange);
//Damage Event
Manager.GetDamage().NewDamageEvent(livingEnt, player, null,
DamageCause.CUSTOM, damage * scale, true, true, false,
player.getName(), isSuper ? "Atomic Blast" : GetName());
double scale = 0.1 + 0.9 * ((maxRange - dist) / maxRange);
// Damage Event
Manager.GetDamage().NewDamageEvent(livingEnt, player, null, DamageCause.CUSTOM, damage * scale, true, true, false, player.getName(), isSuperActive(player) ? "Atomic Blast" : GetName());
}
//Velocity
// Velocity
UtilAction.velocity(player, 1.8, 0.2, 1.4, true);
//Inform
if (!isSuper)
// Inform
if (!isSuperActive(player))
{
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
}
}
public void activate(Player player)
{
_active.put(player.getUniqueId(), System.currentTimeMillis());
}
public DisguiseCreeper GetDisguise(Player player)
{
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
if (disguise == null)
{
return null;
}
if (!(disguise instanceof DisguiseCreeper))
{
return null;
}
return (DisguiseCreeper)disguise;
return (DisguiseCreeper) disguise;
}
public int GetSize(Player player)
{
DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null) return 0;
if (creeper == null)
{
return 0;
}
return creeper.bV();
}
public void DecreaseSize(Player player)
{
DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null) return;
if (creeper == null)
{
return;
}
creeper.a(-1);
Manager.GetDisguise().updateDisguise(creeper);
}
public void IncreaseSize(Player player)
{
DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null) return;
if (creeper == null)
{
return;
}
creeper.a(1);
Manager.GetDisguise().updateDisguise(creeper);
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
event.AddKnockback(GetName(), 2.5);
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
@EventHandler
public void Death(PlayerDeathEvent event)
public void Death(CombatDeathEvent event)
{
if (!Kit.HasKit(event.getEntity()))
if (!(event.GetEvent().getEntity() instanceof Player))
{
return;
_active.remove(event.getEntity());
_super.remove(event.getEntity());
DecreaseSize(event.getEntity());
}
Player player = (Player) event.GetEvent().getEntity();
if (!hasPerk(player))
{
return;
}
_active.remove(player.getUniqueId());
DecreaseSize(player);
}
}

View File

@ -1,12 +1,12 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.creeper;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
@ -15,110 +15,121 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
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.UtilServer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
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.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown
{
public PerkCreeperSulphurBomb()
{
super("Sulphur Bomb", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Sulphur Bomb"
});
}
private static final int COOLDOWN = 3000;
private static final float DAMAGE = 6.5F;
private static final float KNOCKBACK_MAGNITUDE = 2.5F;
public PerkCreeperSulphurBomb()
{
super("Sulphur Bomb", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Sulphur Bomb" });
}
@EventHandler
public void ShootWeb(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
}
Player player = event.getPlayer();
if (isSuperActive(player))
if (!UtilItem.isAxe(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (!Kit.HasKit(player))
if (isSuperActive(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), 3000, true, true))
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
event.setCancelled(true);
UtilInv.Update(player);
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte)0));
Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte) 0));
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true,
null, 1f, 1f,
null, 1, UpdateType.SLOW,
0.65f);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, 0.6f);
//Inform
// Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
//Effect
// Effect
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_DEATH, 2f, 1.5f);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
Explode(data);
if (target == null)
{
return;
//Damage Event
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null,
DamageCause.PROJECTILE, 7, true, true, false,
UtilEnt.getName(data.getThrower()), GetName());
}
// Damage Event
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, DAMAGE, true, true, false, UtilEnt.getName(data.getThrower()), GetName());
}
@Override
public void Idle(ProjectileUser data)
public void Idle(ProjectileUser data)
{
Explode(data);
}
@Override
public void Expire(ProjectileUser data)
public void Expire(ProjectileUser data)
{
Explode(data);
}
public void Explode(ProjectileUser data)
{
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers());
data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f);
data.getThrown().remove();
}
@ -127,8 +138,10 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
event.AddKnockback(GetName(), 2);
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
}

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.smash.perks.creeper;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
import nautilus.game.arcade.kit.Perk;
public class SmashCreeper extends SmashUltimate
{
public SmashCreeper()
{
super("Atomic Blast", new String[] {}, Sound.CREEPER_HISS, 1600);
}
@Override
public void activate(Player player)
{
super.activate(player);
for (Perk perk : Kit.GetPerks())
{
if (!(perk instanceof PerkCreeperExplode))
{
continue;
}
PerkCreeperExplode explode = (PerkCreeperExplode) perk;
explode.IncreaseSize(player);
explode.activate(player);
}
}
}

View File

@ -0,0 +1,102 @@
package nautilus.game.arcade.game.games.smash.perks.enderman;
import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.particles.effects.LineParticle;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkBlink extends SmashPerk
{
private static final float INCREMENTAITON = 0.2F;
private String _name;
private double _range;
private int _recharge;
public PerkBlink(String name, double range, int recharge)
{
super(name, new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + name });
_name = name;
_range = range;
_recharge = recharge;
}
@EventHandler
public void Blink(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
}
Player player = event.getPlayer();
if (!UtilItem.isAxe(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (isSuperActive(player))
{
return;
}
if (!Recharge.Instance.use(player, _name, _recharge, true, true))
{
return;
}
LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTAITON, _range, null, ParticleType.SMOKE, UtilServer.getPlayers());
while (!lineParticle.update())
{
}
// Firework
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f);
player.teleport(lineParticle.getDestination());
player.setFallDistance(0);
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f);
// Firework
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
// Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(_name) + "."));
}
}

View File

@ -1,28 +1,10 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.enderman;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk;
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 java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Effect;
import org.bukkit.block.Block;
@ -35,49 +17,91 @@ import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
import nautilus.game.arcade.kit.perks.data.BlockTossData;
import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent;
import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent;
public class PerkBlockToss extends SmashPerk implements IThrown
{
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>();
private HashMap<FallingBlock, Player> _falling = new HashMap<FallingBlock, Player>();
public PerkBlockToss()
private static final int COOLDOWN = 2000;
private static final int CHARGE_TIME = 1200;
private static final int DAMAGE = 9;
private static final float KNOCKBACK_MAGNITUDE = 2.5F;
private Map<UUID, BlockTossData> _hold = new HashMap<>();
private Set<UUID> _charged = new HashSet<>();
private Map<FallingBlock, UUID> _falling = new HashMap<>();
public PerkBlockToss()
{
super("Block Toss", new String[]
{
C.cYellow + "Hold Block" + C.cGray + " to " + C.cGreen + "Grab Block",
C.cYellow + "Release Block" + C.cGray + " to " + C.cGreen + "Throw Block"
});
super("Block Toss", new String[] { C.cYellow + "Hold Block" + C.cGray + " to " + C.cGreen + "Grab Block", C.cYellow + "Release Block" + C.cGray + " to " + C.cGreen + "Throw Block" });
}
@EventHandler
public void Grab(PlayerInteractEvent event)
{
Player player = event.getPlayer();
{
if (event.isCancelled())
{
return;
}
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
}
Player player = event.getPlayer();
if (!UtilItem.isSword(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (isSuperActive(player))
{
return;
}
if (!Kit.HasKit(player))
return;
if (!UtilGear.isSword(player.getItemInHand()))
return;
if (_hold.containsKey(player))
if (_hold.containsKey(player.getUniqueId()))
{
return;
}
Block grab = event.getClickedBlock();
if (UtilBlock.usable(grab))
return;
if (!Recharge.Instance.usable(player, GetName()))
{
return;
}
if (!UtilBlock.airFoliage(grab.getRelative(BlockFace.UP)) || Manager.GetBlockRestore().contains(grab.getRelative(BlockFace.UP)))
{
@ -85,23 +109,20 @@ public class PerkBlockToss extends SmashPerk implements IThrown
return;
}
//Event
// Event
PerkBlockGrabEvent blockEvent = new PerkBlockGrabEvent(player, grab.getTypeId(), grab.getData());
UtilServer.getServer().getPluginManager().callEvent(blockEvent);
//Block to Data
// Block to Data
int id = grab.getTypeId();
byte data = grab.getData();
//Remove Block
//Manager.GetBlockRestore().Add(event.getClickedBlock(), 0, (byte)0, 10000);
event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, event.getClickedBlock().getType());
_hold.put(player, new BlockTossData(id, data));
_charge.put(player, System.currentTimeMillis());
//Effect
// Remove Block
event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, event.getClickedBlock().getType());
_hold.put(player.getUniqueId(), new BlockTossData(id, data, System.currentTimeMillis()));
// Effect
player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, id);
}
@ -109,104 +130,119 @@ public class PerkBlockToss extends SmashPerk implements IThrown
public void Throw(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
HashSet<Player> throwSet = new HashSet<Player>();
for (Player cur : _hold.keySet())
{
//Throw
if (!cur.isBlocking())
throwSet.add(cur);
return;
}
//Charged Tick
if (!_charged.contains(cur))
if (System.currentTimeMillis() - _charge.get(cur) > 1200)
Set<Player> throwSet = new HashSet<>();
for (UUID key : _hold.keySet())
{
Player player = UtilPlayer.searchExact(key);
if (player == null)
{
continue;
}
// Throw
if (!player.isBlocking())
{
throwSet.add(player);
}
// Charged Tick
if (!_charged.contains(key))
{
if (System.currentTimeMillis() - _hold.get(key).Time > CHARGE_TIME)
{
_charged.add(cur);
cur.playEffect(cur.getLocation(), Effect.CLICK1, 0);
_charged.add(key);
player.getWorld().playEffect(player.getLocation(), Effect.CLICK1, 0);
}
}
}
for (Player cur : throwSet)
{
UUID key = cur.getUniqueId();
Recharge.Instance.recharge(cur, GetName());
Recharge.Instance.use(cur, GetName(), 2000, false, true);
BlockTossData data = _hold.remove(cur);
FallingBlock block = cur.getWorld().spawnFallingBlock(cur.getEyeLocation().add(cur.getLocation().getDirection()), data.Type, data.Data);
_falling.put(block, cur);
_charged.remove(cur);
long charge = System.currentTimeMillis() - _charge.remove(cur);
Recharge.Instance.use(cur, GetName(), COOLDOWN, false, true);
//Throw
double mult = 1.4;
if (charge < 1200)
mult = mult * ((double)charge/1200d);
//Action
BlockTossData data = _hold.remove(key);
FallingBlock block = cur.getWorld().spawnFallingBlock(cur.getEyeLocation().add(cur.getLocation().getDirection()), data.Type, data.Data);
_falling.put(block, key);
_charged.remove(key);
long charge = System.currentTimeMillis() - data.Time;
// Throw
double mult = Math.min(1.4, 1.4 * ((double) charge / CHARGE_TIME));
// Action
UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true);
Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, true,
null, 0, 0, null, 0, UpdateType.FASTEST, 1f);
Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, true, null, 0, 0, null, 0, UpdateType.FASTEST, 1f);
//Event
// Event
PerkBlockThrowEvent blockEvent = new PerkBlockThrowEvent(cur);
UtilServer.getServer().getPluginManager().callEvent(blockEvent);
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target == null)
{
return;
}
//Damage Event
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null,
DamageCause.PROJECTILE, data.getThrown().getVelocity().length() * 10, true, true, false,
UtilEnt.getName(data.getThrower()), GetName());
// Damage Event
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, data.getThrown().getVelocity().length() * DAMAGE, true, true, false, UtilEnt.getName(data
.getThrower()), GetName());
//Block to Item
// Block to Item
if (data.getThrown() instanceof FallingBlock)
{
FallingBlock thrown = (FallingBlock) data.getThrown();
FallingBlock newThrown = data.getThrown().getWorld().spawnFallingBlock(data.getThrown().getLocation(), thrown.getMaterial(), (byte)0);
FallingBlock newThrown = data.getThrown().getWorld().spawnFallingBlock(data.getThrown().getLocation(), thrown.getMaterial(), (byte) 0);
//Remove Old
// Remove Old
_falling.remove(thrown);
thrown.remove();
//Add New
// Add New
if (data.getThrower() instanceof Player)
_falling.put(newThrown, (Player)data.getThrower());
{
_falling.put(newThrown, data.getThrower().getUniqueId());
}
}
}
@Override
public void Idle(ProjectileUser data)
{
}
@Override
public void Expire(ProjectileUser data)
public void Idle(ProjectileUser data)
{
}
}
@Override
public void Expire(ProjectileUser data)
{
}
@EventHandler
public void BlockForm(EntityChangeBlockEvent event)
{
if (!(event.getEntity() instanceof FallingBlock))
{
return;
}
FallingBlock falling = (FallingBlock)event.getEntity();
FallingBlock falling = (FallingBlock) event.getEntity();
falling.getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, falling.getBlockId());
@ -220,8 +256,10 @@ public class PerkBlockToss extends SmashPerk implements IThrown
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
}
event.AddKnockback(GetName(), 2.5);
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
}

View File

@ -1,7 +1,8 @@
package nautilus.game.arcade.game.games.smash.perks;
package nautilus.game.arcade.game.games.smash.perks.enderman;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -12,111 +13,120 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
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.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkEndermanTeleport extends SmashPerk
{
private HashMap<Player, Block> _target = new HashMap<Player, Block>();
private HashMap<Player, Float> _charge = new HashMap<Player, Float>();
public PerkEndermanTeleport()
private static final int COOLDOWN = 5000;
private static final float CHARGE_PER_TICK = 0.015F;
private Map<UUID, Block> _target = new HashMap<>();
private Map<UUID, Float> _charge = new HashMap<>();
public PerkEndermanTeleport()
{
super("Teleport", new String[]
{
C.cYellow + "Hold Sneak" + C.cGray + " to " + C.cGreen + "Teleport"
});
super("Teleport", new String[] { C.cYellow + "Hold Sneak" + C.cGray + " to " + C.cGreen + "Teleport" });
}
@EventHandler
public void update(UpdateEvent event)
{
{
if (event.getType() != UpdateType.TICK)
{
return;
if(!Manager.GetGame().IsLive())
return;
}
for (Player player : UtilServer.getPlayers())
{
if (!Kit.HasKit(player))
if (!hasPerk(player) || UtilPlayer.isSpectator(player))
{
continue;
}
UUID key = player.getUniqueId();
if (!player.isSneaking() || !Recharge.Instance.usable(player, GetName()))
{
_target.remove(player);
_charge.remove(player);
_target.remove(key);
_charge.remove(key);
continue;
}
Block block = player.getTargetBlock((HashSet<Byte>) null, 200);
if (!_target.containsKey(player) || !_charge.containsKey(player))
Block block = UtilPlayer.getTarget(player, UtilBlock.blockPassSet, 100);
if (!_target.containsKey(key) || !_charge.containsKey(key))
{
if (block == null || block.getType() == Material.AIR)
{
continue;
_target.put(player, block);
_charge.put(player, 0f);
}
_target.put(key, block);
_charge.put(key, 0f);
}
//Invalid Block - End
// Invalid Block - End
if (block == null || block.getType() == Material.AIR)
{
_target.remove(player);
_charge.remove(player);
_target.remove(key);
_charge.remove(key);
}
//Same Block - Increase Charge
else if (block.equals(_target.get(player)))
// Same Block - Increase Charge
else if (block.equals(_target.get(key)))
{
_charge.put(player, _charge.get(player) + 0.015f);
UtilTextMiddle.display(null, UtilTextMiddle.progress(_charge.get(player)), 0, 10, 10, player);
if (_charge.get(player) >= 1f)
_charge.put(key, _charge.get(key) + CHARGE_PER_TICK);
UtilTextMiddle.display(null, UtilTextMiddle.progress(_charge.get(key)), 0, 10, 10, player);
if (_charge.get(key) >= 1)
{
UtilTextMiddle.display(null, C.cGreen + "Teleported", 0, 10, 10, player);
Recharge.Instance.useForce(player, GetName(), 5000);
Recharge.Instance.useForce(player, GetName(), COOLDOWN);
while (block.getRelative(BlockFace.UP).getType() != Material.AIR)
{
block = block.getRelative(BlockFace.UP);
}
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 0.5f);
player.teleport(block.getLocation().add(0.5, 1, 0.5).setDirection(player.getLocation().getDirection()));
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 0.5f);
UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0.1f, 100, ViewDist.LONG, UtilServer.getPlayers());
UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0.1f, 100, ViewDist.LONG);
}
else
{
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f + _charge.get(player));
UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0.05f, 10, ViewDist.LONG, UtilServer.getPlayers());
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f + _charge.get(key));
UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0.05f, 10, ViewDist.LONG);
}
}
//New Block - Reset
// New Block - Reset
else
{
_target.put(player, block);
_charge.put(player, 0f);
_target.put(key, block);
_charge.put(key, 0f);
}
}
}
@EventHandler
public void clean(PlayerQuitEvent event)
{
_target.remove(event.getPlayer());
_charge.remove(event.getPlayer());
UUID key = event.getPlayer().getUniqueId();
_target.remove(key);
_charge.remove(key);
}
}

View File

@ -1,184 +1,224 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.enderman;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderDragon;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityExplodeEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
public class PerkEndermanDragon extends SmashPerk
public class SmashEnderman extends SmashUltimate
{
private HashMap<Player, EnderDragon> _dragons = new HashMap<Player, EnderDragon>();
public PerkEndermanDragon()
{
super("Ender Dragon", new String[]
{
}, false);
}
@Override
public void addSuperCustom(Player player)
private static final int DURATION = 30000;
private static final int DRAGON_VELOCITY_MAGNITUDE = 40;
private static final int HIT_COOLDOWN = 1000;
private static final int DAMAGE_RADIUS = 6;
private static final int DAMAGE = 20;
private static final int KNOCKBACK_MAGNITUDE = 4;
private Map<UUID, EnderDragon> _dragons = new HashMap<>();
public SmashEnderman()
{
super("Ender Dragon", new String[] {}, Sound.ENDERDRAGON_GROWL, DURATION);
}
@Override
public void activate(Player player)
{
super.activate(player);
Manager.GetGame().CreatureAllowOverride = true;
EnderDragon dragon = player.getWorld().spawn(player.getLocation().add(0, 5, 0), EnderDragon.class);
UtilEnt.Vegetate(dragon);
Manager.GetGame().CreatureAllowOverride = false;
dragon.setCustomName(C.cYellow + player.getName() + "'s Dragon");
UtilFirework.playFirework(dragon.getLocation(), Type.BALL_LARGE, Color.BLACK, true, true);
_dragons.put(player, dragon);
_dragons.put(player.getUniqueId(), dragon);
}
@Override
public void removeSuperCustom(Player player)
public void cancel(Player player)
{
EnderDragon dragon = _dragons.remove(player);
super.cancel(player);
EnderDragon dragon = _dragons.remove(player.getUniqueId());
if (dragon == null)
{
return;
}
player.leaveVehicle();
dragon.remove();
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : _dragons.keySet())
for (UUID key : _dragons.keySet())
{
EnderDragon dragon = _dragons.get(player);
Player player = UtilPlayer.searchExact(key);
//Mount
if (player == null)
{
continue;
}
EnderDragon dragon = _dragons.get(key);
// Mount
if (dragon.getPassenger() == null || !dragon.getPassenger().equals(player))
{
player.leaveVehicle();
dragon.setPassenger(player);
}
//Move
Location target = player.getLocation().add(player.getLocation().getDirection().multiply(40));
((CraftEnderDragon)dragon).getHandle().setTargetBlock(target.getBlockX(), target.getBlockY(), target.getBlockZ());
// Move
Location target = player.getLocation().add(player.getLocation().getDirection().multiply(DRAGON_VELOCITY_MAGNITUDE));
((CraftEnderDragon) dragon).getHandle().setTargetBlock(target.getBlockX(), target.getBlockY(), target.getBlockZ());
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void explosionBlocks(EntityExplodeEvent event)
{
event.blockList().clear();
}
@EventHandler(priority = EventPriority.LOW)
public void suffocationCancel(CustomDamageEvent event)
{
if (event.GetCause() != DamageCause.SUFFOCATION)
{
return;
}
if (event.GetDamageePlayer() == null)
{
return;
if (isSuperActive(event.GetDamageePlayer()))
}
if (isUsingUltimate(event.GetDamageePlayer()))
{
event.SetCancelled("Enderman Dragon Suffocate");
}
}
@EventHandler(priority = EventPriority.LOW)
public void dragonDamageeCancel(CustomDamageEvent event)
{
if (event.GetDamagerEntity(false) == null)
return;
if (_dragons.values().contains(event.GetDamagerEntity(false)))
event.SetCancelled("Enderman Dragon Damagee");
}
@EventHandler(priority = EventPriority.LOW)
public void dragonDamagerCancel(CustomDamageEvent event)
{
if (event.GetDamagerEntity(false) == null)
{
return;
}
if (!_dragons.values().contains(event.GetDamagerEntity(false)))
{
return;
}
event.SetCancelled("Dragon Damage Cancel");
}
@EventHandler
public void updateDamageAoe(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : _dragons.keySet())
{
EnderDragon dragon = _dragons.get(player);
return;
}
for (UUID key : _dragons.keySet())
{
Player player = UtilPlayer.searchExact(key);
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, dragon.getLocation(), 0, 0, 0, 0, 1,
ViewDist.LONGER, UtilServer.getPlayers());
if (player == null)
{
continue;
}
EnderDragon dragon = _dragons.get(key);
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, dragon.getLocation(), 0, 0, 0, 0, 1, ViewDist.LONGER);
for (Player other : Manager.GetGame().GetPlayers(true))
{
if (other.equals(player))
continue;
if (UtilMath.offset(dragon.getLocation().add(0, 4, 0), other.getLocation()) < 6 && Recharge.Instance.use(other, "Hit By Dragon", 1000, false, false))
{
//Damage Event
Manager.GetDamage().NewDamageEvent(other, player, null,
DamageCause.CUSTOM, 20, true, true, false,
player.getName(), GetName());
continue;
}
if (UtilMath.offset(dragon.getLocation().add(0, 4, 0), other.getLocation()) < DAMAGE_RADIUS && Recharge.Instance.use(other, "Hit By Dragon", HIT_COOLDOWN, false, false))
{
// Damage Event
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, true, false, player.getName(), GetName());
}
}
}
}
@EventHandler
public void knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
}
event.AddKnockback(GetName(), 4);
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
@EventHandler(priority = EventPriority.LOW)
public void voidCancel(CustomDamageEvent event)
{
if (event.GetCause() != DamageCause.VOID)
{
return;
}
Player player = event.GetDamageePlayer();
if (player == null)
{
return;
}
if (!isSuperActive(player))
if (!isUsingUltimate(player))
{
return;
}
event.SetCancelled("Dragon Void Immunity");
event.SetCancelled("Dragon Void Immunity");
}
}

View File

@ -1,16 +1,19 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.golem;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
@ -19,72 +22,87 @@ import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.data.FissureData;
public class PerkFissure extends Perk
{
private HashSet<FissureData> _active = new HashSet<FissureData>();
{
public PerkFissure()
private static final int COOLDOWN = 8000;
private Set<FissureData> _active = new HashSet<>();
public PerkFissure()
{
super("Fissure", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Fissure"
});
super("Fissure", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Fissure" });
}
@EventHandler
public void Leap(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
}
Player player = event.getPlayer();
if (!Kit.HasKit(player))
if (!UtilItem.isAxe(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (!UtilEnt.isGrounded(player))
{
UtilPlayer.message(player, F.main("Game", "You cannot use " + F.skill(GetName()) + " while airborne."));
return;
}
if (!Recharge.Instance.use(player, GetName(), 8000, true, true))
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
FissureData data = new FissureData(this, player, player.getLocation().getDirection(), player.getLocation().add(0, -0.4, 0));
_active.add(data);
//Inform
// Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
HashSet<FissureData> remove = new HashSet<FissureData>();
Set<FissureData> remove = new HashSet<>();
for (FissureData data : _active)
{
if (data.Update())
{
remove.add(data);
}
}
for (FissureData data : remove)
{
_active.remove(data);
data.Clear();
}
}
}
}

View File

@ -0,0 +1,132 @@
package nautilus.game.arcade.game.games.smash.perks.golem;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import nautilus.game.arcade.kit.Perk;
public class PerkIronHook extends Perk implements IThrown
{
private static final int COOLDOWN = 8000;
private static final int DAMAGE = 4;
public PerkIronHook()
{
super("Iron Hook", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Pickaxe to " + C.cGreen + "Iron Hook" });
}
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
}
Player player = event.getPlayer();
if (!UtilItem.isPickaxe(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
// Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(131));
UtilAction.velocity(item, player.getLocation().getDirection(), 1.8, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(item, player, this, -1, true, true, true, true, Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 0.6f);
// Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
// Effect
item.getWorld().playSound(item.getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.8f);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
// Remove
double velocity = data.getThrown().getVelocity().length();
data.getThrown().remove();
if (!(data.getThrower() instanceof Player))
{
return;
}
Player player = (Player) data.getThrower();
if (target == null)
{
return;
}
// Pull
UtilAction.velocity(target, UtilAlg.getTrajectory(target.getLocation(), player.getLocation()), 2, false, 0, 0.8, 1.5, true);
// Condition
Manager.GetCondition().Factory().Falling(GetName(), target, player, 10, false, true);
// Damage Event
Manager.GetDamage().NewDamageEvent(target, player, null, DamageCause.CUSTOM, velocity * DAMAGE, false, true, false, player.getName(), GetName());
// Inform
UtilPlayer.message(target, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + "."));
}
@Override
public void Idle(ProjectileUser data)
{
data.getThrown().remove();
}
@Override
public void Expire(ProjectileUser data)
{
data.getThrown().remove();
}
}

View File

@ -0,0 +1,192 @@
package nautilus.game.arcade.game.games.smash.perks.golem;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Effect;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
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.kit.Perk;
public class PerkSeismicSlam extends Perk
{
private static final int COOLDOWN = 7000;
private static final int TIME = 1000;
private static final int DAMAGE = 10;
private static final int RADIUS = 8;
private static final float KNOCKBACK_MAGNITUDE = 2.4F;
private Map<LivingEntity, Long> _live = new HashMap<>();
public PerkSeismicSlam()
{
super("Seismic Slam", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Seismic Slam" });
}
@EventHandler
public void deactivateDeath(PlayerDeathEvent event)
{
Player player = event.getEntity();
if (!hasPerk(player))
{
return;
}
if (_live.containsKey(player))
{
_live.remove(player);
}
}
@EventHandler
public void Leap(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
}
Player player = event.getPlayer();
if (!UtilItem.isSpade(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
return;
// Action
Vector vec = player.getLocation().getDirection();
if (vec.getY() < 0)
{
vec.setY(vec.getY() * -1);
}
UtilAction.velocity(player, vec, 1, true, 1, 0, 1, true);
// Record
_live.put(player, System.currentTimeMillis());
// Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void Slam(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!UtilEnt.isGrounded(player))
{
continue;
}
if (!_live.containsKey(player))
{
continue;
}
if (!UtilTime.elapsed(_live.get(player), TIME))
{
continue;
}
_live.remove(player);
// Action
Map<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), RADIUS);
for (LivingEntity cur : targets.keySet())
{
if (cur.equals(player))
{
continue;
}
if (cur instanceof Player && !UtilPlayer.isSpectator(cur))
{
continue;
}
// Damage Event
Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE * targets.get(cur) + 0.5, true, true, false, player.getName(), GetName());
// Condition
Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true);
// Inform
if (cur instanceof Player)
UtilPlayer.message((Player) cur, F.main("Game", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + "."));
}
// Effect
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f);
for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4).keySet())
{
if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur))
{
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getType());
}
}
}
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
}

View File

@ -0,0 +1,120 @@
package nautilus.game.arcade.game.games.smash.perks.golem;
import java.util.List;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
public class SmashGolem extends SmashUltimate
{
private static final int DURATION = 16000;
private static final int HIT_FREQUENCY = 400;
private static final int DAMAGE_RADIUS = 2;
private static final int EFFECT_RADIUS = 5;
public SmashGolem()
{
super("Earthquake", new String[] {}, Sound.IRONGOLEM_HIT, DURATION);
}
@Override
public void activate(Player player)
{
super.activate(player);
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
{
return;
}
List<Player> alivePlayers = Manager.GetGame().GetPlayers(true);
for (Player player : alivePlayers)
{
if (!isUsingUltimate(player))
{
continue;
}
List<Player> team = TeamSuperSmash.getTeam(Manager, player, true);
for (Player other : alivePlayers)
{
if (player.equals(other) || UtilPlayer.isSpectator(other) || team.contains(other))
{
continue;
}
other.playSound(other.getLocation(), Sound.MINECART_BASE, 0.2f, 0.2f);
boolean grounded = false;
for (Block block : UtilBlock.getInRadius(other.getLocation(), DAMAGE_RADIUS).keySet())
{
if (block.getType() != Material.AIR)
{
grounded = true;
break;
}
}
if (!grounded)
{
continue;
}
// Damage Event
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, 1 + 2 * Math.random(), false, false, false, other.getName(), GetName());
// Velocity
if (Recharge.Instance.use(other, GetName() + " Hit", HIT_FREQUENCY, false, false))
{
UtilAction.velocity(other, new Vector(Math.random() - 0.5, Math.random() * 0.2, Math.random() - 0.5), Math.random() * 1 + 1, false, 0, 0.1 + Math.random() * 0.2, 2, true);
}
// Effect
for (Block block : UtilBlock.getInRadius(other.getLocation(), EFFECT_RADIUS).keySet())
{
if (Math.random() < 0.98)
{
continue;
}
if (!UtilBlock.solid(block))
{
continue;
}
if (!UtilBlock.airFoliage(block.getRelative(BlockFace.UP)))
{
continue;
}
other.playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
}
}
}
}
}

View File

@ -0,0 +1,269 @@
package nautilus.game.arcade.game.games.smash.perks.guardian;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseGuardian;
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.smash.perks.SmashPerk;
public class PerkTargetLazer extends SmashPerk
{
private static final int COOLDOWN = 15000;
private static final int MAX_RANGE = 11;
private static final int MAX_TIME = 8000;
private static final int DAMAGE_INCREASE = 3;
private static final int KNOCKBACK_INCREASE = 1;
private Set<TargetLazerData> _data = new HashSet<>();
public PerkTargetLazer()
{
super("Target Laser", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Pickaxe to use " + C.cGreen + "Target Laser" });
}
@EventHandler
public void activate(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
}
Player player = event.getPlayer();
if (!UtilItem.isPickaxe(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (!UtilEnt.isGrounded(player))
{
player.sendMessage(F.main("Game", "You must be on the ground to use " + F.skill(GetName())) + ".");
return;
}
if (!Recharge.Instance.usable(player, GetName()))
{
return;
}
Player best = null;
double bestD = Double.MAX_VALUE;
for (Player other : UtilServer.getPlayers())
{
if (player.equals(other) || UtilPlayer.isSpectator(other) || isTeamDamage(player, other))
{
continue;
}
double d = UtilMath.offset(player, other);
if (d > MAX_RANGE)
{
continue;
}
if (best == null || d < bestD)
{
best = other;
bestD = d;
}
}
boolean contained = false;
for (TargetLazerData data : _data)
{
if (data.getAttacker().equals(player))
{
if (data.getTimeElapsed() < MAX_TIME)
{
return;
}
contained = true;
data.setTarget(best);
}
}
if (best == null)
{
player.sendMessage(F.main("Game", "There are no targets within range."));
return;
}
player.sendMessage(F.main("Game", "You targeted " + F.name(best.getName())) + " with " + F.skill(GetName()) + ".");
best.sendMessage(F.main("Game", F.name(player.getName()) + " targeted you with their " + F.skill(GetName()) + "."));
if (!contained)
{
TargetLazerData data = new TargetLazerData(player);
_data.add(data);
data.setTarget(best);
}
setLazerTarget(player, best);
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK)
{
for (TargetLazerData data : _data)
{
data.update(Manager);
}
}
if (event.getType() != UpdateType.FASTER)
{
return;
}
Iterator<TargetLazerData> iterator = _data.iterator();
while (iterator.hasNext())
{
TargetLazerData data = iterator.next();
if (data.getTarget() == null)
{
continue;
}
UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT, data.getTarget().getLocation().add(0, 0.5, 0.5), 1F, 0.5F, 1F, 0.1F, 10, ViewDist.LONG, data.getAttacker());
if (UtilMath.offset(data.getTarget(), data.getAttacker()) > MAX_RANGE || data.getTimeElapsed() > MAX_TIME)
{
long time = data.getTimeElapsed() / 1000;
double damage = 0.5 * time;
ArmorStand targetPlaceholder = data.update(Manager);
targetPlaceholder.remove();
setLazerTarget(data.getAttacker(), null);
data.getAttacker().sendMessage(F.main("Game", "Your laser broke, dealing damage to " + F.name(data.getTarget().getName())) + ".");
Manager.GetDamage().NewDamageEvent(data.getTarget(), data.getAttacker(), null, DamageCause.CUSTOM, damage, false, true, false, data.getAttacker().getName(), GetName());
Recharge.Instance.use(data.getAttacker(), GetName(), COOLDOWN, true, true);
iterator.remove();
}
}
}
@EventHandler
public void damage(CustomDamageEvent event)
{
if (event.GetDamagerPlayer(true) == null || event.GetDamageePlayer() == null)
{
return;
}
Player damager = event.GetDamagerPlayer(true);
Player damagee = event.GetDamageePlayer();
for (TargetLazerData data : _data)
{
if (data.getTarget() == null)
{
continue;
}
if (data.getAttacker().equals(damager) && data.getTarget().equals(damagee))
{
event.AddMod(GetName(), DAMAGE_INCREASE);
event.AddKnockback(GetName(), KNOCKBACK_INCREASE);
data.getAttacker().playEffect(damagee.getLocation().add(0, 0.5, 0), Effect.STEP_SOUND, Material.REDSTONE_BLOCK);
}
}
}
@EventHandler
public void death(PlayerDeathEvent event)
{
Player player = event.getEntity();
Iterator<TargetLazerData> iterator = _data.iterator();
while (iterator.hasNext())
{
TargetLazerData data = iterator.next();
if (data.getTarget().equals(player) || data.getAttacker().equals(player))
{
iterator.remove();
}
}
}
private void setLazerTarget(Player disguised, Player target)
{
DisguiseManager disguiseManager = Manager.GetDisguise();
DisguiseGuardian disguise = (DisguiseGuardian) disguiseManager.getActiveDisguise(disguised);
for (TargetLazerData data : _data)
{
if (data.getAttacker().equals(disguised))
{
if (target == null)
{
disguise.setTarget(0);
}
else
{
disguise.setTarget(data.update(Manager).getEntityId());
}
disguiseManager.updateDisguise(disguise);
}
}
}
}

View File

@ -0,0 +1,47 @@
package nautilus.game.arcade.game.games.smash.perks.guardian;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.C;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkThorns extends Perk
{
private static final int MAX_HEALTH = 10;
private static final float DAMAGE_DECREASE = 0.66F;
private static final float KNOCKBACK_DECREASE = 0.66F;
public PerkThorns()
{
super("Thorns", new String[] { C.cGray + "Takes 66% less damage and knockback from projectiles", C.cGray + "when under 10 health."});
}
@EventHandler(priority = EventPriority.HIGHEST)
public void damage(CustomDamageEvent event)
{
if (event.GetDamagerPlayer(true) == null || event.GetCause() == DamageCause.ENTITY_ATTACK)
{
return;
}
Player player = event.GetDamageePlayer();
if (!hasPerk(player))
{
return;
}
if (player.getHealth() < MAX_HEALTH)
{
event.AddMult(GetName(), null, DAMAGE_DECREASE, false);
event.AddKnockback(GetName(), KNOCKBACK_DECREASE);
}
}
}

View File

@ -0,0 +1,193 @@
package nautilus.game.arcade.game.games.smash.perks.guardian;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Effect;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
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.UtilTime;
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.smash.TeamSuperSmash;
import nautilus.game.arcade.kit.Perk;
public class PerkWaterSplash extends Perk
{
private static final int COOLDOWN = 12000;
private static final int VELOCITY_Y = 1;
private static final int RADIUS = 5;
private static final int MIN_AIR_TIME = 750;
private static final int SECOND_BOOST_TIME = 800;
private static final int DAMAGE = 12;
private Map<UUID, Long> _active = new HashMap<>();
private Set<UUID> _usedSecondBoost = new HashSet<>();
public PerkWaterSplash()
{
super("Water Splash", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Sword to use " + C.cGreen + "Water Splash", C.cYellow + "Hold Block" + C.cGray + " to " + C.cGreen + "Bounce higher with Water Splash" });
}
@EventHandler
public void activate(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
}
Player player = event.getPlayer();
if (!UtilItem.isSword(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
UtilAction.velocity(player, new Vector(0, VELOCITY_Y, 0));
_active.put(player.getUniqueId(), System.currentTimeMillis());
List<Player> team = TeamSuperSmash.getTeam(Manager, player, true);
for (Player other : UtilPlayer.getNearby(player.getLocation(), RADIUS))
{
if (team.contains(other))
{
continue;
}
UtilAction.velocity(other, UtilAlg.getTrajectory(other, player).setY(0.5));
}
}
@EventHandler
public void damage(CustomDamageEvent event)
{
if (_active.containsKey(event.GetDamageeEntity().getUniqueId()))
{
event.SetKnockback(false);
}
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<UUID> iterator = _active.keySet().iterator();
while (iterator.hasNext())
{
UUID uuid = iterator.next();
Player player = UtilPlayer.searchExact(uuid);
if (player == null)
{
continue;
}
if (UtilPlayer.isSpectator(player))
{
iterator.remove();
_usedSecondBoost.remove(uuid);
continue;
}
UtilParticle.PlayParticleToAll(ParticleType.DRIP_WATER, player.getLocation(), 0.5F, 0.5F, 0.5F, 0.01F, 10, ViewDist.LONG);
if (UtilEnt.isGrounded(player) && UtilTime.elapsed(_active.get(uuid), MIN_AIR_TIME))
{
iterator.remove();
_usedSecondBoost.remove(uuid);
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, player.getEyeLocation(), 0, 0, 0, 0.5F, 50, ViewDist.LONG);
for (Block block : UtilBlock.getInRadius(player.getLocation(), RADIUS).keySet())
{
if (Math.random() > 0.5)
{
continue;
}
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
}
player.getWorld().playSound(player.getLocation(), Sound.SPLASH2, 2, 0);
Map<Player, Double> nearby = UtilPlayer.getInRadius(player.getLocation(), RADIUS);
List<Player> team = TeamSuperSmash.getTeam(Manager, player, true);
for (Player other : nearby.keySet())
{
if (team.contains(other))
{
continue;
}
double power = nearby.get(other);
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE * power, true, true, false, player.getName(), GetName());
Manager.GetCondition().Factory().Falling(GetName(), other, player, DAMAGE, false, true);
}
}
else if (UtilTime.elapsed(_active.get(uuid), SECOND_BOOST_TIME) && !_usedSecondBoost.contains(uuid) && player.isBlocking())
{
_usedSecondBoost.add(uuid);
Vector direction = player.getLocation().getDirection().setY(0.2);
UtilAction.velocity(player, direction);
}
}
}
}

View File

@ -0,0 +1,153 @@
package nautilus.game.arcade.game.games.smash.perks.guardian;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkWhirlpoolBlade extends Perk implements IThrown
{
private static final int COOLDOWN = 5000;
private static final int EXPIRE_TIME = 3000;
private static final float VELOCITY = 1.6F;
private static final float HIT_BOX = 0.5F;
private static final int DAMAGE = 5;
private Set<Item> _items = new HashSet<>();
public PerkWhirlpoolBlade()
{
super("Whirlpool Axe", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Whirlpool Axe" });
}
@EventHandler
public void activate(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
}
Player player = event.getPlayer();
if (!UtilItem.isAxe(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
player.playSound(player.getLocation(), Sound.DIG_SNOW, 1, 1);
Item item = player.getWorld().dropItem(player.getEyeLocation(), new ItemStack(Material.PRISMARINE_SHARD));
item.setVelocity(player.getLocation().getDirection().multiply(VELOCITY));
Manager.GetProjectile().AddThrow(item, player, this, EXPIRE_TIME, true, true, true, false, false, HIT_BOX);
_items.add(item);
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<Item> iterator = _items.iterator();
while (iterator.hasNext())
{
Item item = iterator.next();
if (!item.isValid())
{
iterator.remove();
continue;
}
UtilParticle.PlayParticleToAll(ParticleType.DRIP_WATER, item.getLocation(), 0, 0, 0, 0.01F, 1, ViewDist.LONG);
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (!UtilBlock.airFoliage(block))
{
data.getThrown().remove();
}
if (target == null)
{
return;
}
CustomDamageEvent event = Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, DAMAGE, false, true, true, data.getThrower().getName(), GetName());
if(event.IsCancelled())
{
return;
}
UtilAction.velocity(target, UtilAlg.getTrajectory(target, data.getThrower()).setY(0.5));
}
@Override
public void Idle(ProjectileUser data)
{
data.getThrown().remove();
}
@Override
public void Expire(ProjectileUser data)
{
data.getThrown().remove();
}
}

View File

@ -0,0 +1,194 @@
package nautilus.game.arcade.game.games.smash.perks.guardian;
import java.util.List;
import java.util.Map;
import java.util.Random;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.util.Vector;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.particles.effects.LineParticle;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseGuardian;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
public class SmashAnimationData
{
private static final double THETA_INCREMENTATION = Math.PI / 20;
private static final int RADIUS = 3;
private static final int DAMAGE_RADIUS = 11;
private static final int VELOCITY_DAMAGE = 2;
private static final int Y_INCREASE = 7;
private ArcadeManager _manager;
private Player _player;
private ArmorStand _elder;
private ArmorStand[] _guardians;
private ArmorStand _target;
private double _lastTheta;
private double _thetaSpacing;
private int _blockRadius;
private int _duration;
private int _ticks;
public SmashAnimationData(ArcadeManager manager, Player player, int guardians, int duration)
{
_manager = manager;
_player = player;
_thetaSpacing = 2 * Math.PI / guardians;
_duration = duration;
DisguiseManager disguiseManager = manager.GetDisguise();
Location location = player.getLocation().add(0, Y_INCREASE, 0);
ArmorStand target = player.getWorld().spawn(player.getLocation(), ArmorStand.class);
target.setArms(false);
target.setSmall(true);
target.setBasePlate(false);
target.setGravity(false);
target.setVisible(false);
_target = target;
_elder = player.getWorld().spawn(location, ArmorStand.class);
_elder.setGravity(false);
DisguiseGuardian disguiseElder = new DisguiseGuardian(_elder);
disguiseElder.setElder(true);
disguiseElder.setTarget(target.getEntityId());
disguiseManager.disguise(disguiseElder);
_guardians = new ArmorStand[guardians];
for (int i = 0; i < guardians; i++)
{
ArmorStand guardian = player.getWorld().spawn(location, ArmorStand.class);
guardian.setGravity(false);
DisguiseGuardian disguise = new DisguiseGuardian(guardian);
disguise.setTarget(target.getEntityId());
disguiseManager.disguise(disguise);
_guardians[i] = guardian;
}
}
@SuppressWarnings("deprecation")
public void update()
{
_ticks++;
if (_ticks % 10 == 0)
{
_blockRadius++;
BlockRestore blockRestore = _manager.GetBlockRestore();
Map<Block, Double> inRadius = UtilBlock.getInRadius(_target.getLocation().getBlock(), _blockRadius, true);
Random random = new Random();
for (Block block : inRadius.keySet())
{
if (blockRestore.contains(block) || UtilBlock.airFoliage(block) || UtilBlock.liquid(block))
{
continue;
}
blockRestore.add(block, Material.PRISMARINE.getId(), (byte) random.nextInt(3), (long) (_duration + 5000 * Math.random()));
}
List<Player> team = TeamSuperSmash.getTeam(_manager, _player, true);
for (Player player : UtilPlayer.getNearby(_target.getLocation(), DAMAGE_RADIUS))
{
if (team.contains(player))
{
continue;
}
double offset = UtilMath.offset(_target, player);
Vector vector = UtilAlg.getTrajectory(player, _target);
if (offset < DAMAGE_RADIUS / 3)
{
continue;
}
LineParticle lineParticle = new LineParticle(player.getEyeLocation(), _target.getEyeLocation(), vector, 0.2, offset, null, ParticleType.WITCH_MAGIC, UtilServer.getPlayers());
while (!lineParticle.update())
{
}
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_REMEDY, 1, 0.75F);
UtilAction.velocity(player, vector.setY(player.getLocation().getY() - 3 > _target.getLocation().getY() ? 0 : 0.5).multiply(0.5));
_manager.GetDamage().NewDamageEvent(player, _player, null, DamageCause.CUSTOM, VELOCITY_DAMAGE, false, true, false, _player.getName(), "Mini Guardian");
}
}
Location center = _target.getLocation().add(0, Y_INCREASE, 0);
int i = 0;
//Teleport the elder guardian around in a circle
{
double x = Math.cos(_lastTheta);
double z = Math.sin(_lastTheta);
center.add(x, 0, z);
_elder.teleport(center);
center.subtract(x, 0, z);
}
//Teleport all guardians around in a circle
for (ArmorStand guardian : _guardians)
{
double theta = _lastTheta + _thetaSpacing * i++;
double x = RADIUS * Math.cos(theta);
double z = RADIUS * Math.sin(theta);
center.add(x, 0, z);
guardian.teleport(center);
center.subtract(x, 0, z);
}
_lastTheta += THETA_INCREMENTATION;
}
public Player getPlayer()
{
return _player;
}
public ArmorStand getElder()
{
return _elder;
}
public ArmorStand[] getGuardians()
{
return _guardians;
}
public ArmorStand getTarget()
{
return _target;
}
}

View File

@ -0,0 +1,123 @@
package nautilus.game.arcade.game.games.smash.perks.guardian;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.Sound;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
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.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
public class SmashGuardian extends SmashUltimate
{
private static final int DURATION = 10000;
private static final int GUARDIANS = 4;
private static final int RADIUS = 15;
private static final int DAMAGE = 40;
private Set<SmashAnimationData> _data = new HashSet<>();
public SmashGuardian()
{
super("Rise of the Guardian", new String[] {}, Sound.AMBIENCE_THUNDER, DURATION);
}
@Override
public void activate(Player player)
{
super.activate(player);
Manager.GetGame().CreatureAllowOverride = true;
_data.add(new SmashAnimationData(Manager, player, GUARDIANS, DURATION));
Manager.GetGame().CreatureAllowOverride = false;
}
@Override
public void cancel(Player player)
{
super.cancel(player);
Iterator<SmashAnimationData> iterator = _data.iterator();
while (iterator.hasNext())
{
SmashAnimationData data = iterator.next();
if (data.getPlayer().equals(player))
{
Map<Player, Double> inRadius = UtilPlayer.getInRadius(data.getTarget().getLocation(), RADIUS);
List<Player> team = TeamSuperSmash.getTeam(Manager, player, true);
for (Player other : inRadius.keySet())
{
if (team.contains(other))
{
continue;
}
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE * inRadius.get(other), true, true, false, player.getName(), GetName());
}
data.getTarget().getWorld().strikeLightningEffect(data.getTarget().getLocation());
UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, data.getTarget().getLocation().add(0, 2, 0), RADIUS, 1, RADIUS, 1F, 30, ViewDist.MAX);
player.getWorld().playSound(data.getTarget().getLocation(), Sound.EXPLODE, 5, 0.5F);
data.getElder().remove();
data.getTarget().remove();
for (ArmorStand guardian : data.getGuardians())
{
guardian.remove();
}
iterator.remove();
}
}
}
@Override
public boolean isUsable(Player player)
{
boolean grounded = UtilEnt.isGrounded(player);
if (!grounded)
{
player.sendMessage(F.main("Game", "You need to be on the ground to use " + F.skill(GetName()) + "."));
}
return grounded;
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (SmashAnimationData data : _data)
{
data.update();
}
}
}

View File

@ -0,0 +1,65 @@
package nautilus.game.arcade.game.games.smash.perks.guardian;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import mineplex.core.common.util.UtilEnt;
import nautilus.game.arcade.ArcadeManager;
public class TargetLazerData
{
private Player _attacker;
private Player _target;
private long _startTime;
private ArmorStand _targetPlaceholder;
public TargetLazerData(Player attacker)
{
_attacker = attacker;
}
public void setTarget(Player target)
{
_target = target;
_startTime = System.currentTimeMillis();
}
public ArmorStand update(ArcadeManager manager)
{
if (_targetPlaceholder == null || !_targetPlaceholder.isValid())
{
manager.GetGame().CreatureAllowOverride = true;
_targetPlaceholder = _target.getWorld().spawn(_target.getLocation(), ArmorStand.class);
_targetPlaceholder.setArms(false);
_targetPlaceholder.setSmall(true);
_targetPlaceholder.setBasePlate(false);
_targetPlaceholder.setGravity(false);
_targetPlaceholder.setVisible(false);
UtilEnt.ghost(_targetPlaceholder, true, true);
manager.GetGame().CreatureAllowOverride = false;
}
_targetPlaceholder.teleport(_target.getLocation().add(0, 0.25, 0));
return _targetPlaceholder;
}
public Player getAttacker()
{
return _attacker;
}
public Player getTarget()
{
return _target;
}
public long getTimeElapsed()
{
return System.currentTimeMillis() - _startTime;
}
}

View File

@ -1,12 +1,12 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.magmacube;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
@ -15,13 +15,16 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -31,38 +34,48 @@ import nautilus.game.arcade.kit.perks.data.FireflyData;
public class PerkFlameDash extends Perk
{
private HashSet<FireflyData> _data = new HashSet<FireflyData>();
private static final int COOLDOWN = 8000;
private static final int TIME = 800;
private static final int DAMAGE_RADIUS = 3;
private static final int KNOCKBACK_MAGNITUDE = 2;
private Set<FireflyData> _data = new HashSet<FireflyData>();
public PerkFlameDash()
public PerkFlameDash()
{
super("Flame Dash", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Flame Dash"
});
super("Flame Dash", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Flame Dash" });
}
@EventHandler
public void Skill(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE"))
return;
}
Player player = event.getPlayer();
if (!Kit.HasKit(player))
if (!UtilItem.isSpade(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (!Recharge.Instance.usable(player, GetName()))
{
@ -75,7 +88,7 @@ public class PerkFlameDash extends Perk
done = true;
}
}
if (done)
{
UtilPlayer.message(player, F.main("Skill", "You ended " + F.skill(GetName()) + "."));
@ -83,18 +96,18 @@ public class PerkFlameDash extends Perk
}
else
{
Recharge.Instance.use(player, GetName(), 8000, true, true);
Recharge.Instance.use(player, GetName(), COOLDOWN, true, true);
}
return;
}
Recharge.Instance.useForce(player, GetName(), 8000);
Recharge.Instance.recharge(player, GetName());
Recharge.Instance.use(player, GetName(), COOLDOWN, true, true);
_data.add(new FireflyData(player));
Manager.GetCondition().Factory().Cloak(GetName(), player, player, 2.5, false, false);
//Manager.GetCondition().Factory().Invisible(getName(), player, player, 2.5, 0, false, false, true);
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@ -116,9 +129,8 @@ public class PerkFlameDash extends Perk
{
FireflyData data = dataIterator.next();
//Move
if (!UtilTime.elapsed(data.Time, 800))
// Move
if (!UtilTime.elapsed(data.Time, TIME))
{
Vector vel = data.Location.getDirection();
vel.setY(0);
@ -126,58 +138,59 @@ public class PerkFlameDash extends Perk
vel.setY(0.05);
UtilAction.velocity(data.Player, vel);
//Sound
// Sound
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.FIZZ, 0.6f, 1.2f);
//Particles
UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation().add(0, 0.4, 0), 0.2f, 0.2f, 0.2f, 0f, 3,
ViewDist.LONGER, UtilServer.getPlayers());
// Particles
UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation().add(0, 0.4, 0), 0.2f, 0.2f, 0.2f, 0f, 3, ViewDist.LONGER, UtilServer.getPlayers());
}
//End
// End
else
{
for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), 3))
for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), DAMAGE_RADIUS))
{
if (other.equals(data.Player))
{
continue;
if (!Manager.GetGame().IsAlive(other))
continue;
}
double dist = UtilMath.offset(data.Player.getLocation(), data.Location)/2d;
if (UtilPlayer.isSpectator(other))
{
continue;
}
double dist = UtilMath.offset(data.Player.getLocation(), data.Location) / 2;
//Damage Event
Manager.GetDamage().NewDamageEvent(other, data.Player, null,
DamageCause.CUSTOM, 2 + dist, true, true, false,
data.Player.getName(), GetName());
// Damage Event
Manager.GetDamage().NewDamageEvent(other, data.Player, null, DamageCause.CUSTOM, 2 + dist, true, true, false, data.Player.getName(), GetName());
UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(data.Player) + data.Player.getName()) + " hit you with " + F.elem(GetName()) + "."));
}
//End Invisible
// End Invisible
Manager.GetCondition().EndCondition(data.Player, null, GetName());
//Sound
// Sound
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 1f, 1.2f);
//Particles
UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation(), 0.1f, 0.1f, 0.1f, 0.3f, 100,
ViewDist.MAX, UtilServer.getPlayers());
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Player.getLocation().add(0, 0.4, 0), 0.2f, 0.2f, 0.2f, 0f, 1,
ViewDist.MAX, UtilServer.getPlayers());
// Particles
UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation(), 0.1f, 0.1f, 0.1f, 0.3f, 100, ViewDist.MAX, UtilServer.getPlayers());
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Player.getLocation().add(0, 0.4, 0), 0.2f, 0.2f, 0.2f, 0f, 1, ViewDist.MAX, UtilServer.getPlayers());
dataIterator.remove();
}
}
}
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
event.AddKnockback(GetName(), 2);
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
}

View File

@ -1,7 +1,11 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.magmacube;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import net.minecraft.server.v1_8_R3.EntityLargeFireball;
import org.bukkit.Location;
import org.bukkit.Sound;
@ -10,7 +14,7 @@ import org.bukkit.entity.LargeFireball;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
@ -20,109 +24,125 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.kit.Perk;
import net.minecraft.server.v1_8_R3.EntityLargeFireball;
public class PerkMagmaBlast extends Perk
{
public HashMap<LargeFireball, Location> _proj = new HashMap<LargeFireball, Location>();
public PerkMagmaBlast()
{
super("Magma Blast", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Magma Blast"
});
}
private static final int COOLDOWN = 6000;
private static final float FIREBALL_VELOCITY = 0.2F;
private static final int FIRE_TICKS = 40;
private static final int VELOCITY_RADIUS = 8;
private static final int FIRE_RADIUS = 2;
private static final int DAMAGE = 8;
private Map<LargeFireball, Location> _proj = new HashMap<>();
public PerkMagmaBlast()
{
super("Magma Blast", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Magma Blast" });
}
@EventHandler
public void Shoot(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
}
Player player = event.getPlayer();
if (!Kit.HasKit(player))
if (!UtilItem.isAxe(player.getItemInHand()))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), 6000, true, true))
if (!hasPerk(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
event.setCancelled(true);
//Action
// Action
LargeFireball ball = player.launchProjectile(LargeFireball.class);
ball.setShooter(player);
ball.setIsIncendiary(false);
ball.setIsIncendiary(false);
ball.setYield(0);
ball.setBounce(false);
ball.teleport(player.getEyeLocation().add(player.getLocation().getDirection().multiply(1)));
//ball.setVelocity(new Vector(0,0,0));
Vector dir = player.getLocation().getDirection().multiply(0.2);
Vector dir = player.getLocation().getDirection().multiply(FIREBALL_VELOCITY);
EntityLargeFireball eFireball = ((CraftLargeFireball) ball).getHandle();
eFireball.dirX = dir.getX();
eFireball.dirY = dir.getY();
eFireball.dirZ = dir.getZ();
//Knockback
// Knockback
UtilAction.velocity(player, player.getLocation().getDirection().multiply(-1), 1.2, false, 0, 0.2, 1.2, true);
//Add
// Add
_proj.put(ball, player.getLocation());
//Inform
// Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
//Effect
// Effect
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_DEATH, 2f, 1.5f);
}
@EventHandler
public void Update(UpdateEvent event)
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
Iterator<LargeFireball> projIterator = _proj.keySet().iterator();
}
Iterator<LargeFireball> projIterator = _proj.keySet().iterator();
while (projIterator.hasNext())
{
LargeFireball proj = projIterator.next();
if (!proj.isValid())
{
projIterator.remove();
proj.remove();
continue;
}
// proj.setDirection(_proj.get(proj).clone().getDirection());
// proj.setVelocity(_proj.get(proj).clone().getDirection().multiply(0.6));
}
}
@ -130,29 +150,81 @@ public class PerkMagmaBlast extends Perk
public void Collide(ProjectileHitEvent event)
{
Projectile proj = event.getEntity();
if (!_proj.containsKey(proj))
{
return;
if (proj.getShooter() == null)
return;
if (!(proj.getShooter() instanceof Player))
return;
//Velocity Players
HashMap<Player,Double> hitMap = UtilPlayer.getInRadius(proj.getLocation(), 8);
for (Player cur : hitMap.keySet())
{
double range = hitMap.get(cur);
//Velocity
UtilAction.velocity(cur, UtilAlg.getTrajectory(proj.getLocation().add(0, -0.5, 0), cur.getEyeLocation()),
1 + 2 * range, false, 0, 0.2 + 0.4 * range, 1.2, true);
}
//Particles
UtilParticle.PlayParticle(ParticleType.LAVA, proj.getLocation(), 0.1f, 0.1f, 0.1f, 0.1f, 50,
ViewDist.LONG, UtilServer.getPlayers());
if (proj.getShooter() == null)
{
return;
}
if (!(proj.getShooter() instanceof Player))
{
return;
}
Player shooter = (Player) proj.getShooter();
// Velocity Players
Map<Player, Double> hitMap = UtilPlayer.getInRadius(proj.getLocation(), VELOCITY_RADIUS);
List<Player> team = TeamSuperSmash.getTeam(Manager, shooter, false);
for (Player cur : hitMap.keySet())
{
if(team.contains(cur))
{
{
continue;
}
}
double range = hitMap.get(cur);
Manager.GetDamage().NewDamageEvent(cur, shooter, proj, DamageCause.PROJECTILE, range * DAMAGE, false, true, false, shooter.getName(), GetName());
// Velocity
UtilAction.velocity(cur, UtilAlg.getTrajectory(proj.getLocation().add(0, -0.5, 0), cur.getEyeLocation()), 1 + 2 * range, false, 0, 0.2 + 0.4 * range, 1.2, true);
}
// Particles
UtilParticle.PlayParticleToAll(ParticleType.LAVA, proj.getLocation(), 0.1f, 0.1f, 0.1f, 0.1f, 50, ViewDist.LONG);
}
@EventHandler
public void damage(CustomDamageEvent event)
{
if (event.GetProjectile() == null || event.GetDamageeEntity() == null)
{
return;
}
Projectile proj = event.GetProjectile();
if (!(proj instanceof LargeFireball))
{
return;
}
if (!_proj.containsKey(proj))
{
return;
}
Player player = event.GetDamageePlayer();
if(proj.getShooter() instanceof Player)
{
Player shooter = (Player) proj.getShooter();
if(TeamSuperSmash.getTeam(Manager, shooter, true).contains(player))
{
return;
}
}
if (UtilMath.offset(player, proj) < FIRE_RADIUS)
{
player.setFireTicks(FIRE_TICKS);
}
}
}

View File

@ -0,0 +1,181 @@
package nautilus.game.arcade.game.games.smash.perks.magmacube;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.C;
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.UtilServer;
import mineplex.core.disguise.disguises.DisguiseMagmaCube;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkMagmaBoost extends Perk
{
private static final int MAX_STACKS = 3;
private Map<UUID, Integer> _kills = new HashMap<>();
public PerkMagmaBoost()
{
super("Fuel the Fire", new String[] { C.cGray + "Kills give +1 Damage, -15% Knockback Taken and +1 Size.", C.cGray + "Kill bonuses can stack " + MAX_STACKS + " times, and reset on death.", });
}
@EventHandler
public void kill(CombatDeathEvent event)
{
Player killed = (Player) event.GetEvent().getEntity();
_kills.remove(killed.getUniqueId());
if (event.GetLog().GetKiller() == null)
{
return;
}
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (killer == null || killer.equals(killed) || !hasPerk(killer))
{
return;
}
DisguiseMagmaCube slime = (DisguiseMagmaCube) Manager.GetDisguise().getActiveDisguise(killer);
UUID key = killer.getUniqueId();
if (slime == null)
{
return;
}
int size = 1;
if (_kills.containsKey(key))
{
size += _kills.get(key);
}
size = Math.min(MAX_STACKS, size);
_kills.put(key, size);
slime.SetSize(size + 1);
Manager.GetDisguise().updateDisguise(slime);
killer.setExp(0.99F * (size / (float) MAX_STACKS));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void sizeDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
{
return;
}
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
{
return;
}
Player damager = event.GetDamagerPlayer(false);
if (damager == null)
{
return;
}
if (!hasPerk(damager))
{
return;
}
UUID key = damager.getUniqueId();
if (!_kills.containsKey(key))
{
return;
}
event.AddMod(damager.getName(), GetName(), _kills.get(key), false);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void sizeKnockback(CustomDamageEvent event)
{
if (event.IsCancelled())
{
return;
}
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
{
return;
}
Player damagee = event.GetDamageePlayer();
if (damagee == null)
{
return;
}
if (!hasPerk(damagee))
{
return;
}
if (!_kills.containsKey(damagee.getUniqueId()))
{
return;
}
int bonus = _kills.get(damagee.getUniqueId());
event.AddKnockback(GetName(), bonus * 0.15d);
}
@EventHandler
public void energyUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
{
return;
}
for (Player player : UtilServer.getPlayers())
{
if (!hasPerk(player))
{
continue;
}
float size = 0;
if (_kills.containsKey(player.getUniqueId()))
{
size += _kills.get(player.getUniqueId());
}
playParticles(player, size);
}
}
private void playParticles(Player player, float size)
{
UtilParticle.PlayParticleToAll(ParticleType.LAVA, player.getLocation().add(0, 0.4, 0), 0.15f + 0.15f * size, 0.15f + 0.15f * size, 0.15f + 0.15f * size, 0, 1, ViewDist.LONG);
}
}

View File

@ -0,0 +1,56 @@
package nautilus.game.arcade.game.games.smash.perks.magmacube;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
import nautilus.game.arcade.kit.perks.data.MeteorShowerData;
public class SmashMagmacube extends SmashUltimate
{
private static final int DURATION = 12000;
private List<MeteorShowerData> _meteors = new ArrayList<>();
public SmashMagmacube()
{
super("Meteor Shower", new String[] {}, Sound.AMBIENCE_THUNDER, 0);
}
@Override
public void activate(Player player)
{
_meteors.add(new MeteorShowerData(player, UtilPlayer.getTarget(player, UtilBlock.blockPassSet, 128).getLocation(), DURATION));
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<MeteorShowerData> meteorIter = _meteors.iterator();
while (meteorIter.hasNext())
{
MeteorShowerData data = meteorIter.next();
if (data.update())
{
meteorIter.remove();
}
}
}
}

View File

@ -1,16 +1,17 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.pig;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.WeakHashMap;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
@ -20,158 +21,195 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
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.UtilServer;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguisePigZombie;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkPigBaconBomb extends SmashPerk
{
private WeakHashMap<Player, HashSet<Pig>> _pigs = new WeakHashMap<Player, HashSet<Pig>>();
public PerkPigBaconBomb()
private static final float ENERGY_PER_PIG = 0.35F;
private static final float ENERGY_PER_PIG_DISGUISED_FACTOR = 0.7F;
private static final int COOLDOWN = 100;
private static final int PIG_MAX_TICKS = 80;
private static final float PIG_SPEED = 1.2F;
private static final int PIG_EXPLODE_RADIUS = 2;
private static final int PIG_EXPLODE_DAMAGE = 4;
private static final int PIG_EXPLODE_DAMAGE_RADIUS = 4;
private Map<UUID, Set<Pig>> _pigs = new HashMap<UUID, Set<Pig>>();
public PerkPigBaconBomb()
{
super("Baby Bacon Bomb", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Baby Bacon Bomb"
});
super("Baby Bacon Bomb", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Baby Bacon Bomb" });
}
@EventHandler
public void Skill(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE"))
return;
}
Player player = event.getPlayer();
if (!Kit.HasKit(player))
if (!UtilItem.isSpade(player.getItemInHand()))
{
return;
float energy = 0.30f;
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise != null && disguise instanceof DisguisePigZombie)
energy = energy * 0.7f;
}
//Energy
if (!hasPerk(player))
{
return;
}
float energy = ENERGY_PER_PIG;
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
if (disguise != null && disguise instanceof DisguisePigZombie)
{
energy = energy * ENERGY_PER_PIG_DISGUISED_FACTOR;
}
// Energy
if (player.getExp() < energy)
{
UtilPlayer.message(player, F.main("Energy", "Not enough Energy to use " + F.skill(GetName()) + "."));
return;
}
//Recharge
if (!Recharge.Instance.use(player, GetName(), 100, false, false))
// Recharge
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, false, false))
{
return;
//Use Energy
}
// Use Energy
player.setExp(Math.max(0f, player.getExp() - energy));
//Velocity
UtilAction.velocity(player, player.getLocation().getDirection(), 0.8, true, 0.9, 0, 1, true);
//Sound
// Velocity
UtilAction.velocity(player, player.getLocation().getDirection(), 0.8, true, 0.9, 0, 1, true);
// Sound
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 0.75f);
//Pig
// Pig
Manager.GetGame().CreatureAllowOverride = true;
Pig pig = player.getWorld().spawn(player.getLocation(), Pig.class);
pig.setHealth(5);
pig.setVelocity(new Vector(0, -0.4, 0));
Manager.GetGame().CreatureAllowOverride = false;
pig.setBaby();
UtilEnt.Vegetate(pig);
UtilEnt.ghost(pig, true, false);
UUID key = player.getUniqueId();
//Store
if (!_pigs.containsKey(player))
_pigs.put(player, new HashSet<Pig>());
// Store
if (!_pigs.containsKey(key))
{
_pigs.put(key, new HashSet<Pig>());
}
_pigs.get(player).add(pig);
//Inform
_pigs.get(key).add(pig);
// Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void Check(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : _pigs.keySet())
for (UUID key : _pigs.keySet())
{
Iterator<Pig> pigIterator = _pigs.get(player).iterator();
Player player = UtilPlayer.searchExact(key);
if (player == null)
{
continue;
}
Iterator<Pig> pigIterator = _pigs.get(key).iterator();
while (pigIterator.hasNext())
{
Pig pig = pigIterator.next();
if (!pig.isValid() || pig.getTicksLived() > 80)
if (!pig.isValid() || pig.getTicksLived() > PIG_MAX_TICKS)
{
PigExplode(pigIterator, pig, player);
continue;
}
Player target = UtilPlayer.getClosest(pig.getLocation(), player);
Player target = UtilPlayer.getClosest(pig.getLocation(), player);
if (target == null)
{
continue;
}
UtilEnt.CreatureMoveFast(pig, target.getLocation(), 1.2f);
if (UtilMath.offset(target, pig) < 2)
UtilEnt.CreatureMoveFast(pig, target.getLocation(), PIG_SPEED);
if (UtilMath.offset(target, pig) < PIG_EXPLODE_RADIUS)
{
PigExplode(pigIterator, pig, player);
}
}
}
}
}
public void PigExplode(Iterator<Pig> pigIterator, Pig pig, Player owner)
{
//Effect
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, pig.getLocation().add(0, 0.5, 0), 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
//Sound
// Effect
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, pig.getLocation().add(0, 0.5, 0), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers());
// Sound
pig.getWorld().playSound(pig.getLocation(), Sound.EXPLODE, 0.6f, 2f);
pig.getWorld().playSound(pig.getLocation(), Sound.PIG_DEATH, 1f, 2f);
// Damage
Map<LivingEntity, Double> targets = UtilEnt.getInRadius(pig.getLocation(), PIG_EXPLODE_DAMAGE_RADIUS);
//Damage
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(pig.getLocation(), 4);
for (LivingEntity cur : targets.keySet())
{
if (cur.equals(owner))
{
continue;
//Damage Event
Manager.GetDamage().NewDamageEvent(cur, owner, null,
DamageCause.CUSTOM, 4 * targets.get(cur) + 2, false, true, false,
owner.getName(), GetName());
}
// Damage Event
Manager.GetDamage().NewDamageEvent(cur, owner, null, DamageCause.CUSTOM, PIG_EXPLODE_DAMAGE, false, true, false, owner.getName(), GetName());
}
//Remove
// Remove
pigIterator.remove();
pig.remove();
}

View File

@ -1,4 +1,4 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.pig;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -9,7 +9,6 @@ import org.bukkit.entity.LivingEntity;
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.event.player.PlayerPickupItemEvent;
@ -21,11 +20,14 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguisePigZombie;
@ -33,154 +35,162 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkPigBaconBounce extends SmashPerk implements IThrown
{
public PerkPigBaconBounce()
private static final float ENERGY_PER_BACON = 0.2F;
private static final float ENERGY_PER_BACON_DISGUISED_FACTOR = 0.7F;
private static final int COOLDOWN = 100;
private static final int HEALTH_PER_BACON = 1;
private static final int BACON_DAMAGE = 4;
public PerkPigBaconBounce()
{
super("Bouncy Bacon", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Bouncy Bacon",
});
super("Bouncy Bacon", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Bouncy Bacon", });
}
@EventHandler
public void Skill(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
}
Player player = event.getPlayer();
if (!Kit.HasKit(player))
if (!UtilItem.isAxe(player.getItemInHand()))
{
return;
float energy = 0.2f;
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise != null && disguise instanceof DisguisePigZombie)
energy = energy * 0.7f;
}
//Energy
if (!hasPerk(player))
{
return;
}
float energy = ENERGY_PER_BACON;
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
if (disguise != null && disguise instanceof DisguisePigZombie)
{
energy = energy * ENERGY_PER_BACON_DISGUISED_FACTOR;
}
// Energy
if (player.getExp() < energy)
{
UtilPlayer.message(player, F.main("Energy", "Not enough Energy to use " + F.skill(GetName()) + "."));
return;
}
//Recharge
if (!Recharge.Instance.use(player, GetName(), 100, false, false))
// Recharge
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, false, false))
{
return;
//Use Energy
player.setExp(Math.max(0f, player.getExp() - energy));
}
//Launch
Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.PORK, (byte) 0, 1, "Bacon"+System.currentTimeMillis()));
// Use Energy
player.setExp(Math.max(0f, player.getExp() - energy));
// Launch
Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.PORK, (byte) 0, 1, "Bacon" + System.currentTimeMillis()));
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.4f);
ent.setPickupDelay(9999);
//Sound
// Sound
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 1.5f);
//Inform
// Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
Rebound(data.getThrower(), data.getThrown());
if (target == null)
return;
if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player)
{
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
Player targetPlayer = (Player) target;
Player throwerPlayer = (Player) data.getThrower();
if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer)))
{
return;
}
return;
}
//Damage Event
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null,
DamageCause.CUSTOM, 4, true, true, false,
UtilEnt.getName(data.getThrower()), GetName());
Item item = (Item)data.getThrown();
// Damage Event
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, BACON_DAMAGE, true, true, false, UtilEnt.getName(data.getThrower()), GetName());
Item item = (Item) data.getThrown();
item.setItemStack(new ItemStack(Material.GRILLED_PORK));
}
@Override
public void Idle(ProjectileUser data)
public void Idle(ProjectileUser data)
{
Rebound(data.getThrower(), data.getThrown());
}
@Override
public void Expire(ProjectileUser data)
public void Expire(ProjectileUser data)
{
Rebound(data.getThrower(), data.getThrown());
}
public void Rebound(LivingEntity player, Entity ent)
{
ent.getWorld().playSound(ent.getLocation(), Sound.ITEM_PICKUP, 1f, 0.5f);
double mult = 0.5 + (0.035 * UtilMath.offset(player.getLocation(), ent.getLocation()));
//Velocity
// Velocity
ent.setVelocity(player.getLocation().toVector().subtract(ent.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult));
//Ticks
// Ticks
if (ent instanceof Item)
((Item)ent).setPickupDelay(5);
{
((Item) ent).setPickupDelay(5);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void Pickup(PlayerPickupItemEvent event)
{
if (!Kit.HasKit(event.getPlayer()))
if (!hasPerk(event.getPlayer()))
{
return;
}
if (event.getItem().getItemStack().getType() != Material.PORK && event.getItem().getItemStack().getType() != Material.GRILLED_PORK)
Material type = event.getItem().getItemStack().getType();
if (type != Material.PORK && type != Material.GRILLED_PORK)
return;
//Remove
// Remove
event.getItem().remove();
//Restore Energy
// Restore Energy
event.getPlayer().setExp(Math.min(0.999f, event.getPlayer().getExp() + 0.05f));
//Sound
// Sound
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.EAT, 2f, 1f);
//Heal
// Heal
if (event.getItem().getItemStack().getType() == Material.GRILLED_PORK)
{
UtilPlayer.health(event.getPlayer(), 1);
UtilParticle.PlayParticle(ParticleType.HEART, event.getPlayer().getLocation().add(0, 0.5, 0), 0.2f, 0.2f, 0.2f, 0, 4,
ViewDist.LONG, UtilServer.getPlayers());
UtilPlayer.health(event.getPlayer(), HEALTH_PER_BACON);
UtilParticle.PlayParticle(ParticleType.HEART, event.getPlayer().getLocation().add(0, 0.5, 0), 0.2f, 0.2f, 0.2f, 0, 4, ViewDist.LONG, UtilServer.getPlayers());
}
}
}

View File

@ -1,6 +1,8 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.pig;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -14,113 +16,106 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguisePig;
import mineplex.core.disguise.disguises.DisguisePigZombie;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkPigZombie extends SmashPerk
{
public HashSet<Player> _active = new HashSet<Player>();
public PerkPigZombie()
private static final int MIN_HEALTH = 6;
public Set<UUID> _active = new HashSet<>();
public PerkPigZombie()
{
super("Nether Pig", new String[]
{
C.cGray + "Become Nether Pig when HP is below 6.",
C.cGray + "Return to Pig when HP is 10 or higher."
});
super("Nether Pig", new String[] { C.cGray + "Become Nether Pig when HP is below 6.", C.cGray + "Return to Pig when HP is 10 or higher." });
}
@EventHandler
public void Check(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
{
return;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!Kit.HasKit(player))
if (!hasPerk(player))
{
continue;
}
//Active
if (_active.contains(player))
// Active
if (_active.contains(player.getUniqueId()))
{
Manager.GetCondition().Factory().Speed("Pig Zombie", player, player, 0.9, 0, false, false, false);
if (player.getHealth() < 10 || isSuperActive(player))
{
continue;
}
//Deactivate
_active.remove(player);
//Armor
// Deactivate
_active.remove(player.getUniqueId());
// Armor
player.getInventory().setHelmet(null);
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
player.getInventory().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
player.getInventory().remove(Material.IRON_HELMET);
player.getInventory().remove(Material.IRON_CHESTPLATE);
player.getInventory().remove(Material.IRON_LEGGINGS);
player.getInventory().remove(Material.IRON_BOOTS);
SmashKit kit = (SmashKit) Kit;
//Disguise
DisguisePig disguise = new DisguisePig(player);
kit.disguise(player, DisguisePig.class);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
//Sound
// Sound
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 1f);
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 1f);
//Inform
// Inform
UtilPlayer.message(player, F.main("Skill", "You returned to " + F.skill("Pig Form") + "."));
}
//Not Active
// Not Active
else
{
if (player.getHealth() <= 0 || (!isSuperActive(player) && player.getHealth() > 6))
if (player.getHealth() <= 0 || (!isSuperActive(player) && player.getHealth() > MIN_HEALTH))
{
continue;
}
//Activate
_active.add(player);
//Armor
// Activate
_active.add(player.getUniqueId());
// Armor
player.getInventory().setHelmet(new ItemStack(Material.IRON_HELMET));
player.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
player.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS));
player.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS));
//Disguise
DisguisePigZombie disguise = new DisguisePigZombie(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
SmashKit kit = (SmashKit) Kit;
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
//Sound
kit.disguise(player, DisguisePigZombie.class);
// Sound
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 2f, 1f);
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 2f, 1f);
//Inform
// Inform
UtilPlayer.message(player, F.main("Skill", "You transformed into " + F.skill("Nether Pig Form") + "."));
player.setExp(0.99f);
}
}
}
@EventHandler
public void Clean(PlayerDeathEvent event)
{

View File

@ -0,0 +1,32 @@
package nautilus.game.arcade.game.games.smash.perks.pig;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
public class SmashPig extends SmashUltimate
{
private static final int DURATION = 40000;
public SmashPig()
{
super("Pig Stink", new String[] {}, Sound.PIG_IDLE, DURATION);
}
@Override
public void activate(Player player)
{
super.activate(player);
for (Player other : Manager.GetGame().GetPlayers(true))
{
if (!player.equals(other))
{
Manager.GetCondition().Factory().Confuse(GetName() + " " + player.getName(), other, player, DURATION / 1000, 0, false, false, false);
}
}
}
}

View File

@ -1,8 +1,9 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.sheep;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
@ -10,98 +11,113 @@ import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
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.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
import nautilus.game.arcade.kit.perks.data.HomingSheepData;
public class PerkSheepHoming extends SmashPerk
public class SmashSheep extends SmashUltimate
{
private ArrayList<HomingSheepData> _sheep = new ArrayList<HomingSheepData>();
public PerkSheepHoming()
private static final int DAMAGE_RADIUS = 10;
private static final int DAMAGE = 20;
private static final int KNOCKBACK_MAGNITUDE = 3;
private List<HomingSheepData> _sheep = new ArrayList<>();
public SmashSheep()
{
super("Homing Sheeples", new String[]
{
}, false);
super("Homing Sheeples", new String[] {}, Sound.SHEEP_IDLE, 0);
}
@Override
public void addSuperCustom(Player player)
{
//Fire Sheep
public void activate(Player player)
{
super.activate(player);
Game game = Manager.GetGame();
game.CreatureAllowOverride = true;
// Fire Sheep
for (Player target : Manager.GetGame().GetPlayers(true))
{
if (target.equals(player))
{
continue;
}
Manager.GetGame().CreatureAllowOverride = true;
Sheep sheep = player.getWorld().spawn(player.getEyeLocation(), Sheep.class);
Manager.GetGame().CreatureAllowOverride = false;
sheep.setBaby();
_sheep.add(new HomingSheepData(player, target, sheep));
}
game.CreatureAllowOverride = false;
}
@EventHandler
public void sheepUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<HomingSheepData> sheepIter = _sheep.iterator();
while (sheepIter.hasNext())
{
HomingSheepData data = sheepIter.next();
if (data.update())
{
sheepIter.remove();
explode(data);
}
}
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<HomingSheepData> sheepIter = _sheep.iterator();
while (sheepIter.hasNext())
{
HomingSheepData data = sheepIter.next();
if (data.update())
{
sheepIter.remove();
explode(data);
}
}
}
private void explode(HomingSheepData data)
{
double scale = 0.4 + 0.6 * Math.min(1, data.Sheep.getTicksLived()/60d);
double scale = 0.4 + 0.6 * Math.min(1, data.Sheep.getTicksLived() / 60d);
// Players
Map<Player, Double> players = UtilPlayer.getInRadius(data.Sheep.getLocation(), DAMAGE_RADIUS);
//Players
HashMap<Player, Double> players = UtilPlayer.getInRadius(data.Sheep.getLocation(), 10);
for (Player player : players.keySet())
{
if (!Manager.GetGame().IsAlive(player))
if (UtilPlayer.isSpectator(player))
{
continue;
//Damage Event
Manager.GetDamage().NewDamageEvent(player, data.Shooter, null,
DamageCause.CUSTOM, 20 * scale, true, true, false,
data.Shooter.getName(), GetName());
}
// Damage Event
Manager.GetDamage().NewDamageEvent(player, data.Shooter, null, DamageCause.CUSTOM, DAMAGE * scale, true, true, false, data.Shooter.getName(), GetName());
}
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Sheep.getLocation(), 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Sheep.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers());
data.Sheep.getWorld().playSound(data.Sheep.getLocation(), Sound.EXPLODE, 2f, 1f);
data.Sheep.remove();
}
@EventHandler
public void knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
}
event.AddKnockback(GetName(), 3);
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
}

View File

@ -0,0 +1,241 @@
package nautilus.game.arcade.game.games.smash.perks.skeletalhorse;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkBoneRush extends SmashPerk implements IThrown
{
private static final int COOLDOWN = 10000;
private static final float DAMAGE_NORMAL = 0.7F;
private static final int DAMAGE_SMASH = 3;
private static final int KNOCKBACK_NORMAL = 10;
private static final int KNOCKBACK_SMASH = 6;
private static final int EXPIRE_TIME = 2000;
private static final float Y_LIMIT = 0.25F;
private Map<UUID, Long> _active = new HashMap<>();
public PerkBoneRush()
{
super("Bone Rush", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Bone Rush", C.cGray + "Crouch to avoid movement with " + C.cGreen + "Bone Rush" });
}
@EventHandler
public void Skill(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
}
Player player = event.getPlayer();
if (!UtilItem.isSpade(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (isSuperActive(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
activate(player);
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
public void activate(Player player)
{
_active.put(player.getUniqueId(), System.currentTimeMillis());
}
public void deactivate(Player player)
{
_active.remove(player.getUniqueId());
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<UUID> playerIterator = _active.keySet().iterator();
while (playerIterator.hasNext())
{
UUID key = playerIterator.next();
Player player = UtilPlayer.searchExact(key);
if (player == null)
{
playerIterator.remove();
continue;
}
if (!player.isValid() || (UtilTime.elapsed(_active.get(key), 1500) && !isSuperActive(player)))
{
playerIterator.remove();
continue;
}
// Sound
player.getWorld().playSound(player.getLocation(), Sound.SKELETON_HURT, 0.4f, (float) (Math.random() + 1));
// Velocity
Vector dir = player.getLocation().getDirection();
double limit = isSuperActive(player) ? Y_LIMIT + 0.1 : Y_LIMIT;
if (dir.getY() > limit)
{
dir.setY(limit);
}
// Player
if (!player.isSneaking())
{
UtilAction.velocity(player, dir, 0.6, false, 0, 0.1, 0.3, false);
}
// Bones
for (int i = 0; i < 6; i++)
{
Item bone = player.getWorld().dropItem(player.getLocation().add(Math.random() * 5 - 2.5, Math.random() * 3, Math.random() * 5 - 2.5), new ItemStack(Material.BONE));
UtilAction.velocity(bone, dir, 0.6 + 0.3 * Math.random(), false, 0, 0.1 + Math.random() * 0.05, 0.3, false);
Manager.GetProjectile().AddThrow(bone, player, this, EXPIRE_TIME, true, true, true, true, 0.5f);
}
}
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null)
{
return;
}
if (event.GetReason().contains(GetName()))
{
event.AddKnockback(GetName(), KNOCKBACK_NORMAL);
}
if (event.GetReason().contains("Bone Storm"))
{
event.AddKnockback(GetName(), KNOCKBACK_SMASH);
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
data.getThrown().remove();
if (target == null)
{
return;
}
if (!(target instanceof Player || data.getThrower() instanceof Player))
{
return;
}
target = (Player) target;
Player damager = (Player) data.getThrower();
String reason = GetName();
if (target instanceof Player && damager instanceof Player)
{
if (isTeamDamage((Player) target, damager))
{
return;
}
}
if (isSuperActive(damager))
{
reason = "Bone Storm";
}
// Damage Event
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, isSuperActive(damager) ? DAMAGE_SMASH : DAMAGE_NORMAL, false, true, false, UtilEnt.getName(data.getThrower()), reason);
UtilAction.velocity(target, data.getThrown().getVelocity());
}
@Override
public void Idle(ProjectileUser data)
{
data.getThrown().remove();
}
@Override
public void Expire(ProjectileUser data)
{
data.getThrown().remove();
}
@EventHandler
public void Clean(PlayerDeathEvent event)
{
_active.remove(event.getEntity().getUniqueId());
}
}

View File

@ -1,9 +1,10 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.skeletalhorse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -18,83 +19,109 @@ import mineplex.core.common.util.UtilEnt;
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.UtilServer;
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.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkDeadlyBones extends SmashPerk
{
private HashMap<Item, Player> _active = new HashMap<Item, Player>();
public PerkDeadlyBones()
private static final int RATE = 400;
private static final int TICKS = 50;
private static final int DAMAGE_RADIUS = 4;
private static final int DAMAGE = 4;
private static final float KNOCKBACK_MAGNITUDE = 2.5F;
private Map<Item, UUID> _active = new HashMap<>();
public PerkDeadlyBones()
{
super("Deadly Bones", new String[]
{
C.cGray + "Drop explosive bones when you take damage."
});
super("Deadly Bones", new String[] { C.cGray + "Drop explosive bones when you take damage." });
}
@EventHandler
public void damageActivate(CustomDamageEvent event)
{
if (event.IsCancelled())
{
return;
}
Player player = event.GetDamageePlayer();
if (player == null)
return;
if (!Kit.HasKit(player))
if (player == null)
{
return;
if (!Recharge.Instance.use(player, GetName(), 400, false, false))
}
if (!hasPerk(player))
{
return;
_active.put(player.getWorld().dropItemNaturally(player.getLocation().add(0, 0.5, 0),
ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 1, "Explosive Bone " + System.currentTimeMillis())), player);
}
if (!Recharge.Instance.use(player, GetName(), RATE, false, false))
{
return;
}
_active.put(player.getWorld().dropItemNaturally(player.getLocation().add(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.BONE, (byte) 0, 1, "Explosive Bone " + System
.currentTimeMillis())), player.getUniqueId());
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
// Using copy to prevent concurrency issues for when an explosion damages
// another player with this perk active adding a new item to the list while
// we are still in the loop
List<Item> itemListCopy = new ArrayList<>(_active.keySet());
for(Item item : itemListCopy)
{
//Not Ready
if (item.isValid() && item.getTicksLived() < 50)
continue;
return;
}
//Effect
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, item.getLocation(), 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
item.getWorld().playSound(item.getLocation(), Sound.EXPLODE, 0.8f, 1.4f);
// Using copy to prevent concurrency issues for when an explosion
// damages
// another player with this perk active adding a new item to the list
// while
// we are still in the loop
List<Item> itemListCopy = new ArrayList<>(_active.keySet());
for (Item item : itemListCopy)
{
// Not Ready
if (item.isValid() && item.getTicksLived() < TICKS)
{
continue;
}
// Effect
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, item.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers());
item.getWorld().playSound(item.getLocation(), Sound.EXPLODE, 0.8f, 1.4f);
UUID key = _active.get(item);
Player player = UtilPlayer.searchExact(key);
if (player == null)
{
continue;
}
// Damage
Map<LivingEntity, Double> targets = UtilEnt.getInRadius(item.getLocation(), DAMAGE_RADIUS);
Player player = _active.get(item);
//Damage
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(item.getLocation(), 4);
for (LivingEntity cur : targets.keySet())
{
if (cur.equals(player))
{
continue;
Manager.GetDamage().NewDamageEvent(cur, player, null,
DamageCause.CUSTOM, 4 * targets.get(cur) + 1, true, true, false,
player.getName(), GetName());
}
Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE * targets.get(cur) + 1, true, true, false, player.getName(), GetName());
}
//Remove
// Remove
item.remove();
_active.remove(item);
}
@ -104,8 +131,10 @@ public class PerkDeadlyBones extends SmashPerk
public void knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
event.AddKnockback(GetName(), 2.5);
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
}

View File

@ -1,27 +1,30 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.skeletalhorse;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
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.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
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.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseHorse;
@ -29,123 +32,145 @@ 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.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkHorseKick extends SmashPerk
{
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
public PerkHorseKick()
{
super("Bone Kick", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Bone Kick"
});
}
private static final int COOLDOWN = 6000;
private static final float DAMAGE = 6.5F;
private static final int KICK_TIME = 1000;
private static final int KNOCKBACK_MAGNITUDE = 4;
private Map<UUID, Long> _active = new HashMap<>();
public PerkHorseKick()
{
super("Bone Kick", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Bone Kick" });
}
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
}
Player player = event.getPlayer();
if (!UtilItem.isAxe(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (isSuperActive(player))
{
return;
}
if (!Kit.HasKit(player))
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), 6000, true, true))
return;
// Horse Animation
DisguiseBase horse = Manager.GetDisguise().getActiveDisguise(player);
//Horse Animation
DisguiseBase horse = Manager.GetDisguise().getDisguise(player);
if (horse != null && horse instanceof DisguiseHorse)
{
((DisguiseHorse)horse).kick();
((DisguiseHorse) horse).kick();
Manager.GetDisguise().updateDisguise(horse);
}
//Animation
_active.put(player, System.currentTimeMillis());
// Animation
_active.put(player.getUniqueId(), System.currentTimeMillis());
//AoE Area
// AoE Area
Location loc = player.getLocation();
loc.add(player.getLocation().getDirection().setY(0).normalize().multiply(1.5));
loc.add(0, 0.8, 0);
for (Entity other : player.getWorld().getEntities())
for (LivingEntity other : UtilEnt.getInRadius(loc, 2.5).keySet())
{
if (!(other instanceof LivingEntity))
if (UtilPlayer.isSpectator(other))
{
continue;
if (other instanceof Player)
if (!Manager.GetGame().IsAlive((Player)other))
continue;
}
if (other.equals(player))
{
continue;
}
if (UtilMath.offset(loc, other.getLocation()) > 2.5)
continue;
// Damage Event
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, true, false, player.getName(), GetName());
//Damage Event
Manager.GetDamage().NewDamageEvent((LivingEntity)other, player, null,
DamageCause.CUSTOM, 7, true, true, false,
player.getName(), GetName());
//Sound
// Sound
player.getWorld().playSound(player.getLocation(), Sound.SKELETON_HURT, 4f, 0.6f);
player.getWorld().playSound(player.getLocation(), Sound.SKELETON_HURT, 4f, 0.6f);
//Inform
UtilPlayer.message(other, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + "."));
// Inform
UtilPlayer.message(other, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + "."));
}
//Inform
// Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
//Slow
// Slow
Manager.GetCondition().Factory().Slow(GetName(), player, player, 0.8, 3, false, false, true, false);
}
@EventHandler
public void Update(UpdateEvent event)
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
//Player
Iterator<Player> playerIterator = _active.keySet().iterator();
}
// Player
Iterator<UUID> playerIterator = _active.keySet().iterator();
while (playerIterator.hasNext())
{
Player player = playerIterator.next();
UUID key = playerIterator.next();
Player player = UtilPlayer.searchExact(key);
if (!player.isValid() || player.getHealth() <= 0 || UtilTime.elapsed(_active.get(player), 1000))
if (player == null)
{
playerIterator.remove();
continue;
}
if (!player.isValid() || player.getHealth() <= 0 || UtilTime.elapsed(_active.get(key), KICK_TIME))
{
playerIterator.remove();
// Horse Animation
DisguiseBase horse = Manager.GetDisguise().getActiveDisguise(player);
//Horse Animation
DisguiseBase horse = Manager.GetDisguise().getDisguise(player);
if (horse != null && horse instanceof DisguiseHorse)
{
((DisguiseHorse)horse).stopKick();
((DisguiseHorse) horse).stopKick();
Manager.GetDisguise().updateDisguise(horse);
}
Manager.GetCondition().EndCondition(player, null, GetName());
}
else
@ -153,9 +178,8 @@ public class PerkHorseKick extends SmashPerk
Location loc = player.getLocation();
loc.add(player.getLocation().getDirection().setY(0).normalize().multiply(1.5));
loc.add(0, 0.8, 0);
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, loc, 0.3f, 0.3f, 0.3f, 0, 2,
ViewDist.LONG, UtilServer.getPlayers());
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, loc, 0.3f, 0.3f, 0.3f, 0, 2, ViewDist.LONG, UtilServer.getPlayers());
}
}
}
@ -163,9 +187,11 @@ public class PerkHorseKick extends SmashPerk
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || (!event.GetReason().contains(GetName()) && !event.GetReason().contains("Flame Kick")))
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
event.AddKnockback(GetName(), 4);
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
}

View File

@ -0,0 +1,55 @@
package nautilus.game.arcade.game.games.smash.perks.skeletalhorse;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
import nautilus.game.arcade.kit.Perk;
public class SmashSkeletalHorse extends SmashUltimate
{
private static final int DURATION = 20000;
public SmashSkeletalHorse()
{
super("Bone Storm", new String[] {}, Sound.HORSE_SKELETON_DEATH, DURATION);
}
@Override
public void activate(Player player)
{
super.activate(player);
player.getInventory().remove(Material.IRON_SPADE);
player.getInventory().remove(Material.IRON_AXE);
for (Perk perk : Kit.GetPerks())
{
if (perk instanceof PerkBoneRush)
{
PerkBoneRush boneRush = (PerkBoneRush) perk;
boneRush.activate(player);
}
}
}
@Override
public void cancel(Player player)
{
super.cancel(player);
for (Perk perk : Kit.GetPerks())
{
if (perk instanceof PerkBoneRush)
{
PerkBoneRush boneRush = (PerkBoneRush) perk;
boneRush.deactivate(player);
}
}
}
}

View File

@ -0,0 +1,373 @@
package nautilus.game.arcade.game.games.smash.perks.skeleton;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkBarrage extends SmashPerk
{
private Map<UUID, Integer> _charge = new HashMap<>();
private Map<UUID, Long> _chargeLast = new HashMap<>();
private Set<UUID> _firing = new HashSet<>();
private Set<Projectile> _arrows = new HashSet<Projectile>();
private int _max;
private int _tick;
private boolean _remove;
private boolean _noDelay;
private boolean _useExp;
public PerkBarrage(int max, int tick, boolean remove, boolean noDelay)
{
this(max, tick, remove, noDelay, false);
}
public PerkBarrage(int max, int tick, boolean remove, boolean noDelay, boolean useExpAndBar)
{
super("Barrage", new String[] { C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Barrage" });
_useExp = useExpAndBar;
_max = max;
_tick = tick;
_remove = remove;
_noDelay = noDelay;
}
@EventHandler
public void BarrageDrawBow(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
}
Player player = event.getPlayer();
if (!UtilGear.isBow(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (isSuperActive(player))
{
return;
}
if (!player.getInventory().contains(Material.ARROW))
{
return;
}
if (event.getClickedBlock() != null)
{
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
}
}
// Start Charge
_charge.put(player.getUniqueId(), 0);
_chargeLast.put(player.getUniqueId(), System.currentTimeMillis());
_firing.remove(player.getUniqueId());
}
@EventHandler
public void BarrageCharge(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (Player cur : UtilServer.getPlayers())
{
UUID key = cur.getUniqueId();
// Not Charging
if (!_charge.containsKey(key))
{
continue;
}
if (_firing.contains(key))
{
continue;
}
// Max Charge
if (_charge.get(key) >= _max)
{
continue;
}
// Charge Interval
if (_charge.get(key) == 0)
{
if (!UtilTime.elapsed(_chargeLast.get(key), 1000))
{
continue;
}
}
else
{
if (!UtilTime.elapsed(_chargeLast.get(key), _tick))
{
continue;
}
}
// No Longer Holding Bow
if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW)
{
if (_useExp)
{
cur.setExp(0f);
}
_charge.remove(key);
_chargeLast.remove(key);
continue;
}
// Increase Charge
_charge.put(key, _charge.get(key) + 1);
if (_useExp)
{
cur.setExp(Math.min(0.9999f, (float) _charge.get(key) / (float) _max));
}
_chargeLast.put(key, System.currentTimeMillis());
// Effect
cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(key)));
}
}
@EventHandler(priority = EventPriority.HIGH)
public void BarrageFireBow(EntityShootBowEvent event)
{
if (event.isCancelled())
{
return;
}
if (!Manager.GetGame().IsLive())
{
return;
}
if (!(event.getEntity() instanceof Player))
{
return;
}
if (!(event.getProjectile() instanceof Arrow))
{
return;
}
Player player = (Player) event.getEntity();
if (!_charge.containsKey(player.getUniqueId()))
{
return;
}
// Start Barrage
_firing.add(player.getUniqueId());
_chargeLast.put(player.getUniqueId(), System.currentTimeMillis());
}
@EventHandler
public void BarrageArrows(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Set<Player> remove = new HashSet<Player>();
for (UUID key : _firing)
{
Player cur = UtilPlayer.searchExact(key);
if (cur == null)
{
continue;
}
if (!_charge.containsKey(key) || !_chargeLast.containsKey(key))
{
remove.add(cur);
continue;
}
if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW)
{
remove.add(cur);
continue;
}
int arrows = _charge.get(key);
if (arrows <= 0)
{
remove.add(cur);
continue;
}
_charge.put(key, arrows - 1);
if (_useExp)
{
cur.setExp(Math.min(0.9999f, _charge.get(key) / _max));
}
// Fire Arrow
Vector random = new Vector((Math.random() - 0.5) / 10, (Math.random() - 0.5) / 10, (Math.random() - 0.5) / 10);
Projectile arrow = cur.launchProjectile(Arrow.class);
arrow.setVelocity(cur.getLocation().getDirection().add(random).multiply(3));
_arrows.add(arrow);
cur.getWorld().playSound(cur.getLocation(), Sound.SHOOT_ARROW, 1f, 1f);
}
for (Player cur : remove)
{
if (_useExp)
{
cur.setExp(0f);
}
_charge.remove(cur.getUniqueId());
_chargeLast.remove(cur.getUniqueId());
_firing.remove(cur.getUniqueId());
}
}
@EventHandler(priority = EventPriority.HIGH)
public void BarrageDamageTime(CustomDamageEvent event)
{
if (!_noDelay)
{
return;
}
if (event.GetProjectile() == null)
{
return;
}
if (event.GetDamagerPlayer(true) == null)
{
return;
}
if (!(event.GetProjectile() instanceof Arrow))
{
return;
}
Player damager = event.GetDamagerPlayer(true);
if (!hasPerk(damager))
{
return;
}
event.SetCancelled("Barrage Cancel");
event.GetProjectile().remove();
// Damage Event
Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), damager, null, DamageCause.THORNS, event.GetDamage(), true, true, false, damager.getName(), GetName());
}
@EventHandler
public void BarrageProjectileHit(ProjectileHitEvent event)
{
if (_remove)
{
if (_arrows.remove(event.getEntity().getUniqueId()))
{
event.getEntity().remove();
}
}
}
@EventHandler
public void BarrageClean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
}
for (Iterator<Projectile> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
{
Projectile arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid())
{
arrowIterator.remove();
}
}
}
@EventHandler
public void Quit(PlayerQuitEvent event)
{
Player player = event.getPlayer();
clean(player);
}
public void clean(Player player)
{
_charge.remove(player.getUniqueId());
_chargeLast.remove(player.getUniqueId());
_firing.remove(player.getUniqueId());
}
}

View File

@ -1,90 +1,109 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.skeleton;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkBoneExplosion extends SmashPerk
{
public PerkBoneExplosion()
{
private static final int COOLDOWN = 10000;
private static final int DAMAGE_RADIUS = 7;
private static final int DAMAGE = 6;
private static final float KNOCKBACK_MAGNITUDE = 2.5F;
public PerkBoneExplosion()
{
super("Bone Explosion", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Bone Explosion"
});
super("Bone Explosion", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Bone Explosion" });
}
@EventHandler
public void Skill(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
}
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
}
Player player = event.getPlayer();
if (!UtilItem.isAxe(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (isSuperActive(player))
return;
if (!Kit.HasKit(player))
{
return;
if (!Recharge.Instance.use(player, GetName(), 10000, true, true))
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
Map<Player, Double> nearby = UtilPlayer.getInRadius(player.getLocation(), DAMAGE_RADIUS);
HashMap<Player, Double> nearby = UtilPlayer.getInRadius(player.getLocation(), 7);
for (Player other : nearby.keySet())
{
if (player.equals(other))
{
continue;
}
//Inform
// Inform
UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(player) + player.getName()) + " used " + F.skill(GetName()) + "."));
//Damage Event
Manager.GetDamage().NewDamageEvent(other, player, null,
DamageCause.CUSTOM, 6 * nearby.get(other), true, true, false,
player.getName(), GetName());
// Damage Event
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE * nearby.get(other), true, true, false, player.getName(), GetName());
}
//Inform
// Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
//Effect
Manager.GetBlood().Effects(null, player.getLocation().add(0, 0.5, 0), 48, 0.8, Sound.SKELETON_HURT, 2f, 1.2f, Material.BONE, (byte)0, 40, false);
// Effect
Manager.GetBlood().Effects(null, player.getLocation().add(0, 0.5, 0), 48, 0.8, Sound.SKELETON_HURT, 2f, 1.2f, Material.BONE, (byte) 0, 40, false);
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
}
event.AddKnockback(GetName(), 2.5);
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
}

View File

@ -0,0 +1,85 @@
package nautilus.game.arcade.game.games.smash.perks.skeleton;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
public class SmashSkeleton extends SmashUltimate
{
private static final int DURATION = 10000;
private Set<Projectile> _arrows = new HashSet<Projectile>();
public SmashSkeleton()
{
super("Arrow Storm", new String[] {}, Sound.SKELETON_HURT, DURATION);
}
@EventHandler
public void fireArrows(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (UUID uuid : getLastUltimate().keySet())
{
Player cur = UtilPlayer.searchExact(uuid);
if (cur == null)
{
continue;
}
Vector random = new Vector((Math.random() - 0.5) / 5, (Math.random() - 0.5) / 5, (Math.random() - 0.5) / 5);
Projectile arrow = cur.launchProjectile(Arrow.class);
arrow.setVelocity(cur.getLocation().getDirection().add(random).multiply(3));
_arrows.add(arrow);
cur.getWorld().playSound(cur.getLocation(), Sound.SHOOT_ARROW, 1f, 1f);
}
}
@EventHandler
public void projectileHit(ProjectileHitEvent event)
{
if (_arrows.remove(event.getEntity()))
{
event.getEntity().remove();
}
}
@EventHandler
public void clean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
}
for (Iterator<Projectile> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
{
Projectile arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid())
{
arrowIterator.remove();
}
}
}
}

View File

@ -1,7 +1,9 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.slime;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -10,9 +12,8 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
@ -20,12 +21,15 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
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.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.disguises.DisguiseSlime;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
@ -33,53 +37,71 @@ 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.smash.TeamSuperSmash;
import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkSlimeRocket extends SmashPerk implements IThrown
{
private HashMap<Player, Long> _charge = new HashMap<Player, Long>();
private HashMap<Slime, Player> _owner = new HashMap<Slime, Player>();
private HashMap<Slime, Long> _lastAttack = new HashMap<Slime, Long>();
public PerkSlimeRocket()
private static final int COOLDOWN = 6000;
private static final float ENERGY_PER_TICK = 0.004F;
private static final int KNOCKBACK_MAGNITUDE = 3;
private static final int MAX_ENERGY_TIME = 3000;
private static final int MAX_HOLD_TIME = 5000;
private Map<UUID, Long> _charge = new HashMap<>();
private Map<Slime, UUID> _owner = new HashMap<>();
private Map<Slime, Long> _lastAttack = new HashMap<>();
public PerkSlimeRocket()
{
super("Slime Rocket", new String[]
{
C.cYellow + "Hold/Release Block" + C.cGray + " to use " + C.cGreen + "Slime Rocket"
});
super("Slime Rocket", new String[] { C.cYellow + "Hold/Release Block" + C.cGray + " to use " + C.cGreen + "Slime Rocket" });
}
@EventHandler
public void EnergyUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!Kit.HasKit(player))
if (!hasPerk(player))
{
continue;
}
if (isSuperActive(player))
{
continue;
}
int size = 1;
if (player.getExp() > 0.8) size = 3;
else if (player.getExp() > 0.55) size = 2;
DisguiseSlime slime = (DisguiseSlime)Manager.GetDisguise().getDisguise(player);
if (player.getExp() > 0.8)
{
size = 3;
}
else if (player.getExp() > 0.55)
{
size = 2;
}
DisguiseSlime slime = (DisguiseSlime) Manager.GetDisguise().getActiveDisguise(player);
if (slime != null && slime.GetSize() != size)
{
slime.SetSize(size);
Manager.GetDisguise().updateDisguise(slime);
}
if (player.isBlocking())
if (player.isBlocking() && !Recharge.Instance.usable(player, GetName()))
{
continue;
}
player.setExp((float) Math.min(0.999, player.getExp()+0.004));
player.setExp((float) Math.min(0.999, player.getExp() + ENERGY_PER_TICK));
}
}
@ -87,51 +109,74 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown
public void Activate(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD"))
return;
}
Player player = event.getPlayer();
if (isSuperActive(player))
return;
if (!Kit.HasKit(player))
if (!UtilItem.isSword(player.getItemInHand()))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), 6000, true, true))
if (!hasPerk(player))
{
return;
}
if (isSuperActive(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
UtilPlayer.message(player, F.main("Skill", "You are charging " + F.skill(GetName()) + "."));
_charge.put(player, System.currentTimeMillis());
_charge.put(player.getUniqueId(), System.currentTimeMillis());
}
@EventHandler
public void ChargeRelease(UpdateEvent event)
public void ChargeRelease(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<Player> chargeIterator = _charge.keySet().iterator();
Iterator<UUID> chargeIterator = _charge.keySet().iterator();
while (chargeIterator.hasNext())
{
Player player = chargeIterator.next();
UUID key = chargeIterator.next();
Player player = UtilPlayer.searchExact(key);
long time = _charge.get(player);
//Charge
if (player == null)
{
chargeIterator.remove();
continue;
}
long time = _charge.get(key);
// Charge
if (player.isBlocking())
{
//Energy Depleted
// Energy Depleted
if (player.getExp() < 0.1)
{
FireRocket(player);
@ -139,29 +184,29 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown
}
else
{
double elapsed = Math.min(3, (double)(System.currentTimeMillis() - time)/1000d);
//Use Energy
if (!UtilTime.elapsed(time, 3000))
double elapsed = Math.min(3, (double) (System.currentTimeMillis() - time) / 1000d);
// Use Energy
if (!UtilTime.elapsed(time, MAX_ENERGY_TIME))
{
player.setExp((float) Math.max(0, player.getExp()-0.01f));
player.setExp((float) Math.max(0, player.getExp() - 0.01f));
}
//AutoFire
if (UtilTime.elapsed(time, 5000))
// AutoFire
if (UtilTime.elapsed(time, MAX_HOLD_TIME))
{
FireRocket(player);
chargeIterator.remove();
}
//Effect
player.getWorld().playSound(player.getLocation(), Sound.SLIME_WALK, 0.5f, (float)(0.5 + 1.5*(elapsed/3d)));
UtilParticle.PlayParticle(ParticleType.SLIME, player.getLocation().add(0, 1, 0),
(float)(elapsed/6d), (float)(elapsed/6d), (float)(elapsed/6d), 0, (int)(elapsed * 5),
ViewDist.LONGER, UtilServer.getPlayers());
float offset = (float) (elapsed / 6d);
// Effect
player.getWorld().playSound(player.getLocation(), Sound.SLIME_WALK, 0.5f, (float) (0.5 + 1.5 * (elapsed / 3d)));
UtilParticle.PlayParticle(ParticleType.SLIME, player.getLocation().add(0, 1, 0), offset, offset, offset, 0, (int) (elapsed * 5), ViewDist.LONGER, UtilServer.getPlayers());
}
}
//Release
// Release
else
{
FireRocket(player);
@ -172,54 +217,55 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown
public void FireRocket(Player player)
{
double charge = Math.min(3, (double)(System.currentTimeMillis() - _charge.get(player))/1000d);
double charge = Math.min(3, (double) (System.currentTimeMillis() - _charge.get(player.getUniqueId())) / 1000d);
//Spawn Slime
// Spawn Slime
Manager.GetGame().CreatureAllowOverride = true;
Slime slime = player.getWorld().spawn(player.getEyeLocation(), Slime.class);
slime.setSize(1);
Manager.GetGame().CreatureAllowOverride = false;
//Size
slime.setSize(Math.max(1, (int)charge));
// Size
slime.setSize(Math.max(1, (int) charge));
slime.setMaxHealth(5 + charge * 7);
slime.setHealth(slime.getMaxHealth());
_owner.put(slime, player);
//Inform
_owner.put(slime, player.getUniqueId());
// Inform
UtilPlayer.message(player, F.main("Skill", "You released " + F.skill(GetName()) + "."));
slime.leaveVehicle();
player.eject();
UtilAction.velocity(slime, player.getLocation().getDirection(), 1 + charge/2d, false, 0, 0.2, 10, true);
Manager.GetProjectile().AddThrow(slime, player, this, -1, true, true, true, true,
null, 0, 0, null, 0, UpdateType.FASTEST, 1f);
UtilAction.velocity(slime, player.getLocation().getDirection(), 1 + charge / 2d, false, 0, 0.2, 10, true);
Manager.GetProjectile().AddThrow(slime, player, this, -1, true, true, true, true, null, 0, 0, null, 0, UpdateType.FASTEST, 1f);
}
@EventHandler
public void SlimeTarget(EntityTargetEvent event)
{
if (event.isCancelled())
{
return;
}
if (!_owner.containsKey(event.getEntity()))
return;
if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player)
{
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
Player targetPlayer = (Player) event.getTarget();
if (smash.GetTeam(_owner.get(event.getEntity())).equals(smash.GetTeam(targetPlayer)))
return;
}
if (event.getTarget() instanceof Player)
{
if (isTeamDamage((Player) event.getTarget(), UtilPlayer.searchExact(_owner.get(event.getEntity()))))
{
event.setCancelled(true);
return;
}
}
if (_owner.get(event.getEntity()).equals(event.getTarget()))
{
event.setCancelled(true);
@ -230,86 +276,89 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target == null)
return;
if (!(data.getThrown() instanceof Slime))
return;
Slime slime = (Slime)data.getThrown();
if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player)
{
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
return;
}
if (!(data.getThrown() instanceof Slime))
{
return;
}
Slime slime = (Slime) data.getThrown();
if (target instanceof Player && data.getThrower() instanceof Player)
{
Player targetPlayer = (Player) target;
Player throwerPlayer = (Player) data.getThrower();
if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer)))
if (isTeamDamage(targetPlayer, throwerPlayer))
{
return;
}
}
//Damage Event
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null,
DamageCause.PROJECTILE, 3 + slime.getSize() * 3, true, true, false,
UtilEnt.getName(data.getThrower()), GetName());
// Damage Event
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 3 + slime.getSize() * 3, true, true, false, UtilEnt.getName(data.getThrower()), GetName());
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
event.AddKnockback(GetName(), 3.0);
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
@Override
public void Idle(ProjectileUser data)
{
}
@Override
public void Expire(ProjectileUser data)
{
}
@EventHandler
public void SlimeDamage(CustomDamageEvent event)
{
if (!(event.GetDamagerEntity(false) instanceof Slime))
{
return;
Slime slime = (Slime)event.GetDamagerEntity(false);
//Attack Rate
}
Slime slime = (Slime) event.GetDamagerEntity(false);
// Attack Rate
if (_lastAttack.containsKey(slime) && !UtilTime.elapsed(_lastAttack.get(slime), 500))
{
event.SetCancelled("Slime Attack Rate");
return;
}
_lastAttack.put(slime, System.currentTimeMillis());
//Get Owner
Player owner = _owner.get(slime);
//if (owner != null)
// event.SetDamager(owner); This gives knockback from wrong direction :(
if (Manager.GetGame() instanceof TeamSuperSmash)
// Get Owner
UUID key = _owner.get(slime);
Player owner = UtilPlayer.searchExact(key);
if (owner == null)
{
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
if (smash.GetTeam(owner).equals(smash.GetTeam(event.GetDamageePlayer())))
{
event.SetCancelled("Team Damage");
return;
}
return;
}
if (isTeamDamage(owner, event.GetDamageePlayer()))
{
event.SetCancelled("Team Damage");
return;
}
if (owner != null && owner.equals(event.GetDamageeEntity()))
{
event.SetCancelled("Owner Damage");
@ -319,41 +368,49 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown
event.AddMod("Slime Damage", "Negate", -event.GetDamageInitial(), false);
event.AddMod("Slime Damage", "Attack", 2 * slime.getSize(), true);
event.AddKnockback("Slime Knockback", 2);
}
}
}
@EventHandler
public void SlimeClean(UpdateEvent event)
public void SlimeClean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
}
Iterator<Slime> slimeIterator = _owner.keySet().iterator();
while (slimeIterator.hasNext())
{
Slime slime = slimeIterator.next();
//Shrink
// Shrink
if (slime.getVehicle() == null)
{
if (slime.getTicksLived() > 120)
{
slime.setTicksLived(1);
Manager.GetBlood().Effects(null, slime.getLocation(), 6 + 6 * slime.getSize(), 0.2 + 0.1 * slime.getSize(), null, 1f, 1f, Material.SLIME_BALL, (byte)0, 15, false);
Manager.GetBlood().Effects(null, slime.getLocation(), 6 + 6 * slime.getSize(), 0.2 + 0.1 * slime.getSize(), null, 1f, 1f, Material.SLIME_BALL, (byte) 0, 15, false);
if (slime.getSize() <= 1)
{
slime.remove();
}
else
slime.setSize(slime.getSize()-1);
{
slime.setSize(slime.getSize() - 1);
}
}
}
if (!slime.isValid())
{
slimeIterator.remove();
}
}
slimeIterator = _lastAttack.keySet().iterator();
while (slimeIterator.hasNext())
@ -361,7 +418,9 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown
Slime slime = slimeIterator.next();
if (!slime.isValid())
{
slimeIterator.remove();
}
}
}
}

View File

@ -0,0 +1,184 @@
package nautilus.game.arcade.game.games.smash.perks.slime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
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.smash.perks.SmashPerk;
public class PerkSlimeSlam extends SmashPerk
{
private static final int COOLDOWN = 6000;
private static final int HIT_BOX = 2;
private static final int START_TIME = 1000;
private static final int DAMAGE_RATE_LIMIT = 500;
private static final int DAMAGE = 7;
private static final int KNOCKBACK_MAGNITUDE = 2;
private Map<UUID, Long> _live = new HashMap<>();
public PerkSlimeSlam()
{
super("Slime Slam", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Slime Slam" });
}
@EventHandler
public void Leap(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
}
Player player = event.getPlayer();
if (!UtilItem.isAxe(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
UtilAction.velocity(player, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 1.2, true);
// Record
_live.put(player.getUniqueId(), System.currentTimeMillis());
// Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void End(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
List<Player> alivePlayers = Manager.GetGame().GetPlayers(true);
// Collide
for (Player player : alivePlayers)
{
if (!_live.containsKey(player.getUniqueId()))
{
continue;
}
for (Player other : alivePlayers)
{
if (player.equals(other) || UtilPlayer.isSpectator(other) || isTeamDamage(player, other))
{
continue;
}
if (UtilMath.offset(player, other) < HIT_BOX)
{
doSlam(player, other);
_live.remove(player.getUniqueId());
return;
}
}
}
// End
for (Player player : alivePlayers)
{
UUID key = player.getUniqueId();
if (!UtilEnt.isGrounded(player))
{
continue;
}
if (!_live.containsKey(key))
{
continue;
}
if (!UtilTime.elapsed(_live.get(key), START_TIME))
{
continue;
}
_live.remove(key);
}
}
public void doSlam(Player damager, LivingEntity damagee)
{
if (damagee instanceof Player)
{
if (!Recharge.Instance.use((Player) damagee, GetName() + " Hit", DAMAGE_RATE_LIMIT, false, false))
{
return;
}
}
// Recoil Event
if (!isSuperActive(damager))
{
Manager.GetDamage().NewDamageEvent(damager, damagee, null, DamageCause.CUSTOM, DAMAGE / 4, true, true, false, damager.getName(), GetName() + " Recoil");
// Damage Event
Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, DAMAGE, true, true, false, damager.getName(), GetName());
}
// Inform
UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + "."));
UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + "."));
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
}

View File

@ -0,0 +1,143 @@
package nautilus.game.arcade.game.games.smash.perks.slime;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseSlime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
public class SmashSlime extends SmashUltimate
{
private static final int DURATION = 19000;
private static final int HIT_BOX = 5;
private static final int DAMAGE = 8;
public SmashSlime()
{
super("Giga Slime", new String[] {}, Sound.SLIME_ATTACK, DURATION);
}
@Override
public void activate(Player player)
{
super.activate(player);
player.getInventory().remove(Material.IRON_SWORD);
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
if (disguise != null && disguise instanceof DisguiseSlime)
{
DisguiseSlime slime = (DisguiseSlime) disguise;
slime.SetSize(14);
Manager.GetDisguise().updateDisguise(slime);
}
player.setExp(0.99f);
Manager.GetCondition().Factory().Speed(GetName(), player, player, DURATION / 1000, 2, false, false, false);
}
@Override
public void cancel(Player player)
{
super.cancel(player);
Manager.GetCondition().EndCondition(player, ConditionType.SPEED, GetName());
}
@EventHandler(priority = EventPriority.LOW)
public void immunityDamagee(CustomDamageEvent event)
{
if (event.GetDamageePlayer() == null || event.GetDamagerEntity(true) == null)
{
return;
}
if (isUsingUltimate(event.GetDamageePlayer()))
{
event.SetCancelled(GetName());
}
}
@EventHandler(priority = EventPriority.LOW)
public void immunityDamager(CustomDamageEvent event)
{
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
{
return;
}
if (event.GetDamagerPlayer(true) == null)
{
return;
}
if (isUsingUltimate(event.GetDamagerPlayer(true)))
{
event.SetCancelled(GetName());
}
}
@EventHandler
public void collide(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
List<Player> alivePlayers = Manager.GetGame().GetPlayers(true);
for (Player player : alivePlayers)
{
if (!isUsingUltimate(player))
{
continue;
}
for (Player other : alivePlayers)
{
if (player.equals(other))
{
continue;
}
if (UtilPlayer.isSpectator(other))
{
continue;
}
if (UtilMath.offset(player.getLocation().add(0, 3, 0), other.getLocation()) < HIT_BOX)
{
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, false, false, player.getName(), GetName());
UtilParticle.PlayParticle(ParticleType.SLIME, other.getLocation().add(0, 0.6, 0), 1f, 1f, 1f, 0, 20, ViewDist.LONG, UtilServer.getPlayers());
player.getWorld().playSound(other.getLocation(), Sound.SLIME_ATTACK, 3f, 1f);
}
}
}
}
}

View File

@ -0,0 +1,56 @@
package nautilus.game.arcade.game.games.smash.perks.snowman;
import java.util.Map;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkArcticAura extends Perk
{
private static final int DURATION = 2000;
private static final int RANGE = 5;
public PerkArcticAura()
{
super("Arctic Aura", new String[] { "You freeze things around you, slowing enemies." });
}
@EventHandler
public void SnowAura(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!hasPerk(player))
{
continue;
}
if (UtilPlayer.isSpectator(player))
{
continue;
}
double range = RANGE * player.getExp();
Map<Block, Double> blocks = UtilBlock.getInRadius(player.getLocation(), range);
for (Block block : blocks.keySet())
{
Manager.GetBlockRestore().snow(block, (byte) 1, (byte) 1, (int) (DURATION * (1 + blocks.get(block))), 250, 0);
}
}
}
}

View File

@ -0,0 +1,173 @@
package nautilus.game.arcade.game.games.smash.perks.snowman;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
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.kit.Perk;
public class PerkBlizzard extends Perk
{
private static final float MAX_ENERGY = 0.99F;
private static final float ENERGY_PER_TICK = 1 / 60;
private static final float ENERGY_PER_USE = 1 / 9;
private static final int SNOWBALL_PER_USE = 4;
private Map<Projectile, Player> _snowball = new HashMap<>();
public PerkBlizzard()
{
super("Blizzard", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Blizzard" });
}
@EventHandler
public void EnergyUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!hasPerk(player))
{
continue;
}
if (player.isBlocking())
{
continue;
}
player.setExp(Math.min(MAX_ENERGY, player.getExp() + ENERGY_PER_TICK));
}
}
@EventHandler
public void Snow(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
{
return;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!player.isBlocking())
{
continue;
}
if (!hasPerk(player))
{
continue;
}
// Energy
if (player.getExp() < 0.1)
{
continue;
}
player.setExp(Math.max(0, player.getExp() - ENERGY_PER_USE));
for (int i = 0; i < SNOWBALL_PER_USE; i++)
{
Snowball snow = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Snowball.class);
double x = 0.1 - (UtilMath.r(20) / 100d);
double y = UtilMath.r(20) / 100d;
double z = 0.1 - (UtilMath.r(20) / 100d);
snow.setShooter(player);
snow.setVelocity(player.getLocation().getDirection().add(new Vector(x, y, z)).multiply(2));
_snowball.put(snow, player);
}
// Effect
player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 0.1f, 0.5f);
}
}
@EventHandler(priority = EventPriority.LOW)
public void Snowball(CustomDamageEvent event)
{
if (event.GetCause() != DamageCause.PROJECTILE)
{
return;
}
Projectile proj = event.GetProjectile();
if (proj == null)
{
return;
}
if (!(proj instanceof Snowball))
{
return;
}
if (!_snowball.containsKey(proj))
{
return;
}
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null)
{
return;
}
event.SetCancelled("Blizzard");
UtilAction.velocity(damagee, proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0)));
// Damage Event
if (damagee instanceof Player)
{
if (Recharge.Instance.use((Player) damagee, GetName(), 200, false, false))
{
Manager.GetDamage().NewDamageEvent(damagee, event.GetDamagerEntity(true), null, DamageCause.CUSTOM, 1, false, true, false, UtilEnt.getName(event.GetDamagerEntity(true)), GetName());
}
}
}
@EventHandler
public void SnowballForm(ProjectileHitEvent event)
{
Projectile proj = event.getEntity();
if (!(proj instanceof Snowball))
{
return;
}
if (_snowball.remove(proj) == null)
{
return;
}
Manager.GetBlockRestore().snow(proj.getLocation().getBlock(), (byte) 1, (byte) 7, 2000, 250, 0);
}
}

View File

@ -0,0 +1,49 @@
package nautilus.game.arcade.game.games.smash.perks.snowman;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.kit.Perk;
public class PerkDamageSnow extends Perk
{
private int _damage;
private double _knockback;
public PerkDamageSnow(int damage, double knockback)
{
super("Snow Attack", new String[] { C.cGray + "+" + damage + " Damage and " + (int) ((knockback - 1) * 100) + "% Knockback to enemies on snow.", });
_damage = damage;
_knockback = knockback;
}
@EventHandler(priority = EventPriority.HIGH)
public void Knockback(CustomDamageEvent event)
{
if (event.GetDamageeEntity().getLocation().getBlock().getType() != Material.SNOW)
{
return;
}
Player damager = event.GetDamagerPlayer(true);
if (damager == null)
{
return;
}
if (!hasPerk(damager) || UtilPlayer.isSpectator(damager))
{
return;
}
event.AddMod(damager.getName(), GetName(), _damage, false);
event.AddKnockback("Knockback Snow", _knockback);
}
}

View File

@ -1,13 +1,13 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.snowman;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.Effect;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
@ -15,6 +15,9 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
@ -24,65 +27,77 @@ import nautilus.game.arcade.kit.perks.data.IcePathData;
public class PerkIcePath extends Perk
{
private HashSet<IcePathData> _data = new HashSet<IcePathData>();
public PerkIcePath()
private static final int COOLDOWN = 12000;
private static final int MELT_TIME = 6000;
private Set<IcePathData> _data = new HashSet<>();
public PerkIcePath()
{
super("Ice Path", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Ice Path"
});
super("Ice Path", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Ice Path" });
}
@EventHandler
public void Skill(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
}
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
}
Player player = event.getPlayer();
if (!Kit.HasKit(player))
if (!UtilItem.isAxe(player.getItemInHand()))
{
return;
if (!Recharge.Instance.use(player, GetName(), 12000, true, true))
}
if (!hasPerk(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
player.teleport(player.getLocation().add(0, 1, 0));
UtilAction.velocity(player, new Vector(0,0.5,0));
UtilAction.velocity(player, new Vector(0, 0.5, 0));
_data.add(new IcePathData(player));
//Inform
// Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void Freeze(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<IcePathData> dataIterator = _data.iterator();
while (dataIterator.hasNext())
{
IcePathData data = dataIterator.next();
IcePathData data = dataIterator.next();
Block block = data.GetNextBlock();
if (block == null)
{
dataIterator.remove();
@ -90,7 +105,7 @@ public class PerkIcePath extends Perk
else
{
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 79);
Manager.GetBlockRestore().add(block, 79, (byte) 0, 6000);
Manager.GetBlockRestore().add(block, 79, (byte) 0, MELT_TIME);
}
}
}

View File

@ -0,0 +1,254 @@
package nautilus.game.arcade.game.games.smash.perks.snowman;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.Snowman;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
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.Game;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
public class SmashSnowman extends SmashUltimate
{
private static final int DURATION = 20000;
private static final int TURRET_HEALTH = 40;
private static final int RATE = 250;
private static final float KNOCKBACK_MAGNITUDE = 2.5F;
private static final int COOLDOWN = 1000;
private Map<Projectile, Player> _snowball = new HashMap<>();
private Map<Snowman, Player> _turret = new HashMap<>();
public SmashSnowman()
{
super("Snow Turret", new String[] {}, Sound.STEP_SNOW, DURATION);
}
@Override
public void activate(Player player)
{
// super.activate(player);
player.sendMessage(F.main("Game", "Activated " + F.skill(GetName()) + "."));
Game game = Manager.GetGame();
game.CreatureAllowOverride = true;
Snowman ent = player.getWorld().spawn(player.getEyeLocation(), Snowman.class);
game.CreatureAllowOverride = false;
UtilEnt.Vegetate(ent);
UtilEnt.ghost(ent, true, false);
ent.setMaxHealth(TURRET_HEALTH);
ent.setHealth(TURRET_HEALTH);
UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false);
Recharge.Instance.useForce(player, "Smash Cooldown - " + GetName(), COOLDOWN);
_turret.put(ent, player);
}
@Override
public void cancel(Player player)
{
// super.cancel(player);
player.sendMessage(F.main("Game", "Deactivated " + F.skill(GetName()) + "."));
/*
Iterator<Snowman> iterator = _turret.keySet().iterator();
while (iterator.hasNext())
{
Snowman snowman = iterator.next();
if (_turret.get(snowman).equals(player))
{
UtilParticle.PlayParticle(ParticleType.SNOWBALL_POOF, snowman.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12, ViewDist.LONG, UtilServer.getPlayers());
snowman.remove();
iterator.remove();
return;
}
}
*/
}
@EventHandler
public void updateSnowman(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
{
return;
}
Iterator<Snowman> turretIter = _turret.keySet().iterator();
while (turretIter.hasNext())
{
Snowman snowman = turretIter.next();
if(snowman.getTicksLived() >= (DURATION/50.0))
{
UtilParticle.PlayParticle(ParticleType.SNOWBALL_POOF, snowman.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12, ViewDist.LONG, UtilServer.getPlayers());
snowman.remove();
turretIter.remove();
continue;
}
else
{
double amount = 1 - snowman.getTicksLived() / (DURATION/50.0);
snowman.setCustomName(UtilText.getProgress(C.cGreen, amount, C.cRed, false));
snowman.setCustomNameVisible(true);
}
Player player = _turret.get(snowman);
Player target = UtilPlayer.getClosest(snowman.getLocation(), TeamSuperSmash.getTeam(Manager, player, true));
if (target == null)
{
continue;
}
snowman.setTarget(target);
// Snowball
double mult = 1 + Math.min(3, UtilMath.offset(snowman, target) / 16);
double heightBonus = UtilMath.offset(snowman, target) / 140;
Vector rand = new Vector((Math.random() - 0.5) * 0.2, (Math.random() - 0.5) * 0.2, (Math.random() - 0.5) * 0.2);
_snowball.put(snowman.launchProjectile(Snowball.class, UtilAlg.getTrajectory(snowman.getLocation(), target.getLocation()).multiply(mult).add(rand).add(new Vector(0, heightBonus, 0))),
player);
// Look dir
UtilEnt.CreatureMoveFast(snowman, target.getLocation(), 0.1f);
// Sound
snowman.getWorld().playSound(snowman.getLocation(), Sound.STEP_SNOW, 0.6f, 1f);
}
}
@EventHandler(priority = EventPriority.LOW)
public void snowballHit(CustomDamageEvent event)
{
if (event.GetCause() != DamageCause.PROJECTILE)
{
return;
}
Projectile proj = event.GetProjectile();
if (proj == null)
{
return;
}
if (!(proj instanceof Snowball))
{
return;
}
Player damager = _snowball.get(proj);
if (damager == null)
{
return;
}
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null)
{
return;
}
event.SetCancelled("Turret");
if(TeamSuperSmash.getTeam(Manager, damager, true).contains(damagee))
{
return;
}
UtilAction.velocity(damagee, proj.getVelocity().multiply(0.3).add(new Vector(0, 0.3, 0)));
// Damage Event
if (!(damagee instanceof LivingEntity))
{
return;
}
if (!Recharge.Instance.use((Player) damagee, GetName() + " Hit", RATE, false, false))
{
return;
}
Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.PROJECTILE, 2, false, true, false, UtilEnt.getName(_snowball.get(proj)), GetName());
}
@EventHandler
public void damageCancel(CustomDamageEvent event)
{
if (_turret.containsKey(event.GetDamageeEntity()))
{
event.SetCancelled("Turret Immunity");
}
}
@EventHandler
public void clean(ProjectileHitEvent event)
{
_snowball.remove(event.getEntity());
}
@EventHandler
public void knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
@Override
public boolean isUsable(Player player)
{
return Recharge.Instance.usable(player, "Smash Cooldown - " + GetName());
}
}

View File

@ -1,106 +1,127 @@
package nautilus.game.arcade.kit.perks;
package nautilus.game.arcade.game.games.smash.perks.spider;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
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.kit.Perk;
import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkNeedler extends SmashPerk
{
private HashMap<Player, Integer> _active = new HashMap<Player, Integer>();
private HashSet<Arrow> _arrows = new HashSet<Arrow>();
public PerkNeedler()
private static final int COOLDOWN_NORMAL = 2000;
private static final int COOLDOWN_SMASH = 600;
private static final float DAMAGE = 1.1F;
private static final int MAX_TICKS = 300;
private Map<UUID, Integer> _active = new HashMap<>();
private Set<Arrow> _arrows = new HashSet<>();
public PerkNeedler()
{
super("Needler", new String[]
{
C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Needler"
});
super("Needler", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Needler" });
}
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.isCancelled())
{
return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
if (UtilBlock.usable(event.getClickedBlock()))
{
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD"))
return;
}
Player player = event.getPlayer();
if (!Kit.HasKit(player))
if (!UtilItem.isSword(player.getItemInHand()))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 600 : 2000, !isSuperActive(player), !isSuperActive(player)))
if (!hasPerk(player))
{
return;
}
_active.put(player, 8);
if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? COOLDOWN_SMASH : COOLDOWN_NORMAL, !isSuperActive(player), !isSuperActive(player)))
{
return;
}
_active.put(player.getUniqueId(), 8);
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void Update(UpdateEvent event)
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : UtilServer.getPlayers())
{
if (!_active.containsKey(cur))
UUID key = cur.getUniqueId();
if (!_active.containsKey(key))
{
continue;
}
if (!cur.isBlocking())
{
_active.remove(cur);
_active.remove(key);
continue;
}
int count = _active.get(cur) - 1;
int count = _active.get(key) - 1;
if (count <= 0)
{
_active.remove(cur);
_active.remove(key);
continue;
}
else
{
_active.put(cur, count);
_active.put(key, count);
}
Arrow arrow = cur.getWorld().spawnArrow(cur.getEyeLocation().add(cur.getLocation().getDirection()),
cur.getLocation().getDirection(), 1.2f, 6);
Arrow arrow = cur.getWorld().spawnArrow(cur.getEyeLocation().add(cur.getLocation().getDirection()), cur.getLocation().getDirection(), 1.2f, 6);
arrow.setShooter(cur);
_arrows.add(arrow);
//Sound
// Sound
cur.getWorld().playSound(cur.getLocation(), Sound.SPIDER_IDLE, 0.8f, 2f);
}
}
@ -109,45 +130,53 @@ public class PerkNeedler extends SmashPerk
public void ArrowDamamge(CustomDamageEvent event)
{
if (event.GetProjectile() == null)
{
return;
}
if (event.GetDamagerPlayer(true) == null)
{
return;
}
if (!(event.GetProjectile() instanceof Arrow))
{
return;
}
Player damager = event.GetDamagerPlayer(true);
if (!Kit.HasKit(damager))
if (!hasPerk(damager))
{
return;
}
event.SetCancelled("Needler Cancel");
event.GetProjectile().remove();
//Damage Event
Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), damager, null,
DamageCause.THORNS, 1.1, true, true, false,
damager.getName(), GetName());
if(!Manager.GetGame().GetTeam(event.GetDamageePlayer()).equals(Manager.GetGame().GetTeam(damager)))
event.GetProjectile().remove();
// Damage Event
Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), damager, null, DamageCause.THORNS, DAMAGE, true, true, false, damager.getName(), GetName());
if (!isTeamDamage(damager, event.GetDamageePlayer()))
{
Manager.GetCondition().Factory().Poison(GetName(), event.GetDamageeEntity(), damager, 2, 0, false, false, false);
}
}
@EventHandler
public void Clean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
}
for (Iterator<Arrow> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
for (Iterator<Arrow> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
{
Arrow arrow = arrowIterator.next();
if (arrow.isOnGround() || !arrow.isValid() || arrow.getTicksLived() > 300)
if (arrow.isOnGround() || !arrow.isValid() || arrow.getTicksLived() > MAX_TICKS)
{
arrowIterator.remove();
arrow.remove();

Some files were not shown because too many files have changed in this diff Show More