From 3ba848567c1adc4593cb52c7b0ed36c9978980fb Mon Sep 17 00:00:00 2001 From: Chiss Date: Sat, 5 Oct 2013 07:49:05 +1000 Subject: [PATCH] paintball added hg additions minor changes to other games --- .../src/mineplex/core/common/Rank.java | 1 + .../mineplex/core/explosion/Explosion.java | 2 +- .../nautilus/game/arcade/ArcadeManager.java | 2 +- .../src/nautilus/game/arcade/GameFactory.java | 2 + .../src/nautilus/game/arcade/GameType.java | 1 + .../game/games/dragonescape/DragonEscape.java | 12 +- .../games/dragonescape/DragonEscapeData.java | 10 +- .../game/games/hungergames/HungerGames.java | 18 +- .../games/hungergames/kit/KitBeastmaster.java | 39 ++ .../games/hungergames/kit/KitBrawler.java | 2 +- .../games/hungergames/kit/KitNecromancer.java | 39 ++ .../game/games/paintball/Paintball.java | 82 +++ .../games/paintball/kits/KitMachineGun.java | 66 +++ .../game/games/paintball/kits/KitRifle.java | 66 +++ .../game/games/paintball/kits/KitShotgun.java | 67 +++ .../arcade/game/games/smash/SuperSmash.java | 8 +- .../game/games/smash/kits/KitSkeleton.java | 4 +- .../arcade/game/games/smash/kits/KitWolf.java | 65 +++ .../game/arcade/game/games/uhc/UHC.java | 150 ++++-- .../arcade/kit/perks/PerkLeapTackleHG.java | 17 +- .../kit/perks/PerkPaintballMachineGun.java | 124 +++++ .../arcade/kit/perks/PerkPaintballRifle.java | 131 +++++ .../kit/perks/PerkPaintballShotgun.java | 139 +++++ .../game/arcade/kit/perks/PerkSkeletons.java | 165 ++++++ .../game/arcade/kit/perks/PerkWolfPack.java | 488 ++++++++++++++++++ .../game/arcade/kit/perks/PerkWolfPet.java | 299 +++++++++++ .../arcade/managers/GameLobbyManager.java | 15 + .../game/arcade/managers/MiscManager.java | 3 +- 28 files changed, 1950 insertions(+), 67 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/kit/KitBeastmaster.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/kit/KitNecromancer.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballMachineGun.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballRifle.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballShotgun.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java index 2aeb25748..bf94c07e8 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java @@ -14,6 +14,7 @@ public enum Rank MODERATOR("Mod", ChatColor.GOLD), HELPER("Helper", ChatColor.YELLOW), MAPDEV("Mapper", ChatColor.LIGHT_PURPLE), + YOUTUBE("Hero", ChatColor.LIGHT_PURPLE), ULTRA("Ultra", ChatColor.AQUA), ALL("All", ChatColor.GREEN); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java b/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java index c4f0a1dec..965408d5f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java @@ -154,7 +154,7 @@ public class Explosion extends MiniPlugin { //XXX ANTILAG double chance = 0.2 + (double)_explosionBlocks.size()/(double)120; - if (Math.random() > Math.min(0.85, chance)) + if (Math.random() > Math.min(0.95, chance)) { FallingBlock fall = cur.getWorld().spawnFallingBlock(cur.getLocation().add(0.5, 0.5, 0.5), blocks.get(cur).getKey(), blocks.get(cur).getValue()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index a472f9824..bea2d4d5d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -344,7 +344,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation { if (_game != null && _game.GetType() == GameType.UHC) { - event.setMotd(ChatColor.RED + "UHC - Season 2"); + event.setMotd(ChatColor.RED + "UHC - Season 3"); return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameFactory.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameFactory.java index 5e3886753..351564740 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameFactory.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameFactory.java @@ -22,6 +22,7 @@ import nautilus.game.arcade.game.games.smash.SuperSmash; import nautilus.game.arcade.game.games.snowfight.SnowFight; import nautilus.game.arcade.game.games.spleef.Spleef; import nautilus.game.arcade.game.games.squidshooter.SquidShooter; +import nautilus.game.arcade.game.games.paintball.Paintball; import nautilus.game.arcade.game.games.turfforts.TurfForts; import nautilus.game.arcade.game.games.uhc.UHC; import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival; @@ -48,6 +49,7 @@ public class GameFactory else if (gameType == GameType.HungerGames) return new HungerGames(_manager); else if (gameType == GameType.MineWare) return new MineWare(_manager); else if (gameType == GameType.MilkCow) return new MilkCow(_manager); + else if (gameType == GameType.Paintball) return new Paintball(_manager); else if (gameType == GameType.Quiver) return new Quiver(_manager); else if (gameType == GameType.Runner) return new Runner(_manager); else if (gameType == GameType.SnowFight) return new SnowFight(_manager); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index 253d6a535..2377f6eeb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -15,6 +15,7 @@ public enum GameType HungerGames("Hunger Games"), MineWare("MineWare"), MilkCow("Milk the Cow"), + Paintball("Super Paintball"), Quiver("One in the Quiver"), Runner("Runner"), Smash("Super Smash Mobs"), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java index 8ce83b23a..4a2404677 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java @@ -48,6 +48,8 @@ public class DragonEscape extends SoloGame private DragonEscapeData _dragonData; private Player _winner = null; + + private double _speedMult = 1; public DragonEscape(ArcadeManager manager) { @@ -112,8 +114,11 @@ public class DragonEscape extends SoloGame last = best; } + if (!WorldData.GetDataLocs("GREEN").isEmpty()) + _speedMult = WorldData.GetDataLocs("GREEN").get(0).getX()/100d; + if (WorldData.MapName.contains("Hell")) - this.WorldTimeSet = 16000; + this.WorldTimeSet = 16000; } @EventHandler @@ -380,6 +385,11 @@ public class DragonEscape extends SoloGame } } + public double GetSpeedMult() + { + return _speedMult; + } + @EventHandler public void Warp(PlayerInteractEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeData.java index b1ffb556c..02bb83103 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeData.java @@ -31,7 +31,7 @@ public class DragonEscapeData Velocity = dragon.getLocation().getDirection().setY(0).normalize(); Pitch = UtilAlg.GetPitch(dragon.getLocation().getDirection()); - Location = dragon.getLocation(); + Location = dragon.getLocation(); } public void Move() @@ -39,11 +39,12 @@ public class DragonEscapeData Turn(); //Speed - double speed = 0.16; + double speed = 0.2; speed += (System.currentTimeMillis() - Host.GetStateTime())/1000d * 0.001; //Speed Distance Boost + /* if (!Host.GetScores().isEmpty()) { double score = Host.GetScore(Dragon); @@ -53,7 +54,10 @@ public class DragonEscapeData speed += lead * 0.0025; } - + */ + + speed = speed * Host.GetSpeedMult(); + Location.add(Velocity.clone().multiply(speed)); Location.add(0, -Pitch, 0); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java index f9da13c0a..8c802dff6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java @@ -6,7 +6,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map.Entry; -import org.bukkit.Chunk; import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; @@ -31,7 +30,6 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -64,13 +62,15 @@ public class HungerGames extends SoloGame { new KitHunter(manager), new KitLooter(manager), - new KitBrawler(manager), new KitKnight(manager), new KitArcher(manager), new KitAssassin(manager), - + new KitBrawler(manager), + + new KitBeastmaster(manager), new KitBomber(manager), + new KitNecromancer(manager) }, new String[] @@ -84,12 +84,18 @@ public class HungerGames extends SoloGame this.DamageSelf = true; this.DamageTeamSelf = true; + + this.DeathOut = false; //XXX + this.DeathDropItems = true; + + this.ItemDrop = true; + this.ItemPickup = true; this.CompassEnabled = true; this.GemMultiplier = 2; - _spreadType = UtilMath.r(3); + _spreadType = 1;//UtilMath.r(3); System.out.println("==================="); System.out.println("SPREAD TYPE: " + _spreadType); System.out.println("==================="); @@ -371,7 +377,7 @@ public class HungerGames extends SoloGame if (_redLocations.isEmpty()) return; - int max = Math.max(5, Math.min(400, _redLocations.size()/10)); + int max = Math.max(5, Math.min(40, _redLocations.size()/100)); for (int i=0 ; i _rejoinTime = new NautHashMap(); - private NautHashMap _combatTime = new NautHashMap(); + private NautHashMap _combatTime = new NautHashMap(); private int _gameMinutes = 0; private long _lastMinute = System.currentTimeMillis(); + + private boolean _soloGame = false; public UHC(ArcadeManager manager) { @@ -104,11 +106,13 @@ public class UHC extends TeamGame "20 minutes of no PvP", "Borders at -1000 and 1000", "No default health regeneration", - "Last team alive wins!" + "Last player/team alive wins!" }); + this.DamageTeamSelf = true; + this.DeathDropItems = true; - + this.ItemDrop = true; this.ItemPickup = true; @@ -268,17 +272,17 @@ public class UHC extends TeamGame //Allowed if ( - event.getTo().getX() <= 999.5 && - event.getTo().getX() >= -999.5 && - event.getTo().getZ() <= 999.5 && - event.getTo().getZ() >= -999.5) + event.getTo().getX() < WorldData.MaxX && + event.getTo().getX() >= WorldData.MinX && + event.getTo().getZ() < WorldData.MaxZ && + event.getTo().getZ() >= WorldData.MinZ) return; Location from = event.getFrom(); - if (from.getX() > 999.5) from.setX(999.5); - if (from.getX() < -999.5) from.setX(-999.5); - if (from.getZ() > 999.5) from.setZ(999.5); - if (from.getZ() < -999.5) from.setZ(-999.5); + if (from.getX() >= WorldData.MaxX) from.setX(WorldData.MaxX - 1); + if (from.getX() < WorldData.MinX) from.setX(WorldData.MinX + 1); + if (from.getZ() >= WorldData.MaxZ) from.setZ(WorldData.MaxZ - 1); + if (from.getZ() < WorldData.MaxZ) from.setZ(WorldData.MinZ + 1); event.setTo(event.getFrom()); @@ -291,21 +295,43 @@ public class UHC extends TeamGame if (event.GetState() != GameState.Recruit) return; - this.WorldData.MinX = -1050; - this.WorldData.MaxX = 1050; - this.WorldData.MinZ = -1050; - this.WorldData.MaxZ = 1050; - - for (int x=-63 ; x<=62 ; x++) + if (_soloGame) { - WorldBoundaryRed(WorldData.World.getChunkAt(x, 62)); - WorldBoundaryRed(WorldData.World.getChunkAt(x, -63)); + this.WorldData.MinX = -1250; + this.WorldData.MaxX = 1250; + this.WorldData.MinZ = -1250; + this.WorldData.MaxZ = 1250; + + for (int x=-79 ; x<=78 ; x++) + { + WorldBoundaryRed(WorldData.World.getChunkAt(x, 78)); + WorldBoundaryRed(WorldData.World.getChunkAt(x, -79)); + } + + for (int z=-79 ; z<=78 ; z++) + { + WorldBoundaryRed(WorldData.World.getChunkAt(78, z)); + WorldBoundaryRed(WorldData.World.getChunkAt(-79, z)); + } } - - for (int z=-63 ; z<=62 ; z++) + else { - WorldBoundaryRed(WorldData.World.getChunkAt(62, z)); - WorldBoundaryRed(WorldData.World.getChunkAt(-63, z)); + this.WorldData.MinX = -1000; + this.WorldData.MaxX = 1000; + this.WorldData.MinZ = -1000; + this.WorldData.MaxZ = 1000; + + for (int x=-63 ; x<=62 ; x++) + { + WorldBoundaryRed(WorldData.World.getChunkAt(x, 62)); + WorldBoundaryRed(WorldData.World.getChunkAt(x, -63)); + } + + for (int z=-63 ; z<=62 ; z++) + { + WorldBoundaryRed(WorldData.World.getChunkAt(62, z)); + WorldBoundaryRed(WorldData.World.getChunkAt(-63, z)); + } } } @@ -319,10 +345,10 @@ public class UHC extends TeamGame block = chunk.getBlock(x, y, z); if ( - block.getX() <= 999 && - block.getX() >= -1000 && - block.getZ() <= 999 && - block.getZ() >= -1000) + block.getX() < WorldData.MaxX && + block.getX() >= WorldData.MinX && + block.getZ() < WorldData.MaxZ && + block.getZ() >= WorldData.MinZ) continue; if (block.getTypeId() != 0 || block.getY() <= 128) @@ -336,10 +362,10 @@ public class UHC extends TeamGame Block block = event.getBlock(); if ( - block.getX() < 1000 && - block.getX() > -1000 && - block.getZ() < 1000 && - block.getZ() > -1000) + block.getX() < WorldData.MaxX && + block.getX() >= WorldData.MinX && + block.getZ() < WorldData.MaxZ && + block.getZ() >= WorldData.MinZ) return; event.setCancelled(true); @@ -351,6 +377,23 @@ public class UHC extends TeamGame if (event.GetState() != GameState.Recruit) return; + //Solo + if (GetTeamList().size() > 10) + { + int i = 0; + for (GameTeam team : GetTeamList()) + { + team.SetColor(ChatColor.WHITE); + team.SetName(i+""); + + i++; + } + + _soloGame = true; + + return; + } + for (GameTeam team : GetTeamList()) { if (team.GetColor() == ChatColor.RED) team.SetName("Red"); @@ -379,6 +422,10 @@ public class UHC extends TeamGame { Location loc = GetRandomSpawn(null); + double dist = 250; + if (_soloGame) + dist = 200; + //Ensure 250 Blocks between Teams while (true) { @@ -389,7 +436,7 @@ public class UHC extends TeamGame if (otherTeam.GetSpawns().isEmpty()) continue; - if (UtilMath.offset(loc, otherTeam.GetSpawn()) < 250) + if (UtilMath.offset(loc, otherTeam.GetSpawn()) < dist) { clash = true; break; @@ -561,7 +608,7 @@ public class UHC extends TeamGame if (player.isDead()) return; - if (_combatTime.containsKey(player) && !UtilTime.elapsed(_combatTime.get(player), 15000)) + if (_combatTime.containsKey(player.getName()) && !UtilTime.elapsed(_combatTime.get(player.getName()), 15000)) { //Announcement Announce(team.GetColor() + C.Bold + player.getName() + " was killed for disconnecting during combat."); @@ -618,7 +665,7 @@ public class UHC extends TeamGame //Damager Alive else { - _combatTime.put(damager, System.currentTimeMillis()); + _combatTime.put(damager.getName(), System.currentTimeMillis()); } } } @@ -643,7 +690,7 @@ public class UHC extends TeamGame //Damagee Alive else if (damagerEnt != null && damagerEnt instanceof Player) { - _combatTime.put(damagee, System.currentTimeMillis()); + _combatTime.put(damagee.getName(), System.currentTimeMillis()); } } } @@ -836,7 +883,7 @@ public class UHC extends TeamGame UtilPlayer.message(event.getPlayer(), "You ate " + event.getItem().getItemMeta().getDisplayName()); - (new PotionEffect(PotionEffectType.ABSORPTION, 2400, 1)).apply(event.getPlayer()); + (new PotionEffect(PotionEffectType.ABSORPTION, 2400, 0)).apply(event.getPlayer()); (new PotionEffect(PotionEffectType.REGENERATION, 200, 1)).apply(event.getPlayer()); } @@ -1091,6 +1138,24 @@ public class UHC extends TeamGame } } */ + + @EventHandler + public void HungerHurt(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (!InProgress()) + return; + + for (Player player : GetPlayers(true)) + { + if (player.getHealth() <= 10 && player.getFoodLevel() == 0) + { + player.damage(1); + } + } + } @EventHandler public void TabHealth(UpdateEvent event) @@ -1135,6 +1200,8 @@ public class UHC extends TeamGame health += UtilMath.trim(1, hp/2d); String name = team.GetColor() + player.getName(); + if (_soloGame) + name = player.getName(); try { @@ -1185,6 +1252,9 @@ public class UHC extends TeamGame @Override public boolean CanJoinTeam(GameTeam team) { + if (_soloGame) + return (team.GetPlayers(true).isEmpty()); + return (team.GetPlayers(true).size() < 3); } @@ -1228,12 +1298,16 @@ public class UHC extends TeamGame UtilPlayer.message(player, C.cYellow+ C.Bold + this.GetName()); UtilPlayer.message(player, ""); UtilPlayer.message(player, ""); - + if (team != null) { WinnerTeam = team; Winner = team.GetName() + " Team"; - UtilPlayer.message(player, team.GetColor() + C.Bold + "Team " + team.GetName() + " won the match!"); + + if (_soloGame) + UtilPlayer.message(player, team.GetColor() + C.Bold + team.GetPlayers(false).get(0).getName() + " won the match!"); + else + UtilPlayer.message(player, team.GetColor() + C.Bold + "Team " + team.GetName() + " won the match!"); } else { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeapTackleHG.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeapTackleHG.java index b9a4b1f92..b23bb1b1c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeapTackleHG.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeapTackleHG.java @@ -31,9 +31,9 @@ public class PerkLeapTackleHG extends Perk public PerkLeapTackleHG(int damage) { - super("Leap Tackle", new String[] + super("Leap Attack", new String[] { - C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Leap Tackle" + C.cYellow + "Right-Click" + C.cGray + " with Sword/Axe to " + C.cGreen + "Leap Attack" }); _damage = damage; @@ -88,7 +88,7 @@ public class PerkLeapTackleHG extends Perk if (!other.equals(player)) if (UtilMath.offset(player, other) < 2) { - DoSlam(player, other); + Hit(player, other); _live.remove(player); return; } @@ -109,21 +109,16 @@ public class PerkLeapTackleHG extends Perk } } - public void DoSlam(Player damager, LivingEntity damagee) + public void Hit(Player damager, LivingEntity damagee) { - //Damage Event - Manager.GetDamage().NewDamageEvent(damager, damagee, null, - DamageCause.CUSTOM, _damage/2d, false, true, false, - damager.getName(), GetName() + " Recoil"); - //Damage Event Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, _damage, false, true, false, damager.getName(), GetName()); //Slow - Manager.GetCondition().Factory().Slow(GetName(), damagee, damager, 6, 3, false, false, true, false); - Manager.GetCondition().Factory().Slow(GetName(), damager, damagee, 6, 1, false, false, true, false); + Manager.GetCondition().Factory().Slow(GetName(), damagee, damager, 1, 3, false, false, true, false); + Manager.GetCondition().Factory().Slow(GetName(), damager, damagee, 1, 3, false, false, true, false); //Inform UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballMachineGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballMachineGun.java new file mode 100644 index 000000000..9757e62f0 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballMachineGun.java @@ -0,0 +1,124 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashSet; + +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EnderPearl; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.kit.Perk; + +public class PerkPaintballMachineGun extends Perk +{ + private HashSet _balls = new HashSet(); + + public PerkPaintballMachineGun() + { + super("Rifle", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " to use " + C.cGreen + "Machine Gun" + }); + } + + @EventHandler + public void Shoot(PlayerInteractEvent event) + { + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (event.getPlayer().getItemInHand().getType() != Material.DIAMOND_BARDING) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + GameTeam team = Manager.GetGame().GetTeam(player); + if (team == null) + return; + + event.setCancelled(true); + + Vector rand = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); + rand.multiply(0.15); + + if (team.GetColor() == ChatColor.AQUA) + { + Projectile proj = player.launchProjectile(Snowball.class); + proj.setVelocity(proj.getVelocity().multiply(1.6).add(rand)); + _balls.add(proj); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1.5f, 2f); + } + else + { + Projectile proj = player.launchProjectile(EnderPearl.class); + proj.setVelocity(proj.getVelocity().multiply(1.6).add(rand)); + _balls.add(proj); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1.5f, 1.75f); + } + + //Slow + Manager.GetCondition().Factory().Slow("Firing", player, player, 0.9, 1, false, false, false, false); + } + + @EventHandler + public void Damage(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + if (!_balls.contains(event.GetProjectile())) + return; + + //Negate + event.AddMod("Negate", "Negate", -event.GetDamageInitial(), false); + + event.AddMod("Paintball", "Machine Gun", 8, true); + + if (event.GetDamageePlayer() == null) + return; + + double r = Math.random(); + ItemStack item = null; + if (r > 0.75) item= event.GetDamageePlayer().getInventory().getHelmet(); + else if (r > 0.50) item= event.GetDamageePlayer().getInventory().getChestplate(); + else if (r > 0.25) item= event.GetDamageePlayer().getInventory().getLeggings(); + else item= event.GetDamageePlayer().getInventory().getBoots(); + + LeatherArmorMeta meta = (LeatherArmorMeta)item.getItemMeta(); + + //Color + if (event.GetProjectile() instanceof Snowball) + meta.setColor(Color.AQUA); + else + meta.setColor(Color.FUCHSIA); + + item.setItemMeta(meta); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballRifle.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballRifle.java new file mode 100644 index 000000000..be559a6db --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballRifle.java @@ -0,0 +1,131 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashSet; + +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EnderPearl; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.recharge.*; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.kit.Perk; + +public class PerkPaintballRifle extends Perk +{ + private HashSet _balls = new HashSet(); + + public PerkPaintballRifle() + { + super("Rifle", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " to use " + C.cGreen + "Rifle" + }); + } + + @EventHandler + public void Recharge(RechargedEvent event) + { + if (!event.GetAbility().equals(GetName())) + return; + + event.GetPlayer().playSound(event.GetPlayer().getLocation(), Sound.NOTE_STICKS, 2f, 1.5f); + } + + @EventHandler + public void Shoot(PlayerInteractEvent event) + { + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (event.getPlayer().getItemInHand().getType() != Material.IRON_BARDING) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + GameTeam team = Manager.GetGame().GetTeam(player); + if (team == null) + return; + + if (!Recharge.Instance.use(player, GetName(), 400, true)) + return; + + event.setCancelled(true); + + if (team.GetColor() == ChatColor.AQUA) + { + Projectile proj = player.launchProjectile(Snowball.class); + proj.setVelocity(proj.getVelocity().multiply(2)); + _balls.add(proj); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1.5f, 1.5f); + } + else + { + Projectile proj = player.launchProjectile(EnderPearl.class); + proj.setVelocity(proj.getVelocity().multiply(2)); + _balls.add(proj); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1.5f, 1.2f); + } + } + + @EventHandler + public void Damage(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + if (!_balls.contains(event.GetProjectile())) + return; + + //Negate + event.AddMod("Negate", "Negate", -event.GetDamageInitial(), false); + + event.AddMod("Paintball", "Rifle", 16, true); + + if (event.GetDamageePlayer() == null) + return; + + double r = Math.random(); + ItemStack item = null; + if (r > 0.75) item= event.GetDamageePlayer().getInventory().getHelmet(); + else if (r > 0.50) item= event.GetDamageePlayer().getInventory().getChestplate(); + else if (r > 0.25) item= event.GetDamageePlayer().getInventory().getLeggings(); + else item= event.GetDamageePlayer().getInventory().getBoots(); + + LeatherArmorMeta meta = (LeatherArmorMeta)item.getItemMeta(); + + //Color + if (event.GetProjectile() instanceof Snowball) + meta.setColor(Color.AQUA); + else + meta.setColor(Color.FUCHSIA); + + item.setItemMeta(meta); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballShotgun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballShotgun.java new file mode 100644 index 000000000..a276fecbb --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballShotgun.java @@ -0,0 +1,139 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashSet; + +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EnderPearl; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.recharge.Recharge; +import mineplex.core.recharge.RechargedEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.kit.Perk; + +public class PerkPaintballShotgun extends Perk +{ + private HashSet _balls = new HashSet(); + + public PerkPaintballShotgun() + { + super("Shotgun", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " to use " + C.cGreen + "Shotgun" + }); + } + + @EventHandler + public void Recharge(RechargedEvent event) + { + if (!event.GetAbility().equals(GetName())) + return; + + event.GetPlayer().playSound(event.GetPlayer().getLocation(), Sound.NOTE_STICKS, 2f, 1f); + event.GetPlayer().playSound(event.GetPlayer().getLocation(), Sound.NOTE_STICKS, 2f, 1.5f); + } + + @EventHandler + public void Shoot(PlayerInteractEvent event) + { + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (event.getPlayer().getItemInHand().getType() != Material.GOLD_BARDING) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + GameTeam team = Manager.GetGame().GetTeam(player); + if (team == null) + return; + + event.setCancelled(true); + + if (!Recharge.Instance.use(player, GetName(), 1000, true)) + return; + + for (int i=0 ; i<6 ; i++) + { + Vector rand = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); + rand.multiply(0.25); + + if (team.GetColor() == ChatColor.AQUA) + { + Projectile proj = player.launchProjectile(Snowball.class); + proj.setVelocity(proj.getVelocity().multiply(1).add(rand)); + _balls.add(proj); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 0.8f, 1f); + } + else + { + Projectile proj = player.launchProjectile(EnderPearl.class); + proj.setVelocity(proj.getVelocity().multiply(1).add(rand)); + _balls.add(proj); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 0.8f, 0.75f); + } + } + } + + @EventHandler + public void Damage(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + if (!_balls.contains(event.GetProjectile())) + return; + + //Negate + event.AddMod("Negate", "Negate", -event.GetDamageInitial(), false); + + event.AddMod("Paintball", "Shotgun", 8, true); + + if (event.GetDamageePlayer() == null) + return; + + double r = Math.random(); + ItemStack item = null; + if (r > 0.75) item= event.GetDamageePlayer().getInventory().getHelmet(); + else if (r > 0.50) item= event.GetDamageePlayer().getInventory().getChestplate(); + else if (r > 0.25) item= event.GetDamageePlayer().getInventory().getLeggings(); + else item= event.GetDamageePlayer().getInventory().getBoots(); + + LeatherArmorMeta meta = (LeatherArmorMeta)item.getItemMeta(); + + //Color + if (event.GetProjectile() instanceof Snowball) + meta.setColor(Color.AQUA); + else + meta.setColor(Color.FUCHSIA); + + item.setItemMeta(meta); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java new file mode 100644 index 000000000..af5c155fc --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java @@ -0,0 +1,165 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityTargetEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.arcade.kit.Perk; +import net.minecraft.server.v1_6_R3.EntityCreature; +import net.minecraft.server.v1_6_R3.Navigation; + +public class PerkSkeletons extends Perk +{ + private HashMap> _minions = new HashMap>(); + + private boolean _name; + + public PerkSkeletons(boolean name) + { + super("Skeleton Minons", new String[] + { + C.cGray + "Killing an opponent summons a skeletal minion." + }); + + _name = name; + } + + @EventHandler + public void MinionSpawn(CombatDeathEvent event) + { + if (event.GetLog().GetKiller() == null) + return; + + if (!(event.GetEvent().getEntity() instanceof Player)) + return; + + Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + if (killer == null) + return; + + if (!Kit.HasKit(killer)) + return; + + Player killed = (Player)event.GetEvent().getEntity(); + + Manager.GetGame().CreatureAllowOverride = true; + Skeleton skel = killer.getWorld().spawn(killed.getLocation(), Skeleton.class); + Manager.GetGame().CreatureAllowOverride = false; + + skel.setMaxHealth(30); + skel.setHealth(skel.getMaxHealth()); + + skel.getEquipment().setItemInHand(killed.getItemInHand()); + skel.getEquipment().setHelmet(killed.getInventory().getHelmet()); + skel.getEquipment().setChestplate(killed.getInventory().getChestplate()); + skel.getEquipment().setLeggings(killed.getInventory().getLeggings()); + skel.getEquipment().setBoots(killed.getInventory().getBoots()); + + event.GetEvent().getDrops().remove(killed.getItemInHand()); + event.GetEvent().getDrops().remove(killed.getInventory().getHelmet()); + event.GetEvent().getDrops().remove(killed.getInventory().getChestplate()); + event.GetEvent().getDrops().remove(killed.getInventory().getLeggings()); + event.GetEvent().getDrops().remove(killed.getInventory().getBoots()); + + + if (_name) + { + skel.setCustomName("Skeletal " + UtilEnt.getName(event.GetEvent().getEntity())); + skel.setCustomNameVisible(true); + } + + if (!_minions.containsKey(killer)) + _minions.put(killer, new ArrayList()); + + _minions.get(killer).add(skel); + + killer.playSound(killer.getLocation(), Sound.SKELETON_HURT, 1f, 1f); + } + + @EventHandler + public void TargetCancel(EntityTargetEvent event) + { + if (!_minions.containsKey(event.getTarget())) + return; + + if (_minions.get(event.getTarget()).contains(event.getEntity())) + event.setCancelled(true); + } + + @EventHandler + public void WolfUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player player : _minions.keySet()) + { + Iterator skelIterator = _minions.get(player).iterator(); + + while (skelIterator.hasNext()) + { + Skeleton skel = skelIterator.next(); + + //Dead + if (!skel.isValid()) + { + skelIterator.remove(); + continue; + } + + //Return to Owner + double range = 3; + if (skel.getTarget() != null) + range = 12; + + if (UtilMath.offset(skel, player) > range) + { + float speed = 1f; + if (player.isSprinting()) + speed = 1.4f; + + //Move + EntityCreature ec = ((CraftCreature)skel).getHandle(); + Navigation nav = ec.getNavigation(); + Location target = player.getLocation().add(UtilAlg.getTrajectory(player, skel)); + nav.a(target.getX(), target.getY(), target.getZ(), speed); + + skel.setTarget(null); + } + } + } + } + + @EventHandler + public void Heal(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (ArrayList skels : _minions.values()) + { + for (Skeleton skel : skels) + { + if (skel.getHealth() > 0) + skel.setHealth(Math.min(skel.getMaxHealth(), skel.getHealth()+1)); + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java new file mode 100644 index 000000000..b0c4bec5a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java @@ -0,0 +1,488 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.bukkit.DyeColor; +import org.bukkit.Effect; +import org.bukkit.EntityEffect; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_6_R3.entity.CraftWolf; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Wolf; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; +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.UtilMath; +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.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; +import net.minecraft.server.v1_6_R3.EntityCreature; +import net.minecraft.server.v1_6_R3.Navigation; + +public class PerkWolfPack extends Perk +{ + private HashMap> _wolfMap = new HashMap>(); + + private HashMap _strike = new HashMap(); + private HashMap _tackle = new HashMap(); + + private int _spawnRate; + private int _max; + private boolean _baby; + private boolean _name; + + public PerkWolfPack(int spawnRate, int max, boolean baby, boolean name) + { + super("Wolf Master", new String[] + { + C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Double Jump", + C.cGray + "Spawn 1 Wolf Cub every " + spawnRate + " seconds. Maximum of " + max + ".", + C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Cub Strike", + C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Pack Leap", + C.cYellow + "Crouch" + C.cGray + " to use " + C.cGreen + "Cub Return", + }); + + _spawnRate = spawnRate; + _max = max; + _baby = baby; + _name = name; + } + + @Override + public void Apply(Player player) + { + Recharge.Instance.use(player, GetName(), _spawnRate*1000, false); + } + + @EventHandler + public void DoubleJump(PlayerToggleFlightEvent event) + { + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (player.getGameMode() == GameMode.CREATIVE) + return; + + event.setCancelled(true); + player.setFlying(false); + + //Disable Flight + player.setAllowFlight(false); + + //Velocity + UtilAction.velocity(player, player.getLocation().getDirection(), 1, true, 1, 0, 1, true); + + //Wolves Velocity + if (_wolfMap.containsKey(player)) + { + for (Wolf wolf : _wolfMap.get(player)) + { + UtilAction.velocity(wolf, player.getLocation().getDirection(), 1, true, 1, 0, 1, true); + } + } + + //Sound + player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); + } + + @EventHandler + public void DoubleJumpUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (player.getGameMode() == GameMode.CREATIVE) + continue; + + if (!Kit.HasKit(player)) + continue; + + if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + player.setAllowFlight(true); + } + } + + @EventHandler + public void CubSpawn(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (!Kit.HasKit(cur)) + continue; + + if (!Manager.GetGame().IsAlive(cur)) + continue; + + if (!Recharge.Instance.use(cur, GetName(), _spawnRate*1000, false)) + continue; + + if (!_wolfMap.containsKey(cur)) + _wolfMap.put(cur, new ArrayList()); + + if (_wolfMap.get(cur).size() >= _max) + continue; + + Manager.GetGame().CreatureAllowOverride = true; + Wolf wolf = cur.getWorld().spawn(cur.getLocation(), Wolf.class); + Manager.GetGame().CreatureAllowOverride = false; + + wolf.setOwner(cur); + wolf.setCollarColor(DyeColor.GREEN); + wolf.playEffect(EntityEffect.WOLF_HEARTS); + + wolf.setMaxHealth(30); + wolf.setHealth(wolf.getMaxHealth()); + + if (_baby) + wolf.setBaby(); + + if (_name) + { + wolf.setCustomName(cur.getName() + "'s Wolf"); + wolf.setCustomNameVisible(true); + } + + _wolfMap.get(cur).add(wolf); + } + } + + @EventHandler + public void CubTargetCancel(EntityTargetEvent event) + { + if (!_wolfMap.containsKey(event.getTarget())) + return; + + if (_wolfMap.get(event.getTarget()).contains(event.getEntity())) + event.setCancelled(true); + } + + @EventHandler + public void CubUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player player : _wolfMap.keySet()) + { + Iterator wolfIterator = _wolfMap.get(player).iterator(); + + while (wolfIterator.hasNext()) + { + Wolf wolf = wolfIterator.next(); + + //Dead + if (!wolf.isValid()) + { + wolf.getWorld().playSound(wolf.getLocation(), Sound.WOLF_DEATH, 1f, 1f); + Recharge.Instance.useForce(player, GetName(), _spawnRate*1000); + wolfIterator.remove(); + continue; + } + + if (player.isSneaking()) + { + ((CraftWolf)wolf).getHandle().setGoalTarget(null); + } + + //Return to Owner + double range = 0.5; + if (wolf.getTarget() != null) + range = 12; + + Location target = player.getLocation().add(player.getLocation().getDirection().multiply(3)); + target.setY(player.getLocation().getY()); + + if (UtilMath.offset(wolf.getLocation(), target) > range) + { + float speed = 1f; + if (player.isSprinting()) + speed = 1.4f; + + //Move + EntityCreature ec = ((CraftCreature)wolf).getHandle(); + Navigation nav = ec.getNavigation(); + nav.a(target.getX(), target.getY(), target.getZ(), speed); + + wolf.setTarget(null); + } + } + } + } + + @EventHandler + public void CubStrikeTrigger(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() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + //Get Nearest Wolf + Wolf wolf = null; + double best = 999; + + for (Wolf other : _wolfMap.get(player)) + { + double dist = UtilMath.offset(other.getLocation(), player.getEyeLocation().add(player.getLocation().getDirection().setY(0).multiply(2))); + + if (dist > 4) + continue; + + if (wolf == null || dist < best) + { + wolf = other; + best = dist; + } + } + + if (wolf == null) + { + UtilPlayer.message(player, F.main("Game", "You have no nearby Wolf Cubs.")); + return; + } + + UtilAction.velocity(wolf, player.getLocation().getDirection(), 1.4, false, 0, 0.2, 1.2, true); + + wolf.playEffect(EntityEffect.WOLF_SMOKE); + + player.getWorld().playSound(wolf.getLocation(), Sound.WOLF_BARK, 1f, 1.8f); + + //Record + _strike.put(wolf, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Cub Strike") + ".")); + } + + @EventHandler + public void CubStrikeEnd(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + //Collide + Iterator wolfIterator = _strike.keySet().iterator(); + + while (wolfIterator.hasNext()) + { + Wolf wolf = wolfIterator.next(); + + for (Player other : Manager.GetGame().GetPlayers(true)) + if (other.getGameMode() == GameMode.SURVIVAL) + if (UtilEnt.hitBox(wolf.getLocation(), other, 2, null)) + { + if (other.equals(wolf.getOwner())) + continue; + + CubStrikeHit((Player)wolf.getOwner(), other, wolf); + wolfIterator.remove(); + return; + } + + if (!UtilEnt.isGrounded(wolf)) + continue; + + if (!UtilTime.elapsed(_strike.get(wolf), 1000)) + continue; + + wolfIterator.remove(); + } + } + + public void CubStrikeHit(Player damager, LivingEntity damagee, Wolf wolf) + { + //Damage + Manager.GetDamage().NewDamageEvent(damagee, damager, null, + DamageCause.CUSTOM, 5, false, true, false, + damager.getName(), "Cub Strike"); + + //Target + ((CraftWolf)wolf).getHandle().setGoalTarget(((CraftLivingEntity)damagee).getHandle()); + + //Sound + damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_BARK, 1.5f, 2f); + + //Inform + UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill("Cub Strike") + ".")); + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill("Cub Strike") + ".")); + } + + @EventHandler + public void CubHeal(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (ArrayList wolves : _wolfMap.values()) + { + for (Wolf wolf : wolves) + { + if (wolf.getHealth() > 0) + wolf.setHealth(Math.min(wolf.getMaxHealth(), wolf.getHealth()+1)); + } + } + } + + @EventHandler + public void TackleTrigger(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() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, "Pack Leap", 4000, true)) + return; + + //Velocity + UtilAction.velocity(player, player.getLocation().getDirection(), 1.4, false, 1, 0.2, 1, true); + + //Wolves Velocity + if (_wolfMap.containsKey(player)) + { + for (Wolf wolf : _wolfMap.get(player)) + { + UtilAction.velocity(wolf, player.getLocation().getDirection(), 1.4, false, 1, 0.2, 1, true); + } + } + + //Record + _tackle.put(player, System.currentTimeMillis()); + + player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 1f, 1.2f); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Tackle Leap") + ".")); + } + + @EventHandler + public void TackleEnd(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + //Collide + Iterator playerIterator = _tackle.keySet().iterator(); + + while (playerIterator.hasNext()) + { + Player player = playerIterator.next(); + + for (Player other : Manager.GetGame().GetPlayers(true)) + if (!player.equals(other)) + if (other.getGameMode() == GameMode.SURVIVAL) + if (UtilEnt.hitBox(player.getLocation(), other, 2, null)) + { + TackleHit(player, other); + playerIterator.remove(); + return; + } + + if (!UtilEnt.isGrounded(player)) + continue; + + if (!UtilTime.elapsed(_tackle.get(player), 1000)) + continue; + + playerIterator.remove(); + } + } + + public void TackleHit(Player damager, LivingEntity damagee) + { + damager.setVelocity(new Vector(0,0,0)); + + Manager.GetDamage().NewDamageEvent(damagee, damager, null, + DamageCause.CUSTOM, 7, false, true, false, + damager.getName(), "Tackle Leap"); + + //Wolves Target + if (_wolfMap.containsKey(damager)) + { + for (Wolf wolf : _wolfMap.get(damager)) + { + //Target + ((CraftWolf)wolf).getHandle().setGoalTarget(((CraftLivingEntity)damagee).getHandle()); + } + } + + //Sound + damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_BARK, 1.5f, 1.5f); + + //Slow + Manager.GetCondition().Factory().Slow(GetName(), damagee, damager, 6, 2, false, false, true, false); + + //Inform + UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill("Tackle Leap") + ".")); + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill("Tackle Leap") + ".")); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() != null && event.GetReason().contains("Cub Strike")) + { + event.AddKnockback(GetName(), 3); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java new file mode 100644 index 000000000..c7bc425b7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java @@ -0,0 +1,299 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.bukkit.DyeColor; +import org.bukkit.EntityEffect; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_6_R3.entity.CraftWolf; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Wolf; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityTargetEvent; +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.UtilMath; +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.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import nautilus.game.arcade.kit.Perk; +import net.minecraft.server.v1_6_R3.EntityCreature; +import net.minecraft.server.v1_6_R3.EntityLiving; +import net.minecraft.server.v1_6_R3.Navigation; + +public class PerkWolfPet extends Perk +{ + private HashMap> _wolfMap = new HashMap>(); + + private HashMap _tackle = new HashMap(); + + private int _spawnRate; + private int _max; + private boolean _baby; + private boolean _name; + + public PerkWolfPet(int spawnRate, int max, boolean baby, boolean name) + { + super("Wolf Master", new String[] + { + C.cGray + "Spawn 1 Wolf every " + spawnRate + " seconds. Maximum of " + max + ".", + C.cYellow + "Right-Click" + C.cGray + " with Sword/Axe to use " + C.cGreen + "Wolf Tackle", + //C.cYellow + "Hold Crouch" + C.cGray + " to " + C.cGreen + "Wolf Return" + }); + + _spawnRate = spawnRate; + _max = max; + _baby = baby; + _name = name; + } + + @Override + public void Apply(Player player) + { + Recharge.Instance.use(player, GetName(), _spawnRate*1000, false); + } + + @EventHandler + public void CubSpawn(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (!Kit.HasKit(cur)) + continue; + + if (!Manager.GetGame().IsAlive(cur)) + continue; + + if (!Recharge.Instance.use(cur, GetName(), _spawnRate*1000, false)) + continue; + + if (!_wolfMap.containsKey(cur)) + _wolfMap.put(cur, new ArrayList()); + + if (_wolfMap.get(cur).size() >= _max) + continue; + + Manager.GetGame().CreatureAllowOverride = true; + Wolf wolf = cur.getWorld().spawn(cur.getLocation(), Wolf.class); + Manager.GetGame().CreatureAllowOverride = false; + + wolf.setOwner(cur); + wolf.setCollarColor(DyeColor.GREEN); + wolf.playEffect(EntityEffect.WOLF_HEARTS); + + wolf.setMaxHealth(30); + wolf.setHealth(wolf.getMaxHealth()); + + + + if (_baby) + wolf.setBaby(); + + if (_name) + { + wolf.setCustomName(cur.getName() + "'s Wolf"); + wolf.setCustomNameVisible(true); + } + + + _wolfMap.get(cur).add(wolf); + + cur.playSound(cur.getLocation(), Sound.WOLF_HOWL, 1f, 1f); + } + } + + @EventHandler + public void CubTargetCancel(EntityTargetEvent event) + { + if (!_wolfMap.containsKey(event.getTarget())) + return; + + if (_wolfMap.get(event.getTarget()).contains(event.getEntity())) + event.setCancelled(true); + } + + @EventHandler + public void CubUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player player : _wolfMap.keySet()) + { + Iterator wolfIterator = _wolfMap.get(player).iterator(); + + while (wolfIterator.hasNext()) + { + Wolf wolf = wolfIterator.next(); + + //Dead + if (!wolf.isValid()) + { + wolf.getWorld().playSound(wolf.getLocation(), Sound.WOLF_DEATH, 1f, 1f); + Recharge.Instance.useForce(player, GetName(), _spawnRate*1000); + wolfIterator.remove(); + continue; + } + + if (player.isSneaking()) + { + ((CraftWolf)wolf).getHandle().setGoalTarget(null); + } + + //Return to Owner + double range = 0.5; + if (wolf.getTarget() != null) + range = 12; + + Location target = player.getLocation().add(player.getLocation().getDirection().multiply(3)); + target.setY(player.getLocation().getY()); + + if (UtilMath.offset(wolf.getLocation(), target) > range) + { + float speed = 1f; + if (player.isSprinting()) + speed = 1.4f; + + //Move + EntityCreature ec = ((CraftCreature)wolf).getHandle(); + Navigation nav = ec.getNavigation(); + nav.a(target.getX(), target.getY(), target.getZ(), speed); + + wolf.setTarget(null); + } + } + } + } + + @EventHandler + public void CubStrikeTrigger(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() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!_wolfMap.containsKey(player) || _wolfMap.get(player).isEmpty()) + { + UtilPlayer.message(player, F.main("Game", "You have no Wolf Cubs.")); + return; + } + + if (!Recharge.Instance.use(player, "Cub Strike", 4000, true)) + return; + + Wolf wolf = _wolfMap.get(player).get(UtilMath.r(_wolfMap.get(player).size())); + + UtilAction.velocity(wolf, player.getLocation().getDirection(), 1.4, false, 0, 0.2, 1.2, true); + + wolf.playEffect(EntityEffect.WOLF_SMOKE); + + player.getWorld().playSound(wolf.getLocation(), Sound.WOLF_BARK, 1f, 1.2f); + + //Record + _tackle.put(wolf, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Cub Strike") + ".")); + } + + @EventHandler + public void CubStrikeEnd(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + //Collide + Iterator wolfIterator = _tackle.keySet().iterator(); + + while (wolfIterator.hasNext()) + { + Wolf wolf = wolfIterator.next(); + + for (Player other : Manager.GetGame().GetPlayers(true)) + if (other.getGameMode() == GameMode.SURVIVAL) + if (UtilEnt.hitBox(wolf.getLocation(), other, 2, null)) + { + if (other.equals(wolf.getOwner())) + continue; + + CubStrikeHit((Player)wolf.getOwner(), other, wolf); + wolfIterator.remove(); + return; + } + + if (!UtilEnt.isGrounded(wolf)) + continue; + + if (!UtilTime.elapsed(_tackle.get(wolf), 1000)) + continue; + + wolfIterator.remove(); + } + } + + public void CubStrikeHit(Player damager, LivingEntity damagee, Wolf wolf) + { + //Damage Event + ((CraftWolf)wolf).getHandle().setGoalTarget((EntityLiving)damagee); + + //Sound + damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_BARK, 1.5f, 1.5f); + + //Slow + Manager.GetCondition().Factory().Slow(GetName(), damagee, damager, 6, 2, false, false, true, false); + + //Inform + UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill("Wolf Tackle") + ".")); + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill("Wolf Tackle") + ".")); + } + + @EventHandler + public void CubHeal(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (ArrayList wolves : _wolfMap.values()) + { + for (Wolf wolf : wolves) + { + if (wolf.getHealth() > 0) + wolf.setHealth(Math.min(wolf.getMaxHealth(), wolf.getHealth()+1)); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java index 3d38efb84..a636a828a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java @@ -305,6 +305,21 @@ public class GameLobbyManager implements IPacketRunnable, Listener //Text WriteTeamLine("Ultra", 0, 159, (byte)15); WriteTeamLine("Kits", 1, 159, (byte)4); + + CreateScoreboards(); + return; + } + + //UHC Empty + if (game.GetTeamList().size() > 10 && game.GetType() == GameType.UHC) + { + WriteTeamLine("Season", 0, 159, (byte)15); + WriteTeamLine("3", 1, 159, (byte)4); + + WriteKitLine("Season", 0, 159, (byte)15); + WriteKitLine("3", 1, 159, (byte)4); + + CreateScoreboards(); return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java index e2271ea2a..8f4a74f44 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java @@ -46,9 +46,10 @@ public class MiscManager implements Listener { event.setCancelled(true); } + //BoneMeal else if (event.getPlayer().getItemInHand().getType() == Material.INK_SACK && event.getPlayer().getItemInHand().getData().getData() == (byte)15) { - if (event.getAction() == Action.RIGHT_CLICK_BLOCK) + if (event.getAction() == Action.RIGHT_CLICK_BLOCK && Manager.GetGame().GetType() != GameType.UHC) event.setCancelled(true); } }