diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitDestructor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitDestructor.java index eed51f7f8..d82da7a63 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitDestructor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitDestructor.java @@ -25,7 +25,7 @@ public class KitDestructor extends Kit new Perk[] { - new PerkDestructor(40, 2) + new PerkDestructor(40, 2, 400, false) }, EntityType.ZOMBIE, new ItemStack(Material.ENDER_PEARL)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SkyWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SkyWars.java index 39f93e8d1..4da5f6325 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SkyWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SkyWars.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.skywars; import java.util.ArrayList; import java.util.HashSet; +import java.util.Iterator; import mineplex.core.common.util.C; import mineplex.core.common.util.MapUtil; @@ -33,7 +34,8 @@ import nautilus.game.arcade.game.games.skywars.data.TNTGenerator; import nautilus.game.arcade.game.games.skywars.events.PlayerKillZombieEvent; import nautilus.game.arcade.game.games.skywars.events.TNTKillEvent; import nautilus.game.arcade.game.games.skywars.kits.KitChicken; -import nautilus.game.arcade.game.games.skywars.kits.KitLooter; +import nautilus.game.arcade.game.games.skywars.kits.KitDestructor; +import nautilus.game.arcade.game.games.skywars.kits.KitMiner; import nautilus.game.arcade.game.games.skywars.kits.KitZoo; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.ore.OreHider; @@ -74,6 +76,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.entity.EntityTargetLivingEntityEvent; import org.bukkit.event.entity.ItemDespawnEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; @@ -89,7 +92,8 @@ public class SkyWars extends SoloGame private HashSet _lootedBlocks = new HashSet(); private TNTGenerator _tntGen; private boolean _alreadyAnnounced; - private ArrayList _mobs = new ArrayList(); + + private NautHashMap _zombies = new NautHashMap(); private ArrayList _spawnChests = new ArrayList(); private ArrayList _middleChests = new ArrayList(); @@ -116,12 +120,18 @@ public class SkyWars extends SoloGame { super(manager, GameType.Skywars, new Kit[] { - new KitZoo(manager), new KitLooter(manager), - new KitChicken(manager) + new KitMiner(manager), + new KitMiner(manager), + new KitZoo(manager), + new KitChicken(manager), + new KitDestructor(manager), + }, new String[] { - "Free for all battle in the sky:", "Collect loot from chests", - "Mine up ores on your island", "Last player alive wins!" + "Free for all battle in the sky!", + "Collect loot from chests", + "Mine ores on your island", + "Last player alive wins!" }); PrepareFreeze = true; @@ -134,7 +144,7 @@ public class SkyWars extends SoloGame QuitDropItems = true; - WorldTimeSet = 0; + WorldTimeSet = 0; WorldBoundaryKill = false; SpawnDistanceRequirement = 48; @@ -231,51 +241,31 @@ public class SkyWars extends SoloGame // Zombies for (Location loc : WorldData.GetDataLocs("RED")) { - while (_mobs.size() < 15) - { - CreatureAllowOverride = true; - Zombie zombie = (Zombie) loc.getWorld() - .spawn(loc, Zombie.class); - zombie.setRemoveWhenFarAway(false); - zombie.setCustomName(C.cDRed + "Zombie Guardian"); - zombie.setCustomNameVisible(true); - zombie.setMaxHealth(20.0D); + //Spawn + CreatureAllowOverride = true; + Zombie zombie = (Zombie) loc.getWorld().spawn(loc, Zombie.class); + zombie.setRemoveWhenFarAway(false); + zombie.setCustomName(C.cDRed + "Zombie Guardian"); + zombie.setCustomNameVisible(true); + zombie.setMaxHealth(20.0D); + CreatureAllowOverride = false; + + // Armor - Make sure the player can't get it! + zombie.getEquipment().setHelmet( + new ItemStack(Material.GOLD_HELMET)); + zombie.getEquipment().setHelmetDropChance(0F); + zombie.getEquipment().setChestplate( + new ItemStack(Material.GOLD_CHESTPLATE)); + zombie.getEquipment().setChestplateDropChance(0F); + zombie.getEquipment().setLeggings( + new ItemStack(Material.GOLD_LEGGINGS)); + zombie.getEquipment().setLeggingsDropChance(0F); + zombie.getEquipment().setBoots( + new ItemStack(Material.GOLD_BOOTS)); + zombie.getEquipment().setBootsDropChance(0F); - // Armor - Make sure the player can't get it! - zombie.getEquipment().setHelmet( - new ItemStack(Material.GOLD_HELMET)); - zombie.getEquipment().setHelmetDropChance(0F); - zombie.getEquipment().setChestplate( - new ItemStack(Material.GOLD_CHESTPLATE)); - zombie.getEquipment().setChestplateDropChance(0F); - zombie.getEquipment().setLeggings( - new ItemStack(Material.GOLD_LEGGINGS)); - zombie.getEquipment().setLeggingsDropChance(0F); - zombie.getEquipment().setBoots( - new ItemStack(Material.GOLD_BOOTS)); - zombie.getEquipment().setBootsDropChance(0F); - // Buff? - int c = UtilMath.r(9); - - switch (c) - { - case 1: - - case 7: - - case 4: - - zombie.addPotionEffect(new PotionEffect( - PotionEffectType.SPEED, Integer.MAX_VALUE, 0)); - - default: - break; - } - - _mobs.add(zombie); - CreatureAllowOverride = false; - } + _zombies.put(zombie, loc); } } @@ -370,12 +360,6 @@ public class SkyWars extends SoloGame } } - @EventHandler - public void equipWeapons(PlayerKitGiveEvent event) - { - event.GetPlayer().getInventory().addItem(new ItemStack(Material.WOOD_AXE)); - event.GetPlayer().getInventory().addItem(new ItemStack(Material.WOOD_PICKAXE)); - } @EventHandler public void blockUpdate(UpdateEvent event) @@ -734,6 +718,50 @@ public class SkyWars extends SoloGame _tntGen.update(); } + @EventHandler + public void zombieUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator zombieIter = _zombies.keySet().iterator(); + + while (zombieIter.hasNext()) + { + Zombie zombie = zombieIter.next(); + + if (!zombie.isValid()) + { + zombieIter.remove(); + continue; + } + + Location loc = _zombies.get(zombie); + + if (zombie.getTarget() == null || UtilMath.offset(zombie.getLocation(), loc) > 8) + { + zombie.setTarget(null); + UtilEnt.CreatureMove(zombie, loc, 1f); + } + } + } + + @EventHandler + public void zombieTarget(EntityTargetLivingEntityEvent event) + { + if (event.getEntity() instanceof Zombie && _zombies.containsKey((Zombie)event.getEntity())) + { + Zombie zombie = (Zombie)event.getEntity(); + Location loc = _zombies.get(zombie); + + if (UtilMath.offset(event.getTarget().getLocation(), loc) > 8) + { + event.setCancelled(true); + zombie.setTarget(null); + } + } + } + @EventHandler public void noZombieBurn(EntityCombustEvent e) { @@ -785,12 +813,12 @@ public class SkyWars extends SoloGame if (e.getBlock().getType() == Material.WEB) { for (int i=0 ; i<1 + UtilMath.r(2) ; i++) - e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation().add(0.5, 0.5, 0.5), new ItemStack(Material.STRING)); + e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation().add(0.5, 0, 0.5), new ItemStack(Material.STRING)); } if (e.getBlock().getType() == Material.GRAVEL) { - e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation().add(0.5, 0.5, 0.5), new ItemStack(Material.FLINT)); + e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation().add(0.5, 0, 0.5), new ItemStack(Material.FLINT)); } if (e.getBlock().getType() == Material.IRON_ORE) @@ -798,7 +826,7 @@ public class SkyWars extends SoloGame e.setCancelled(true); e.getBlock().setType(Material.AIR); - e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation().add(0.5, 0.5, 0.5), new ItemStack(Material.IRON_INGOT)); + e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation().add(0.5, 0, 0.5), new ItemStack(Material.IRON_INGOT)); } } @@ -842,21 +870,18 @@ public class SkyWars extends SoloGame @EventHandler public void onKillZombie(EntityDeathEvent e) { - if (e.getEntity() instanceof Zombie) { Zombie ent = (Zombie) e.getEntity(); - if (_mobs.contains(ent)) + if (_zombies.containsKey(ent)) { - if (ent.getKiller() instanceof Player) { Player p = ent.getKiller(); Bukkit.getPluginManager().callEvent( new PlayerKillZombieEvent(p, ent)); - } } } @@ -891,7 +916,7 @@ public class SkyWars extends SoloGame event.getDrops().clear(); //Zombie Loot - if (_mobs.contains(event.getEntity())) + if (event.getEntity() instanceof Zombie && _zombies.containsKey((Zombie)event.getEntity())) { double r = Math.random(); @@ -1108,6 +1133,7 @@ public class SkyWars extends SoloGame //Projectile _middleTool.addLoot(new RandomItem(Material.BOW, 1)); _middleProjectile.addLoot(new RandomItem(Material.ARROW, 2, 4, 12)); + _middleProjectile.addLoot(new RandomItem(Material.ENDER_PEARL, 1, 1, 2)); //Block _middleBlock.addLoot(new RandomItem(Material.BRICK, 30, 8, 16)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitChicken.java index 9df2bcd88..b01cf62ae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitChicken.java @@ -32,10 +32,11 @@ public class KitChicken extends Kit } @Override - public void GiveItems(Player player){ - + public void GiveItems(Player player) + { p.spawnChicken(player, player.getLocation()); - + + player.getInventory().addItem(new ItemStack(Material.WOOD_AXE)); + player.getInventory().addItem(new ItemStack(Material.WOOD_PICKAXE)); } - } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitDestructor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitDestructor.java new file mode 100644 index 000000000..c8bc39200 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitDestructor.java @@ -0,0 +1,51 @@ +package nautilus.game.arcade.game.games.skywars.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.achievement.Achievement; +import 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.*; + +public class KitDestructor extends Kit +{ + public KitDestructor(ArcadeManager manager) + { + super(manager, "Destructor", KitAvailability.Achievement, + + new String[] + { + "Your Ender Pearls make the world crumble!" + }, + + new Perk[] + { + new PerkDestructor(40, 2, 2500, true) + }, + EntityType.ZOMBIE, + new ItemStack(Material.ENDER_PEARL)); + + this.setAchievementRequirements(new Achievement[] + { + Achievement.SKYWARS_BOMBER, + Achievement.SKYWARS_NOARMOR, + Achievement.SKYWARS_NOCHEST, + Achievement.SKYWARS_PLAYER_KILLS, + Achievement.SKYWARS_TNT, + Achievement.SKYWARS_WINS, + Achievement.SKYWARS_ZOMBIE_KILLS + }); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(new ItemStack(Material.WOOD_AXE)); + player.getInventory().addItem(new ItemStack(Material.WOOD_PICKAXE)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitLooter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitLooter.java deleted file mode 100644 index e806e8c24..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitLooter.java +++ /dev/null @@ -1,37 +0,0 @@ -package nautilus.game.arcade.game.games.skywars.kits; - -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkLooter; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -public class KitLooter extends Kit -{ - - public KitLooter(ArcadeManager manager) - { - super(manager, "Bandit", KitAvailability.Gem, 5000, - new String[] - { - "hehehe...","ALL MINE!" - }, - new Perk[] {new PerkLooter()}, - EntityType.ZOMBIE, - new ItemStack(Material.GOLD_INGOT)); - // TODO Auto-generated constructor stub - } - - @Override - public void GiveItems(Player player) - { - // TODO Auto-generated method stub - - } - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitMiner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitMiner.java new file mode 100644 index 000000000..bb055425c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitMiner.java @@ -0,0 +1,40 @@ +package nautilus.game.arcade.game.games.skywars.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +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.*; + +public class KitMiner extends Kit +{ + public KitMiner(ArcadeManager manager) + { + super(manager, "Miner", KitAvailability.Gem, 5000, + + new String[] + { + "Start with better tools!" + }, + + new Perk[] + { + new PerkDigger(), + }, + EntityType.ZOMBIE, + new ItemStack(Material.STONE_PICKAXE)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(new ItemStack(Material.STONE_AXE)); + player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitZoo.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitZoo.java index 7c55f7b28..9c8aadc56 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitZoo.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitZoo.java @@ -16,18 +16,21 @@ public class KitZoo extends Kit public KitZoo(ArcadeManager manager) { - super(manager, "Mad Scientist", KitAvailability.Achievement, 0, new String[] - { "EUREKA!" }, new Perk[] - { new PerkZoologist(manager) }, EntityType.ZOMBIE, new ItemStack( - Material.MONSTER_EGG)); + super(manager, "Mad Scientist", + KitAvailability.Gem, + new String[]{ "EUREKA! Zombie Eggs!" }, + new Perk[] + { + new PerkZoologist(manager) }, EntityType.ZOMBIE, new ItemStack( + Material.MONSTER_EGG)); // TODO Auto-generated constructor stub } @Override public void GiveItems(Player player) { - - + player.getInventory().addItem(new ItemStack(Material.WOOD_AXE)); + player.getInventory().addItem(new ItemStack(Material.WOOD_PICKAXE)); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java index ab0e96bc9..77d9f5acf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java @@ -54,6 +54,9 @@ public class PerkChicken extends Perk c.setRemoveWhenFarAway(false); c.setMaxHealth(35.0D); c.setAdult(); + + c.setCustomName(player.getName() + "'s Chicken"); + c.setCustomNameVisible(true); _activeKitHolders.put(player.getName(), c); _failedAttempts.put(player.getName(), 0); @@ -137,7 +140,7 @@ public class PerkChicken extends Perk @EventHandler public void dropEggs(UpdateEvent e) { - if (e.getType() != UpdateType.SLOWER) + if (e.getType() != UpdateType.SLOW) { return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDestructor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDestructor.java index f56226073..9c547a856 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDestructor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDestructor.java @@ -24,24 +24,29 @@ import java.util.*; public class PerkDestructor extends Perk { - private boolean _enabled = false; + private boolean _enabled; private int _spawnRate; private int _max; + + private long _fallTime; private HashMap _blocks = new HashMap(); - public PerkDestructor(int spawnRate, int max) + public PerkDestructor(int spawnRate, int max, long fallTime, boolean enabled) { super("Seismic Charge", new String[] { C.cGray + "Receive 1 Seismic Charge every " + spawnRate + " seconds. Maximum of " + max + ".", C.cYellow + "Right-Click" + C.cGray + " with Seismic Charge to " + C.cGreen + "Throw Seismic Charge", - C.cGray + "You will not receive them until bridges drop", + enabled ? "" : C.cGray + "You will not receive them until bridges drop", }); _spawnRate = spawnRate; _max = max; + _fallTime = fallTime; + + _enabled = enabled; } public void Apply(Player player) @@ -172,7 +177,7 @@ public class PerkDestructor extends Perk for (Block block : _blocks.keySet()) { - if (!UtilTime.elapsed(_blocks.get(block), 400)) + if (!UtilTime.elapsed(_blocks.get(block), _fallTime)) continue; if (lowest == null || block.getY() < lowestY) @@ -198,23 +203,6 @@ public class PerkDestructor extends Perk _blocks.remove(lowest); } } - - @EventHandler - public void PaintballDamage(CustomDamageEvent event) - { - if (Manager.GetGame() == null || !Manager.GetGame().IsLive()) - return; - - if (event.GetProjectile() == null) - return; - - if (!(event.GetProjectile() instanceof EnderPearl)) - return; - - event.AddMod(GetName(), GetName(), 4, true); - - event.AddKnockback(GetName(), 2.5); - } public void setEnabled(boolean var) {