More CS Update
This commit is contained in:
parent
ab2a72ba16
commit
fe09c3fc49
@ -1,61 +0,0 @@
|
|||||||
package nautilus.game.arcade.game;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
|
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
|
||||||
import nautilus.game.arcade.GameType;
|
|
||||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
|
||||||
import nautilus.game.arcade.kit.Kit;
|
|
||||||
|
|
||||||
public abstract class AsymTeamGame extends TeamGame
|
|
||||||
{
|
|
||||||
private HashMap<String, ChatColor> _pastTeams = null;
|
|
||||||
|
|
||||||
public AsymTeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc, HashMap<String, ChatColor> pastTeams)
|
|
||||||
{
|
|
||||||
super(manager, gameType, kits, gameDesc);
|
|
||||||
|
|
||||||
_pastTeams = pastTeams;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<String, ChatColor> GetPastTeams()
|
|
||||||
{
|
|
||||||
return _pastTeams;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
|
||||||
public void GameStateChange(GameStateChangeEvent event)
|
|
||||||
{
|
|
||||||
if (event.GetState() != GameState.Recruit)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (GetPastTeams() != null)
|
|
||||||
{
|
|
||||||
this.SetCountdown(30);
|
|
||||||
this.SetCountdownForce(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GameTeam ChooseTeam(Player player)
|
|
||||||
{
|
|
||||||
//Get Past Team
|
|
||||||
ChatColor pastTeam = null;
|
|
||||||
if (_pastTeams != null)
|
|
||||||
pastTeam = _pastTeams.get(player.getName());
|
|
||||||
|
|
||||||
GameTeam newTeam = null;
|
|
||||||
|
|
||||||
for (int i=0 ; i<GetTeamList().size() ; i++)
|
|
||||||
if (newTeam == null || GetTeamList().get(i).GetSize() < newTeam.GetSize())
|
|
||||||
if (pastTeam == null || GetTeamList().get(i).GetColor() != pastTeam)
|
|
||||||
newTeam = GetTeamList().get(i);
|
|
||||||
|
|
||||||
return newTeam;
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,6 +7,7 @@ import java.util.Iterator;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.FireworkEffect;
|
import org.bukkit.FireworkEffect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -50,7 +51,6 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
|||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.GameType;
|
import nautilus.game.arcade.GameType;
|
||||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||||
import nautilus.game.arcade.game.AsymTeamGame;
|
|
||||||
import nautilus.game.arcade.game.GameTeam;
|
import nautilus.game.arcade.game.GameTeam;
|
||||||
import nautilus.game.arcade.game.TeamGame;
|
import nautilus.game.arcade.game.TeamGame;
|
||||||
import nautilus.game.arcade.game.Game.GameState;
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
@ -72,7 +72,7 @@ public class CastleSiege extends TeamGame
|
|||||||
private Location _kingLoc;
|
private Location _kingLoc;
|
||||||
private String _kingName;
|
private String _kingName;
|
||||||
private Player _kingDamager = null;
|
private Player _kingDamager = null;
|
||||||
private int _kingHealth = 30;
|
private int _kingHealth = 40;
|
||||||
|
|
||||||
private ArrayList<Location> _peasantSpawns;
|
private ArrayList<Location> _peasantSpawns;
|
||||||
private ArrayList<Location> _horseSpawns;
|
private ArrayList<Location> _horseSpawns;
|
||||||
@ -83,10 +83,10 @@ public class CastleSiege extends TeamGame
|
|||||||
|
|
||||||
new Kit[]
|
new Kit[]
|
||||||
{
|
{
|
||||||
|
|
||||||
new KitHumanKnight(manager),
|
|
||||||
new KitHumanMarksman(manager),
|
new KitHumanMarksman(manager),
|
||||||
new KitHumanBrawler(manager),
|
new KitHumanKnight(manager),
|
||||||
|
//new KitHumanBrawler(manager),
|
||||||
|
new KitHumanAssassin(manager),
|
||||||
new KitHumanPeasant(manager),
|
new KitHumanPeasant(manager),
|
||||||
new NullKit(manager),
|
new NullKit(manager),
|
||||||
new KitUndeadGhoul(manager),
|
new KitUndeadGhoul(manager),
|
||||||
@ -98,13 +98,25 @@ public class CastleSiege extends TeamGame
|
|||||||
{
|
{
|
||||||
F.elem(C.cAqua + "Defenders") + C.cWhite + " must defend the King.",
|
F.elem(C.cAqua + "Defenders") + C.cWhite + " must defend the King.",
|
||||||
F.elem(C.cAqua + "Defenders") + C.cWhite + " win when the sun rises.",
|
F.elem(C.cAqua + "Defenders") + C.cWhite + " win when the sun rises.",
|
||||||
F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as pigs.",
|
F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as wolves.",
|
||||||
"",
|
"",
|
||||||
F.elem(C.cRed + "Undead") + C.cWhite + " must kill the King.",
|
F.elem(C.cRed + "Undead") + C.cWhite + " must kill the King.",
|
||||||
F.elem(C.cRed + "Undead") + C.cWhite + " lose when the sun rises.",
|
F.elem(C.cRed + "Undead") + C.cWhite + " lose when the sun rises.",
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_help = new String[]
|
||||||
|
{
|
||||||
|
"Marksmen are extremely important to defence!",
|
||||||
|
"It's recommended 50%+ of defence are Marksmen.",
|
||||||
|
"Use Barricades to block the Undeads path.",
|
||||||
|
"Use TNT to destroy weak points in walls.",
|
||||||
|
"Weak points are marked by cracked stone brick.",
|
||||||
|
"Undead can break fences with their axes.",
|
||||||
|
"Undead Archers must pick up arrows from the ground.",
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
this.HungerSet = 20;
|
this.HungerSet = 20;
|
||||||
this.DeathOut = false;
|
this.DeathOut = false;
|
||||||
this.WorldTimeSet = 14000; //14000
|
this.WorldTimeSet = 14000; //14000
|
||||||
@ -212,6 +224,28 @@ public class CastleSiege extends TeamGame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void HorseDamageCancel(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (!(event.GetDamageeEntity() instanceof Horse))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = event.GetDamagerPlayer(true);
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!IsAlive(player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (GetTeam(player) == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (GetTeam(player).GetColor() == ChatColor.RED)
|
||||||
|
return;
|
||||||
|
|
||||||
|
event.SetCancelled("Horse Team Damage");
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void GameStateChange(GameStateChangeEvent event)
|
public void GameStateChange(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
@ -429,6 +463,9 @@ public class CastleSiege extends TeamGame
|
|||||||
if (event.getType() != UpdateType.SEC)
|
if (event.getType() != UpdateType.SEC)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!UtilTime.elapsed(this.GetStateTime(), 20000))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!UtilTime.elapsed(_tntSpawn, 25000))
|
if (!UtilTime.elapsed(_tntSpawn, 25000))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -538,7 +575,7 @@ public class CastleSiege extends TeamGame
|
|||||||
|
|
||||||
if (dist < 2)
|
if (dist < 2)
|
||||||
{
|
{
|
||||||
int damage = (int) (9 * (event.getEntity().getVelocity().length() / 3d));
|
int damage = (int) (5 * (event.getEntity().getVelocity().length() / 3d));
|
||||||
|
|
||||||
//Damage Event
|
//Damage Event
|
||||||
Manager.GetDamage().NewDamageEvent(player, event.getEntity().getShooter(), event.getEntity(),
|
Manager.GetDamage().NewDamageEvent(player, event.getEntity().getShooter(), event.getEntity(),
|
||||||
@ -564,7 +601,7 @@ public class CastleSiege extends TeamGame
|
|||||||
Player player = tntIterator.next();
|
Player player = tntIterator.next();
|
||||||
FallingBlock block = _tntCarry.get(player);
|
FallingBlock block = _tntCarry.get(player);
|
||||||
|
|
||||||
if (player.isDead() || !block.isValid() || block.getTicksLived() > 600)
|
if (player.isDead() || !block.isValid() || block.getTicksLived() > 900)
|
||||||
{
|
{
|
||||||
player.eject();
|
player.eject();
|
||||||
block.remove();
|
block.remove();
|
||||||
@ -703,4 +740,25 @@ public class CastleSiege extends TeamGame
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void SnowDamage(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (GetState() != GameState.Live)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.getType() != UpdateType.FAST)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Player player : GetPlayers(true))
|
||||||
|
if (player.getLocation().getBlock().getTypeId() == 78)
|
||||||
|
{
|
||||||
|
//Damage Event
|
||||||
|
Manager.GetDamage().NewDamageEvent(player, null, null,
|
||||||
|
DamageCause.DROWNING, 2, false, true, false,
|
||||||
|
"Snow", "Snow Damage");
|
||||||
|
|
||||||
|
player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 80);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,81 @@
|
|||||||
|
package nautilus.game.arcade.game.games.castlesiege.kits;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
|
import nautilus.game.arcade.kit.Kit;
|
||||||
|
import nautilus.game.arcade.kit.KitAvailability;
|
||||||
|
import nautilus.game.arcade.kit.Perk;
|
||||||
|
import nautilus.game.arcade.kit.perks.PerkFletcher;
|
||||||
|
import nautilus.game.arcade.kit.perks.PerkLeap;
|
||||||
|
import nautilus.game.arcade.kit.perks.PerkPowershot;
|
||||||
|
import nautilus.game.arcade.kit.perks.PerkRegeneration;
|
||||||
|
|
||||||
|
public class KitHumanAssassin extends Kit
|
||||||
|
{
|
||||||
|
public KitHumanAssassin(ArcadeManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Castle Assassin", KitAvailability.Blue,
|
||||||
|
new String[]
|
||||||
|
{
|
||||||
|
"Able to kill with a single shot!"
|
||||||
|
},
|
||||||
|
new Perk[]
|
||||||
|
{
|
||||||
|
new PerkFletcher(2, 4, false),
|
||||||
|
new PerkLeap("Leap", 1.2, 1, 8000),
|
||||||
|
new PerkPowershot(5, 400),
|
||||||
|
new PerkRegeneration(0),
|
||||||
|
},
|
||||||
|
EntityType.ZOMBIE,
|
||||||
|
new ItemStack(Material.BOW));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void FireItemResist(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.FAST)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Manager.GetGame() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||||
|
{
|
||||||
|
if (!HasKit(player))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void GiveItems(Player player)
|
||||||
|
{
|
||||||
|
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE));
|
||||||
|
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
|
||||||
|
|
||||||
|
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET));
|
||||||
|
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE));
|
||||||
|
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS));
|
||||||
|
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void SpawnCustom(LivingEntity ent)
|
||||||
|
{
|
||||||
|
ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
|
||||||
|
ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
|
||||||
|
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
|
||||||
|
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
|
||||||
|
}
|
||||||
|
}
|
@ -21,7 +21,7 @@ public class KitHumanKnight extends Kit
|
|||||||
{
|
{
|
||||||
public KitHumanKnight(ArcadeManager manager)
|
public KitHumanKnight(ArcadeManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Castle Knight", KitAvailability.Free,
|
super(manager, "Castle Knight", KitAvailability.Green,
|
||||||
|
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
@ -31,7 +31,7 @@ public class KitHumanKnight extends Kit
|
|||||||
new Perk[]
|
new Perk[]
|
||||||
{
|
{
|
||||||
new PerkMammoth(),
|
new PerkMammoth(),
|
||||||
new PerkConstructor("Constructor", 60, 2, Material.FENCE, "Castle Barricade", true)
|
new PerkConstructor("Constructor", 40, 2, Material.FENCE, "Castle Barricade", true)
|
||||||
},
|
},
|
||||||
|
|
||||||
EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD));
|
EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD));
|
||||||
@ -67,7 +67,8 @@ public class KitHumanKnight extends Kit
|
|||||||
|
|
||||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||||
|
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||||
|
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||||
|
|
||||||
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET));
|
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET));
|
||||||
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));
|
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));
|
||||||
|
@ -21,7 +21,7 @@ public class KitHumanMarksman extends Kit
|
|||||||
{
|
{
|
||||||
public KitHumanMarksman(ArcadeManager manager)
|
public KitHumanMarksman(ArcadeManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Castle Marksman", KitAvailability.Green,
|
super(manager, "Castle Marksman", KitAvailability.Free,
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
"Skilled human marksman, can fletch arrows."
|
"Skilled human marksman, can fletch arrows."
|
||||||
@ -62,7 +62,6 @@ public class KitHumanMarksman extends Kit
|
|||||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, 32));
|
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, 32));
|
||||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
|
||||||
|
|
||||||
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
|
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
|
||||||
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
|
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
|
||||||
|
@ -61,6 +61,8 @@ public class KitHumanPeasant extends Kit
|
|||||||
@Override
|
@Override
|
||||||
public void GiveItems(Player player)
|
public void GiveItems(Player player)
|
||||||
{
|
{
|
||||||
|
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 0, "Wolf Bite"));
|
||||||
|
|
||||||
player.setHealth(4);
|
player.setHealth(4);
|
||||||
|
|
||||||
DisguiseWolf disguise = new DisguiseWolf(player);
|
DisguiseWolf disguise = new DisguiseWolf(player);
|
||||||
|
@ -28,7 +28,7 @@ public class KitUndeadGhoul extends Kit
|
|||||||
|
|
||||||
new Perk[]
|
new Perk[]
|
||||||
{
|
{
|
||||||
new PerkLeap("Ghoul Attack", 1.2, 0.8, 8000),
|
new PerkLeap("Ghoul Leap", 1.2, 0.8, 8000),
|
||||||
new PerkSpeed(0)
|
new PerkSpeed(0)
|
||||||
},
|
},
|
||||||
EntityType.PIG_ZOMBIE,
|
EntityType.PIG_ZOMBIE,
|
||||||
|
@ -41,8 +41,13 @@ public class KitUndeadZombie extends Kit
|
|||||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE));
|
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE));
|
||||||
|
|
||||||
DisguiseZombie disguise = new DisguiseZombie(player);
|
DisguiseZombie disguise = new DisguiseZombie(player);
|
||||||
disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
|
||||||
disguise.SetCustomNameVisible(true);
|
if (Manager.GetGame().GetTeam(player) != null)
|
||||||
|
{
|
||||||
|
disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||||
|
disguise.SetCustomNameVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
Manager.GetDisguise().disguise(disguise);
|
Manager.GetDisguise().disguise(disguise);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,13 +6,13 @@ import org.bukkit.ChatColor;
|
|||||||
|
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.GameType;
|
import nautilus.game.arcade.GameType;
|
||||||
import nautilus.game.arcade.game.AsymTeamGame;
|
|
||||||
import nautilus.game.arcade.game.GameTeam;
|
import nautilus.game.arcade.game.GameTeam;
|
||||||
|
import nautilus.game.arcade.game.TeamGame;
|
||||||
import nautilus.game.arcade.game.games.horsecharge.kits.*;
|
import nautilus.game.arcade.game.games.horsecharge.kits.*;
|
||||||
import nautilus.game.arcade.kit.Kit;
|
import nautilus.game.arcade.kit.Kit;
|
||||||
import nautilus.game.arcade.kit.NullKit;
|
import nautilus.game.arcade.kit.NullKit;
|
||||||
|
|
||||||
public class Horse extends AsymTeamGame
|
public class Horse extends TeamGame
|
||||||
{
|
{
|
||||||
public Horse(ArcadeManager manager, HashMap<String, ChatColor> pastTeams)
|
public Horse(ArcadeManager manager, HashMap<String, ChatColor> pastTeams)
|
||||||
{
|
{
|
||||||
@ -34,7 +34,7 @@ public class Horse extends AsymTeamGame
|
|||||||
"Undead win when all Horsemen are dead.",
|
"Undead win when all Horsemen are dead.",
|
||||||
"",
|
"",
|
||||||
"Teams swap after game is over"
|
"Teams swap after game is over"
|
||||||
}, pastTeams);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,183 @@
|
|||||||
|
package nautilus.game.arcade.kit.perks;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilBlock;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
import nautilus.game.arcade.kit.Perk;
|
||||||
|
|
||||||
|
public class PerkPowershot extends Perk
|
||||||
|
{
|
||||||
|
private WeakHashMap<Player, Integer> _charge = new WeakHashMap<Player, Integer>();
|
||||||
|
private WeakHashMap<Player, Long> _chargeLast = new WeakHashMap<Player, Long>();
|
||||||
|
|
||||||
|
private WeakHashMap<Arrow, Integer> _arrows = new WeakHashMap<Arrow, Integer>();
|
||||||
|
|
||||||
|
private int _max;
|
||||||
|
private long _tick;
|
||||||
|
|
||||||
|
public PerkPowershot(int max, long tick)
|
||||||
|
{
|
||||||
|
super("Power Shot", new String[]
|
||||||
|
{
|
||||||
|
C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Power Shot",
|
||||||
|
"Arrows deal up to +15 damage"
|
||||||
|
});
|
||||||
|
|
||||||
|
_max = max;
|
||||||
|
_tick = tick;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void DrawBow(PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!Kit.HasKit(player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!player.getInventory().contains(Material.ARROW))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.getClickedBlock() != null)
|
||||||
|
if (UtilBlock.usable(event.getClickedBlock()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Start Charge
|
||||||
|
_charge.put(player, 0);
|
||||||
|
_chargeLast.put(player, System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void ChargeBow(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.TICK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Player cur : UtilServer.getPlayers())
|
||||||
|
{
|
||||||
|
//Not Charging
|
||||||
|
if (!_charge.containsKey(cur))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//Max Charge
|
||||||
|
if (_charge.get(cur) >= _max)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//Charge Interval
|
||||||
|
if (_charge.get(cur) == 0)
|
||||||
|
{
|
||||||
|
if (!UtilTime.elapsed(_chargeLast.get(cur), 1000))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!UtilTime.elapsed(_chargeLast.get(cur), _tick))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//No Longer Holding Bow
|
||||||
|
if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW)
|
||||||
|
{
|
||||||
|
_charge.remove(cur);
|
||||||
|
_chargeLast.remove(cur);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Increase Charge
|
||||||
|
_charge.put(cur, _charge.get(cur) + 1);
|
||||||
|
_chargeLast.put(cur, System.currentTimeMillis());
|
||||||
|
|
||||||
|
//Effect
|
||||||
|
cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void FireBow(EntityShootBowEvent event)
|
||||||
|
{
|
||||||
|
if (!(event.getEntity() instanceof Player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!(event.getProjectile() instanceof Arrow))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = (Player)event.getEntity();
|
||||||
|
|
||||||
|
if (!_charge.containsKey(player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Start
|
||||||
|
_arrows.put((Arrow)event.getProjectile(), _charge.remove(player));
|
||||||
|
_chargeLast.put(player, System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
|
public void Damage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetProjectile() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.GetDamagerPlayer(true) == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!(event.GetProjectile() instanceof Arrow))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Arrow arrow = (Arrow)event.GetProjectile();
|
||||||
|
|
||||||
|
if (!_arrows.containsKey(arrow))
|
||||||
|
return;
|
||||||
|
|
||||||
|
int charge = _arrows.remove(arrow);
|
||||||
|
|
||||||
|
event.AddMod("Power Shot", "Power Shot", charge * 3, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void Clean(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SEC)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Iterator<Arrow> arrowIterator = _arrows.keySet().iterator(); arrowIterator.hasNext();)
|
||||||
|
{
|
||||||
|
Arrow arrow = arrowIterator.next();
|
||||||
|
|
||||||
|
if (arrow.isDead() || !arrow.isValid())
|
||||||
|
arrowIterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void Quit(PlayerQuitEvent event)
|
||||||
|
{
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
_charge.remove(player);
|
||||||
|
_chargeLast.remove(player);
|
||||||
|
}
|
||||||
|
}
|
@ -68,19 +68,19 @@ public class PerkSeismicSlamCS extends Perk
|
|||||||
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), range);
|
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), range);
|
||||||
for (LivingEntity cur : targets.keySet())
|
for (LivingEntity cur : targets.keySet())
|
||||||
{
|
{
|
||||||
|
if (!(cur instanceof Player))
|
||||||
|
return;
|
||||||
|
|
||||||
if (cur.equals(player))
|
if (cur.equals(player))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (cur instanceof Player)
|
Player other = (Player)cur;
|
||||||
{
|
|
||||||
Player other = (Player)cur;
|
|
||||||
|
|
||||||
if (!Manager.GetGame().IsAlive(other))
|
if (!Manager.GetGame().IsAlive(other))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Manager.GetGame().GetTeam(other).equals(Manager.GetGame().GetTeam(player)))
|
if (Manager.GetGame().GetTeam(other).equals(Manager.GetGame().GetTeam(player)))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
//Damage Event
|
//Damage Event
|
||||||
Manager.GetDamage().NewDamageEvent(cur, player, null,
|
Manager.GetDamage().NewDamageEvent(cur, player, null,
|
||||||
@ -101,10 +101,10 @@ public class PerkSeismicSlamCS extends Perk
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Effect
|
//Effect
|
||||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f);
|
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f);
|
||||||
for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet())
|
for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet())
|
||||||
if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur))
|
if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur))
|
||||||
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId());
|
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId());
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||||
|
@ -11,9 +11,7 @@ import mineplex.core.updater.UpdateType;
|
|||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.GameType;
|
import nautilus.game.arcade.GameType;
|
||||||
import nautilus.game.arcade.game.AsymTeamGame;
|
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
import nautilus.game.arcade.game.GameTeam;
|
|
||||||
import nautilus.game.arcade.game.Game.GameState;
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -81,20 +79,6 @@ public class GameCreationManager implements Listener
|
|||||||
//Lobby Display
|
//Lobby Display
|
||||||
Manager.GetLobby().DisplayLast(Manager.GetGame());
|
Manager.GetLobby().DisplayLast(Manager.GetGame());
|
||||||
|
|
||||||
//Prepare Round 2 - If Applicable
|
|
||||||
if (Manager.GetGame() instanceof AsymTeamGame)
|
|
||||||
{
|
|
||||||
if (((AsymTeamGame) Manager.GetGame()).GetPastTeams() == null)
|
|
||||||
{
|
|
||||||
_nextGame = Manager.GetGame().GetType();
|
|
||||||
_nextGameTeams = new HashMap<String, ChatColor>();
|
|
||||||
|
|
||||||
for (GameTeam team : Manager.GetGame().GetTeamList())
|
|
||||||
for (Player player : team.GetPlayers(false))
|
|
||||||
_nextGameTeams.put(player.getName(), team.GetColor());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Manager.SetGame(null);
|
Manager.SetGame(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,6 @@ import mineplex.core.updater.event.UpdateEvent;
|
|||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.GameType;
|
import nautilus.game.arcade.GameType;
|
||||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||||
import nautilus.game.arcade.game.AsymTeamGame;
|
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
import nautilus.game.arcade.game.GameTeam;
|
import nautilus.game.arcade.game.GameTeam;
|
||||||
import nautilus.game.arcade.game.Game.GameState;
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
@ -826,13 +825,6 @@ public class GameLobbyManager implements IPacketRunnable, Listener
|
|||||||
|
|
||||||
DisplayWaiting();
|
DisplayWaiting();
|
||||||
|
|
||||||
if (game instanceof AsymTeamGame)
|
|
||||||
{
|
|
||||||
if (pastTeams == null) WriteGameLine("Round 1 of 2", 2, 159, (byte)4);
|
|
||||||
else WriteGameLine("Round 2 of 2", 2, 159, (byte)4);
|
|
||||||
}
|
|
||||||
else WriteGameLine(" ", 2, 159, (byte)14);
|
|
||||||
|
|
||||||
CreateKits(game);
|
CreateKits(game);
|
||||||
CreateTeams(game);
|
CreateTeams(game);
|
||||||
}
|
}
|
||||||
|
@ -271,13 +271,6 @@ public class GameManager implements Listener
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
event.GetGame().DeregisterKits();
|
event.GetGame().DeregisterKits();
|
||||||
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
|
||||||
{
|
|
||||||
Manager.Clear(player);
|
|
||||||
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator");
|
|
||||||
player.teleport(Manager.GetLobby().GetSpawn());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST) //BEFORE PARSE DATA
|
@EventHandler(priority = EventPriority.LOWEST) //BEFORE PARSE DATA
|
||||||
@ -528,16 +521,32 @@ public class GameManager implements Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void PlayerClean(GameStateChangeEvent event)
|
public void PlayerTeleportOut(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
if (event.GetState() != GameState.Dead)
|
if (event.GetState() != GameState.Dead)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
final Player[] players = UtilServer.getPlayers();
|
||||||
|
|
||||||
|
//Prepare Players
|
||||||
|
for (int i=0 ; i<players.length ; i++)
|
||||||
{
|
{
|
||||||
Manager.Clear(player);
|
final Player player = players[i];
|
||||||
player.eject();
|
|
||||||
player.teleport(Manager.GetLobby().GetSpawn());
|
UtilServer.getServer().getScheduler().runTaskLater(Manager.GetPlugin(), new Runnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
Manager.Clear(player);
|
||||||
|
UtilInv.Clear(player);
|
||||||
|
|
||||||
|
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator");
|
||||||
|
|
||||||
|
player.eject();
|
||||||
|
player.leaveVehicle();
|
||||||
|
player.teleport(Manager.GetLobby().GetSpawn());
|
||||||
|
}
|
||||||
|
}, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user