skywars update!
This commit is contained in:
parent
2d1d65b239
commit
0874178973
@ -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));
|
||||
|
@ -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<Location> _lootedBlocks = new HashSet<Location>();
|
||||
private TNTGenerator _tntGen;
|
||||
private boolean _alreadyAnnounced;
|
||||
private ArrayList<Creature> _mobs = new ArrayList<Creature>();
|
||||
|
||||
private NautHashMap<Zombie, Location> _zombies = new NautHashMap<Zombie, Location>();
|
||||
|
||||
private ArrayList<Block> _spawnChests = new ArrayList<Block>();
|
||||
private ArrayList<Block> _middleChests = new ArrayList<Block>();
|
||||
@ -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;
|
||||
@ -231,15 +241,14 @@ public class SkyWars extends SoloGame
|
||||
// Zombies
|
||||
for (Location loc : WorldData.GetDataLocs("RED"))
|
||||
{
|
||||
while (_mobs.size() < 15)
|
||||
{
|
||||
//Spawn
|
||||
CreatureAllowOverride = true;
|
||||
Zombie zombie = (Zombie) loc.getWorld()
|
||||
.spawn(loc, Zombie.class);
|
||||
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(
|
||||
@ -255,27 +264,8 @@ public class SkyWars extends SoloGame
|
||||
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<Zombie> 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));
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -16,9 +16,12 @@ 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(
|
||||
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
|
||||
}
|
||||
@ -26,8 +29,8 @@ public class KitZoo extends Kit
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
|
||||
|
||||
player.getInventory().addItem(new ItemStack(Material.WOOD_AXE));
|
||||
player.getInventory().addItem(new ItemStack(Material.WOOD_PICKAXE));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,6 +55,9 @@ public class PerkChicken extends Perk
|
||||
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;
|
||||
}
|
||||
|
@ -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<Block, Long> _blocks = new HashMap<Block, Long>();
|
||||
|
||||
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)
|
||||
@ -199,23 +204,6 @@ public class PerkDestructor extends Perk
|
||||
}
|
||||
}
|
||||
|
||||
@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)
|
||||
{
|
||||
_enabled = var;
|
||||
|
Loading…
Reference in New Issue
Block a user