Merge branch 'master' of ssh://dev1.mineplex.com:7999/min/master

This commit is contained in:
Jonathan Williams 2013-10-04 23:57:58 -07:00
commit f389378bd2
28 changed files with 1950 additions and 67 deletions

View File

@ -14,6 +14,7 @@ public enum Rank
MODERATOR("Mod", ChatColor.GOLD), MODERATOR("Mod", ChatColor.GOLD),
HELPER("Helper", ChatColor.YELLOW), HELPER("Helper", ChatColor.YELLOW),
MAPDEV("Mapper", ChatColor.LIGHT_PURPLE), MAPDEV("Mapper", ChatColor.LIGHT_PURPLE),
YOUTUBE("Hero", ChatColor.LIGHT_PURPLE),
ULTRA("Ultra", ChatColor.AQUA), ULTRA("Ultra", ChatColor.AQUA),
ALL("All", ChatColor.GREEN); ALL("All", ChatColor.GREEN);

View File

@ -154,7 +154,7 @@ public class Explosion extends MiniPlugin
{ {
//XXX ANTILAG //XXX ANTILAG
double chance = 0.2 + (double)_explosionBlocks.size()/(double)120; 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()); FallingBlock fall = cur.getWorld().spawnFallingBlock(cur.getLocation().add(0.5, 0.5, 0.5), blocks.get(cur).getKey(), blocks.get(cur).getValue());

View File

@ -344,7 +344,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
{ {
if (_game != null && _game.GetType() == GameType.UHC) if (_game != null && _game.GetType() == GameType.UHC)
{ {
event.setMotd(ChatColor.RED + "UHC - Season 2"); event.setMotd(ChatColor.RED + "UHC - Season 3");
return; return;
} }

View File

@ -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.snowfight.SnowFight;
import nautilus.game.arcade.game.games.spleef.Spleef; import nautilus.game.arcade.game.games.spleef.Spleef;
import nautilus.game.arcade.game.games.squidshooter.SquidShooter; 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.turfforts.TurfForts;
import nautilus.game.arcade.game.games.uhc.UHC; import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival; 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.HungerGames) return new HungerGames(_manager);
else if (gameType == GameType.MineWare) return new MineWare(_manager); else if (gameType == GameType.MineWare) return new MineWare(_manager);
else if (gameType == GameType.MilkCow) return new MilkCow(_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.Quiver) return new Quiver(_manager);
else if (gameType == GameType.Runner) return new Runner(_manager); else if (gameType == GameType.Runner) return new Runner(_manager);
else if (gameType == GameType.SnowFight) return new SnowFight(_manager); else if (gameType == GameType.SnowFight) return new SnowFight(_manager);

View File

@ -15,6 +15,7 @@ public enum GameType
HungerGames("Hunger Games"), HungerGames("Hunger Games"),
MineWare("MineWare"), MineWare("MineWare"),
MilkCow("Milk the Cow"), MilkCow("Milk the Cow"),
Paintball("Super Paintball"),
Quiver("One in the Quiver"), Quiver("One in the Quiver"),
Runner("Runner"), Runner("Runner"),
Smash("Super Smash Mobs"), Smash("Super Smash Mobs"),

View File

@ -49,6 +49,8 @@ public class DragonEscape extends SoloGame
private Player _winner = null; private Player _winner = null;
private double _speedMult = 1;
public DragonEscape(ArcadeManager manager) public DragonEscape(ArcadeManager manager)
{ {
super(manager, GameType.DragonEscape, super(manager, GameType.DragonEscape,
@ -112,6 +114,9 @@ public class DragonEscape extends SoloGame
last = best; last = best;
} }
if (!WorldData.GetDataLocs("GREEN").isEmpty())
_speedMult = WorldData.GetDataLocs("GREEN").get(0).getX()/100d;
if (WorldData.MapName.contains("Hell")) if (WorldData.MapName.contains("Hell"))
this.WorldTimeSet = 16000; this.WorldTimeSet = 16000;
} }
@ -380,6 +385,11 @@ public class DragonEscape extends SoloGame
} }
} }
public double GetSpeedMult()
{
return _speedMult;
}
@EventHandler @EventHandler
public void Warp(PlayerInteractEvent event) public void Warp(PlayerInteractEvent event)
{ {

View File

@ -39,11 +39,12 @@ public class DragonEscapeData
Turn(); Turn();
//Speed //Speed
double speed = 0.16; double speed = 0.2;
speed += (System.currentTimeMillis() - Host.GetStateTime())/1000d * 0.001; speed += (System.currentTimeMillis() - Host.GetStateTime())/1000d * 0.001;
//Speed Distance Boost //Speed Distance Boost
/*
if (!Host.GetScores().isEmpty()) if (!Host.GetScores().isEmpty())
{ {
double score = Host.GetScore(Dragon); double score = Host.GetScore(Dragon);
@ -53,6 +54,9 @@ public class DragonEscapeData
speed += lead * 0.0025; speed += lead * 0.0025;
} }
*/
speed = speed * Host.GetSpeedMult();
Location.add(Velocity.clone().multiply(speed)); Location.add(Velocity.clone().multiply(speed));
Location.add(0, -Pitch, 0); Location.add(0, -Pitch, 0);

View File

@ -6,7 +6,6 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.bukkit.Chunk;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; 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.UtilMath;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -64,13 +62,15 @@ public class HungerGames extends SoloGame
{ {
new KitHunter(manager), new KitHunter(manager),
new KitLooter(manager), new KitLooter(manager),
new KitBrawler(manager),
new KitKnight(manager), new KitKnight(manager),
new KitArcher(manager), new KitArcher(manager),
new KitAssassin(manager), new KitAssassin(manager),
new KitBrawler(manager),
new KitBeastmaster(manager),
new KitBomber(manager), new KitBomber(manager),
new KitNecromancer(manager)
}, },
new String[] new String[]
@ -85,11 +85,17 @@ public class HungerGames extends SoloGame
this.DamageSelf = true; this.DamageSelf = true;
this.DamageTeamSelf = true; this.DamageTeamSelf = true;
this.DeathOut = false; //XXX
this.DeathDropItems = true;
this.ItemDrop = true;
this.ItemPickup = true;
this.CompassEnabled = true; this.CompassEnabled = true;
this.GemMultiplier = 2; this.GemMultiplier = 2;
_spreadType = UtilMath.r(3); _spreadType = 1;//UtilMath.r(3);
System.out.println("==================="); System.out.println("===================");
System.out.println("SPREAD TYPE: " + _spreadType); System.out.println("SPREAD TYPE: " + _spreadType);
System.out.println("==================="); System.out.println("===================");
@ -371,7 +377,7 @@ public class HungerGames extends SoloGame
if (_redLocations.isEmpty()) if (_redLocations.isEmpty())
return; 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<max ; i++) for (int i=0 ; i<max ; i++)
{ {

View File

@ -0,0 +1,39 @@
package nautilus.game.arcade.game.games.hungergames.kit;
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 KitBeastmaster extends Kit
{
public KitBeastmaster(ArcadeManager manager)
{
super(manager, "Beastmaster", KitAvailability.Blue,
new String[]
{
"Your wolves growl when someone is nearby!"
},
new Perk[]
{
new PerkWolfPet(30, 1, false, true)
},
EntityType.ZOMBIE,
new ItemStack(Material.BONE));
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -15,7 +15,7 @@ public class KitBrawler extends Kit
{ {
public KitBrawler(ArcadeManager manager) public KitBrawler(ArcadeManager manager)
{ {
super(manager, "Brawler", KitAvailability.Free, super(manager, "Brawler", KitAvailability.Green,
new String[] new String[]
{ {

View File

@ -0,0 +1,39 @@
package nautilus.game.arcade.game.games.hungergames.kit;
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 KitNecromancer extends Kit
{
public KitNecromancer(ArcadeManager manager)
{
super(manager, "Necromancer", KitAvailability.Blue,
new String[]
{
"Cool undead guy and stuff"
},
new Perk[]
{
new PerkSkeletons(true)
},
EntityType.ZOMBIE,
new ItemStack(Material.SKULL));
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,82 @@
package nautilus.game.arcade.game.games.paintball;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.EnderPearl;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import mineplex.core.common.util.UtilBlock;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.paintball.kits.*;
import nautilus.game.arcade.kit.Kit;
public class Paintball extends TeamGame
{
public Paintball(ArcadeManager manager)
{
super(manager, GameType.Paintball,
new Kit[]
{
new KitRifle(manager),
new KitMachineGun(manager),
new KitShotgun(manager)
},
new String[]
{
"put put put put put"
});
}
@EventHandler
public void CustomTeamGeneration(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Recruit)
return;
this.GetTeamList().get(0).SetColor(ChatColor.AQUA);
this.GetTeamList().get(0).SetName("Frost");
this.GetTeamList().get(1).SetColor(ChatColor.RED);
this.GetTeamList().get(1).SetName("Nether");
}
@EventHandler
public void Teleport(PlayerTeleportEvent event)
{
if (event.getCause() == TeleportCause.ENDER_PEARL)
event.setCancelled(true);
}
@EventHandler
public void Paint(ProjectileHitEvent event)
{
byte color = 3;
if (event.getEntity() instanceof EnderPearl)
color = 6;
Location loc = event.getEntity().getLocation().add(event.getEntity().getVelocity());
for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet())
{
if (block.getType() != Material.WOOL && block.getType() != Material.STAINED_CLAY)
continue;
block.setData(color);
}
if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8);
else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10);
}
}

View File

@ -0,0 +1,66 @@
package nautilus.game.arcade.game.games.paintball.kits;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory;
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 KitMachineGun extends Kit
{
public KitMachineGun(ArcadeManager manager)
{
super(manager, "Machine Gun", KitAvailability.Free,
new String[]
{
"Full-automatic paintball gun. " + F.elem("6 Damage")
},
new Perk[]
{
new PerkPaintballMachineGun()
},
EntityType.ZOMBIE,
new ItemStack(Material.DIAMOND_BARDING));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BARDING));
ItemStack helm = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta();
metaHelm.setColor(Color.WHITE);
helm.setItemMeta(metaHelm);
player.getInventory().setHelmet(helm);
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(Color.WHITE);
armor.setItemMeta(meta);
player.getInventory().setChestplate(armor);
ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS);
LeatherArmorMeta metaLegs = (LeatherArmorMeta)armor.getItemMeta();
metaLegs.setColor(Color.WHITE);
legs.setItemMeta(metaLegs);
player.getInventory().setLeggings(legs);
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
LeatherArmorMeta metaBoots = (LeatherArmorMeta)armor.getItemMeta();
metaBoots.setColor(Color.WHITE);
boots.setItemMeta(metaBoots);
player.getInventory().setBoots(boots);
}
}

View File

@ -0,0 +1,66 @@
package nautilus.game.arcade.game.games.paintball.kits;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory;
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 KitRifle extends Kit
{
public KitRifle(ArcadeManager manager)
{
super(manager, "Rifle", KitAvailability.Free,
new String[]
{
"Semi-automatic paintball rifle. " + F.elem("12 Damage")
},
new Perk[]
{
new PerkPaintballRifle()
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_BARDING));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_BARDING));
ItemStack helm = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta();
metaHelm.setColor(Color.WHITE);
helm.setItemMeta(metaHelm);
player.getInventory().setHelmet(helm);
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(Color.WHITE);
armor.setItemMeta(meta);
player.getInventory().setChestplate(armor);
ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS);
LeatherArmorMeta metaLegs = (LeatherArmorMeta)armor.getItemMeta();
metaLegs.setColor(Color.WHITE);
legs.setItemMeta(metaLegs);
player.getInventory().setLeggings(legs);
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
LeatherArmorMeta metaBoots = (LeatherArmorMeta)armor.getItemMeta();
metaBoots.setColor(Color.WHITE);
boots.setItemMeta(metaBoots);
player.getInventory().setBoots(boots);
}
}

View File

@ -0,0 +1,67 @@
package nautilus.game.arcade.game.games.paintball.kits;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory;
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 KitShotgun extends Kit
{
public KitShotgun(ArcadeManager manager)
{
super(manager, "Shotgun", KitAvailability.Free,
new String[]
{
"Pump action paintball shotgun. " + F.elem("6 Damage per Pellet")
},
new Perk[]
{
new PerkPaintballShotgun(),
new PerkSpeed(0)
},
EntityType.ZOMBIE,
new ItemStack(Material.GOLD_BARDING));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_BARDING));
ItemStack helm = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta();
metaHelm.setColor(Color.WHITE);
helm.setItemMeta(metaHelm);
player.getInventory().setHelmet(helm);
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(Color.WHITE);
armor.setItemMeta(meta);
player.getInventory().setChestplate(armor);
ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS);
LeatherArmorMeta metaLegs = (LeatherArmorMeta)armor.getItemMeta();
metaLegs.setColor(Color.WHITE);
legs.setItemMeta(metaLegs);
player.getInventory().setLeggings(legs);
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
LeatherArmorMeta metaBoots = (LeatherArmorMeta)armor.getItemMeta();
metaBoots.setColor(Color.WHITE);
boots.setItemMeta(metaBoots);
player.getInventory().setBoots(boots);
}
}

View File

@ -62,6 +62,7 @@ public class SuperSmash extends SoloGame
new KitSkySquid(manager), new KitSkySquid(manager),
new KitWitherSkeleton(manager), new KitWitherSkeleton(manager),
//new KitWither(manager), //new KitWither(manager),
new KitWolf(manager),
}, },
@ -82,6 +83,8 @@ public class SuperSmash extends SoloGame
this.SpawnDistanceRequirement = 16; this.SpawnDistanceRequirement = 16;
this.InventoryOpen = false; this.InventoryOpen = false;
this.HungerSet = 20;
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
@ -348,7 +351,7 @@ public class SuperSmash extends SoloGame
UtilPlayer.message(player, F.main("Game", "Attack other players to restore hunger!")); UtilPlayer.message(player, F.main("Game", "Attack other players to restore hunger!"));
} }
hungerTick = (hungerTick + 1)%6; hungerTick = (hungerTick + 1)%8;
if (hungerTick == 0) if (hungerTick == 0)
UtilPlayer.hunger(player, -1); UtilPlayer.hunger(player, -1);
@ -361,11 +364,12 @@ public class SuperSmash extends SoloGame
if (event.IsCancelled()) if (event.IsCancelled())
return; return;
if (event.GetDamagerPlayer(true) != null) if (event.GetDamagerPlayer(true) != null)
return; return;
Player damager = event.GetDamagerPlayer(true); Player damager = event.GetDamagerPlayer(true);
if (damager == null)
return;
if (!Recharge.Instance.use(damager, "Hunger Restore", 250, false)) if (!Recharge.Instance.use(damager, "Hunger Restore", 250, false))
return; return;

View File

@ -34,12 +34,12 @@ public class KitSkeleton extends SmashKit
new Perk[] new Perk[]
{ {
new PerkSmashStats(5, 1.25, 0.25, 6), new PerkSmashStats(5, 1.25, 0.20, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkFletcher(1, 2, false), new PerkFletcher(1, 2, false),
new PerkKnockbackArrow(2), new PerkKnockbackArrow(2),
new PerkBoneExplosion(), new PerkBoneExplosion(),
new PerkRopedArrow("Roped Arrow", 1, 3000), new PerkRopedArrow("Roped Arrow", 1, 5000),
new PerkBarrage(5, 250, true), new PerkBarrage(5, 250, true),
}, },
EntityType.SKELETON, EntityType.SKELETON,

View File

@ -0,0 +1,65 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguisePig;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
import nautilus.game.arcade.kit.perks.PerkWolfPack;
import nautilus.game.arcade.kit.perks.PerkWolfPet;
public class KitWolf extends SmashKit
{
public KitWolf(ArcadeManager manager)
{
super(manager, "Wolf Pack", KitAvailability.Blue,
new String[]
{
},
new Perk[]
{
new PerkSmashStats(7, 1.6, 0.3, 3),
new PerkWolfPack(15, 3, true, false)
},
EntityType.WOLF,
new ItemStack(Material.BONE));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Cub Strike",
new String[]
{
ChatColor.RESET + "",
}));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Pack Leap",
new String[]
{
ChatColor.RESET + "",
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
//Disguise
DisguisePig disguise = new DisguisePig(player);
disguise.SetName(C.cYellow + player.getName());
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
}

View File

@ -86,11 +86,13 @@ public class UHC extends TeamGame
private NautHashMap<String, Long> _rejoinTime = new NautHashMap<String, Long>(); private NautHashMap<String, Long> _rejoinTime = new NautHashMap<String, Long>();
private NautHashMap<Player, Long> _combatTime = new NautHashMap<Player, Long>(); private NautHashMap<String, Long> _combatTime = new NautHashMap<String, Long>();
private int _gameMinutes = 0; private int _gameMinutes = 0;
private long _lastMinute = System.currentTimeMillis(); private long _lastMinute = System.currentTimeMillis();
private boolean _soloGame = false;
public UHC(ArcadeManager manager) public UHC(ArcadeManager manager)
{ {
super(manager, GameType.UHC, super(manager, GameType.UHC,
@ -104,9 +106,11 @@ public class UHC extends TeamGame
"20 minutes of no PvP", "20 minutes of no PvP",
"Borders at -1000 and 1000", "Borders at -1000 and 1000",
"No default health regeneration", "No default health regeneration",
"Last team alive wins!" "Last player/team alive wins!"
}); });
this.DamageTeamSelf = true;
this.DeathDropItems = true; this.DeathDropItems = true;
this.ItemDrop = true; this.ItemDrop = true;
@ -268,17 +272,17 @@ public class UHC extends TeamGame
//Allowed //Allowed
if ( if (
event.getTo().getX() <= 999.5 && event.getTo().getX() < WorldData.MaxX &&
event.getTo().getX() >= -999.5 && event.getTo().getX() >= WorldData.MinX &&
event.getTo().getZ() <= 999.5 && event.getTo().getZ() < WorldData.MaxZ &&
event.getTo().getZ() >= -999.5) event.getTo().getZ() >= WorldData.MinZ)
return; return;
Location from = event.getFrom(); Location from = event.getFrom();
if (from.getX() > 999.5) from.setX(999.5); if (from.getX() >= WorldData.MaxX) from.setX(WorldData.MaxX - 1);
if (from.getX() < -999.5) from.setX(-999.5); if (from.getX() < WorldData.MinX) from.setX(WorldData.MinX + 1);
if (from.getZ() > 999.5) from.setZ(999.5); if (from.getZ() >= WorldData.MaxZ) from.setZ(WorldData.MaxZ - 1);
if (from.getZ() < -999.5) from.setZ(-999.5); if (from.getZ() < WorldData.MaxZ) from.setZ(WorldData.MinZ + 1);
event.setTo(event.getFrom()); event.setTo(event.getFrom());
@ -291,21 +295,43 @@ public class UHC extends TeamGame
if (event.GetState() != GameState.Recruit) if (event.GetState() != GameState.Recruit)
return; return;
this.WorldData.MinX = -1050; if (_soloGame)
this.WorldData.MaxX = 1050;
this.WorldData.MinZ = -1050;
this.WorldData.MaxZ = 1050;
for (int x=-63 ; x<=62 ; x++)
{ {
WorldBoundaryRed(WorldData.World.getChunkAt(x, 62)); this.WorldData.MinX = -1250;
WorldBoundaryRed(WorldData.World.getChunkAt(x, -63)); 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));
}
} }
else
for (int z=-63 ; z<=62 ; z++)
{ {
WorldBoundaryRed(WorldData.World.getChunkAt(62, z)); this.WorldData.MinX = -1000;
WorldBoundaryRed(WorldData.World.getChunkAt(-63, z)); 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); block = chunk.getBlock(x, y, z);
if ( if (
block.getX() <= 999 && block.getX() < WorldData.MaxX &&
block.getX() >= -1000 && block.getX() >= WorldData.MinX &&
block.getZ() <= 999 && block.getZ() < WorldData.MaxZ &&
block.getZ() >= -1000) block.getZ() >= WorldData.MinZ)
continue; continue;
if (block.getTypeId() != 0 || block.getY() <= 128) if (block.getTypeId() != 0 || block.getY() <= 128)
@ -336,10 +362,10 @@ public class UHC extends TeamGame
Block block = event.getBlock(); Block block = event.getBlock();
if ( if (
block.getX() < 1000 && block.getX() < WorldData.MaxX &&
block.getX() > -1000 && block.getX() >= WorldData.MinX &&
block.getZ() < 1000 && block.getZ() < WorldData.MaxZ &&
block.getZ() > -1000) block.getZ() >= WorldData.MinZ)
return; return;
event.setCancelled(true); event.setCancelled(true);
@ -351,6 +377,23 @@ public class UHC extends TeamGame
if (event.GetState() != GameState.Recruit) if (event.GetState() != GameState.Recruit)
return; 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()) for (GameTeam team : GetTeamList())
{ {
if (team.GetColor() == ChatColor.RED) team.SetName("Red"); if (team.GetColor() == ChatColor.RED) team.SetName("Red");
@ -379,6 +422,10 @@ public class UHC extends TeamGame
{ {
Location loc = GetRandomSpawn(null); Location loc = GetRandomSpawn(null);
double dist = 250;
if (_soloGame)
dist = 200;
//Ensure 250 Blocks between Teams //Ensure 250 Blocks between Teams
while (true) while (true)
{ {
@ -389,7 +436,7 @@ public class UHC extends TeamGame
if (otherTeam.GetSpawns().isEmpty()) if (otherTeam.GetSpawns().isEmpty())
continue; continue;
if (UtilMath.offset(loc, otherTeam.GetSpawn()) < 250) if (UtilMath.offset(loc, otherTeam.GetSpawn()) < dist)
{ {
clash = true; clash = true;
break; break;
@ -561,7 +608,7 @@ public class UHC extends TeamGame
if (player.isDead()) if (player.isDead())
return; return;
if (_combatTime.containsKey(player) && !UtilTime.elapsed(_combatTime.get(player), 15000)) if (_combatTime.containsKey(player.getName()) && !UtilTime.elapsed(_combatTime.get(player.getName()), 15000))
{ {
//Announcement //Announcement
Announce(team.GetColor() + C.Bold + player.getName() + " was killed for disconnecting during combat."); Announce(team.GetColor() + C.Bold + player.getName() + " was killed for disconnecting during combat.");
@ -618,7 +665,7 @@ public class UHC extends TeamGame
//Damager Alive //Damager Alive
else else
{ {
_combatTime.put(damager, System.currentTimeMillis()); _combatTime.put(damager.getName(), System.currentTimeMillis());
} }
} }
} }
@ -643,7 +690,7 @@ public class UHC extends TeamGame
//Damagee Alive //Damagee Alive
else if (damagerEnt != null && damagerEnt instanceof Player) 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()); 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()); (new PotionEffect(PotionEffectType.REGENERATION, 200, 1)).apply(event.getPlayer());
} }
@ -1092,6 +1139,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 @EventHandler
public void TabHealth(UpdateEvent event) public void TabHealth(UpdateEvent event)
{ {
@ -1135,6 +1200,8 @@ public class UHC extends TeamGame
health += UtilMath.trim(1, hp/2d); health += UtilMath.trim(1, hp/2d);
String name = team.GetColor() + player.getName(); String name = team.GetColor() + player.getName();
if (_soloGame)
name = player.getName();
try try
{ {
@ -1185,6 +1252,9 @@ public class UHC extends TeamGame
@Override @Override
public boolean CanJoinTeam(GameTeam team) public boolean CanJoinTeam(GameTeam team)
{ {
if (_soloGame)
return (team.GetPlayers(true).isEmpty());
return (team.GetPlayers(true).size() < 3); return (team.GetPlayers(true).size() < 3);
} }
@ -1233,7 +1303,11 @@ public class UHC extends TeamGame
{ {
WinnerTeam = team; WinnerTeam = team;
Winner = team.GetName() + " 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 else
{ {

View File

@ -31,9 +31,9 @@ public class PerkLeapTackleHG extends Perk
public PerkLeapTackleHG(int damage) 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; _damage = damage;
@ -88,7 +88,7 @@ public class PerkLeapTackleHG extends Perk
if (!other.equals(player)) if (!other.equals(player))
if (UtilMath.offset(player, other) < 2) if (UtilMath.offset(player, other) < 2)
{ {
DoSlam(player, other); Hit(player, other);
_live.remove(player); _live.remove(player);
return; 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 //Damage Event
Manager.GetDamage().NewDamageEvent(damagee, damager, null, Manager.GetDamage().NewDamageEvent(damagee, damager, null,
DamageCause.CUSTOM, _damage, false, true, false, DamageCause.CUSTOM, _damage, false, true, false,
damager.getName(), GetName()); damager.getName(), GetName());
//Slow //Slow
Manager.GetCondition().Factory().Slow(GetName(), damagee, damager, 6, 3, false, false, true, false); Manager.GetCondition().Factory().Slow(GetName(), damagee, damager, 1, 3, false, false, true, false);
Manager.GetCondition().Factory().Slow(GetName(), damager, damagee, 6, 1, false, false, true, false); Manager.GetCondition().Factory().Slow(GetName(), damager, damagee, 1, 3, false, false, true, false);
//Inform //Inform
UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + "."));

View File

@ -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<Projectile> _balls = new HashSet<Projectile>();
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);
}
}

View File

@ -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<Projectile> _balls = new HashSet<Projectile>();
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);
}
}

View File

@ -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<Projectile> _balls = new HashSet<Projectile>();
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);
}
}

View File

@ -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<Player, ArrayList<Skeleton>> _minions = new HashMap<Player, ArrayList<Skeleton>>();
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<Skeleton>());
_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<Skeleton> 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<Skeleton> skels : _minions.values())
{
for (Skeleton skel : skels)
{
if (skel.getHealth() > 0)
skel.setHealth(Math.min(skel.getMaxHealth(), skel.getHealth()+1));
}
}
}
}

View File

@ -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<Player, ArrayList<Wolf>> _wolfMap = new HashMap<Player, ArrayList<Wolf>>();
private HashMap<Wolf, Long> _strike = new HashMap<Wolf, Long>();
private HashMap<Player, Long> _tackle = new HashMap<Player, Long>();
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<Wolf>());
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<Wolf> 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<Wolf> 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<Wolf> 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<Player> 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);
}
}
}

View File

@ -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<Player, ArrayList<Wolf>> _wolfMap = new HashMap<Player, ArrayList<Wolf>>();
private HashMap<Wolf, Long> _tackle = new HashMap<Wolf, Long>();
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<Wolf>());
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<Wolf> 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<Wolf> 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<Wolf> wolves : _wolfMap.values())
{
for (Wolf wolf : wolves)
{
if (wolf.getHealth() > 0)
wolf.setHealth(Math.min(wolf.getMaxHealth(), wolf.getHealth()+1));
}
}
}
}

View File

@ -305,6 +305,21 @@ public class GameLobbyManager implements IPacketRunnable, Listener
//Text //Text
WriteTeamLine("Ultra", 0, 159, (byte)15); WriteTeamLine("Ultra", 0, 159, (byte)15);
WriteTeamLine("Kits", 1, 159, (byte)4); 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; return;
} }

View File

@ -46,9 +46,10 @@ public class MiscManager implements Listener
{ {
event.setCancelled(true); event.setCancelled(true);
} }
//BoneMeal
else if (event.getPlayer().getItemInHand().getType() == Material.INK_SACK && event.getPlayer().getItemInHand().getData().getData() == (byte)15) 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); event.setCancelled(true);
} }
} }