More CS Update

This commit is contained in:
Chiss 2014-03-22 10:44:31 +11:00
parent ab2a72ba16
commit fe09c3fc49
14 changed files with 446 additions and 193 deletions

View File

@ -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;
}
}

View File

@ -7,6 +7,7 @@ import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.Material;
@ -50,7 +51,6 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.AsymTeamGame;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.Game.GameState;
@ -66,27 +66,27 @@ public class CastleSiege extends TeamGame
private ArrayList<Location> _tntSpawns = new ArrayList<Location>();
private ArrayList<Location> _tntWeakness = new ArrayList<Location>();
private HashMap<Player, FallingBlock> _tntCarry = new HashMap<Player, FallingBlock>();
private ArrayList<Location> _kingLocs;
private Creature _king;
private Location _kingLoc;
private String _kingName;
private Player _kingDamager = null;
private int _kingHealth = 30;
private int _kingHealth = 40;
private ArrayList<Location> _peasantSpawns;
private ArrayList<Location> _horseSpawns;
public CastleSiege(ArcadeManager manager)
{
super(manager, GameType.CastleSiege,
new Kit[]
{
new KitHumanKnight(manager),
new KitHumanMarksman(manager),
new KitHumanBrawler(manager),
new KitHumanKnight(manager),
//new KitHumanBrawler(manager),
new KitHumanAssassin(manager),
new KitHumanPeasant(manager),
new NullKit(manager),
new KitUndeadGhoul(manager),
@ -98,18 +98,30 @@ public class CastleSiege extends TeamGame
{
F.elem(C.cAqua + "Defenders") + C.cWhite + " must defend the King.",
F.elem(C.cAqua + "Defenders") + C.cWhite + " win when the sun rises.",
F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as pigs.",
F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as wolves.",
"",
F.elem(C.cRed + "Undead") + C.cWhite + " must kill the King.",
F.elem(C.cRed + "Undead") + C.cWhite + " lose when the sun rises.",
});
_help = new String[]
{
"Marksmen are extremely important to defence!",
"It's recommended 50%+ of defence are Marksmen.",
"Use Barricades to block the Undeads path.",
"Use TNT to destroy weak points in walls.",
"Weak points are marked by cracked stone brick.",
"Undead can break fences with their axes.",
"Undead Archers must pick up arrows from the ground.",
};
this.HungerSet = 20;
this.DeathOut = false;
this.WorldTimeSet = 14000; //14000
this.BlockPlaceAllow.add(85);
_kingName = C.cYellow + C.Bold + "King Jonalon";
}
@ -141,13 +153,13 @@ public class CastleSiege extends TeamGame
{
if (kit.GetName().contains("Undead"))
team.GetRestrictedKits().add(kit);
team.SetRespawnTime(8);
}
}
}
}
@EventHandler
public void MoveKits(GameStateChangeEvent event)
{
@ -162,25 +174,25 @@ public class CastleSiege extends TeamGame
this.CreatureAllowOverride = true;
Entity ent = GetKits()[5+i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i));
this.CreatureAllowOverride = false;
Manager.GetCondition().Factory().Invulnerable("Kit", (LivingEntity)ent, (LivingEntity)ent, 999999, false, false);
Manager.GetLobby().AddKitLocation(ent, GetKits()[5+i], WorldData.GetDataLocs("PINK").get(i));
}
}
@EventHandler
public void HorseSpawn(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
return;
for (Location loc : _horseSpawns)
{
this.CreatureAllowOverride = true;
Horse horse = loc.getWorld().spawn(loc, Horse.class);
this.CreatureAllowOverride = false;
horse.setAdult();
horse.setAgeLock(true);
horse.setColor(org.bukkit.entity.Horse.Color.BLACK);
@ -189,14 +201,14 @@ public class CastleSiege extends TeamGame
horse.setMaxDomestication(1);
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
horse.getInventory().setArmor(new ItemStack(Material.IRON_BARDING));
horse.setMaxHealth(60);
horse.setHealth(horse.getMaxHealth());
horse.setCustomName("War Horse");
}
}
@EventHandler
public void HorseInteract(PlayerInteractEntityEvent event)
{
@ -205,19 +217,41 @@ public class CastleSiege extends TeamGame
Player player = event.getPlayer();
GameTeam team = GetTeam(player);
if (team == null || team.GetColor() == ChatColor.RED || !IsAlive(player))
{
event.setCancelled(true);
}
}
@EventHandler
public void HorseDamageCancel(CustomDamageEvent event)
{
if (!(event.GetDamageeEntity() instanceof Horse))
return;
Player player = event.GetDamagerPlayer(true);
if (player == null)
return;
if (!IsAlive(player))
return;
if (GetTeam(player) == null)
return;
if (GetTeam(player).GetColor() == ChatColor.RED)
return;
event.SetCancelled("Horse Team Damage");
}
@EventHandler(priority = EventPriority.HIGH)
public void GameStateChange(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
return;
//Spawn King
this.CreatureAllowOverride = true;
@ -233,22 +267,22 @@ public class CastleSiege extends TeamGame
_king.setCustomName(_kingName);
_king.setCustomNameVisible(true);
_king.setRemoveWhenFarAway(false);
this.CreatureAllowOverride = false;
}
@EventHandler(priority = EventPriority.HIGH)
public void SetDefenderRespawn(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
//Change to Peasant Spawns
this.GetTeam(ChatColor.AQUA).SetSpawns(_peasantSpawns);
}
@EventHandler
public void KingTarget(EntityTargetEvent event)
@ -264,7 +298,7 @@ public class CastleSiege extends TeamGame
if (!event.GetDamageeEntity().equals(_king))
return;
event.SetCancelled("King Damage");
Player damager = event.GetDamagerPlayer(true);
@ -276,24 +310,24 @@ public class CastleSiege extends TeamGame
{
_kingDamager = damager;
_kingHealth--;
if (_kingHealth <= 0)
_king.damage(500);
}
}
@EventHandler
public void KingUpdate(UpdateEvent event)
{
if (GetState() != GameState.Live)
return;
if (event.getType() != UpdateType.SEC)
return;
if (_king == null)
return;
if (UtilMath.offset(_king.getLocation(), _kingLoc) > 6)
{
_king.teleport(_kingLoc);
@ -323,21 +357,21 @@ public class CastleSiege extends TeamGame
{
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(C.cYellow + C.Bold + "Kings Health")).setScore(_kingHealth);
}
//Teams
HashMap<String, Integer> _scoreGroup = new HashMap<String, Integer>();
_scoreGroup.put(C.cAqua + "Wolves", 0);
_scoreGroup.put(C.cAqua + "Defenders", 0);
_scoreGroup.put(C.cRed + "Undead", 0);
for (Player player : UtilServer.getPlayers())
{
if (!IsAlive(player))
continue;
Kit kit = GetKit(player);
if (kit == null) continue;
if (kit.GetName().contains("Castle"))
{
if (kit.GetName().contains("Wolf"))
@ -354,7 +388,7 @@ public class CastleSiege extends TeamGame
_scoreGroup.put(C.cRed + "Undead", 1 + _scoreGroup.get(C.cRed + "Undead"));
}
}
for (String group : _scoreGroup.keySet())
{
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(group)).setScore(_scoreGroup.get(group));
@ -366,11 +400,11 @@ public class CastleSiege extends TeamGame
{
if (!IsLive())
return;
if (this.WorldTimeSet > 24100)
{
SetCustomWinLine(_kingName + ChatColor.RESET + " has survived the seige!");
SetState(GameState.End);
AnnounceEnd(GetTeam(ChatColor.AQUA));
@ -399,7 +433,7 @@ public class CastleSiege extends TeamGame
}
else
SetCustomWinLine(_kingName + ChatColor.RESET + " has died!");
SetState(GameState.End);
AnnounceEnd(GetTeam(ChatColor.RED));
@ -425,13 +459,16 @@ public class CastleSiege extends TeamGame
{
if (GetState() != GameState.Live)
return;
if (event.getType() != UpdateType.SEC)
return;
if (!UtilTime.elapsed(this.GetStateTime(), 20000))
return;
if (!UtilTime.elapsed(_tntSpawn, 25000))
return;
if (_tntSpawns.isEmpty())
return;
@ -459,7 +496,7 @@ public class CastleSiege extends TeamGame
if (!IsAlive(player))
return;
if (!GetTeam(ChatColor.RED).HasPlayer(player))
return;
@ -494,7 +531,7 @@ public class CastleSiege extends TeamGame
return;
event.setCancelled(true);
for (Location loc : _tntSpawns)
{
if (UtilMath.offset(player.getLocation(), loc) < 16)
@ -538,7 +575,7 @@ public class CastleSiege extends TeamGame
if (dist < 2)
{
int damage = (int) (9 * (event.getEntity().getVelocity().length() / 3d));
int damage = (int) (5 * (event.getEntity().getVelocity().length() / 3d));
//Damage Event
Manager.GetDamage().NewDamageEvent(player, event.getEntity().getShooter(), event.getEntity(),
@ -563,8 +600,8 @@ public class CastleSiege extends TeamGame
{
Player player = tntIterator.next();
FallingBlock block = _tntCarry.get(player);
if (player.isDead() || !block.isValid() || block.getTicksLived() > 600)
if (player.isDead() || !block.isValid() || block.getTicksLived() > 900)
{
player.eject();
block.remove();
@ -588,7 +625,7 @@ public class CastleSiege extends TeamGame
}
}
}
@EventHandler
public void TNTWeakness(ExplosionPrimeEvent event)
{
@ -601,14 +638,14 @@ public class CastleSiege extends TeamGame
break;
}
}
if (weakness == null)
return;
_tntWeakness.remove(weakness);
final Location extra = weakness;
for (int i=0 ; i<10 ; i++)
{
Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
@ -621,37 +658,37 @@ public class CastleSiege extends TeamGame
}
}, i*3);
}
weakness.getWorld().playSound(weakness, Sound.EXPLODE, 16f, 0.8f);
}
@EventHandler(priority = EventPriority.HIGH)
public void AttackerBlockBreak(org.bukkit.event.block.BlockBreakEvent event)
{
GameTeam team = GetTeam(event.getPlayer());
if (team == null)
return;
if (team.GetColor() != ChatColor.RED)
return;
if (event.getBlock().getTypeId() == 85)
event.setCancelled(false);
}
@EventHandler
public void DefenderBlockPlace(org.bukkit.event.block.BlockPlaceEvent event)
{
GameTeam team = GetTeam(event.getPlayer());
if (team == null)
return;
if (team.GetColor() != ChatColor.AQUA)
return;
if (event.getBlock().getTypeId() != 85)
return;
for (Block block : UtilBlock.getSurrounding(event.getBlock(), false))
{
if (block.isLiquid())
@ -666,14 +703,14 @@ public class CastleSiege extends TeamGame
event.setCancelled(true);
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " on each other."));
}
if (_king != null && UtilMath.offset(_king.getLocation(), event.getBlock().getLocation().add(0.5, 0.5, 0.5)) < 4)
{
event.setCancelled(true);
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " near " + F.elem(C.cAqua + _kingName) + "."));
}
}
@EventHandler
public void DayTimer(UpdateEvent event)
{
@ -682,13 +719,13 @@ public class CastleSiege extends TeamGame
if (event.getType() != UpdateType.TICK)
return;
WorldTimeSet = (WorldTimeSet+1);
long timeLeft = 24000 - WorldTimeSet;
timeLeft = timeLeft / 20 * 1000;
if (timeLeft > 0)
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lSun Rise: " + C.cGreen + "§l"
@ -697,10 +734,31 @@ public class CastleSiege extends TeamGame
{
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lSun has risen!");
for (Player player : GetTeam(ChatColor.RED).GetPlayers(true))
Manager.GetCondition().Factory().Ignite("Sun Damage", player, player, 5, false, false);
}
}
@EventHandler
public void SnowDamage(UpdateEvent event)
{
if (GetState() != GameState.Live)
return;
if (event.getType() != UpdateType.FAST)
return;
for (Player player : GetPlayers(true))
if (player.getLocation().getBlock().getTypeId() == 78)
{
//Damage Event
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.DROWNING, 2, false, true, false,
"Snow", "Snow Damage");
player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 80);
}
}
}

View File

@ -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));
}
}

View File

@ -21,7 +21,7 @@ public class KitHumanKnight extends Kit
{
public KitHumanKnight(ArcadeManager manager)
{
super(manager, "Castle Knight", KitAvailability.Free,
super(manager, "Castle Knight", KitAvailability.Green,
new String[]
{
@ -31,7 +31,7 @@ public class KitHumanKnight extends Kit
new Perk[]
{
new PerkMammoth(),
new PerkConstructor("Constructor", 60, 2, Material.FENCE, "Castle Barricade", true)
new PerkConstructor("Constructor", 40, 2, Material.FENCE, "Castle Barricade", true)
},
EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD));
@ -67,7 +67,8 @@ public class KitHumanKnight extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));

View File

@ -21,7 +21,7 @@ public class KitHumanMarksman extends Kit
{
public KitHumanMarksman(ArcadeManager manager)
{
super(manager, "Castle Marksman", KitAvailability.Green,
super(manager, "Castle Marksman", KitAvailability.Free,
new String[]
{
"Skilled human marksman, can fletch arrows."
@ -62,7 +62,6 @@ public class KitHumanMarksman extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, 32));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));

View File

@ -61,6 +61,8 @@ public class KitHumanPeasant extends Kit
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 0, "Wolf Bite"));
player.setHealth(4);
DisguiseWolf disguise = new DisguiseWolf(player);

View File

@ -28,7 +28,7 @@ public class KitUndeadGhoul extends Kit
new Perk[]
{
new PerkLeap("Ghoul Attack", 1.2, 0.8, 8000),
new PerkLeap("Ghoul Leap", 1.2, 0.8, 8000),
new PerkSpeed(0)
},
EntityType.PIG_ZOMBIE,

View File

@ -41,8 +41,13 @@ public class KitUndeadZombie extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE));
DisguiseZombie disguise = new DisguiseZombie(player);
disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
disguise.SetCustomNameVisible(true);
if (Manager.GetGame().GetTeam(player) != null)
{
disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
disguise.SetCustomNameVisible(true);
}
Manager.GetDisguise().disguise(disguise);
}

View File

@ -6,13 +6,13 @@ import org.bukkit.ChatColor;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.AsymTeamGame;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.horsecharge.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
public class Horse extends AsymTeamGame
public class Horse extends TeamGame
{
public Horse(ArcadeManager manager, HashMap<String, ChatColor> pastTeams)
{
@ -34,7 +34,7 @@ public class Horse extends AsymTeamGame
"Undead win when all Horsemen are dead.",
"",
"Teams swap after game is over"
}, pastTeams);
});
}
@Override

View File

@ -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);
}
}

View File

@ -68,19 +68,19 @@ public class PerkSeismicSlamCS extends Perk
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), range);
for (LivingEntity cur : targets.keySet())
{
if (!(cur instanceof Player))
return;
if (cur.equals(player))
continue;
if (cur instanceof Player)
{
Player other = (Player)cur;
if (!Manager.GetGame().IsAlive(other))
continue;
if (Manager.GetGame().GetTeam(other).equals(Manager.GetGame().GetTeam(player)))
continue;
}
Player other = (Player)cur;
if (!Manager.GetGame().IsAlive(other))
continue;
if (Manager.GetGame().GetTeam(other).equals(Manager.GetGame().GetTeam(player)))
continue;
//Damage Event
Manager.GetDamage().NewDamageEvent(cur, player, null,
@ -101,11 +101,11 @@ public class PerkSeismicSlamCS extends Perk
}
//Effect
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f);
for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet())
if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur))
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId());
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f);
for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet())
if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur))
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId());
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}

View File

@ -11,9 +11,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.AsymTeamGame;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState;
import org.bukkit.ChatColor;
@ -81,20 +79,6 @@ public class GameCreationManager implements Listener
//Lobby Display
Manager.GetLobby().DisplayLast(Manager.GetGame());
//Prepare Round 2 - If Applicable
if (Manager.GetGame() instanceof AsymTeamGame)
{
if (((AsymTeamGame) Manager.GetGame()).GetPastTeams() == null)
{
_nextGame = Manager.GetGame().GetType();
_nextGameTeams = new HashMap<String, ChatColor>();
for (GameTeam team : Manager.GetGame().GetTeamList())
for (Player player : team.GetPlayers(false))
_nextGameTeams.put(player.getName(), team.GetColor());
}
}
Manager.SetGame(null);
}
}

View File

@ -55,7 +55,6 @@ import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.AsymTeamGame;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState;
@ -826,13 +825,6 @@ public class GameLobbyManager implements IPacketRunnable, Listener
DisplayWaiting();
if (game instanceof AsymTeamGame)
{
if (pastTeams == null) WriteGameLine("Round 1 of 2", 2, 159, (byte)4);
else WriteGameLine("Round 2 of 2", 2, 159, (byte)4);
}
else WriteGameLine(" ", 2, 159, (byte)14);
CreateKits(game);
CreateTeams(game);
}

View File

@ -271,13 +271,6 @@ public class GameManager implements Listener
return;
event.GetGame().DeregisterKits();
for (Player player : UtilServer.getPlayers())
{
Manager.Clear(player);
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator");
player.teleport(Manager.GetLobby().GetSpawn());
}
}
@EventHandler(priority = EventPriority.LOWEST) //BEFORE PARSE DATA
@ -528,19 +521,35 @@ public class GameManager implements Listener
}
@EventHandler
public void PlayerClean(GameStateChangeEvent event)
public void PlayerTeleportOut(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Dead)
return;
for (Player player : UtilServer.getPlayers())
final Player[] players = UtilServer.getPlayers();
//Prepare Players
for (int i=0 ; i<players.length ; i++)
{
Manager.Clear(player);
player.eject();
player.teleport(Manager.GetLobby().GetSpawn());
final Player player = players[i];
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);
}
}
@EventHandler
public void disguiseClean(GameStateChangeEvent event)
{