Progress on converting SSM to a new cleaner system

This commit is contained in:
Sam 2016-09-22 17:11:21 +01:00
parent 209ea32ef9
commit 2ba2b21577
136 changed files with 8436 additions and 2473 deletions

View File

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

View File

@ -15,8 +15,9 @@ import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.smash.kits.*; import nautilus.game.arcade.game.games.smash.kits.*;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.SmashKit;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;

View File

@ -3,9 +3,14 @@ package nautilus.game.arcade.game.games.smash;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
@ -17,21 +22,12 @@ import nautilus.game.arcade.stats.OneVThreeStatTracker;
import nautilus.game.arcade.stats.RecoveryMasterStatTracker; import nautilus.game.arcade.stats.RecoveryMasterStatTracker;
import nautilus.game.arcade.stats.WinWithoutDyingStatTracker; import nautilus.game.arcade.stats.WinWithoutDyingStatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class TeamSuperSmash extends SuperSmash public class TeamSuperSmash extends SuperSmash
{ {
public TeamSuperSmash(ArcadeManager manager) public TeamSuperSmash(ArcadeManager manager)
{ {
super(manager, GameType.SmashTeams, super(manager, GameType.SmashTeams, new String[] { "Each player has 3 respawns", "Attack to restore hunger!", "Last team alive wins!" });
new String[]
{
"Each player has 3 respawns",
"Attack to restore hunger!",
"Last team alive wins!"
});
PlayersPerTeam = 2; PlayersPerTeam = 2;
FillTeamsInOrderToCount = 2; FillTeamsInOrderToCount = 2;
@ -47,25 +43,10 @@ public class TeamSuperSmash extends SuperSmash
registerModule(new TeamModule()); registerModule(new TeamModule());
registerStatTrackers( registerStatTrackers(new WinWithoutDyingStatTracker(this, "MLGPro"), new FreeKitWinStatTracker(this), new OneVThreeStatTracker(this), new KillFastStatTracker(this, 3, 10, "TripleKill"),
new WinWithoutDyingStatTracker(this, "MLGPro"), new RecoveryMasterStatTracker(this));
new FreeKitWinStatTracker(this),
new OneVThreeStatTracker(this),
new KillFastStatTracker(this, 3, 10, "TripleKill"),
new RecoveryMasterStatTracker(this)
);
registerChatStats( registerChatStats(Kills, Deaths, KDRatio, BlankLine, Assists, DamageTaken, DamageDealt, BlankLine, new ChatStatData("kit", "Kit", true));
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt,
BlankLine,
new ChatStatData("kit", "Kit", true)
);
} }
@Override @Override
@ -82,7 +63,7 @@ public class TeamSuperSmash extends SuperSmash
alive.add(team); alive.add(team);
} }
//Wipe Last // Wipe Last
Scoreboard.reset(); Scoreboard.reset();
Scoreboard.writeNewLine(); Scoreboard.writeNewLine();
@ -122,6 +103,27 @@ public class TeamSuperSmash extends SuperSmash
Scoreboard.draw(); Scoreboard.draw();
} }
@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).equals(GetTeam(damagee)))
{
if (event.GetCause() == DamageCause.FIRE)
{
damagee.setFireTicks(0);
}
event.SetCancelled("Team Damage");
}
}
@Override @Override
public void EndCheck() public void EndCheck()
{ {
@ -136,7 +138,7 @@ public class TeamSuperSmash extends SuperSmash
if (teamsAlive.size() <= 1) if (teamsAlive.size() <= 1)
{ {
//Announce // Announce
if (teamsAlive.size() > 0) if (teamsAlive.size() > 0)
AnnounceEnd(teamsAlive.get(0)); AnnounceEnd(teamsAlive.get(0));
@ -153,7 +155,7 @@ public class TeamSuperSmash extends SuperSmash
AddGems(player, 10, "Participation", false, false); AddGems(player, 10, "Participation", false, false);
} }
//End // End
SetState(GameState.End); SetState(GameState.End);
} }
} }

View File

@ -1,5 +1,12 @@
package nautilus.game.arcade.game.games.smash.kits; 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.C;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseBlaze; import mineplex.core.disguise.disguises.DisguiseBlaze;
@ -8,24 +15,18 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit2;
import nautilus.game.arcade.game.games.smash.perks.blaze.PerkInferno;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; 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.*; import nautilus.game.arcade.kit.perks.PerkFirefly;
import org.bukkit.ChatColor; import nautilus.game.arcade.kit.perks.PerkKnockbackFire;
import org.bukkit.Material; import nautilus.game.arcade.kit.perks.PerkSpeed;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
public class KitBlaze extends SmashKit public class KitBlaze extends SmashKit2
{ {
private static final String[] DESCRIPTION = {
DOUBLE_JUMP,
};
private static final Perk[] PERKS = { private static final Perk[] PERKS = {
new PerkSmashStats(6, 1.5, 0.25, 5), new PerkSmashStats(6, 1.5, 0.25, 5),
new PerkDoubleJump("Double Jump", 1, 1, false), new PerkDoubleJump("Double Jump", 1, 1, false),
@ -64,20 +65,22 @@ public class KitBlaze extends SmashKit
}; };
private static final ItemStack[] PLAYER_ARMOR = { private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), new ItemStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_CHESTPLATE),
}; };
public KitBlaze(ArcadeManager manager) 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 @Override
public void giveCoreItems(Player player) public void GiveItems(Player player)
{ {
disguise(player);
UtilInv.Clear(player); UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -86,50 +89,29 @@ public class KitBlaze extends SmashKit
player.getInventory().addItem(PLAYER_ITEMS[2]); player.getInventory().addItem(PLAYER_ITEMS[2]);
} }
player.getInventory().setArmorContents(PLAYER_ARMOR); 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 @EventHandler
public void FireItemResist(UpdateEvent event) public void FireItemResist(UpdateEvent event)
{ {
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
{
return; return;
}
if (Manager.GetGame() == null) if (Manager.GetGame() == null)
{
return; return;
}
for (Player player : Manager.GetGame().GetPlayers(true)) for (Player player : Manager.GetGame().GetPlayers(true))
{ {
if (!HasKit(player)) if (!HasKit(player))
{
continue; continue;
}
Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false); Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false);
} }

View File

@ -1,29 +1,27 @@
package nautilus.game.arcade.game.games.smash.kits; 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.C;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit2;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; 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.PerkChickenRocket;
import nautilus.game.arcade.kit.perks.PerkEggGun; import nautilus.game.arcade.kit.perks.PerkEggGun;
import nautilus.game.arcade.kit.perks.PerkFlap; 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 public class KitChicken extends SmashKit2
{ {
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = { private static final Perk[] PERKS = {
new PerkSmashStats(4.5, 2.0, 0.2, 2), new PerkSmashStats(4.5, 2.0, 0.2, 2),
@ -71,19 +69,21 @@ public class KitChicken extends SmashKit
private static final ItemStack[] PLAYER_ARMOR = { private static final ItemStack[] PLAYER_ARMOR = {
null, null,
null, null,
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_CHESTPLATE),
null null
}; };
public KitChicken(ArcadeManager manager) 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 @Override
public void giveCoreItems(Player player) public void GiveItems(Player player)
{ {
disguise(player);
UtilInv.Clear(player); UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -93,39 +93,6 @@ public class KitChicken extends SmashKit
player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]);
} }
player.getInventory().setArmorContents(PLAYER_ARMOR); 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,30 +1,29 @@
package nautilus.game.arcade.game.games.smash.kits; 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.C;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseCow; import mineplex.core.disguise.disguises.DisguiseCow;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkCowAngryHerd; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.PerkCowMilkSpiral; import nautilus.game.arcade.game.games.smash.perks.SmashKit2;
import nautilus.game.arcade.game.games.smash.perks.PerkCowMooshroomMadness; import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowAngryHerd;
import nautilus.game.arcade.game.games.smash.perks.PerkCowStampede; import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowMilkSpiral;
import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowMooshroomMadness;
import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowStampede;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; 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.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 public class KitCow extends SmashKit2
{ {
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = { private static final Perk[] PERKS = {
new PerkSmashStats(6, 1.1, 0.25, 6.5), new PerkSmashStats(6, 1.1, 0.25, 6.5),
@ -70,57 +69,34 @@ public class KitCow extends SmashKit
ChatColor.RESET + "and abilities, halves ability cooldowns,", ChatColor.RESET + "and abilities, halves ability cooldowns,",
ChatColor.RESET + "and increases your health to 15 hearts.", ChatColor.RESET + "and increases your health to 15 hearts.",
ChatColor.RESET + "", 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 = { private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), new ItemStack(Material.IRON_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), new ItemStack(Material.IRON_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), new ItemStack(Material.IRON_HELMET),
}; };
public KitCow(ArcadeManager manager) 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 @Override
public void giveCoreItems(Player player) public void GiveItems(Player player)
{ {
disguise(player);
UtilInv.Clear(player); UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
if (Manager.GetGame().GetState() == GameState.Recruit) if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]);
player.getInventory().setArmorContents(PLAYER_ARMOR); 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,27 +1,28 @@
package nautilus.game.arcade.game.games.smash.kits; 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.C;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseCreeper; import mineplex.core.disguise.disguises.DisguiseCreeper;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit2;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.PerkCreeperElectricity;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.PerkCreeperExplode;
import org.bukkit.ChatColor; import nautilus.game.arcade.kit.perks.PerkCreeperSulphurBomb;
import org.bukkit.Material; import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitCreeper extends SmashKit public class KitCreeper extends SmashKit2
{ {
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = { private static final Perk[] PERKS = {
new PerkSmashStats(6, 1.65, 0.4, 3.5), new PerkSmashStats(6, 1.65, 0.4, 3.5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
@ -72,21 +73,22 @@ public class KitCreeper extends SmashKit
}; };
private static final ItemStack[] PLAYER_ARMOR = { private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS), new ItemStack(Material.LEATHER_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS), new ItemStack(Material.LEATHER_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE), new ItemStack(Material.LEATHER_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET), new ItemStack(Material.LEATHER_HELMET),
}; };
public KitCreeper(ArcadeManager manager) 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 @Override
public void giveCoreItems(Player player) public void GiveItems(Player player)
{ {
disguise(player);
UtilInv.Clear(player); UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -95,27 +97,4 @@ public class KitCreeper extends SmashKit
player.getInventory().setArmorContents(PLAYER_ARMOR); 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; 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.C;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseEnderman; import mineplex.core.disguise.disguises.DisguiseEnderman;
@ -8,30 +20,20 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; 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.SmashKit2;
import nautilus.game.arcade.game.games.smash.perks.enderman.PerkEndermanTeleport;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.PerkBlink;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.PerkBlockToss;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkEndermanDragon;
import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent;
import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; 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; public class KitEnderman extends SmashKit2
import java.util.Iterator;
import java.util.Map.Entry;
public class KitEnderman extends SmashKit
{ {
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = { private static final Perk[] PERKS = {
new PerkSmashStats(7, 1.3, 0.25, 6), new PerkSmashStats(7, 1.3, 0.25, 6),
@ -73,10 +75,10 @@ public class KitEnderman extends SmashKit
}; };
private static final ItemStack[] PLAYER_ARMOR = { private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), new ItemStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), new ItemStack(Material.CHAINMAIL_HELMET),
}; };
@ -84,49 +86,26 @@ public class KitEnderman extends SmashKit
public KitEnderman(ArcadeManager manager) public KitEnderman(ArcadeManager manager)
{ {
super(manager, "Enderman", KitAvailability.Gem, 3000, DESCRIPTION, PERKS, EntityType.ENDERMAN, IN_HAND, "Dragon Rider", 30000, Sound.ENDERDRAGON_GROWL); super(manager, "Enderman", KitAvailability.Gem, 3000, PERKS, EntityType.ENDERMAN, IN_HAND, DisguiseEnderman.class);
}
@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);
} }
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
giveCoreItems(player); disguise(player);
//Disguise _disguises.put(player, (DisguiseEnderman) Manager.GetDisguise().getActiveDisguise(player));
DisguiseEnderman disguise = new DisguiseEnderman(player);
if (Manager.GetGame().GetTeam(player) != null) UtilInv.Clear(player);
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
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 @EventHandler
@ -150,7 +129,9 @@ public class KitEnderman extends SmashKit
public void SetBlock(DisguiseEnderman disguise, int id, byte data) public void SetBlock(DisguiseEnderman disguise, int id, byte data)
{ {
if (disguise == null) if (disguise == null)
{
return; return;
}
disguise.SetCarriedId(id); disguise.SetCarriedId(id);
disguise.SetCarriedData(data); disguise.SetCarriedData(data);
@ -162,16 +143,19 @@ public class KitEnderman extends SmashKit
public void cleanDisguises(UpdateEvent event) public void cleanDisguises(UpdateEvent event)
{ {
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
{
return; 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(); Entry<Player, DisguiseEnderman> current = iterator.next();
if (!Manager.GetDisguise().isDisguised(current.getKey())) if (!Manager.GetDisguise().isDisguised(current.getKey()))
{ {
iterator.remove(); iterator.remove();
} else if (Manager.GetDisguise().getDisguise(current.getKey()) != current.getValue()) }
else if (Manager.GetDisguise().getActiveDisguise(current.getKey()) != current.getValue())
{ {
iterator.remove(); iterator.remove();
} }

View File

@ -6,9 +6,11 @@ import mineplex.core.disguise.disguises.DisguiseIronGolem;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; 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.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;

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,29 @@
package nautilus.game.arcade.game.games.smash.kits; 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.C;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseMagmaCube; import mineplex.core.disguise.disguises.DisguiseMagmaCube;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit2;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; 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.*; import nautilus.game.arcade.kit.perks.PerkFlameDash;
import org.bukkit.ChatColor; import nautilus.game.arcade.kit.perks.PerkMagmaBlast;
import org.bukkit.Material; import nautilus.game.arcade.kit.perks.PerkMagmaBoost;
import org.bukkit.Sound; import nautilus.game.arcade.kit.perks.PerkMeteorShower;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitMagmaCube extends SmashKit public class KitMagmaCube extends SmashKit2
{ {
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = { private static final Perk[] PERKS = {
new PerkSmashStats(5, 1.75, 0.35, 5), new PerkSmashStats(5, 1.75, 0.35, 5),
@ -67,20 +70,26 @@ public class KitMagmaCube extends SmashKit
}; };
private static final ItemStack[] PLAYER_ARMOR = { private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_BOOTS),
null, null,
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), new ItemStack(Material.CHAINMAIL_HELMET),
}; };
public KitMagmaCube(ArcadeManager manager) 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 @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); UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -88,31 +97,6 @@ public class KitMagmaCube extends SmashKit
if (Manager.GetGame().GetState() == GameState.Recruit) if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[2]); player.getInventory().addItem(PLAYER_ITEMS[2]);
player.getInventory().setArmorContents(PLAYER_ARMOR); player.getInventory().setArmorContents(PLAYER_ARMOR);;
}
@Override
public void giveSuperItems(Player player)
{
}
@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);
} }
} }

View File

@ -1,5 +1,12 @@
package nautilus.game.arcade.game.games.smash.kits; 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.C;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguisePig; import mineplex.core.disguise.disguises.DisguisePig;
@ -8,22 +15,21 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit2;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; 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.*; import nautilus.game.arcade.kit.perks.PerkPigBaconBomb;
import org.bukkit.ChatColor; import nautilus.game.arcade.kit.perks.PerkPigBaconBounce;
import org.bukkit.Material; import nautilus.game.arcade.kit.perks.PerkPigZombie;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
public class KitPig extends SmashKit public class KitPig extends SmashKit2
{ {
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 = { private static final Perk[] PERKS = {
new PerkSmashStats(5, 1.5, 0.25, 5), new PerkSmashStats(5, 1.5, 0.25, 5),
@ -75,21 +81,23 @@ public class KitPig extends SmashKit
}; };
private static final ItemStack[] PLAYER_ARMOR = { private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), new ItemStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_CHESTPLATE),
null, null,
}; };
public KitPig(ArcadeManager manager) 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 @Override
public void giveCoreItems(Player player) public void GiveItems(Player player)
{ {
disguise(player);
UtilInv.Clear(player); UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -97,59 +105,25 @@ public class KitPig extends SmashKit
if (Manager.GetGame().GetState() == GameState.Recruit) if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]);
player.getInventory().setArmorContents(PLAYER_ARMOR); 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 @EventHandler
public void EnergyUpdate(UpdateEvent event) public void EnergyUpdate(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
{
return; return;
}
for (Player player : Manager.GetGame().GetPlayers(true)) for (Player player : Manager.GetGame().GetPlayers(true))
{ {
if (!HasKit(player)) if (!HasKit(player))
{
continue; continue;
player.setExp((float) Math.min(0.999, player.getExp() + (isSuperActive(player) ? 0.02 : 0.005)));
}
} }
@Override player.setExp((float) Math.min(MAX_ENERGY, player.getExp() + (isSmashActive(player) ? ENERGY_PER_TICK_SMASH : ENERGY_PER_TICK_NORMAL)));
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; 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.achievement.Achievement;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
@ -7,22 +13,18 @@ import mineplex.core.disguise.disguises.DisguiseSheep;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit2;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; 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.*; import nautilus.game.arcade.kit.perks.PerkLazer;
import org.bukkit.ChatColor; import nautilus.game.arcade.kit.perks.PerkSheepHoming;
import org.bukkit.DyeColor; import nautilus.game.arcade.kit.perks.PerkWoolBomb;
import org.bukkit.Material; import nautilus.game.arcade.kit.perks.PerkWoolCloud;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitSheep extends SmashKit public class KitSheep extends SmashKit2
{ {
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = { private static final Perk[] PERKS = {
new PerkSmashStats(5, 1.7, 0.25, 5), new PerkSmashStats(5, 1.7, 0.25, 5),
@ -89,14 +91,16 @@ public class KitSheep extends SmashKit
public KitSheep(ArcadeManager manager) 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); this.setAchievementRequirements(ACHIEVEMENTS);
} }
@Override @Override
public void giveCoreItems(Player player) public void GiveItems(Player player)
{ {
disguise(player);
UtilInv.Clear(player); UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1], PLAYER_ITEMS[2]); 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); 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,28 +1,32 @@
package nautilus.game.arcade.game.games.smash.kits; 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.C;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseHorse; import mineplex.core.disguise.disguises.DisguiseHorse;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit2;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.PerkBoneRush;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.PerkDeadlyBones;
import org.bukkit.ChatColor; import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import org.bukkit.Location; import nautilus.game.arcade.kit.perks.PerkHorseKick;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.*;
import org.bukkit.entity.Horse.Variant;
import org.bukkit.inventory.ItemStack;
public class KitSkeletalHorse extends SmashKit public class KitSkeletalHorse extends SmashKit2
{ {
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = { private static final Perk[] PERKS = {
new PerkSmashStats(6, 1.4, 0.3, 6.5), new PerkSmashStats(6, 1.4, 0.3, 6.5),
@ -71,20 +75,26 @@ public class KitSkeletalHorse extends SmashKit
}; };
private static final ItemStack[] PLAYER_ARMOR = { private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), new ItemStack(Material.IRON_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), new ItemStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), new ItemStack(Material.CHAINMAIL_HELMET),
}; };
public KitSkeletalHorse(ArcadeManager manager) 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 @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); UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -92,62 +102,16 @@ public class KitSkeletalHorse extends SmashKit
if (Manager.GetGame().GetState() == GameState.Recruit) if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]);
player.getInventory().setArmorContents(PLAYER_ARMOR); 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 @Override
public Entity SpawnEntity(Location loc) public Entity SpawnEntity(Location loc)
{ {
EntityType type = _entityType; Horse horse = (Horse) super.SpawnEntity(loc);
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); horse.setVariant(Variant.SKELETON_HORSE);
}
UtilEnt.Vegetate(entity); return horse;
SpawnCustom(entity);
return entity;
} }
} }

View File

@ -1,26 +1,31 @@
package nautilus.game.arcade.game.games.smash.kits; 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.DisguiseSkeleton;
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.*;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class KitSkeleton extends SmashKit 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.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit2;
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.PerkBoneExplosion;
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;
import nautilus.game.arcade.kit.perks.PerkSkeletonArrowStorm;
public class KitSkeleton extends SmashKit2
{ {
private static final String[] DESCRIPTION = {
};
private static final Perk[] PERKS = { private static final Perk[] PERKS = {
new PerkSmashStats(5, 1.25, 0.2, 6), new PerkSmashStats(5, 1.25, 0.2, 6),
@ -69,21 +74,23 @@ public class KitSkeleton extends SmashKit
}; };
private static final ItemStack[] PLAYER_ARMOR = { private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), new ItemStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), new ItemStack(Material.CHAINMAIL_HELMET),
}; };
public KitSkeleton(ArcadeManager manager) 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, DisguiseCow.class);
} }
@Override @Override
public void giveCoreItems(Player player) public void GiveItems(Player player)
{ {
disguise(player);
UtilInv.Clear(player); UtilInv.Clear(player);
player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]);
@ -95,31 +102,4 @@ public class KitSkeleton extends SmashKit
player.getInventory().setArmorContents(PLAYER_ARMOR); player.getInventory().setArmorContents(PLAYER_ARMOR);
} }
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(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);
disguise.hideArmor();
Manager.GetDisguise().disguise(disguise);
}
} }

View File

@ -7,9 +7,10 @@ import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkFishFlurry; 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.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;

View File

@ -11,13 +11,14 @@ import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; 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.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; 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.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkSlimeRocket; import nautilus.game.arcade.kit.perks.PerkSlimeRocket;
import nautilus.game.arcade.kit.perks.PerkSlimeSlam; import nautilus.game.arcade.kit.perks.PerkSlimeSlam;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;

View File

@ -6,9 +6,10 @@ import mineplex.core.disguise.disguises.DisguiseSnowman;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; 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.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;

View File

@ -6,9 +6,10 @@ import mineplex.core.disguise.disguises.DisguiseSpider;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; 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.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -122,5 +123,10 @@ public class KitSpider extends SmashKit
disguise.setCustomNameVisible(true); disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise); Manager.GetDisguise().disguise(disguise);
if (Manager.GetGame().GetState() == GameState.Prepare)
{
player.setExp(0.99F);
}
} }
} }

View File

@ -6,9 +6,10 @@ import mineplex.core.disguise.disguises.DisguiseWitch;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; 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.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;

View File

@ -18,11 +18,11 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats;
import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; 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.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
import nautilus.game.arcade.kit.perks.PerkSkullShot; import nautilus.game.arcade.kit.perks.PerkSkullShot;
public class KitWither extends SmashKit public class KitWither extends SmashKit

View File

@ -6,9 +6,10 @@ import mineplex.core.disguise.disguises.DisguiseSkeleton;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; 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.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;

View File

@ -7,11 +7,11 @@ import mineplex.core.disguise.disguises.DisguiseWolf;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; 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.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; 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.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
import nautilus.game.arcade.kit.perks.PerkWolf; import nautilus.game.arcade.kit.perks.PerkWolf;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;

View File

@ -6,9 +6,10 @@ import mineplex.core.disguise.disguises.DisguiseZombie;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; 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.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.*;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;

View File

@ -7,9 +7,9 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager; 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.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
/** /**
* KitPlayer * KitPlayer

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

@ -37,7 +37,6 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkFishFlurry extends SmashPerk implements IThrown public class PerkFishFlurry extends SmashPerk implements IThrown
{ {
@ -174,7 +173,7 @@ public class PerkFishFlurry extends SmashPerk implements IThrown
{ {
//Damage Event //Damage Event
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null,
DamageCause.PROJECTILE, 3, true, true, false, DamageCause.PROJECTILE, 3, true, false, false,
UtilEnt.getName(data.getThrower()), GetName()); UtilEnt.getName(data.getThrower()), GetName());
UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers());

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.C;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;

View File

@ -1,11 +1,9 @@
package nautilus.game.arcade.kit; package nautilus.game.arcade.game.games.smash.perks;
import java.util.Collection;
import java.util.Iterator;
import java.util.UUID;
import mineplex.core.common.util.*;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.events.GameStateChangeEvent;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -16,8 +14,21 @@ import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.Collection; import mineplex.core.common.util.C;
import java.util.Iterator; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
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.event.UpdateEvent;
import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
public abstract class SmashKit extends ProgressingKit public abstract class SmashKit extends ProgressingKit
{ {
@ -55,6 +66,14 @@ public abstract class SmashKit extends ProgressingKit
_superSound = superSound; _superSound = superSound;
} }
@Override
public void onSelected(UUID player)
{
super.onSelected(player);
DisplayDesc(UtilPlayer.searchExact(player));
}
@Override @Override
public void DisplayDesc(Player player) public void DisplayDesc(Player player)
{ {

View File

@ -0,0 +1,154 @@
package nautilus.game.arcade.game.games.smash.perks;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
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.UtilPlayer;
import mineplex.core.disguise.disguises.DisguiseInsentient;
import nautilus.game.arcade.ArcadeFormat;
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 SmashKit2 extends ProgressingKit
{
protected static final String DOUBLE_JUMP = C.cYellow + "Double tap " + C.cWhite + "your jump key to " + C.cGreen + "Double Jump";
private static final int DESCRIPTION_SPACING_LINES = 3;
private Class<? extends DisguiseInsentient> _clazz;
private String[] _description;
public SmashKit2(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 SmashKit2(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)
{
try
{
DisguiseInsentient disguise = _clazz.getConstructor(Player.class).newInstance(player);
GameTeam gameTeam = Manager.GetGame().GetTeam(player);
if (gameTeam != null)
{
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
}
else
{
disguise.setName(player.getName());
}
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e)
{
e.printStackTrace();
}
}
/**
* When the player clicks to select the kit or we give them that kit, we
* need to send custom information for Smash stuff.
*/
@Override
public void onSelected(UUID player)
{
super.onSelected(player);
Player playerObj = UtilPlayer.searchExact(player);
if (playerObj == null)
{
return;
}
for (int i = 0; i < DESCRIPTION_SPACING_LINES; i++)
{
playerObj.sendMessage("");
}
playerObj.sendMessage(ArcadeFormat.Line);
for (String line : GetDesc())
{
playerObj.sendMessage(line);
}
playerObj.sendMessage(ArcadeFormat.Line);
}
@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 SmashKit2)
{
SmashKit2 kit = (SmashKit2) 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,141 @@
package nautilus.game.arcade.game.games.smash.perks;
import java.util.HashMap;
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.C;
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.combat.event.CombatDeathEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.quiver.Quiver;
import nautilus.game.arcade.kit.Perk;
public class SmashUltimate extends Perk
{
private Map<UUID, Long> _lastUltimate = new HashMap<>();
private Sound _sound;
private long _length;
public SmashUltimate(String name, String[] perkDesc, Sound sound, long length)
{
super(name, perkDesc);
_sound = sound;
_length = length;
}
public void activate(Player player)
{
_lastUltimate.put(player.getUniqueId(), System.currentTimeMillis());
player.getInventory().addItem(Quiver.SUPER_ARROW);
UtilServer.broadcast(C.cGreenB + player.getName() + C.cWhiteB + " activated their " + C.cGreenB + C.Bold + GetName() + C.cWhiteB + ".");
for (Player other : UtilServer.getPlayers())
{
other.playSound(other.getLocation(), _sound, 1, 0);
}
}
public void cancel(Player player)
{
_lastUltimate.remove(player.getUniqueId());
player.getInventory().clear();
Kit.GiveItems(player);
player.playSound(player.getLocation(), Sound.BLAZE_DEATH, 1, 0);
}
public boolean isUsable(Player player)
{
return true;
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST || _length == 0)
{
return;
}
for (UUID uuid : _lastUltimate.keySet())
{
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 long getLength()
{
return _length;
}
}

View File

@ -0,0 +1,256 @@
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 long COOLDOWN = 12000;
private static final long 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 long HIT_FREQUENCY = 2000;
private static final long 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();
// 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,159 @@
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 long DURATION = 18000;
public SmashBlaze()
{
super("Phoneix", 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

@ -0,0 +1,219 @@
package nautilus.game.arcade.game.games.smash.perks.chicken;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Entity;
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.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.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.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
import nautilus.game.arcade.kit.perks.data.ChickenMissileData;
public class PerkChickenRocket extends SmashPerk
{
private static final long COOLDOWN = 7000;
private static final long MIN_TIME = 200;
private static final long 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." });
}
@EventHandler
public void Missile(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 (isSuperActive(player))
{
return;
}
if (!hasPerk(player))
{
return;
}
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);
ent.getLocation().setPitch(0);
ent.getLocation().setYaw(player.getLocation().getYaw());
ent.setBaby();
ent.setAgeLock(true);
UtilEnt.Vegetate(ent);
Manager.GetGame().CreatureAllowOverride = false;
_data.add(new ChickenMissileData(player, ent));
// 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<ChickenMissileData> dataIterator = _data.iterator();
while (dataIterator.hasNext())
{
ChickenMissileData data = dataIterator.next();
data.Chicken.setVelocity(data.Direction);
data.Chicken.getWorld().playSound(data.Chicken.getLocation(), Sound.CHICKEN_HURT, 0.3f, 1.5f);
if (!UtilTime.elapsed(data.Time, MIN_TIME))
{
continue;
}
boolean detonate = false;
if (UtilTime.elapsed(data.Time, MAX_TIME))
{
detonate = true;
}
else
{
// 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) || ent.equals(data.Chicken))
{
continue;
}
if (ent instanceof Player)
{
if (UtilPlayer.isSpectator(ent))
{
continue;
}
}
// Recharge
Recharge.Instance.useForce(data.Player, GetName(), -1);
detonate = true;
break;
}
// Hit Block
if (!detonate && data.HasHitBlock())
{
detonate = true;
}
}
if (detonate)
{
// Damage
for (LivingEntity ent : UtilEnt.getInRadius(data.Chicken.getLocation(), DAMAGE_RADIUS).keySet())
{
if (ent.equals(data.Player))
{
continue;
}
if (ent instanceof Player)
{
if (UtilPlayer.isSpectator(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());
data.Chicken.getWorld().playSound(data.Chicken.getLocation(), Sound.EXPLODE, 2f, 1.2f);
// Firework
UtilFirework.playFirework(data.Chicken.getLocation().add(0, 0.6, 0), Type.BALL, Color.WHITE, false, false);
data.Chicken.remove();
dataIterator.remove();
continue;
}
}
}
}

View File

@ -0,0 +1,162 @@
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.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.UtilEnt;
import mineplex.core.common.util.UtilEvent;
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.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 PerkEggGun extends SmashPerk
{
private static final long COOLDOWN = 2500;
private static final long DURATION = 750;
private static final long 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" });
}
@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 (isSuperActive(event.getPlayer()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
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 (!isSuperActive(cur))
{
if (!_active.containsKey(key))
{
continue;
}
if (!cur.isBlocking())
{
_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.setShooter(cur);
// 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() >= DAMAGE)
{
return;
}
event.SetCancelled("Egg Blaster");
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

@ -0,0 +1,121 @@
package nautilus.game.arcade.game.games.smash.perks.chicken;
import org.bukkit.GameMode;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerToggleFlightEvent;
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.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 long COOLDOWN = 80;
private double _power;
private 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" });
_power = power;
_control = control;
}
@EventHandler
public void FlightHop(PlayerToggleFlightEvent event)
{
Player player = event.getPlayer();
if (UtilPlayer.isSpectator(player))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (player.getGameMode() == GameMode.CREATIVE)
{
return;
}
event.setCancelled(true);
player.setFlying(false);
// Disable Flight
player.setAllowFlight(false);
double power = 0.4 + 0.6 * (_power * player.getExp());
// Velocity
if (_control)
{
UtilAction.velocity(player, power, 0.2, 10, true);
}
else
{
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(), COOLDOWN, false, false);
// Energy
if (!isSuperActive(player))
{
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 (!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)
{
player.setAllowFlight(true);
}
}
}
}

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 long 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.Location;
import org.bukkit.entity.Cow; 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.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
@ -12,7 +12,6 @@ import mineplex.core.common.util.UtilParticle.ViewDist;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; 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.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -9,7 +10,6 @@ import org.bukkit.entity.Cow;
import org.bukkit.entity.MushroomCow; import org.bukkit.entity.MushroomCow;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -19,63 +19,78 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; 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.UtilMath;
import mineplex.core.common.util.UtilParticle; 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.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguiseMooshroom; import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; 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>();
private static final long COOLDOWN_NORMAL = 13000;
private static final long COOLDOWN_SMASH = 6000;
private static final long MAX_TIME = 1000;
private static final long STUCK_TIME = 300;
private static final long FORCE_MOVE = 350;
private static final float HIT_BOX_RADIUS = 2.2F;
private static final long HIT_FREQUENCY = 600;
private static final int DAMAGE = 5;
private List<DataCowCharge> _active = new ArrayList<>();
public PerkCowAngryHerd() public PerkCowAngryHerd()
{ {
super("Angry Herd", new String[] super("Angry Herd", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Angry Herd" });
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Angry Herd"
});
} }
@EventHandler @EventHandler
public void shoot(PlayerInteractEvent event) public void shoot(PlayerInteractEvent event)
{ {
if (event.isCancelled()) if (event.isCancelled())
{
return; return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) if (!UtilEvent.isAction(event, ActionType.R))
{
return; return;
}
if (UtilBlock.usable(event.getClickedBlock())) if (UtilBlock.usable(event.getClickedBlock()))
{
return; return;
}
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!Kit.HasKit(player)) if (!UtilItem.isAxe(player.getItemInHand()))
{
return; return;
}
if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 6000 : 13000, true, true)) if (!hasPerk(player))
{
return; return;
}
if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? COOLDOWN_SMASH : COOLDOWN_NORMAL, true, true))
{
return;
}
event.setCancelled(true); event.setCancelled(true);
for (double i=-2 ; i<3 ; i++) for (double i = -2; i < 3; i++)
{ {
Vector dir = player.getLocation().getDirection(); Vector dir = player.getLocation().getDirection();
dir.setY(0); dir.setY(0);
@ -84,7 +99,7 @@ public class PerkCowAngryHerd extends SmashPerk
Location loc = player.getLocation(); Location loc = player.getLocation();
loc.add(dir); 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; Manager.GetGame().CreatureAllowOverride = true;
Class<? extends Cow> clazz = isSuperActive(player) ? MushroomCow.class : Cow.class; Class<? extends Cow> clazz = isSuperActive(player) ? MushroomCow.class : Cow.class;
@ -94,10 +109,10 @@ public class PerkCowAngryHerd extends SmashPerk
_active.add(new DataCowCharge(player, cow)); _active.add(new DataCowCharge(player, cow));
} }
//Sound // Sound
player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, 2f, 0.6f); player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, 2f, 0.6f);
//Inform // Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
} }
@ -113,41 +128,40 @@ public class PerkCowAngryHerd extends SmashPerk
{ {
DataCowCharge data = activeIter.next(); DataCowCharge data = activeIter.next();
//Expire // Expire
if (UtilTime.elapsed(data.Time, 3000)) if (UtilTime.elapsed(data.Time, MAX_TIME))
{ {
if (data.Cow.isValid()) if (data.Cow.isValid())
{ {
data.Cow.remove(); 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(); activeIter.remove();
continue; continue;
} }
//Set Moved // Set Moved
if (UtilMath.offset(data.Cow.getLocation(), data.LastLoc) > 1) if (UtilMath.offset(data.Cow.getLocation(), data.LastLoc) > 1)
{ {
data.LastLoc = data.Cow.getLocation(); data.LastLoc = data.Cow.getLocation();
data.LastMoveTime = System.currentTimeMillis(); data.LastMoveTime = System.currentTimeMillis();
} }
//Stuck Remove // Stuck Remove
if (UtilTime.elapsed(data.LastMoveTime, 1000)) if (UtilTime.elapsed(data.LastMoveTime, STUCK_TIME))
{ {
if (data.Cow.isValid()) if (data.Cow.isValid())
{ {
data.Cow.remove(); 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(); activeIter.remove();
continue; continue;
} }
//Gravity // Gravity
if (UtilEnt.isGrounded(data.Cow)) if (UtilEnt.isGrounded(data.Cow))
{ {
data.Direction.setY(-0.1); data.Direction.setY(-0.1);
@ -157,33 +171,42 @@ public class PerkCowAngryHerd extends SmashPerk
data.Direction.setY(Math.max(-1, data.Direction.getY() - 0.03)); data.Direction.setY(Math.max(-1, data.Direction.getY() - 0.03));
} }
//Move // Move
if (UtilTime.elapsed(data.LastMoveTime, 350) && UtilEnt.isGrounded(data.Cow)) if (UtilTime.elapsed(data.LastMoveTime, FORCE_MOVE) && UtilEnt.isGrounded(data.Cow))
data.Cow.setVelocity(data.Direction.clone().add(new Vector(0,0.75,0))); {
data.Cow.setVelocity(data.Direction.clone().add(new Vector(0, 0.75, 0)));
}
else else
{
data.Cow.setVelocity(data.Direction); data.Cow.setVelocity(data.Direction);
}
if (Math.random() > 0.99) if (Math.random() > 0.99)
{
data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_IDLE, 1f, 1f); data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_IDLE, 1f, 1f);
}
if (Math.random() > 0.97) if (Math.random() > 0.97)
{
data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_WALK, 1f, 1.2f); data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_WALK, 1f, 1.2f);
}
//Hit // Hit
for (Player player : Manager.GetGame().GetPlayers(true)) for (Player player : Manager.GetGame().GetPlayers(true))
{ {
if (player.equals(data.Player)) 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 // Damage Event
Manager.GetDamage().NewDamageEvent(player, data.Player, null, data.Cow.getLocation(), DamageCause.CUSTOM, Manager.GetDamage().NewDamageEvent(player, data.Player, null, data.Cow.getLocation(), DamageCause.CUSTOM, DAMAGE, true, true, false, UtilEnt.getName(data.Player), GetName());
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()); 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.ZOMBIE_WOOD, 0.75f, 0.8f);
data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_HURT, 1.5f, 0.75f); data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_HURT, 1.5f, 0.75f);
@ -197,16 +220,10 @@ public class PerkCowAngryHerd extends SmashPerk
public void Knockback(CustomDamageEvent event) public void Knockback(CustomDamageEvent event)
{ {
if (event.GetReason() == null || !event.GetReason().contains(GetName())) if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return; return;
}
event.AddKnockback(GetName(), 1.25); 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,70 +1,85 @@
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.Iterator;
import java.util.Set;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock; 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.UtilMath;
import mineplex.core.common.util.UtilParticle; 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.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguiseMooshroom; import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; 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 public class PerkCowMilkSpiral extends SmashPerk
{ {
private HashMap<Player, DataCowMilkSpiral> _active = new HashMap<Player, DataCowMilkSpiral>();
private static final long COOLDOWN_NORMAL = 11000;
private static final long 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() public PerkCowMilkSpiral()
{ {
super("Milk Spiral", new String[] 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" });
{
C.cYellow + "Right Click" + C.cGray + " with Spade to " + C.cGreen + "Milk Spiral",
C.cGray + "Crouch to cancel movement for Milk Spiral"
});
} }
@EventHandler @EventHandler
public void activate(PlayerInteractEvent event) public void activate(PlayerInteractEvent event)
{ {
if (event.isCancelled()) if (event.isCancelled())
{
return; return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) if (!UtilEvent.isAction(event, ActionType.R))
{
return; return;
}
if (UtilBlock.usable(event.getClickedBlock())) if (UtilBlock.usable(event.getClickedBlock()))
{
return; return;
}
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE"))
return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!Kit.HasKit(player)) if (!UtilItem.isSpade(player.getItemInHand()))
{
return; return;
}
if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 6000 : 11000, true, true)) if (!hasPerk(player))
{
return; return;
}
_active.put(player, new DataCowMilkSpiral(player, isSuperActive(player))); if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? COOLDOWN_SMASH : COOLDOWN_NORMAL, true, true))
{
return;
}
//Inform _active.add(new DataCowMilkSpiral(player, isSuperActive(player)));
// Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
} }
@ -72,40 +87,37 @@ public class PerkCowMilkSpiral extends SmashPerk
public void update(UpdateEvent event) public void update(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
{
return; return;
}
Iterator<DataCowMilkSpiral> activeIter = _active.values().iterator(); Iterator<DataCowMilkSpiral> activeIter = _active.iterator();
while (activeIter.hasNext()) while (activeIter.hasNext())
{ {
DataCowMilkSpiral data = activeIter.next(); DataCowMilkSpiral data = activeIter.next();
if (data.update()) if (data.update())
{
activeIter.remove(); activeIter.remove();
}
for (Player player : Manager.GetGame().GetPlayers(true)) for (Player player : Manager.GetGame().GetPlayers(true))
{ {
if (player.equals(data.Player)) 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, continue;
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()); 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); 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

@ -0,0 +1,72 @@
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.SmashKit2;
import nautilus.game.arcade.game.games.smash.perks.SmashUltimate;
public class PerkCowMooshroomMadness extends SmashUltimate
{
private static final long DURATION = 30000;
private static final int DAMAGE_BUFF = 1;
private static final int HEALTH = 30;
public PerkCowMooshroomMadness()
{
super("Mooshroom Madness", new String[] {}, Sound.COW_IDLE, DURATION);
}
@Override
public void activate(Player player)
{
super.activate(player);
SmashKit2 kit = (SmashKit2) 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);
SmashKit2 kit = (SmashKit2) Kit;
kit.disguise(player, DisguiseCow.class);
}
@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,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 java.util.HashMap;
import java.util.Map;
import mineplex.core.common.util.C; import java.util.UUID;
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 org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -31,39 +13,56 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.potion.PotionEffectType; 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 public class PerkCowStampede extends SmashPerk
{ {
private WeakHashMap<Player, Long> _sprintTime = new WeakHashMap<Player, Long>(); private Map<UUID, Long> _sprintTime = new HashMap<>();
private WeakHashMap<Player, Integer> _sprintStr = new WeakHashMap<Player, Integer>(); private Map<UUID, Integer> _sprintStr = new HashMap<>();
public PerkCowStampede() public PerkCowStampede()
{ {
super("Stampede", new String[] super("Stampede", new String[] { C.cGray + "Build up Speed Levels as you sprint.", C.cGray + "+1 damage for each Speed Level.", });
{
C.cGray + "Build up Speed Levels as you sprint.",
C.cGray + "+1 damage for each Speed Level.",
});
} }
@EventHandler @EventHandler
public void update(UpdateEvent event) public void update(UpdateEvent event)
{ {
if (event.getType() != UpdateType.FASTER) if (event.getType() != UpdateType.FASTER)
{
return; return;
}
for (Player cur : UtilServer.getPlayers()) for (Player cur : UtilServer.getPlayers())
{ {
if (!Kit.HasKit(cur)) if (!hasPerk(cur))
continue;
//Active - Check for Disable
if (_sprintTime.containsKey(cur))
{ {
//Stopped continue;
}
UUID key = cur.getUniqueId();
// Active - Check for Disable
if (_sprintTime.containsKey(key))
{
// Stopped
if (!cur.isSprinting() || cur.getLocation().getBlock().isLiquid()) if (!cur.isSprinting() || cur.getLocation().getBlock().isLiquid())
{ {
_sprintTime.remove(cur); _sprintTime.remove(key);
_sprintStr.remove(cur); _sprintStr.remove(key);
cur.removePotionEffect(PotionEffectType.SPEED); cur.removePotionEffect(PotionEffectType.SPEED);
continue; continue;
} }
@ -71,34 +70,38 @@ public class PerkCowStampede extends SmashPerk
long time = _sprintTime.get(cur); long time = _sprintTime.get(cur);
int str = _sprintStr.get(cur); int str = _sprintStr.get(cur);
//Apply Speed // Apply Speed
if (str > 0) 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)) if (!UtilTime.elapsed(time, 3000))
{
continue; continue;
}
_sprintTime.put(cur, System.currentTimeMillis()); _sprintTime.put(key, System.currentTimeMillis());
if (str < 3) 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); 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)); UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(cur, GetName(), ClassType.Brute));
} }
else if (cur.isSprinting() || !cur.getLocation().getBlock().isLiquid()) else if (cur.isSprinting() || !cur.getLocation().getBlock().isLiquid())
{ {
//Start Timer // Start Timer
if (!_sprintTime.containsKey(cur)) if (!_sprintTime.containsKey(cur))
{ {
_sprintTime.put(cur, System.currentTimeMillis()); _sprintTime.put(key, System.currentTimeMillis());
_sprintStr.put(cur, 0); _sprintStr.put(key, 0);
} }
} }
} }
@ -108,16 +111,26 @@ public class PerkCowStampede extends SmashPerk
public void particle(UpdateEvent event) public void particle(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
return;
for (Player ent : _sprintStr.keySet())
{ {
if (_sprintStr.get(ent) <= 0) return;
continue; }
UtilParticle.PlayParticle(isSuperActive(ent) ? ParticleType.RED_DUST : ParticleType.CRIT, ent.getLocation(), for (UUID key : _sprintStr.keySet())
(float)(Math.random() - 0.5), 0.2f + (float)Math.random(), (float)(Math.random() - 0.5), 0, _sprintStr.get(ent) * 2, {
ViewDist.NORMAL, UtilServer.getPlayers()); if (_sprintStr.get(key) <= 0)
{
continue;
}
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(player) * 2, ViewDist.NORMAL, UtilServer.getPlayers());
} }
} }
@ -125,40 +138,56 @@ public class PerkCowStampede extends SmashPerk
public void damage(CustomDamageEvent event) public void damage(CustomDamageEvent event)
{ {
if (event.IsCancelled()) if (event.IsCancelled())
{
return; return;
}
if (event.GetCause() != DamageCause.ENTITY_ATTACK) if (event.GetCause() != DamageCause.ENTITY_ATTACK)
{
return; return;
}
Player damager = event.GetDamagerPlayer(false); Player damager = event.GetDamagerPlayer(false);
if (damager == null) return;
if (damager == null)
{
return;
}
if (!_sprintStr.containsKey(damager)) if (!_sprintStr.containsKey(damager))
{
return; return;
}
if (_sprintStr.get(damager) == 0) if (_sprintStr.get(damager) == 0)
{
return; return;
}
LivingEntity damagee = event.GetDamageeEntity(); LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return;
//Remove if (damagee == null)
{
return;
}
// Remove
_sprintTime.remove(damager); _sprintTime.remove(damager);
int str = _sprintStr.remove(damager); int str = _sprintStr.remove(damager);
damager.removePotionEffect(PotionEffectType.SPEED); damager.removePotionEffect(PotionEffectType.SPEED);
//Damage // Damage
event.AddMod(damager.getName(), GetName(), str, true); event.AddMod(damager.getName(), GetName(), str, true);
event.AddKnockback(GetName(), 1 + (0.1 * str)); 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()) + ".")); UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + "."));
//Effect // Effect
damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_WOOD, 1f, 2f); damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_WOOD, 1f, 2f);
damager.getWorld().playSound(damager.getLocation(), Sound.COW_HURT, 2f, 2f); damager.getWorld().playSound(damager.getLocation(), Sound.COW_HURT, 2f, 2f);
//Event // Event
UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(damager, GetName(), ClassType.Brute, damagee)); UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(damager, GetName(), ClassType.Brute, damagee));
} }
@ -166,10 +195,16 @@ public class PerkCowStampede extends SmashPerk
public void damageCancel(CustomDamageEvent event) public void damageCancel(CustomDamageEvent event)
{ {
if (event.IsCancelled()) if (event.IsCancelled())
{
return; return;
}
Player damagee = event.GetDamageePlayer(); Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
if (damagee == null)
{
return;
}
clean(damagee); clean(damagee);
Manager.GetCondition().EndCondition(damagee, null, GetName()); Manager.GetCondition().EndCondition(damagee, null, GetName());
@ -183,15 +218,7 @@ public class PerkCowStampede extends SmashPerk
public void clean(Player player) public void clean(Player player)
{ {
_sprintTime.remove(player); _sprintTime.remove(player.getUniqueId());
_sprintStr.remove(player); _sprintStr.remove(player.getUniqueId());
}
@Override
public boolean isSuperActive(Player player)
{
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
return disguise != null && disguise instanceof DisguiseMooshroom;
} }
} }

View File

@ -0,0 +1,204 @@
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;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseCreeper;
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 PerkCreeperElectricity extends Perk
{
private static final long 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)
{
return;
}
Player damagee = event.GetDamageePlayer();
if (damagee == null)
{
return;
}
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
damagee.getWorld().playSound(damagee.getLocation(), Sound.CREEPER_HISS, 3f, 1.25f);
// Inform
UtilPlayer.message(damagee, F.main("Skill", "You gained " + F.skill(GetName()) + "."));
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<UUID> shieldIterator = _active.keySet().iterator();
while (shieldIterator.hasNext())
{
Player player = UtilPlayer.searchExact(shieldIterator.next());
if (player == null)
{
shieldIterator.remove();
}
if (!IsPowered(player))
{
shieldIterator.remove();
SetPowered(player, false);
continue;
}
if (UtilTime.elapsed(_active.get(player), DURATION))
{
shieldIterator.remove();
SetPowered(player, false);
// Sound
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 3f, 0.75f);
}
}
}
@EventHandler
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 (!hasPerk(damagee))
{
return;
}
if (!IsPowered(damagee))
{
return;
}
event.SetCancelled("Lightning Shield");
// Inform
UtilPlayer.message(damagee, F.main("Skill", "You hit " + F.elem(UtilEnt.getName(event.GetDamagerPlayer(false))) + " with " + F.skill(GetName()) + "."));
// Elec
damagee.getWorld().strikeLightningEffect(damagee.getLocation());
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, DAMAGE, true, true, false, damagee.getName(), GetName());
}
public DisguiseCreeper GetDisguise(Player player)
{
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
if (disguise == null)
{
return null;
}
if (!(disguise instanceof DisguiseCreeper))
{
return null;
}
return (DisguiseCreeper) disguise;
}
public void SetPowered(Player player, boolean powered)
{
DisguiseCreeper creeper = GetDisguise(player);
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;
}
return creeper.IsPowered();
}
@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,334 @@
package nautilus.game.arcade.game.games.smash.perks.creeper;
import java.util.Collection;
import java.util.HashMap;
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.game.games.smash.perks.SmashPerk;
public class PerkCreeperExplode extends SmashPerk
{
private static final long COOLDOWN = 8000;
private static final long 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" });
}
@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.isSpade(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (isSuperActive(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
_active.put(player.getUniqueId(), System.currentTimeMillis());
IncreaseSize(player);
UtilPlayer.message(player, F.main("Skill", "You are charging " + F.skill(GetName()) + "."));
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<UUID> chargeIterator = _active.keySet().iterator();
while (chargeIterator.hasNext())
{
UUID key = chargeIterator.next();
Player player = UtilPlayer.searchExact(key);
if (player == null)
{
chargeIterator.remove();
continue;
}
long elapsed = (System.currentTimeMillis() - _active.get(player));
// Idle in Air
UtilAction.zeroVelocity(player);
// 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 / (WARMUP / 1000))));
// Not Detonated
if (UtilTime.elapsed(_active.get(key), WARMUP))
{
continue;
}
chargeIterator.remove();
// Unpower
DecreaseSize(player);
// Explode
if (!isSuperActive(player))
{
// 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
Collection<Block> blocks = UtilBlock.getInRadius(player.getLocation(), 12).keySet();
Iterator<Block> iter = blocks.iterator();
while (iter.hasNext())
{
Block b = iter.next();
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
Iterator<Location> spawnIterator = Manager.GetGame().GetTeam(player).GetSpawns().iterator();
while (spawnIterator.hasNext())
{
Location spawn = spawnIterator.next();
if (UtilMath.offset(player.getLocation(), spawn) < SPAWN_REMOVAL_RADIUS)
{
spawnIterator.remove();
}
}
// If all spawns have been destroyed revert to using the
// spectator spawn
for (GameTeam team : Manager.GetGame().GetTeamList())
{
if (team.GetSpawns().isEmpty())
{
team.GetSpawns().add(Manager.GetGame().GetSpectatorLocation());
}
}
}
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.equals(player))
{
continue;
}
double dist = UtilMath.offset(player.getLocation(), ent.getLocation());
if (UtilPlayer.isSpectator(player))
{
continue;
}
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(), isSuperActive(player) ? "Atomic Blast" : GetName());
}
// Velocity
UtilAction.velocity(player, 1.8, 0.2, 1.4, true);
// Inform
if (!isSuperActive(player))
{
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
}
}
public DisguiseCreeper GetDisguise(Player player)
{
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
if (disguise == null)
{
return null;
}
if (!(disguise instanceof DisguiseCreeper))
{
return null;
}
return (DisguiseCreeper) disguise;
}
public int GetSize(Player player)
{
DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null)
{
return 0;
}
return creeper.bV();
}
public void DecreaseSize(Player player)
{
DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null)
{
return;
}
creeper.a(-1);
Manager.GetDisguise().updateDisguise(creeper);
}
public void IncreaseSize(Player player)
{
DisguiseCreeper creeper = GetDisguise(player);
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(), KNOCKBACK_MAGNITUDE);
}
@EventHandler
public void Death(CombatDeathEvent event)
{
if (!(event.GetEvent().getEntity() instanceof Player))
{
return;
}
Player player = (Player) event.GetEvent().getEntity();
if (!hasPerk(player))
{
return;
}
_active.remove(player.getUniqueId());
DecreaseSize(player);
}
}

View File

@ -0,0 +1,146 @@
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.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.UtilInv;
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.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.game.games.smash.perks.SmashPerk;
public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown
{
private static final long 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 (!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;
}
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));
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.6f);
// Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
// Effect
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_DEATH, 2f, 1.5f);
}
@Override
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, DAMAGE, true, true, false, UtilEnt.getName(data.getThrower()), GetName());
}
@Override
public void Idle(ProjectileUser data)
{
Explode(data);
}
@Override
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());
data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f);
data.getThrown().remove();
}
@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,35 @@
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(String name, String[] perkDesc, Sound sound, long length)
{
super("Atomic Blast", new String[] {}, Sound.CREEPER_HISS, 50);
}
@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);
}
}
}

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 long _recharge;
public PerkBlink(String name, double range, long 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

@ -0,0 +1,269 @@
package nautilus.game.arcade.game.games.smash.perks.enderman;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Effect;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
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 static final long COOLDOWN = 2000;
private static final long CHARGE_TIME = 1200;
private static final int DAMAGE = 8;
private static final float KNOCKBACK_MAGNITUDE = 2.5F;
private Map<UUID, BlockTossData> _hold = new HashMap<>();
private Map<UUID, Long> _charge = 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" });
}
@EventHandler
public void Grab(PlayerInteractEvent event)
{
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 (_hold.containsKey(player.getUniqueId()))
{
return;
}
Block grab = event.getClickedBlock();
if (!Recharge.Instance.usable(player, GetName()))
{
return;
}
if (!UtilBlock.airFoliage(grab.getRelative(BlockFace.UP)) || Manager.GetBlockRestore().contains(grab.getRelative(BlockFace.UP)))
{
UtilPlayer.message(player, F.main("Game", "You can only pick up blocks with Air above them."));
return;
}
// Event
PerkBlockGrabEvent blockEvent = new PerkBlockGrabEvent(player, grab.getTypeId(), grab.getData());
UtilServer.getServer().getPluginManager().callEvent(blockEvent);
// Block to Data
int id = grab.getTypeId();
byte data = grab.getData();
// Remove Block
event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, event.getClickedBlock().getType());
_hold.put(player.getUniqueId(), new BlockTossData(id, data));
_charge.put(player.getUniqueId(), System.currentTimeMillis());
// Effect
player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, id);
}
@EventHandler
public void Throw(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Set<Player> throwSet = new HashSet<Player>();
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(player.getUniqueId()))
{
if (System.currentTimeMillis() - _charge.get(player) > 1200)
{
_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(), COOLDOWN, false, true);
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() - _charge.remove(key);
// Throw
double mult = 1.4;
if (charge < CHARGE_TIME)
{
mult = mult * (charge / 1200);
}
// 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);
// Event
PerkBlockThrowEvent blockEvent = new PerkBlockThrowEvent(cur);
UtilServer.getServer().getPluginManager().callEvent(blockEvent);
}
}
@Override
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() * DAMAGE, true, true, false, UtilEnt.getName(data
.getThrower()), GetName());
// 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);
// Remove Old
_falling.remove(thrown);
thrown.remove();
// Add New
if (data.getThrower() instanceof Player)
{
_falling.put(newThrown, data.getThrower().getUniqueId());
}
}
}
@Override
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();
falling.getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, falling.getBlockId());
_falling.remove(falling);
falling.remove();
event.setCancelled(true);
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
}
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.HashMap;
import java.util.HashSet; import java.util.Map;
import java.util.UUID;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -15,75 +16,83 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; 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 public class PerkEndermanTeleport extends SmashPerk
{ {
private HashMap<Player, Block> _target = new HashMap<Player, Block>();
private HashMap<Player, Float> _charge = new HashMap<Player, Float>(); private static final long 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() public PerkEndermanTeleport()
{ {
super("Teleport", new String[] super("Teleport", new String[] { C.cYellow + "Hold Sneak" + C.cGray + " to " + C.cGreen + "Teleport" });
{
C.cYellow + "Hold Sneak" + C.cGray + " to " + C.cGreen + "Teleport"
});
} }
@EventHandler @EventHandler
public void update(UpdateEvent event) public void update(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
{
return; return;
}
if(!Manager.GetGame().IsLive())
return;
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ {
if (!Kit.HasKit(player)) if (!hasPerk(player))
{
continue; continue;
}
UUID key = player.getUniqueId();
if (!player.isSneaking() || !Recharge.Instance.usable(player, GetName())) if (!player.isSneaking() || !Recharge.Instance.usable(player, GetName()))
{ {
_target.remove(player); _target.remove(key);
_charge.remove(player); _charge.remove(key);
continue; continue;
} }
Block block = player.getTargetBlock((HashSet<Byte>) null, 200); Block block = UtilPlayer.getTarget(player, null, 100);
if (!_target.containsKey(player) || !_charge.containsKey(player)) if (!_target.containsKey(key) || !_charge.containsKey(key))
{ {
if (block == null || block.getType() == Material.AIR) if (block == null || block.getType() == Material.AIR)
{
continue; continue;
_target.put(player, block);
_charge.put(player, 0f);
} }
//Invalid Block - End _target.put(key, block);
_charge.put(key, 0f);
}
// Invalid Block - End
if (block == null || block.getType() == Material.AIR) if (block == null || block.getType() == Material.AIR)
{ {
_target.remove(player); _target.remove(key);
_charge.remove(player); _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); _charge.put(key, _charge.get(key) + CHARGE_PER_TICK);
UtilTextMiddle.display(null, UtilTextMiddle.progress(_charge.get(player)), 0, 10, 10, player); UtilTextMiddle.display(null, UtilTextMiddle.progress(_charge.get(player)), 0, 10, 10, player);
if (_charge.get(player) >= 1f) if (_charge.get(key) >= 1f)
{ {
UtilTextMiddle.display(null, C.cGreen + "Teleported", 0, 10, 10, player); 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) while (block.getRelative(BlockFace.UP).getType() != Material.AIR)
{ {
@ -94,19 +103,19 @@ public class PerkEndermanTeleport extends SmashPerk
player.teleport(block.getLocation().add(0.5, 1, 0.5).setDirection(player.getLocation().getDirection())); player.teleport(block.getLocation().add(0.5, 1, 0.5).setDirection(player.getLocation().getDirection()));
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 0.5f); 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 else
{ {
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f + _charge.get(player)); player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f + _charge.get(key));
UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0.05f, 10, ViewDist.LONG, UtilServer.getPlayers()); 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 else
{ {
_target.put(player, block); _target.put(key, block);
_charge.put(player, 0f); _charge.put(key, 0f);
} }
} }
} }
@ -114,9 +123,9 @@ public class PerkEndermanTeleport extends SmashPerk
@EventHandler @EventHandler
public void clean(PlayerQuitEvent event) public void clean(PlayerQuitEvent event)
{ {
_target.remove(event.getPlayer()); UUID key = event.getPlayer().getUniqueId();
_charge.remove(event.getPlayer());
_target.remove(key);
_charge.remove(key);
} }
} }

View File

@ -0,0 +1,236 @@
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.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.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.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.perks.SmashUltimate;
public class SmashEnderman extends SmashUltimate
{
private static final long DURATION = 30000;
private static final int DRAGON_VELOCITY_MAGNITUDE = 40;
private static final long 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.getUniqueId(), dragon);
}
@Override
public void cancel(Player 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 (UUID key : _dragons.keySet())
{
Player player = UtilPlayer.searchExact(key);
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(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 (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 (UUID key : _dragons.keySet())
{
Player player = UtilPlayer.searchExact(key);
if (player == null)
{
continue;
}
EnderDragon dragon = _dragons.get(player);
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()) < 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(), 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 (!isUsingUltimate(player))
{
return;
}
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.HashSet;
import java.util.Set;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; 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.UtilPlayer;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -20,38 +23,45 @@ import nautilus.game.arcade.kit.perks.data.FissureData;
public class PerkFissure extends Perk public class PerkFissure extends Perk
{ {
private HashSet<FissureData> _active = new HashSet<FissureData>();
private static final long COOLDOWN = 8000;
private Set<FissureData> _active = new HashSet<>();
public PerkFissure() public PerkFissure()
{ {
super("Fissure", new String[] super("Fissure", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Fissure" });
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Fissure"
});
} }
@EventHandler @EventHandler
public void Leap(PlayerInteractEvent event) public void Leap(PlayerInteractEvent event)
{ {
if (event.isCancelled()) if (event.isCancelled())
{
return; return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) if (!UtilEvent.isAction(event, ActionType.R))
{
return; return;
}
if (UtilBlock.usable(event.getClickedBlock())) if (UtilBlock.usable(event.getClickedBlock()))
{
return; return;
}
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!Kit.HasKit(player)) if (!UtilItem.isAxe(player.getItemInHand()))
{
return; return;
}
if (!hasPerk(player))
{
return;
}
if (!UtilEnt.isGrounded(player)) if (!UtilEnt.isGrounded(player))
{ {
@ -59,13 +69,15 @@ public class PerkFissure extends Perk
return; return;
} }
if (!Recharge.Instance.use(player, GetName(), 8000, true, true)) if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return; return;
}
FissureData data = new FissureData(this, player, player.getLocation().getDirection(), player.getLocation().add(0, -0.4, 0)); FissureData data = new FissureData(this, player, player.getLocation().getDirection(), player.getLocation().add(0, -0.4, 0));
_active.add(data); _active.add(data);
//Inform // Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
} }
@ -73,13 +85,19 @@ public class PerkFissure extends Perk
public void Update(UpdateEvent event) public void Update(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
{
return; return;
}
HashSet<FissureData> remove = new HashSet<FissureData>(); Set<FissureData> remove = new HashSet<>();
for (FissureData data : _active) for (FissureData data : _active)
{
if (data.Update()) if (data.Update())
{
remove.add(data); remove.add(data);
}
}
for (FissureData data : remove) for (FissureData data : remove)
{ {

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 long 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 long COOLDOWN = 7000;
private static final long 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.getTypeId());
}
}
}
}
@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,123 @@
package nautilus.game.arcade.game.games.smash.perks.golem;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Effect;
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.UtilEnt;
import mineplex.core.recharge.Recharge;
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.EarthquakeData;
public class SmashEnderman extends SmashUltimate
{
private static final long DURATION = 16000;
private static final long HIT_FREQUENCY = 400;
private static final int EFFECT_RADIUS = 5;
private List<EarthquakeData> _data = new ArrayList<>();
public SmashEnderman()
{
super("Earthquake", new String[] {}, Sound.IRONGOLEM_HIT, DURATION);
}
@Override
public void activate(Player player)
{
super.activate(player);
_data.add(new EarthquakeData(player));
}
@Override
public void cancel(Player player)
{
super.cancel(player);
Iterator<EarthquakeData> quakeIter = _data.iterator();
while (quakeIter.hasNext())
{
EarthquakeData data = quakeIter.next();
if (isUsingUltimate(data.Player))
{
quakeIter.remove();
}
}
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<EarthquakeData> quakeIter = _data.iterator();
while (quakeIter.hasNext())
{
EarthquakeData data = quakeIter.next();
for (Player player : Manager.GetGame().GetPlayers(true))
{
player.playSound(player.getLocation(), Sound.MINECART_BASE, 0.2f, 0.2f);
if (player.equals(data.Player))
{
continue;
}
if (UtilEnt.isGrounded(player))
{
// Damage Event
Manager.GetDamage().NewDamageEvent(player, data.Player, null, DamageCause.CUSTOM, 1 + 2 * Math.random(), false, false, false, player.getName(), GetName());
// Velocity
if (Recharge.Instance.use(player, GetName() + " Hit", HIT_FREQUENCY, false, false))
{
UtilAction.velocity(player, 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(player.getLocation(), EFFECT_RADIUS).keySet())
{
if (Math.random() < 0.98)
{
continue;
}
if (!UtilBlock.solid(block))
{
continue;
}
if (!UtilBlock.airFoliage(block.getRelative(BlockFace.UP)))
{
continue;
}
player.playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
}
}
}
}
}

View File

@ -0,0 +1,195 @@
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.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.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.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.perks.data.FireflyData;
public class PerkFlameDash extends Perk
{
private static final long COOLDOWN = 8000;
private static final long 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()
{
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 (!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.usable(player, GetName()))
{
boolean done = false;
for (FireflyData data : _data)
{
if (data.Player.equals(player))
{
data.Time = 0;
done = true;
}
}
if (done)
{
UtilPlayer.message(player, F.main("Skill", "You ended " + F.skill(GetName()) + "."));
UpdateMovement();
}
else
{
Recharge.Instance.use(player, GetName(), COOLDOWN, true, true);
}
return;
}
Recharge.Instance.useForce(player, GetName(), COOLDOWN);
_data.add(new FireflyData(player));
Manager.GetCondition().Factory().Cloak(GetName(), player, player, 2.5, false, false);
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
UpdateMovement();
}
public void UpdateMovement()
{
Iterator<FireflyData> dataIterator = _data.iterator();
while (dataIterator.hasNext())
{
FireflyData data = dataIterator.next();
// Move
if (!UtilTime.elapsed(data.Time, TIME))
{
Vector vel = data.Location.getDirection();
vel.setY(0);
vel.normalize();
vel.setY(0.05);
UtilAction.velocity(data.Player, vel);
// 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());
}
// End
else
{
for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), DAMAGE_RADIUS))
{
if (other.equals(data.Player))
{
continue;
}
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());
UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(data.Player) + data.Player.getName()) + " hit you with " + F.elem(GetName()) + "."));
}
// End Invisible
Manager.GetCondition().EndCondition(data.Player, null, GetName());
// 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());
dataIterator.remove();
}
}
}
@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,176 @@
package nautilus.game.arcade.game.games.smash.perks.magmacube;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLargeFireball;
import org.bukkit.entity.LargeFireball;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.ProjectileHitEvent;
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.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;
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.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
import net.minecraft.server.v1_8_R3.EntityLargeFireball;
public class PerkMagmaBlast extends Perk
{
private static final int COOLDOWN = 6000;
private static final float FIREBALL_VELOCITY = 0.2F;
private static final int VELOCITY_RADIUS = 8;
private static final int FIRE_TICKS = 40;
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 (!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;
}
event.setCancelled(true);
// Action
LargeFireball ball = player.launchProjectile(LargeFireball.class);
ball.setShooter(player);
ball.setIsIncendiary(false);
ball.setYield(0);
ball.setBounce(false);
ball.teleport(player.getEyeLocation().add(player.getLocation().getDirection().multiply(1)));
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
UtilAction.velocity(player, player.getLocation().getDirection().multiply(-1), 1.2, false, 0, 0.2, 1.2, true);
// Add
_proj.put(ball, player.getLocation());
// Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
// Effect
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_DEATH, 2f, 1.5f);
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<LargeFireball> projIterator = _proj.keySet().iterator();
while (projIterator.hasNext())
{
LargeFireball proj = projIterator.next();
if (!proj.isValid())
{
projIterator.remove();
proj.remove();
continue;
}
}
}
@EventHandler
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
Map<Player, Double> hitMap = UtilPlayer.getInRadius(proj.getLocation(), VELOCITY_RADIUS);
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);
cur.setFireTicks(FIRE_TICKS);
}
// Particles
UtilParticle.PlayParticleToAll(ParticleType.LAVA, proj.getLocation(), 0.1f, 0.1f, 0.1f, 0.1f, 50, ViewDist.LONG);
}
}

View File

@ -0,0 +1,176 @@
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<UUID, Integer>();
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);
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 = killed.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 / 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;
}
if (!_kills.containsKey(damager.getUniqueId()))
{
return;
}
int bonus = _kills.get(damager.getUniqueId());
event.AddMod(damager.getName(), GetName(), bonus, 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.SEC && event.getType() != UpdateType.FAST && event.getType() != UpdateType.FASTER && event.getType() != UpdateType.FASTEST)
{
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,55 @@
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.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 long 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.getTargetLocation(player, 128), 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

@ -0,0 +1,216 @@
package nautilus.game.arcade.game.games.smash.perks.pig;
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.LivingEntity;
import org.bukkit.entity.Pig;
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.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.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.game.games.smash.perks.SmashPerk;
public class PerkPigBaconBomb extends SmashPerk
{
private static final float ENERGY_PER_PIG = 0.35F;
private static final float ENERGY_PER_PIG_DISGUISED_FACTOR = 0.7F;
private static final long 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" });
}
@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;
}
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(), COOLDOWN, false, false))
{
return;
}
// 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
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 0.75f);
// 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(key))
{
_pigs.put(key, new HashSet<Pig>());
}
_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 (UUID key : _pigs.keySet())
{
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() > PIG_MAX_TICKS)
{
PigExplode(pigIterator, pig, player);
continue;
}
Player target = UtilPlayer.getClosest(pig.getLocation(), player);
if (target == null)
{
continue;
}
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
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);
for (LivingEntity cur : targets.keySet())
{
if (cur.equals(owner))
{
continue;
}
// Damage Event
Manager.GetDamage().NewDamageEvent(cur, owner, null, DamageCause.CUSTOM, PIG_EXPLODE_DAMAGE, false, true, false, owner.getName(), GetName());
}
// Remove
pigIterator.remove();
pig.remove();
}
}

View File

@ -0,0 +1,199 @@
package nautilus.game.arcade.game.games.smash.perks.pig;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
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.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
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.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.DisguisePigZombie;
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.perks.SmashPerk;
public class PerkPigBaconBounce extends SmashPerk implements IThrown
{
private static final float ENERGY_PER_BACON = 0.2F;
private static final float ENERGY_PER_BACON_DISGUISED_FACTOR = 0.7F;
private static final long 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", });
}
@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()))
{
return;
}
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(), 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()));
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
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 1.5f);
// Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
Rebound(data.getThrower(), data.getThrown());
if (target == null)
return;
if (isTeamDamage((Player) target, (Player) data.getThrower()))
{
}
// 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)
{
Rebound(data.getThrower(), data.getThrown());
}
@Override
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
ent.setVelocity(player.getLocation().toVector().subtract(ent.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult));
// Ticks
if (ent instanceof Item)
{
((Item) ent).setPickupDelay(5);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void Pickup(PlayerPickupItemEvent event)
{
if (!hasPerk(event.getPlayer()))
{
return;
}
Material type = event.getItem().getItemStack().getType();
if (type != Material.PORK && type != Material.GRILLED_PORK)
return;
// Remove
event.getItem().remove();
// Restore Energy
event.getPlayer().setExp(Math.min(0.999f, event.getPlayer().getExp() + 0.05f));
// Sound
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.EAT, 2f, 1f);
// Heal
if (event.getItem().getItemStack().getType() == Material.GRILLED_PORK)
{
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

@ -0,0 +1,124 @@
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;
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.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguisePig;
import mineplex.core.disguise.disguises.DisguisePigZombie;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.smash.perks.SmashKit2;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkPigZombie extends SmashPerk
{
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." });
}
@EventHandler
public void Check(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
{
return;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!hasPerk(player))
{
continue;
}
// 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.getUniqueId());
// Armor
player.getInventory().setHelmet(null);
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);
SmashKit2 kit = (SmashKit2) Kit;
kit.disguise(player, DisguisePig.class);
// Sound
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 1f);
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 1f);
// Inform
UtilPlayer.message(player, F.main("Skill", "You returned to " + F.skill("Pig Form") + "."));
}
// Not Active
else
{
if (player.getHealth() <= 0 || (!isSuperActive(player) && player.getHealth() > MIN_HEALTH))
{
continue;
}
// 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));
SmashKit2 kit = (SmashKit2) Kit;
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
UtilPlayer.message(player, F.main("Skill", "You transformed into " + F.skill("Nether Pig Form") + "."));
player.setExp(0.99f);
}
}
}
@EventHandler
public void Clean(PlayerDeathEvent event)
{
_active.remove(event.getEntity());
}
}

View File

@ -0,0 +1,30 @@
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
{
public SmashPig()
{
super("Pig Stink", new String[] {}, Sound.PIG_IDLE, 0);
}
@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, 40, 0, false, false, false);
}
}
}
}

View File

@ -0,0 +1,244 @@
package nautilus.game.arcade.game.games.smash.perks.sheep;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Sound;
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.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilFirework;
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.particles.effects.LineParticle;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseSheep;
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 PerkLazer extends Perk
{
private static final float MAX_CHARGE = 0.99F;
private static final float CHARGE_PER_TICK = 0.035F;
private static final float INCREMENTATION = 0.2F;
private static final float HIT_BOX_RADIUS = 2.5F;
private static final int DAMAGE_RADIUS = 3;
private static final int DAMAGE = 7;
private static final int KNOCKBACK_MAGNITUDE = 3;
private double _range;
private long _recharge;
private Set<UUID> _active = new HashSet<>();
public PerkLazer(double range, long recharge)
{
super("Static Lazer", new String[] { C.cYellow + "Hold Block" + C.cGray + " with Sword to use " + C.cGreen + "Static Lazer" });
_range = range;
_recharge = recharge;
}
@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.isSword(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), _recharge, true, true))
{
return;
}
_active.add(player.getUniqueId());
}
@EventHandler
public void chargeFire(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<UUID> playerIterator = _active.iterator();
while (playerIterator.hasNext())
{
UUID uuid = playerIterator.next();
Player player = UtilPlayer.searchExact(uuid);
if (player == null)
{
playerIterator.remove();
}
if (player.isBlocking())
{
player.setExp(Math.min(MAX_CHARGE, player.getExp() + CHARGE_PER_TICK));
player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 0.25f + player.getExp(), 0.75f + player.getExp());
// Wool
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
if (disguise != null && disguise instanceof DisguiseSheep)
{
DisguiseSheep sheep = (DisguiseSheep) disguise;
if (Math.random() > 0.5)
{
sheep.setColor(DyeColor.YELLOW);
}
else
{
sheep.setColor(DyeColor.BLACK);
}
sheep.setSheared(false);
sheep.UpdateDataWatcher();
Manager.GetDisguise().updateDisguise(disguise);
}
if (player.getExp() >= MAX_CHARGE)
{
playerIterator.remove();
fire(player);
}
}
else
{
playerIterator.remove();
fire(player);
}
}
}
public void fire(Player player)
{
if (player.getExp() <= 0.2)
{
setWoolColor(player, DyeColor.WHITE);
player.setExp(0f);
return;
}
LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTATION, _range * player.getExp(), null, ParticleType.FIREWORKS_SPARK,
UtilServer.getPlayers());
particleLoop: while (lineParticle.update())
{
for (Player other : UtilPlayer.getNearby(lineParticle.getLastLocation(), HIT_BOX_RADIUS))
{
if (player.equals(other))
{
continue;
}
break particleLoop;
}
}
Location target = lineParticle.getDestination();
UtilParticle.PlayParticle(ParticleType.EXPLODE, target, 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers());
// Firework
UtilFirework.playFirework(target, Type.BURST, Color.YELLOW, false, false);
for (LivingEntity other : UtilEnt.getInRadius(target, DAMAGE_RADIUS).keySet())
{
if (other.equals(player))
{
continue;
}
// Damage Event
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, player.getExp() * DAMAGE, true, true, false, player.getName(), GetName());
}
// Inform
UtilPlayer.message(player, F.main("Game", "You fired " + F.skill(GetName()) + "."));
// Sound
player.getWorld().playSound(player.getEyeLocation(), Sound.ZOMBIE_REMEDY, 0.5f + player.getExp(), 1.75f - player.getExp());
player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f);
// Wool
setWoolColor(player, DyeColor.WHITE);
player.setExp(0f);
}
@EventHandler
public void knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
public void setWoolColor(Player player, DyeColor color)
{
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
if (disguise != null && disguise instanceof DisguiseSheep)
{
DisguiseSheep sheep = (DisguiseSheep) disguise;
sheep.setSheared(false);
sheep.setColor(color);
sheep.UpdateDataWatcher();
Manager.GetDisguise().updateDisguise(disguise);
}
}
}

View File

@ -0,0 +1,364 @@
package nautilus.game.arcade.game.games.smash.perks.sheep;
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.Effect;
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 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.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.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseSheep;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.recharge.RechargedEvent;
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.perks.data.WoolBombData;
public class PerkWoolBomb extends Perk implements IThrown
{
private static final long RATE = 800;
private static final long COOLDOWN = 8000;
private static final int DAMAGE_RADIUS = 9;
private static final int DAMAGE_EXPLODE = 14;
private static final int DAMAGE_COLLIDE = 4;
private static final int KNOCKBACK_MAGNITUDE = 2;
private Map<UUID, Item> _thrown = new HashMap<>();
private Map<UUID, WoolBombData> _active = new HashMap<>();
public PerkWoolBomb()
{
super("Wool Mine", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Wool Mine" });
}
@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()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (!Recharge.Instance.usable(player, GetName() + " Rate"))
{
return;
}
if (_active.containsKey(player))
{
if (detonate(player, true))
{
return;
}
}
if (_thrown.containsKey(player))
{
if (solidify(player, true))
{
return;
}
}
launch(player);
event.setCancelled(true);
}
private void launch(Player player)
{
if (!Recharge.Instance.usable(player, GetName(), true))
{
return;
}
Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.WOOL, (byte) 0));
UtilAction.velocity(ent, player.getLocation().getDirection(), 1, 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.5f);
_thrown.put(player.getUniqueId(), ent);
// Inform
UtilPlayer.message(player, F.main("Game", "You launched " + F.skill(GetName()) + "."));
// Effect
player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f);
// Rate
Recharge.Instance.useForce(player, GetName() + " Rate", RATE);
// Disguise
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
if (disguise != null && disguise instanceof DisguiseSheep)
{
DisguiseSheep sheep = (DisguiseSheep) disguise;
sheep.setSheared(true);
sheep.UpdateDataWatcher();
Manager.GetDisguise().updateDisguise(disguise);
}
}
@EventHandler
public void rechargeWool(RechargedEvent event)
{
if (event.GetAbility().equals(GetName()))
{
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(event.GetPlayer());
if (disguise != null && disguise instanceof DisguiseSheep)
{
DisguiseSheep sheep = (DisguiseSheep) disguise;
sheep.setSheared(false);
sheep.UpdateDataWatcher();
Manager.GetDisguise().updateDisguise(disguise);
}
}
}
private boolean solidify(LivingEntity ent, boolean inform)
{
if (!(ent instanceof Player))
{
return false;
}
Player player = (Player) ent;
Item thrown = _thrown.remove(player.getUniqueId());
if (thrown == null)
{
return false;
}
// Make Block
Block block = thrown.getLocation().getBlock();
Manager.GetBlockRestore().restore(block);
_active.put(player.getUniqueId(), new WoolBombData(block));
block.setType(Material.WOOL);
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
// Clean
thrown.remove();
// Rate
Recharge.Instance.useForce(player, GetName() + " Rate", RATE);
// Inform
if (inform)
{
player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f);
UtilPlayer.message(player, F.main("Game", "You armed " + F.skill(GetName()) + "."));
}
return true;
}
private boolean detonate(Player player, boolean inform)
{
WoolBombData data = _active.remove(player);
if (data == null)
{
return false;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return false;
}
// Restore
data.restore();
// Explode
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers());
data.Block.getWorld().playSound(data.Block.getLocation(), Sound.EXPLODE, 3f, 0.8f);
// Damage
Map<LivingEntity, Double> targets = UtilEnt.getInRadius(data.Block.getLocation().add(0.5, 0.5, 0.5), DAMAGE_RADIUS);
for (LivingEntity cur : targets.keySet())
{
// Damage Event
Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE_EXPLODE * targets.get(cur) + 0.5, false, true, false, player.getName(), GetName());
// Condition
Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true);
// Knockback
UtilAction.velocity(cur, UtilAlg.getTrajectory2d(data.Block.getLocation().add(0.5, 0.5, 0.5), cur.getEyeLocation()), 0.5 + 2.5 * targets.get(cur), true, 0.8, 0, 10, true);
// Inform
if (cur instanceof Player && !player.equals(cur))
{
UtilPlayer.message((Player) cur, F.main("Game", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + "."));
}
}
// Rate
Recharge.Instance.useForce(player, GetName() + " Rate", RATE);
// Inform
if (inform)
{
player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f);
UtilPlayer.message(player, F.main("Game", "You detonated " + F.skill(GetName()) + "."));
}
return true;
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
solidify(data.getThrower(), false);
if (target == null)
{
return;
}
// Damage Event
Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, DAMAGE_COLLIDE, true, true, false, UtilEnt.getName(data.getThrower()), GetName());
}
@Override
public void Idle(ProjectileUser data)
{
solidify(data.getThrower(), false);
}
@Override
public void Expire(ProjectileUser data)
{
solidify(data.getThrower(), false);
}
@EventHandler
public void colorExpireUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
{
return;
}
Set<Player> detonate = new HashSet<Player>();
Iterator<UUID> playerIterator = _active.keySet().iterator();
while (playerIterator.hasNext())
{
UUID key = playerIterator.next();
Player player = UtilPlayer.searchExact(key);
if (player == null)
{
playerIterator.remove();
continue;
}
WoolBombData data = _active.get(key);
if (UtilTime.elapsed(data.Time, COOLDOWN))
{
detonate.add(player);
continue;
}
if (Recharge.Instance.usable(player, GetName() + " Rate"))
{
if (data.Block.getData() == 14)
{
data.Block.setData((byte) 0);
}
else
{
data.Block.setData((byte) 14);
}
}
}
for (Player player : detonate)
{
detonate(player, false);
}
}
@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,189 @@
package nautilus.game.arcade.game.games.smash.perks.sheep;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
import org.bukkit.DyeColor;
import org.bukkit.Effect;
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.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.DisguiseSheep;
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 PerkWoolCloud extends Perk
{
private static final long COOLDOWN = 10000;
private static final long MIN_VELOCITY_TIME = 200;
private static final long MAX_VELOCITY_TIME = 1200;
private static final int DAMAGE_RADIUS = 2;
private static final int DAMAGE = 8;
private static final float KNOCKBACK_MAGNITUDE = 2.5F;
private Map<UUID, Long> _active = new HashMap<>();
public PerkWoolCloud()
{
super("Wooly Rocket", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Wooly Rocket" });
}
@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;
}
// Recharge
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
UtilAction.velocity(player, new Vector(0, 1, 0), 1, false, 0, 0, 2, true);
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
// Allow double jump
player.setAllowFlight(true);
setWoolColor(player, DyeColor.RED);
_active.put(player.getUniqueId(), System.currentTimeMillis());
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
if (!Manager.GetGame().IsLive())
{
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;
}
UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation(), 0.2f, 0.2f, 0.2f, 0, 4, ViewDist.LONGER, UtilServer.getPlayers());
if (!UtilTime.elapsed(_active.get(player), MIN_VELOCITY_TIME))
{
continue;
}
for (Player other : Manager.GetGame().GetPlayers(true))
{
if (player.equals(other))
{
continue;
}
if (UtilMath.offset(player, other) < DAMAGE_RADIUS)
{
// Damage Event
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, false, false, player.getName(), GetName());
UtilParticle.PlayParticle(ParticleType.EXPLODE, other.getLocation(), 0f, 0f, 0f, 0, 1, ViewDist.MAX, UtilServer.getPlayers());
UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation(), 0.2f, 0.2f, 0.2f, 0, 10, ViewDist.MAX, UtilServer.getPlayers());
}
}
if (UtilEnt.isGrounded(player) || UtilTime.elapsed(_active.get(player), MAX_VELOCITY_TIME))
{
playerIterator.remove();
setWoolColor(player, DyeColor.WHITE);
}
}
}
public void setWoolColor(Player player, DyeColor color)
{
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
if (disguise != null && disguise instanceof DisguiseSheep)
{
DisguiseSheep sheep = (DisguiseSheep) disguise;
sheep.setSheared(false);
sheep.setColor(color);
sheep.UpdateDataWatcher();
Manager.GetDisguise().updateDisguise(disguise);
}
}
@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,123 @@
package nautilus.game.arcade.game.games.smash.perks.sheep;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
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.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.perks.SmashUltimate;
import nautilus.game.arcade.kit.perks.data.HomingSheepData;
public class SmashSheep extends SmashUltimate
{
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[] {}, Sound.SHEEP_IDLE, 0);
}
@Override
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;
}
Sheep sheep = player.getWorld().spawn(player.getEyeLocation(), Sheep.class);
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);
}
}
}
private void explode(HomingSheepData data)
{
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);
for (Player player : players.keySet())
{
if (UtilPlayer.isSpectator(player))
{
continue;
}
// 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());
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(), 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 long 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 long 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

@ -0,0 +1,140 @@
package nautilus.game.arcade.game.games.smash.perks.skeletalhorse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
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.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.C;
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.game.games.smash.perks.SmashPerk;
public class PerkDeadlyBones extends SmashPerk
{
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." });
}
@EventHandler
public void damageActivate(CustomDamageEvent event)
{
if (event.IsCancelled())
{
return;
}
Player player = event.GetDamageePlayer();
if (player == null)
{
return;
}
if (!hasPerk(player))
{
return;
}
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() < 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);
for (LivingEntity cur : targets.keySet())
{
if (cur.equals(player))
{
continue;
}
Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE * targets.get(key) + 1, true, true, false, player.getName(), GetName());
}
// Remove
item.remove();
_active.remove(item);
}
}
@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,197 @@
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.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.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.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseHorse;
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 PerkHorseKick extends SmashPerk
{
private static final long COOLDOWN = 6000;
private static final float DAMAGE = 6.5F;
private static final long 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 (!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, GetName(), COOLDOWN, true, true))
{
return;
}
// Horse Animation
DisguiseBase horse = Manager.GetDisguise().getActiveDisguise(player);
if (horse != null && horse instanceof DisguiseHorse)
{
((DisguiseHorse) horse).kick();
Manager.GetDisguise().updateDisguise(horse);
}
// Animation
_active.put(player.getUniqueId(), System.currentTimeMillis());
// AoE Area
Location loc = player.getLocation();
loc.add(player.getLocation().getDirection().setY(0).normalize().multiply(1.5));
loc.add(0, 0.8, 0);
for (LivingEntity other : UtilEnt.getInRadius(loc, 2.5).keySet())
{
if (UtilPlayer.isSpectator(other))
{
continue;
}
if (other.equals(player))
{
continue;
}
// Damage Event
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, true, false, player.getName(), GetName());
// 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(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
// Slow
Manager.GetCondition().Factory().Slow(GetName(), player, player, 0.8, 3, false, false, true, false);
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
// Player
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() || player.getHealth() <= 0 || UtilTime.elapsed(_active.get(player), KICK_TIME))
{
playerIterator.remove();
// Horse Animation
DisguiseBase horse = Manager.GetDisguise().getActiveDisguise(player);
if (horse != null && horse instanceof DisguiseHorse)
{
((DisguiseHorse) horse).stopKick();
Manager.GetDisguise().updateDisguise(horse);
}
Manager.GetCondition().EndCondition(player, null, GetName());
}
else
{
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());
}
}
}
@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,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(String name, String[] perkDesc)
{
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,322 @@
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.block.Action;
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.UtilItem;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilEvent.ActionType;
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<Player, Integer> _charge = new HashMap<>();
private Map<Player, Long> _chargeLast = new HashMap<>();
private Set<UUID> _firing = new HashSet<>();
private Set<Projectile> _arrows = new HashSet<Projectile>();
private int _max;
private long _tick;
private boolean _remove;
private boolean _noDelay;
private boolean _useExp;
public PerkBarrage(int max, long tick, boolean remove, boolean noDelay)
{
this(max, tick, remove, noDelay, false);
}
public PerkBarrage(int max, long 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 (player.getItemInHand() == null || player.getItemInHand().getType() == Material.BOW)
{
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, 0);
_chargeLast.put(player, System.currentTimeMillis());
_firing.remove(player);
}
@EventHandler
public void BarrageCharge(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : UtilServer.getPlayers())
{
// Not Charging
if (!_charge.containsKey(cur))
continue;
if (_firing.contains(cur))
continue;
// Max Charge
if (_charge.get(cur) >= _max)
continue;
// Charge Interval
if (_charge.get(cur) == 0)
{
if (!UtilTime.elapsed(_chargeLast.get(cur), 1000))
continue;
}
else
{
if (!UtilTime.elapsed(_chargeLast.get(cur), _tick))
continue;
}
// No Longer Holding Bow
if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW)
{
if (_useExp)
{
cur.setExp(0f);
}
_charge.remove(cur);
_chargeLast.remove(cur);
continue;
}
// Increase Charge
_charge.put(cur, _charge.get(cur) + 1);
if (_useExp)
{
cur.setExp(Math.min(0.9999f, (float) _charge.get(cur) / (float) _max));
}
_chargeLast.put(cur, System.currentTimeMillis());
// Effect
cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur)));
}
}
@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))
return;
// Start Barrage
_firing.add(player);
_chargeLast.put(player, System.currentTimeMillis());
}
@EventHandler
public void BarrageArrows(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
HashSet<Player> remove = new HashSet<Player>();
for (Player cur : _firing)
{
if (!_charge.containsKey(cur) || !_chargeLast.containsKey(cur))
{
remove.add(cur);
continue;
}
if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW)
{
remove.add(cur);
continue;
}
int arrows = _charge.get(cur);
if (arrows <= 0)
{
remove.add(cur);
continue;
}
_charge.put(cur, arrows - 1);
if (_useExp)
{
cur.setExp(Math.min(0.9999f, (float) _charge.get(cur) / (float) _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);
_chargeLast.remove(cur);
_firing.remove(cur);
}
}
@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 (!Kit.HasKit(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()))
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);
}
@Override
public void addSuperCustom(Player player)
{
clean(player);
}
public void clean(Player player)
{
_charge.remove(player);
_chargeLast.remove(player);
_firing.remove(player);
}
}

View File

@ -0,0 +1,109 @@
package nautilus.game.arcade.game.games.smash.perks.skeleton;
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.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.game.games.smash.perks.SmashPerk;
public class PerkBoneExplosion extends SmashPerk
{
private static final long 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" });
}
@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()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (isSuperActive(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
Map<Player, Double> nearby = UtilPlayer.getInRadius(player.getLocation(), DAMAGE_RADIUS);
for (Player other : nearby.keySet())
{
if (player.equals(other))
{
continue;
}
// 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, DAMAGE * nearby.get(other), true, true, false, player.getName(), GetName());
}
// 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);
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return;
}
event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
}
}

View File

@ -30,6 +30,11 @@ public abstract class Perk implements Listener
public boolean hasPerk(Player player) public boolean hasPerk(Player player)
{ {
if (Manager.GetGame() == null)
{
return false;
}
if (!Manager.GetGame().IsLive()) if (!Manager.GetGame().IsLive())
{ {
return false; return false;

View File

@ -1,48 +0,0 @@
package nautilus.game.arcade.kit;
import java.util.HashSet;
import org.bukkit.entity.Player;
public abstract class SmashPerk extends Perk
{
private HashSet<Player> _superActive = new HashSet<Player>();
public SmashPerk(String name, String[] perkDesc)
{
super(name, perkDesc);
}
public SmashPerk(String name, String[] perkDesc, boolean display)
{
super(name, perkDesc, display);
}
public void addSuperActive(Player player)
{
_superActive.add(player);
addSuperCustom(player);
}
public void addSuperCustom(Player player)
{
}
public void removeSuperActive(Player player)
{
if (_superActive.remove(player))
removeSuperCustom(player);
}
public void removeSuperCustom(Player player)
{
}
public boolean isSuperActive(Player player)
{
return _superActive.contains(player);
}
}

View File

@ -26,7 +26,7 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkBarrage extends SmashPerk public class PerkBarrage extends SmashPerk
{ {

View File

@ -32,8 +32,8 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.game.games.smash.perks.SmashKit;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
import nautilus.game.arcade.kit.perks.data.SonicBoomData; import nautilus.game.arcade.kit.perks.data.SonicBoomData;
public class PerkBatForm extends SmashPerk public class PerkBatForm extends SmashPerk

View File

@ -32,7 +32,7 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkBatWave extends SmashPerk public class PerkBatWave extends SmashPerk
{ {

View File

@ -1,39 +1,38 @@
package nautilus.game.arcade.kit.perks; package nautilus.game.arcade.kit.perks;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block; import org.bukkit.Sound;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock; 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.UtilFirework;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer; 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 mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkBlink extends SmashPerk public class PerkBlink extends SmashPerk
{ {
private String _name = "";
private static final float INCREMENTAITON = 0.2F;
private String _name;
private double _range; private double _range;
private long _recharge; private long _recharge;
public PerkBlink(String name, double range, long recharge) public PerkBlink(String name, double range, long recharge)
{ {
super("name", new String[] super(name, new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + name });
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + name
});
_name = name; _name = name;
_range = range; _range = range;
@ -44,79 +43,60 @@ public class PerkBlink extends SmashPerk
public void Blink(PlayerInteractEvent event) public void Blink(PlayerInteractEvent event)
{ {
if (event.isCancelled()) if (event.isCancelled())
{
return; return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) if (!UtilEvent.isAction(event, ActionType.R))
{
return; return;
}
if (UtilBlock.usable(event.getClickedBlock())) if (UtilBlock.usable(event.getClickedBlock()))
{
return; return;
}
if (!UtilGear.isAxe(event.getPlayer().getItemInHand()))
return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!Kit.HasKit(player)) if (!UtilItem.isAxe(player.getItemInHand()))
{
return; return;
}
if (!hasPerk(player))
{
return;
}
if (isSuperActive(player)) if (isSuperActive(player))
{
return; return;
}
if (!Recharge.Instance.use(player, _name, _recharge, true, true)) if (!Recharge.Instance.use(player, _name, _recharge, true, true))
{
return; return;
//Smoke Trail
Block lastSmoke = player.getLocation().getBlock();
double curRange = 0;
while (curRange <= _range)
{
Location newTarget = player.getLocation().add(new Vector(0,0.2,0)).add(player.getLocation().getDirection().multiply(curRange));
if (!UtilBlock.airFoliage(newTarget.getBlock()) ||
!UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP)))
break;
//Progress Forwards
curRange += 0.2;
//Smoke Trail
if (!lastSmoke.equals(newTarget.getBlock()))
{
lastSmoke.getWorld().playEffect(lastSmoke.getLocation(), Effect.SMOKE, 4);
} }
lastSmoke = newTarget.getBlock(); LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTAITON, _range, null, ParticleType.SMOKE, UtilServer.getPlayers());
while (lineParticle.update())
{
} }
//Modify Range // Firework
curRange -= 0.4;
if (curRange < 0)
curRange = 0;
//Destination
Location loc = player.getLocation().add(player.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0)));
if (curRange > 0)
{
//Firework
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false); UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f); player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f);
player.teleport(loc); player.teleport(lineParticle.getDestination());
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f);
//Firework
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
}
player.setFallDistance(0); player.setFallDistance(0);
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f);
//Inform // Firework
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
// Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(_name) + ".")); UtilPlayer.message(player, F.main("Game", "You used " + F.skill(_name) + "."));
} }
} }

View File

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

View File

@ -16,7 +16,7 @@ import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; 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 class PerkBoneExplosion extends SmashPerk
{ {

View File

@ -31,7 +31,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash; 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 PerkBoneRush extends SmashPerk implements IThrown public class PerkBoneRush extends SmashPerk implements IThrown
{ {

View File

@ -4,7 +4,6 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
@ -26,16 +25,15 @@ import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; 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.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; 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.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.kit.perks.data.ChickenMissileData; import nautilus.game.arcade.kit.perks.data.ChickenMissileData;
public class PerkChickenRocket extends SmashPerk public class PerkChickenRocket extends SmashPerk

View File

@ -2,6 +2,8 @@ package nautilus.game.arcade.kit.perks;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -22,57 +24,75 @@ import nautilus.game.arcade.kit.Perk;
public class PerkCreeperElectricity extends Perk public class PerkCreeperElectricity extends Perk
{ {
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
private static final long 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() public PerkCreeperElectricity()
{ {
super("Lightning Shield", new String[] super("Lightning Shield", new String[] { "When hit by a non-melee attack, you gain " + C.cGreen + "Lightning Shield" });
{
"When hit by a non-melee attack, you gain " + C.cGreen + "Lightning Shield"
});
} }
@EventHandler @EventHandler
public void Shield(CustomDamageEvent event) public void Shield(CustomDamageEvent event)
{ {
if (event.IsCancelled()) if (event.IsCancelled())
{
return; 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)
{
return; return;
}
Player damagee = event.GetDamageePlayer(); Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
if (!Kit.HasKit(damagee)) if (damagee == null)
{
return; return;
}
_active.put(damagee, System.currentTimeMillis()); if (!hasPerk(damagee))
{
return;
}
_active.put(damagee.getUniqueId(), System.currentTimeMillis());
SetPowered(damagee, true); SetPowered(damagee, true);
Manager.GetCondition().Factory().Speed(GetName(), damagee, damagee, 4, 1, false, false, false); 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); damagee.getWorld().playSound(damagee.getLocation(), Sound.CREEPER_HISS, 3f, 1.25f);
//Inform // Inform
UtilPlayer.message(damagee, F.main("Skill", "You gained " + F.skill(GetName()) + ".")); UtilPlayer.message(damagee, F.main("Skill", "You gained " + F.skill(GetName()) + "."));
} }
@EventHandler @EventHandler
public void Update(UpdateEvent event) public void Update(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
{
return; return;
}
Iterator<Player> shieldIterator = _active.keySet().iterator(); Iterator<UUID> shieldIterator = _active.keySet().iterator();
while (shieldIterator.hasNext()) while (shieldIterator.hasNext())
{ {
Player player = shieldIterator.next(); Player player = UtilPlayer.searchExact(shieldIterator.next());
if (player == null)
{
shieldIterator.remove();
}
if (!IsPowered(player)) if (!IsPowered(player))
{ {
@ -81,13 +101,13 @@ public class PerkCreeperElectricity extends Perk
continue; continue;
} }
if (UtilTime.elapsed(_active.get(player), 2000)) if (UtilTime.elapsed(_active.get(player), DURATION))
{ {
shieldIterator.remove(); shieldIterator.remove();
SetPowered(player, false); SetPowered(player, false);
//Sound // Sound
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 3f, 0.75f); player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 3f, 0.75f);
} }
} }
@ -103,47 +123,56 @@ public class PerkCreeperElectricity extends Perk
return; return;
Player damagee = event.GetDamageePlayer(); Player damagee = event.GetDamageePlayer();
if (damagee == null) return; if (damagee == null)
if (!Kit.HasKit(damagee))
return; return;
if (!hasPerk(damagee))
{
return;
}
if (!IsPowered(damagee)) if (!IsPowered(damagee))
{
return; return;
}
event.SetCancelled("Lightning Shield"); 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()) + ".")); 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()); 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); SetPowered(damagee, false);
//Damage Event // Damage Event
Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), damagee, null, Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), damagee, null, DamageCause.LIGHTNING, DAMAGE, true, true, false, damagee.getName(), GetName());
DamageCause.LIGHTNING, 4, true, true, false,
damagee.getName(), GetName());
} }
public DisguiseCreeper GetDisguise(Player player) public DisguiseCreeper GetDisguise(Player player)
{ {
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
if (disguise == null) if (disguise == null)
{
return null; return null;
}
if (!(disguise instanceof DisguiseCreeper)) if (!(disguise instanceof DisguiseCreeper))
{
return null; return null;
}
return (DisguiseCreeper)disguise; return (DisguiseCreeper) disguise;
} }
public void SetPowered(Player player, boolean powered) public void SetPowered(Player player, boolean powered)
{ {
DisguiseCreeper creeper = GetDisguise(player); DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null) return; if (creeper == null)
return;
creeper.SetPowered(powered); creeper.SetPowered(powered);
@ -153,7 +182,11 @@ public class PerkCreeperElectricity extends Perk
public boolean IsPowered(Player player) public boolean IsPowered(Player player)
{ {
DisguiseCreeper creeper = GetDisguise(player); DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null) return false;
if (creeper == null)
{
return false;
}
return creeper.IsPowered(); return creeper.IsPowered();
} }
@ -162,8 +195,10 @@ public class PerkCreeperElectricity extends Perk
public void Knockback(CustomDamageEvent event) public void Knockback(CustomDamageEvent event)
{ {
if (event.GetReason() == null || !event.GetReason().contains(GetName())) if (event.GetReason() == null || !event.GetReason().contains(GetName()))
{
return; return;
}
event.AddKnockback(GetName(), 2.5); event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE);
} }
} }

View File

@ -9,12 +9,16 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; 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.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseCreeper; import mineplex.core.disguise.disguises.DisguiseCreeper;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
@ -22,7 +26,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
@ -41,42 +45,60 @@ import org.bukkit.util.Vector;
public class PerkCreeperExplode extends SmashPerk public class PerkCreeperExplode extends SmashPerk
{ {
private static final long COOLDOWN = 8000;
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 HashMap<Player, Long> _active = new HashMap<Player, Long>(); private HashMap<Player, Long> _active = new HashMap<Player, Long>();
private HashSet<Player> _super = new HashSet<Player>(); private HashSet<Player> _super = new HashSet<Player>();
public PerkCreeperExplode() public PerkCreeperExplode()
{ {
super("Explode", new String[] super("Explode", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Shovel use " + C.cGreen + "Explosive Leap" });
{
C.cYellow + "Right-Click" + C.cGray + " with Shovel use " + C.cGreen + "Explosive Leap"
});
} }
@EventHandler @EventHandler
public void Activate(PlayerInteractEvent event) public void Activate(PlayerInteractEvent event)
{ {
if (event.isCancelled()) if (event.isCancelled())
{
return; return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) if (!UtilEvent.isAction(event, ActionType.R))
{
return; return;
}
if (UtilBlock.usable(event.getClickedBlock())) if (UtilBlock.usable(event.getClickedBlock()))
{
return; return;
}
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE"))
return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!UtilItem.isSpade(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (isSuperActive(player)) if (isSuperActive(player))
{
return; 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; return;
}
_active.put(player, System.currentTimeMillis()); _active.put(player, System.currentTimeMillis());
@ -98,7 +120,9 @@ public class PerkCreeperExplode extends SmashPerk
public void Update(UpdateEvent event) public void Update(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
{
return; return;
}
Iterator<Player> chargeIterator = _active.keySet().iterator(); Iterator<Player> chargeIterator = _active.keySet().iterator();
@ -106,59 +130,61 @@ public class PerkCreeperExplode extends SmashPerk
{ {
Player player = chargeIterator.next(); Player player = chargeIterator.next();
double elapsed = (System.currentTimeMillis() - _active.get(player))/1000d; double elapsed = (System.currentTimeMillis() - _active.get(player)) / 1000d;
//Idle in Air // Idle in Air
UtilAction.zeroVelocity(player); UtilAction.zeroVelocity(player);
//Sound // Sound
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, (float)(0.5 + elapsed), (float)(0.5 + elapsed)); player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, (float) (0.5 + elapsed), (float) (0.5 + elapsed));
IncreaseSize(player); IncreaseSize(player);
player.setExp(Math.min(0.99f, (float)(elapsed/1.5))); player.setExp(Math.min(0.99f, (float) (elapsed / 1.5)));
//Not Detonated // Not Detonated
if (elapsed < 1.5) if (elapsed < 1.5)
{
continue; continue;
}
chargeIterator.remove(); chargeIterator.remove();
//Unpower // Unpower
DecreaseSize(player); DecreaseSize(player);
boolean isSuper = _super.remove(player); boolean isSuper = _super.remove(player);
//Explode // Explode
if (!isSuper) if (!isSuper)
{ {
//Effect // Effect
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 0, 0, 0, 0, 1, UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers());
ViewDist.MAX, UtilServer.getPlayers());
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f);
} }
else else
{ {
//Particles // Particles
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 5f, 5f, 5f, 0, 20, UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 5f, 5f, 5f, 0, 20, ViewDist.MAX, UtilServer.getPlayers());
ViewDist.MAX, UtilServer.getPlayers());
//Sound // Sound
for (int i=0 ; i<4 ; i++) for (int i = 0; i < 4; i++)
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, (float)(2 + Math.random()*4), (float)(Math.random() + 0.2)); player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, (float) (2 + Math.random() * 4), (float) (Math.random() + 0.2));
//Blocks // Blocks
Collection<Block> blocks = UtilBlock.getInRadius(player.getLocation(), 12).keySet(); Collection<Block> blocks = UtilBlock.getInRadius(player.getLocation(), 12).keySet();
Iterator<Block> iter = blocks.iterator(); Iterator<Block> iter = blocks.iterator();
while (iter.hasNext()) { while (iter.hasNext())
{
Block b = iter.next(); 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); Manager.GetExplosion().BlockExplosion(blocks, player.getLocation(), false);
//Remove Spawns // Remove Spawns
Iterator<Location> spawnIterator = Manager.GetGame().GetTeam(player).GetSpawns().iterator(); Iterator<Location> spawnIterator = Manager.GetGame().GetTeam(player).GetSpawns().iterator();
while (spawnIterator.hasNext()) while (spawnIterator.hasNext())
{ {
@ -168,7 +194,8 @@ public class PerkCreeperExplode extends SmashPerk
spawnIterator.remove(); 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()) for (GameTeam team : Manager.GetGame().GetTeamList())
{ {
if (team.GetSpawns().isEmpty()) if (team.GetSpawns().isEmpty())
@ -178,46 +205,37 @@ public class PerkCreeperExplode extends SmashPerk
} }
} }
//Damage double maxRange = isSuper ? RADIUS_SMASH : RADIUS_NORMAL;
for (Entity ent : player.getWorld().getEntities()) double damage = isSuper ? DAMAGE_SMASH : DAMAGE_NORMAL;
// Damage
for (LivingEntity ent : UtilEnt.getInRadius(player.getLocation(), maxRange).keySet())
{ {
if (!(ent instanceof LivingEntity))
continue;
if (ent.equals(player)) if (ent.equals(player))
{
continue; continue;
}
double dist = UtilMath.offset(player.getLocation(), ent.getLocation()); double dist = UtilMath.offset(player.getLocation(), ent.getLocation());
double maxRange = 8; if (UtilPlayer.isSpectator(player))
if (isSuper) {
maxRange = 24;
double damage = 20;
if (isSuper)
damage = 30;
if (dist > maxRange)
continue; continue;
if (ent instanceof Player)
if (!Manager.GetGame().IsAlive((Player)ent))
continue;
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());
} }
//Velocity 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());
}
// Velocity
UtilAction.velocity(player, 1.8, 0.2, 1.4, true); UtilAction.velocity(player, 1.8, 0.2, 1.4, true);
//Inform // Inform
if (!isSuper) if (!isSuper)
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
} }
@ -225,20 +243,29 @@ public class PerkCreeperExplode extends SmashPerk
public DisguiseCreeper GetDisguise(Player player) public DisguiseCreeper GetDisguise(Player player)
{ {
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
if (disguise == null) if (disguise == null)
{
return null; return null;
}
if (!(disguise instanceof DisguiseCreeper)) if (!(disguise instanceof DisguiseCreeper))
{
return null; return null;
}
return (DisguiseCreeper)disguise; return (DisguiseCreeper) disguise;
} }
public int GetSize(Player player) public int GetSize(Player player)
{ {
DisguiseCreeper creeper = GetDisguise(player); DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null) return 0;
if (creeper == null)
{
return 0;
}
return creeper.bV(); return creeper.bV();
} }
@ -246,7 +273,11 @@ public class PerkCreeperExplode extends SmashPerk
public void DecreaseSize(Player player) public void DecreaseSize(Player player)
{ {
DisguiseCreeper creeper = GetDisguise(player); DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null) return;
if (creeper == null)
{
return;
}
creeper.a(-1); creeper.a(-1);
@ -256,7 +287,11 @@ public class PerkCreeperExplode extends SmashPerk
public void IncreaseSize(Player player) public void IncreaseSize(Player player)
{ {
DisguiseCreeper creeper = GetDisguise(player); DisguiseCreeper creeper = GetDisguise(player);
if (creeper == null) return;
if (creeper == null)
{
return;
}
creeper.a(1); creeper.a(1);

View File

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

View File

@ -2,7 +2,6 @@ package nautilus.game.arcade.kit.perks;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.bukkit.Material; import org.bukkit.Material;
@ -24,7 +23,7 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; 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 public class PerkDeadlyBones extends SmashPerk
{ {

View File

@ -27,7 +27,7 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
import nautilus.game.arcade.kit.perks.data.EarthquakeData; import nautilus.game.arcade.kit.perks.data.EarthquakeData;
import nautilus.game.arcade.kit.perks.data.NightLivingDeadData; import nautilus.game.arcade.kit.perks.data.NightLivingDeadData;

View File

@ -24,8 +24,8 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; 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.Perk;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkEggGun extends SmashPerk public class PerkEggGun extends SmashPerk
{ {

View File

@ -25,7 +25,7 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkEndermanDragon extends SmashPerk public class PerkEndermanDragon extends SmashPerk
{ {

View File

@ -2,12 +2,12 @@ package nautilus.game.arcade.kit.perks;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set;
import org.bukkit.EntityEffect; import org.bukkit.EntityEffect;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -16,79 +16,93 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.kit.perks.data.FireflyData; import nautilus.game.arcade.kit.perks.data.FireflyData;
public class PerkFirefly extends SmashPerk public class PerkFirefly extends SmashPerk
{ {
private HashSet<FireflyData> _data = new HashSet<FireflyData>(); private Set<FireflyData> _data = new HashSet<FireflyData>();
private int _tick = 0; private int _tick = 0;
public PerkFirefly() public PerkFirefly()
{ {
super("Firefly", new String[] super("Firefly", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Firefly" });
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Firefly"
});
} }
@EventHandler @EventHandler
public void Skill(PlayerInteractEvent event) public void Skill(PlayerInteractEvent event)
{ {
if (event.isCancelled()) if (event.isCancelled())
{
return; return;
}
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) if (!UtilEvent.isAction(event, ActionType.R))
{
return; return;
}
if (UtilBlock.usable(event.getClickedBlock())) if (UtilBlock.usable(event.getClickedBlock()))
{
return; return;
}
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (isSuperActive(event.getPlayer())) if (!UtilItem.isAxe(player.getItemInHand().getType()))
{
return; return;
}
if (!Kit.HasKit(player)) if (!hasPerk(player))
{
return; return;
}
if (isSuperActive(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) if (!Recharge.Instance.use(player, GetName(), 12000, true, true))
{
return; return;
}
activate(player);
}
/*
* It is split like this so Blaze's Smash can be called without the need to
* copy code.
*/
public void activate(Player player)
{
_data.add(new FireflyData(player)); _data.add(new FireflyData(player));
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
} }
@Override
public void addSuperCustom(Player player)
{
_data.add(new FireflyData(player));
}
@EventHandler @EventHandler
public void Update(UpdateEvent event) public void Update(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
{
return; return;
}
_tick++; _tick++;
@ -98,63 +112,66 @@ public class PerkFirefly extends SmashPerk
{ {
FireflyData data = dataIterator.next(); FireflyData data = dataIterator.next();
Player player = data.Player;
boolean superActive = isSuperActive(data.Player); boolean superActive = isSuperActive(data.Player);
//Teleport // Teleport
if (!UtilTime.elapsed(data.Time, 1500) && !superActive) if (!UtilTime.elapsed(data.Time, 1500) && !superActive)
{ {
UtilAction.zeroVelocity(data.Player); UtilAction.zeroVelocity(player);
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.2f, 0.6f); player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.2f, 0.6f);
data.Location = data.Player.getLocation(); data.Location = player.getLocation();
//Sound and Effect // Sound and Effect
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, data.Player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 10, ViewDist.LONG, UtilServer.getPlayers()); UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 10, ViewDist.LONG, UtilServer.getPlayers());
float progress = (float)(System.currentTimeMillis()-data.Time)/1500f; float progress = (float) (System.currentTimeMillis() - data.Time) / 1500f;
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.BLAZE_BREATH, 0.5f, 1f + progress); player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 0.5f, 1f + progress);
} }
//Velocity // Velocity
else if (!UtilTime.elapsed(data.Time, 2750) || superActive) else if (!UtilTime.elapsed(data.Time, 2750) || superActive)
{ {
UtilAction.velocity(data.Player, data.Player.getLocation().getDirection().multiply(superActive ? 0.9 : 0.7).add(new Vector(0,0.15,0))); UtilAction.velocity(player, player.getLocation().getDirection().multiply(superActive ? 0.9 : 0.7).add(new Vector(0, 0.15, 0)));
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.6f, 1.2f); player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.6f, 1.2f);
//Sound and Effect // Sound and Effect
if (!isSuperActive(data.Player)) if (!isSuperActive(player))
{ {
UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 40, ViewDist.LONG, UtilServer.getPlayers()); UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 40, ViewDist.LONG, UtilServer.getPlayers());
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.5f, 1.25f); player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.5f, 1.25f);
} }
else else
{ {
UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 60, ViewDist.LONG, UtilServer.getPlayers()); UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 60, ViewDist.LONG, UtilServer.getPlayers());
UtilParticle.PlayParticle(ParticleType.LAVA, data.Player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 40, ViewDist.LONG, UtilServer.getPlayers()); UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 40, ViewDist.LONG, UtilServer.getPlayers());
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.75f, 0.75f); player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.75f, 0.75f);
} }
for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), isSuperActive(data.Player) ? 7 : 4)) for (Player other : UtilPlayer.getNearby(player.getLocation(), superActive ? 7 : 4))
{
if (other.equals(player))
{ {
if (other.equals(data.Player))
continue; continue;
}
if (!Manager.GetGame().IsAlive(other)) if (!Manager.GetGame().IsAlive(other))
{
continue; continue;
}
other.playEffect(EntityEffect.HURT); other.playEffect(EntityEffect.HURT);
if (_tick % 12 == 0) if (_tick % 12 == 0)
{ {
if (Recharge.Instance.use(other, GetName() + " hit by " + data.Player.getName(), 2000, false, false)) if (Recharge.Instance.use(other, GetName() + " hit by " + player.getName(), 2000, false, false))
{ {
//Damage Event // Damage Event
Manager.GetDamage().NewDamageEvent(other, data.Player, null, Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, 7, true, true, false, player.getName(), isSuperActive(player) ? "Phoenix" : GetName());
DamageCause.CUSTOM, 7, true, true, false,
data.Player.getName(), isSuperActive(data.Player) ? "Phoenix" : GetName());
UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(data.Player) + data.Player.getName()) + " hit you with " + F.elem(GetName()) + ".")); UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(player) + player.getName()) + " hit you with " + F.elem(GetName()) + "."));
} }
} }
} }
@ -186,17 +203,11 @@ public class PerkFirefly extends SmashPerk
if (!data.Player.equals(event.GetDamageeEntity())) if (!data.Player.equals(event.GetDamageeEntity()))
continue; continue;
if (!UtilTime.elapsed(data.Time, 1250) && !isSuperActive(data.Player))// && event.GetCause() == DamageCause.PROJECTILE) if (!UtilTime.elapsed(data.Time, 1250) && !isSuperActive(data.Player))
{ {
Game game = Manager.GetGame(); if (isTeamDamage(data.Player, event.GetDamagerPlayer(true)))
if (game instanceof TeamSuperSmash)
{ {
if (game.GetTeam(data.Player).equals(game.GetTeam(event.GetDamagerPlayer(true)))) continue;
{
event.SetCancelled("Team Damage");
return;
}
} }
dataIterator.remove(); dataIterator.remove();

View File

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

View File

@ -15,8 +15,8 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkFlap extends SmashPerk public class PerkFlap extends SmashPerk
{ {

View File

@ -25,7 +25,7 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkFleshArrow extends SmashPerk public class PerkFleshArrow extends SmashPerk
{ {

View File

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

View File

@ -19,7 +19,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.events.PlayerGameRespawnEvent; import nautilus.game.arcade.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkInfernalHorror extends SmashPerk public class PerkInfernalHorror extends SmashPerk
{ {

View File

@ -1,142 +0,0 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
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.block.Action;
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.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
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.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkInferno extends SmashPerk
{
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
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 (!Kit.HasKit(player))
continue;
if (!player.isBlocking())
player.setExp((float) Math.min(0.999, player.getExp()+0.025));
}
}
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD"))
return;
Player player = event.getPlayer();
if (isSuperActive(player))
return;
if (!Kit.HasKit(player))
return;
_active.put(player, System.currentTimeMillis());
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill("Inferno") + "."));
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : UtilServer.getPlayers())
{
if (!_active.containsKey(cur))
continue;
if (!cur.isBlocking())
{
_active.remove(cur);
continue;
}
cur.setExp(cur.getExp()-0.035f);
if (cur.getExp() <= 0)
{
_active.remove(cur);
continue;
}
//Fire
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 0.95, "Inferno", false);
fire.teleport(cur.getEyeLocation());
double x = 0.07 - (UtilMath.r(14)/100d);
double y = 0.07 - (UtilMath.r(14)/100d);
double z = 0.07 - (UtilMath.r(14)/100d);
fire.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(1.6));
//Effect
cur.getWorld().playSound(cur.getLocation(), Sound.GHAST_FIREBALL, 0.1f, 1f);
}
}
@EventHandler
public void onCustomDamage(CustomDamageEvent event)
{
if (Manager.GetGame() instanceof TeamSuperSmash)
{
TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame();
if (event.GetDamagerPlayer(true) == null)
{
return;
}
if (smash.GetTeam(event.GetDamagerPlayer(true)).equals(smash.GetTeam(event.GetDamageePlayer())))
{
event.GetDamageeEntity().setFireTicks(0);
event.SetCancelled("Team Damage");
}
}
}
}

View File

@ -28,7 +28,7 @@ import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.game.games.smash.perks.SmashPerk;
public class PerkInkBlast extends SmashPerk implements IThrown public class PerkInkBlast extends SmashPerk implements IThrown
{ {

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