diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/AsymTeamGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/AsymTeamGame.java deleted file mode 100644 index 03fc43e4f..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/AsymTeamGame.java +++ /dev/null @@ -1,61 +0,0 @@ -package nautilus.game.arcade.game; - -import java.util.HashMap; - -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; - -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.kit.Kit; - -public abstract class AsymTeamGame extends TeamGame -{ - private HashMap _pastTeams = null; - - public AsymTeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc, HashMap pastTeams) - { - super(manager, gameType, kits, gameDesc); - - _pastTeams = pastTeams; - } - - public HashMap GetPastTeams() - { - return _pastTeams; - } - - @EventHandler(priority = EventPriority.HIGH) - public void GameStateChange(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Recruit) - return; - - if (GetPastTeams() != null) - { - this.SetCountdown(30); - this.SetCountdownForce(true); - } - } - - @Override - public GameTeam ChooseTeam(Player player) - { - //Get Past Team - ChatColor pastTeam = null; - if (_pastTeams != null) - pastTeam = _pastTeams.get(player.getName()); - - GameTeam newTeam = null; - - for (int i=0 ; i _tntSpawns = new ArrayList(); private ArrayList _tntWeakness = new ArrayList(); private HashMap _tntCarry = new HashMap(); - + private ArrayList _kingLocs; private Creature _king; private Location _kingLoc; private String _kingName; private Player _kingDamager = null; - private int _kingHealth = 30; + private int _kingHealth = 40; private ArrayList _peasantSpawns; private ArrayList _horseSpawns; - + public CastleSiege(ArcadeManager manager) { super(manager, GameType.CastleSiege, new Kit[] { - - new KitHumanKnight(manager), new KitHumanMarksman(manager), - new KitHumanBrawler(manager), + new KitHumanKnight(manager), + //new KitHumanBrawler(manager), + new KitHumanAssassin(manager), new KitHumanPeasant(manager), new NullKit(manager), new KitUndeadGhoul(manager), @@ -98,18 +98,30 @@ public class CastleSiege extends TeamGame { F.elem(C.cAqua + "Defenders") + C.cWhite + " must defend the King.", F.elem(C.cAqua + "Defenders") + C.cWhite + " win when the sun rises.", - F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as pigs.", + F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as wolves.", "", F.elem(C.cRed + "Undead") + C.cWhite + " must kill the King.", F.elem(C.cRed + "Undead") + C.cWhite + " lose when the sun rises.", }); + + _help = new String[] + { + "Marksmen are extremely important to defence!", + "It's recommended 50%+ of defence are Marksmen.", + "Use Barricades to block the Undeads path.", + "Use TNT to destroy weak points in walls.", + "Weak points are marked by cracked stone brick.", + "Undead can break fences with their axes.", + "Undead Archers must pick up arrows from the ground.", + + }; this.HungerSet = 20; this.DeathOut = false; this.WorldTimeSet = 14000; //14000 this.BlockPlaceAllow.add(85); - + _kingName = C.cYellow + C.Bold + "King Jonalon"; } @@ -141,13 +153,13 @@ public class CastleSiege extends TeamGame { if (kit.GetName().contains("Undead")) team.GetRestrictedKits().add(kit); - + team.SetRespawnTime(8); } } } } - + @EventHandler public void MoveKits(GameStateChangeEvent event) { @@ -162,25 +174,25 @@ public class CastleSiege extends TeamGame this.CreatureAllowOverride = true; Entity ent = GetKits()[5+i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i)); this.CreatureAllowOverride = false; - + Manager.GetCondition().Factory().Invulnerable("Kit", (LivingEntity)ent, (LivingEntity)ent, 999999, false, false); Manager.GetLobby().AddKitLocation(ent, GetKits()[5+i], WorldData.GetDataLocs("PINK").get(i)); } } - + @EventHandler public void HorseSpawn(GameStateChangeEvent event) { if (event.GetState() != GameState.Prepare) return; - + for (Location loc : _horseSpawns) { this.CreatureAllowOverride = true; Horse horse = loc.getWorld().spawn(loc, Horse.class); this.CreatureAllowOverride = false; - + horse.setAdult(); horse.setAgeLock(true); horse.setColor(org.bukkit.entity.Horse.Color.BLACK); @@ -189,14 +201,14 @@ public class CastleSiege extends TeamGame horse.setMaxDomestication(1); horse.getInventory().setSaddle(new ItemStack(Material.SADDLE)); horse.getInventory().setArmor(new ItemStack(Material.IRON_BARDING)); - + horse.setMaxHealth(60); horse.setHealth(horse.getMaxHealth()); - + horse.setCustomName("War Horse"); } } - + @EventHandler public void HorseInteract(PlayerInteractEntityEvent event) { @@ -205,19 +217,41 @@ public class CastleSiege extends TeamGame Player player = event.getPlayer(); GameTeam team = GetTeam(player); - + if (team == null || team.GetColor() == ChatColor.RED || !IsAlive(player)) { event.setCancelled(true); } } + @EventHandler + public void HorseDamageCancel(CustomDamageEvent event) + { + if (!(event.GetDamageeEntity() instanceof Horse)) + return; + + Player player = event.GetDamagerPlayer(true); + if (player == null) + return; + + if (!IsAlive(player)) + return; + + if (GetTeam(player) == null) + return; + + if (GetTeam(player).GetColor() == ChatColor.RED) + return; + + event.SetCancelled("Horse Team Damage"); + } + @EventHandler(priority = EventPriority.HIGH) public void GameStateChange(GameStateChangeEvent event) { if (event.GetState() != GameState.Prepare) return; - + //Spawn King this.CreatureAllowOverride = true; @@ -233,22 +267,22 @@ public class CastleSiege extends TeamGame _king.setCustomName(_kingName); _king.setCustomNameVisible(true); - + _king.setRemoveWhenFarAway(false); - + this.CreatureAllowOverride = false; } - + @EventHandler(priority = EventPriority.HIGH) public void SetDefenderRespawn(GameStateChangeEvent event) { if (event.GetState() != GameState.Live) return; - + //Change to Peasant Spawns this.GetTeam(ChatColor.AQUA).SetSpawns(_peasantSpawns); } - + @EventHandler public void KingTarget(EntityTargetEvent event) @@ -264,7 +298,7 @@ public class CastleSiege extends TeamGame if (!event.GetDamageeEntity().equals(_king)) return; - + event.SetCancelled("King Damage"); Player damager = event.GetDamagerPlayer(true); @@ -276,24 +310,24 @@ public class CastleSiege extends TeamGame { _kingDamager = damager; _kingHealth--; - + if (_kingHealth <= 0) _king.damage(500); } } - + @EventHandler public void KingUpdate(UpdateEvent event) { if (GetState() != GameState.Live) return; - + if (event.getType() != UpdateType.SEC) return; - + if (_king == null) return; - + if (UtilMath.offset(_king.getLocation(), _kingLoc) > 6) { _king.teleport(_kingLoc); @@ -323,21 +357,21 @@ public class CastleSiege extends TeamGame { GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(C.cYellow + C.Bold + "Kings Health")).setScore(_kingHealth); } - + //Teams HashMap _scoreGroup = new HashMap(); _scoreGroup.put(C.cAqua + "Wolves", 0); _scoreGroup.put(C.cAqua + "Defenders", 0); _scoreGroup.put(C.cRed + "Undead", 0); - + for (Player player : UtilServer.getPlayers()) { if (!IsAlive(player)) continue; - + Kit kit = GetKit(player); if (kit == null) continue; - + if (kit.GetName().contains("Castle")) { if (kit.GetName().contains("Wolf")) @@ -354,7 +388,7 @@ public class CastleSiege extends TeamGame _scoreGroup.put(C.cRed + "Undead", 1 + _scoreGroup.get(C.cRed + "Undead")); } } - + for (String group : _scoreGroup.keySet()) { GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(group)).setScore(_scoreGroup.get(group)); @@ -366,11 +400,11 @@ public class CastleSiege extends TeamGame { if (!IsLive()) return; - + if (this.WorldTimeSet > 24100) { SetCustomWinLine(_kingName + ChatColor.RESET + " has survived the seige!"); - + SetState(GameState.End); AnnounceEnd(GetTeam(ChatColor.AQUA)); @@ -399,7 +433,7 @@ public class CastleSiege extends TeamGame } else SetCustomWinLine(_kingName + ChatColor.RESET + " has died!"); - + SetState(GameState.End); AnnounceEnd(GetTeam(ChatColor.RED)); @@ -425,13 +459,16 @@ public class CastleSiege extends TeamGame { if (GetState() != GameState.Live) return; - + if (event.getType() != UpdateType.SEC) return; + + if (!UtilTime.elapsed(this.GetStateTime(), 20000)) + return; if (!UtilTime.elapsed(_tntSpawn, 25000)) return; - + if (_tntSpawns.isEmpty()) return; @@ -459,7 +496,7 @@ public class CastleSiege extends TeamGame if (!IsAlive(player)) return; - + if (!GetTeam(ChatColor.RED).HasPlayer(player)) return; @@ -494,7 +531,7 @@ public class CastleSiege extends TeamGame return; event.setCancelled(true); - + for (Location loc : _tntSpawns) { if (UtilMath.offset(player.getLocation(), loc) < 16) @@ -538,7 +575,7 @@ public class CastleSiege extends TeamGame if (dist < 2) { - int damage = (int) (9 * (event.getEntity().getVelocity().length() / 3d)); + int damage = (int) (5 * (event.getEntity().getVelocity().length() / 3d)); //Damage Event Manager.GetDamage().NewDamageEvent(player, event.getEntity().getShooter(), event.getEntity(), @@ -563,8 +600,8 @@ public class CastleSiege extends TeamGame { Player player = tntIterator.next(); FallingBlock block = _tntCarry.get(player); - - if (player.isDead() || !block.isValid() || block.getTicksLived() > 600) + + if (player.isDead() || !block.isValid() || block.getTicksLived() > 900) { player.eject(); block.remove(); @@ -588,7 +625,7 @@ public class CastleSiege extends TeamGame } } } - + @EventHandler public void TNTWeakness(ExplosionPrimeEvent event) { @@ -601,14 +638,14 @@ public class CastleSiege extends TeamGame break; } } - + if (weakness == null) return; - + _tntWeakness.remove(weakness); - + final Location extra = weakness; - + for (int i=0 ; i<10 ; i++) { Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() @@ -621,37 +658,37 @@ public class CastleSiege extends TeamGame } }, i*3); } - + weakness.getWorld().playSound(weakness, Sound.EXPLODE, 16f, 0.8f); } - + @EventHandler(priority = EventPriority.HIGH) public void AttackerBlockBreak(org.bukkit.event.block.BlockBreakEvent event) { GameTeam team = GetTeam(event.getPlayer()); if (team == null) return; - + if (team.GetColor() != ChatColor.RED) return; - + if (event.getBlock().getTypeId() == 85) event.setCancelled(false); } - + @EventHandler public void DefenderBlockPlace(org.bukkit.event.block.BlockPlaceEvent event) { GameTeam team = GetTeam(event.getPlayer()); if (team == null) return; - + if (team.GetColor() != ChatColor.AQUA) return; - + if (event.getBlock().getTypeId() != 85) return; - + for (Block block : UtilBlock.getSurrounding(event.getBlock(), false)) { if (block.isLiquid()) @@ -666,14 +703,14 @@ public class CastleSiege extends TeamGame event.setCancelled(true); UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " on each other.")); } - + if (_king != null && UtilMath.offset(_king.getLocation(), event.getBlock().getLocation().add(0.5, 0.5, 0.5)) < 4) { event.setCancelled(true); UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " near " + F.elem(C.cAqua + _kingName) + ".")); } } - + @EventHandler public void DayTimer(UpdateEvent event) { @@ -682,13 +719,13 @@ public class CastleSiege extends TeamGame if (event.getType() != UpdateType.TICK) return; - + WorldTimeSet = (WorldTimeSet+1); - + long timeLeft = 24000 - WorldTimeSet; timeLeft = timeLeft / 20 * 1000; - - + + if (timeLeft > 0) GetObjectiveSide().setDisplayName( ChatColor.WHITE + "§lSun Rise: " + C.cGreen + "§l" @@ -697,10 +734,31 @@ public class CastleSiege extends TeamGame { GetObjectiveSide().setDisplayName( ChatColor.WHITE + "§lSun has risen!"); - + for (Player player : GetTeam(ChatColor.RED).GetPlayers(true)) Manager.GetCondition().Factory().Ignite("Sun Damage", player, player, 5, false, false); } - + } + + @EventHandler + public void SnowDamage(UpdateEvent event) + { + if (GetState() != GameState.Live) + return; + + if (event.getType() != UpdateType.FAST) + return; + + for (Player player : GetPlayers(true)) + if (player.getLocation().getBlock().getTypeId() == 78) + { + //Damage Event + Manager.GetDamage().NewDamageEvent(player, null, null, + DamageCause.DROWNING, 2, false, true, false, + "Snow", "Snow Damage"); + + player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 80); + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanAssassin.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanAssassin.java new file mode 100644 index 000000000..9304884ec --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanAssassin.java @@ -0,0 +1,81 @@ +package nautilus.game.arcade.game.games.castlesiege.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkFletcher; +import nautilus.game.arcade.kit.perks.PerkLeap; +import nautilus.game.arcade.kit.perks.PerkPowershot; +import nautilus.game.arcade.kit.perks.PerkRegeneration; + +public class KitHumanAssassin extends Kit +{ + public KitHumanAssassin(ArcadeManager manager) + { + super(manager, "Castle Assassin", KitAvailability.Blue, + new String[] + { + "Able to kill with a single shot!" + }, + new Perk[] + { + new PerkFletcher(2, 4, false), + new PerkLeap("Leap", 1.2, 1, 8000), + new PerkPowershot(5, 400), + new PerkRegeneration(0), + }, + EntityType.ZOMBIE, + new ItemStack(Material.BOW)); + + } + + @EventHandler + public void FireItemResist(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (Manager.GetGame() == null) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!HasKit(player)) + continue; + + Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false); + } + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + + player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE)); + player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS)); + } + + @Override + public void SpawnCustom(LivingEntity ent) + { + ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); + ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); + ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); + ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanKnight.java index ef89dad9a..f08129293 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanKnight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanKnight.java @@ -21,7 +21,7 @@ public class KitHumanKnight extends Kit { public KitHumanKnight(ArcadeManager manager) { - super(manager, "Castle Knight", KitAvailability.Free, + super(manager, "Castle Knight", KitAvailability.Green, new String[] { @@ -31,7 +31,7 @@ public class KitHumanKnight extends Kit new Perk[] { new PerkMammoth(), - new PerkConstructor("Constructor", 60, 2, Material.FENCE, "Castle Barricade", true) + new PerkConstructor("Constructor", 40, 2, Material.FENCE, "Castle Barricade", true) }, EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); @@ -67,7 +67,8 @@ public class KitHumanKnight extends Kit player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java index ed54acaf9..4af931935 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java @@ -21,7 +21,7 @@ public class KitHumanMarksman extends Kit { public KitHumanMarksman(ArcadeManager manager) { - super(manager, "Castle Marksman", KitAvailability.Green, + super(manager, "Castle Marksman", KitAvailability.Free, new String[] { "Skilled human marksman, can fletch arrows." @@ -62,7 +62,6 @@ public class KitHumanMarksman extends Kit player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, 32)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanPeasant.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanPeasant.java index 226413f1f..14161d940 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanPeasant.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanPeasant.java @@ -61,6 +61,8 @@ public class KitHumanPeasant extends Kit @Override public void GiveItems(Player player) { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 0, "Wolf Bite")); + player.setHealth(4); DisguiseWolf disguise = new DisguiseWolf(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadGhoul.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadGhoul.java index ece66fe8b..9849e5906 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadGhoul.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadGhoul.java @@ -28,7 +28,7 @@ public class KitUndeadGhoul extends Kit new Perk[] { - new PerkLeap("Ghoul Attack", 1.2, 0.8, 8000), + new PerkLeap("Ghoul Leap", 1.2, 0.8, 8000), new PerkSpeed(0) }, EntityType.PIG_ZOMBIE, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadZombie.java index 85d69cc53..95d1cd22c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadZombie.java @@ -41,8 +41,13 @@ public class KitUndeadZombie extends Kit player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); DisguiseZombie disguise = new DisguiseZombie(player); - disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - disguise.SetCustomNameVisible(true); + + if (Manager.GetGame().GetTeam(player) != null) + { + disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.SetCustomNameVisible(true); + } + Manager.GetDisguise().disguise(disguise); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/Horse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/Horse.java index 91783244e..ee3c1e223 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/Horse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/Horse.java @@ -6,13 +6,13 @@ import org.bukkit.ChatColor; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; -import nautilus.game.arcade.game.AsymTeamGame; import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.horsecharge.kits.*; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; -public class Horse extends AsymTeamGame +public class Horse extends TeamGame { public Horse(ArcadeManager manager, HashMap pastTeams) { @@ -34,7 +34,7 @@ public class Horse extends AsymTeamGame "Undead win when all Horsemen are dead.", "", "Teams swap after game is over" - }, pastTeams); + }); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPowershot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPowershot.java new file mode 100644 index 000000000..60a503b7f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPowershot.java @@ -0,0 +1,183 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.Iterator; +import java.util.WeakHashMap; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkPowershot extends Perk +{ + private WeakHashMap _charge = new WeakHashMap(); + private WeakHashMap _chargeLast = new WeakHashMap(); + + private WeakHashMap _arrows = new WeakHashMap(); + + private int _max; + private long _tick; + + public PerkPowershot(int max, long tick) + { + super("Power Shot", new String[] + { + C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Power Shot", + "Arrows deal up to +15 damage" + }); + + _max = max; + _tick = tick; + } + + @EventHandler + public void DrawBow(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW) + return; + + if (!Kit.HasKit(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()); + } + + @EventHandler + public void ChargeBow(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : UtilServer.getPlayers()) + { + //Not Charging + if (!_charge.containsKey(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) + { + _charge.remove(cur); + _chargeLast.remove(cur); + continue; + } + + //Increase Charge + _charge.put(cur, _charge.get(cur) + 1); + _chargeLast.put(cur, System.currentTimeMillis()); + + //Effect + cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur))); + } + } + + @EventHandler + public void FireBow(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + if (!(event.getProjectile() instanceof Arrow)) + return; + + Player player = (Player)event.getEntity(); + + if (!_charge.containsKey(player)) + return; + + //Start + _arrows.put((Arrow)event.getProjectile(), _charge.remove(player)); + _chargeLast.put(player, System.currentTimeMillis()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void Damage(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + if (event.GetDamagerPlayer(true) == null) + return; + + if (!(event.GetProjectile() instanceof Arrow)) + return; + + Arrow arrow = (Arrow)event.GetProjectile(); + + if (!_arrows.containsKey(arrow)) + return; + + int charge = _arrows.remove(arrow); + + event.AddMod("Power Shot", "Power Shot", charge * 3, true); + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Iterator arrowIterator = _arrows.keySet().iterator(); arrowIterator.hasNext();) + { + Arrow arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid()) + arrowIterator.remove(); + } + } + + @EventHandler + public void Quit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + _charge.remove(player); + _chargeLast.remove(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlamCS.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlamCS.java index 2e3d520fe..1509152ce 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlamCS.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlamCS.java @@ -68,19 +68,19 @@ public class PerkSeismicSlamCS extends Perk HashMap targets = UtilEnt.getInRadius(player.getLocation(), range); for (LivingEntity cur : targets.keySet()) { + if (!(cur instanceof Player)) + return; + if (cur.equals(player)) continue; - - if (cur instanceof Player) - { - Player other = (Player)cur; - - if (!Manager.GetGame().IsAlive(other)) - continue; - - if (Manager.GetGame().GetTeam(other).equals(Manager.GetGame().GetTeam(player))) - continue; - } + + Player other = (Player)cur; + + if (!Manager.GetGame().IsAlive(other)) + continue; + + if (Manager.GetGame().GetTeam(other).equals(Manager.GetGame().GetTeam(player))) + continue; //Damage Event Manager.GetDamage().NewDamageEvent(cur, player, null, @@ -101,11 +101,11 @@ public class PerkSeismicSlamCS extends Perk } //Effect - player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f); - for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet()) - if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur)) - cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId()); - + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f); + for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet()) + if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur)) + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId()); + //Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java index b8342f692..e6ad4a479 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java @@ -11,9 +11,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; -import nautilus.game.arcade.game.AsymTeamGame; import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.Game.GameState; import org.bukkit.ChatColor; @@ -81,20 +79,6 @@ public class GameCreationManager implements Listener //Lobby Display Manager.GetLobby().DisplayLast(Manager.GetGame()); - //Prepare Round 2 - If Applicable - if (Manager.GetGame() instanceof AsymTeamGame) - { - if (((AsymTeamGame) Manager.GetGame()).GetPastTeams() == null) - { - _nextGame = Manager.GetGame().GetType(); - _nextGameTeams = new HashMap(); - - for (GameTeam team : Manager.GetGame().GetTeamList()) - for (Player player : team.GetPlayers(false)) - _nextGameTeams.put(player.getName(), team.GetColor()); - } - } - Manager.SetGame(null); } } 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 f7fcce713..98ffafda4 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 @@ -55,7 +55,6 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.AsymTeamGame; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.Game.GameState; @@ -826,13 +825,6 @@ public class GameLobbyManager implements IPacketRunnable, Listener DisplayWaiting(); - if (game instanceof AsymTeamGame) - { - if (pastTeams == null) WriteGameLine("Round 1 of 2", 2, 159, (byte)4); - else WriteGameLine("Round 2 of 2", 2, 159, (byte)4); - } - else WriteGameLine(" ", 2, 159, (byte)14); - CreateKits(game); CreateTeams(game); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 33a0b39e7..6ec9cf955 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -271,13 +271,6 @@ public class GameManager implements Listener return; event.GetGame().DeregisterKits(); - - for (Player player : UtilServer.getPlayers()) - { - Manager.Clear(player); - Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator"); - player.teleport(Manager.GetLobby().GetSpawn()); - } } @EventHandler(priority = EventPriority.LOWEST) //BEFORE PARSE DATA @@ -528,19 +521,35 @@ public class GameManager implements Listener } @EventHandler - public void PlayerClean(GameStateChangeEvent event) + public void PlayerTeleportOut(GameStateChangeEvent event) { if (event.GetState() != GameState.Dead) return; - - for (Player player : UtilServer.getPlayers()) + + final Player[] players = UtilServer.getPlayers(); + + //Prepare Players + for (int i=0 ; i