CS Update

This commit is contained in:
Chiss 2014-03-19 17:51:37 +11:00
parent 6830033d8a
commit 7714ff4a09
19 changed files with 479 additions and 67 deletions

View File

@ -52,7 +52,7 @@ public class GameFactory
if (gameType == GameType.Barbarians) return new Barbarians(_manager);
else if (gameType == GameType.BaconBrawl) return new BaconBrawl(_manager);
else if (gameType == GameType.Bridge) return new Bridge(_manager);
else if (gameType == GameType.CastleSiege) return new CastleSiege(_manager, pastTeams);
else if (gameType == GameType.CastleSiege) return new CastleSiege(_manager);
else if (gameType == GameType.Christmas) return new Christmas(_manager);
else if (gameType == GameType.DeathTag) return new DeathTag(_manager);
else if (gameType == GameType.Dominate) return new Dominate(_manager);

View File

@ -160,7 +160,7 @@ public abstract class Game implements Listener
public boolean RepairWeapons = true;
public boolean Autobalance = true;
public boolean AutoBalance = true;
public boolean AnnounceStay = true;
public boolean AnnounceJoinQuit = true;
@ -800,7 +800,7 @@ public abstract class Game implements Listener
public boolean CanJoinTeam(GameTeam team)
{
return Autobalance ? team.GetSize() < Math.max(1, UtilServer.getPlayers().length/GetTeamList().size()) : true;
return AutoBalance ? team.GetSize() < Math.max(1, UtilServer.getPlayers().length/GetTeamList().size()) : true;
}
public GameTeam GetTeamPreference(Player player)

View File

@ -22,6 +22,8 @@ import org.bukkit.entity.Player;
public class GameTeam
{
private double _respawnTime = 0;
public enum PlayerState
{
IN("In", ChatColor.GREEN),
@ -322,4 +324,14 @@ public class GameTeam
{
return _visible;
}
public void SetRespawnTime(double i)
{
_respawnTime = i;
}
public double GetRespawnTime()
{
return _respawnTime;
}
}

View File

@ -33,6 +33,7 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scoreboard.Score;
import org.bukkit.util.Vector;
import mineplex.core.common.Rank;
@ -46,10 +47,13 @@ import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerDeathOutEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.Game.GameState;
@ -81,7 +85,7 @@ public class Bridge extends TeamGame implements OreObsfucation
//Mushroom
private long _lastMushroom = System.currentTimeMillis();
//Chest Loot
private ArrayList<ItemStack> _chestLoot = new ArrayList<ItemStack>();
@ -97,6 +101,13 @@ public class Bridge extends TeamGame implements OreObsfucation
//Player Respawn
private HashSet<String> _usedLife = new HashSet<String>();
//Tourney Mode
private boolean _tournament = false;
private HashMap<GameTeam, Integer> _tournamentKills = new HashMap<GameTeam, Integer>();
//Scoreboard
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
public Bridge(ArcadeManager manager)
{
super(manager, GameType.Bridge,
@ -122,25 +133,30 @@ public class Bridge extends TeamGame implements OreObsfucation
// Flags
DamageSelf = true;
ItemDrop = true;
ItemPickup = true;
PrivateBlocks = true;
BlockBreak = true;
BlockPlace = true;
InventoryOpen = true;
WorldTimeSet = 2000;
WorldWaterDamage = 4;
WorldWaterDamage = 0;
CompassEnabled = true;
DeathDropItems = true;
GemMultiplier = 2.5;
//Tournament
QuitOut = false;
AutoStart = false;
AutoBalance = false;
}
@EventHandler
@ -150,7 +166,7 @@ public class Bridge extends TeamGame implements OreObsfucation
return;
Player player = event.GetPlayer();
if (Manager.GetClients().Get(player).GetRank().Has(Rank.ULTRA) || Manager.GetDonation().Get(player.getName()).OwnsUnknownPackage(GetName() + " ULTRA"))
{
if (!_usedLife.contains(player.getName()))
@ -173,11 +189,11 @@ public class Bridge extends TeamGame implements OreObsfucation
{
if (event.GetState() != GameState.Live)
return;
if (WorldWaterDamage > 0)
Announce(F.main(C.cWhite + C.Bold + "WARNING", C.cRed + C.Bold + "Water is very hot/cold and will hurt you!"));
}
@Override
public void ParseData()
{
@ -194,13 +210,13 @@ public class Bridge extends TeamGame implements OreObsfucation
ParseOre(WorldData.GetCustomLocs("14")); // Yellow
ParseOre(WorldData.GetCustomLocs("129")); // Green
ParseOre(WorldData.GetCustomLocs("56")); // Blue
//Mass Teams
if (!WorldData.GetCustomLocs("152").isEmpty()) ParseOre(WorldData.GetCustomLocs("152"));
if (!WorldData.GetCustomLocs("41").isEmpty()) ParseOre(WorldData.GetCustomLocs("41"));
if (!WorldData.GetCustomLocs("133").isEmpty()) ParseOre(WorldData.GetCustomLocs("133"));
if (!WorldData.GetCustomLocs("57").isEmpty()) ParseOre(WorldData.GetCustomLocs("57"));
if (!WorldData.GetCustomLocs("100").isEmpty()) ParseOre(WorldData.GetCustomLocs("100"));
if (!WorldData.GetCustomLocs("86").isEmpty()) ParseOre(WorldData.GetCustomLocs("86"));
if (!WorldData.GetCustomLocs("103").isEmpty()) ParseOre(WorldData.GetCustomLocs("103"));
@ -773,7 +789,7 @@ public class Bridge extends TeamGame implements OreObsfucation
_animalSet.get(team).add(ent);
}
}
@EventHandler
public void MushroomSpawn(UpdateEvent event)
{
@ -791,19 +807,19 @@ public class Bridge extends TeamGame implements OreObsfucation
for (GameTeam team : GetTeamList())
{
Block block = team.GetSpawn().getBlock();
while (!UtilBlock.airFoliage(block))
{
block = block.getRelative(BlockFace.UP);
}
while (UtilBlock.airFoliage(block))
{
block = block.getRelative(BlockFace.DOWN);
}
block = block.getRelative(BlockFace.UP);
if (block.getTypeId() == 0)
{
if (Math.random() > 0.5)
@ -915,7 +931,7 @@ public class Bridge extends TeamGame implements OreObsfucation
long time = _bridgeTime
- (System.currentTimeMillis() - this.GetStateTime());
if (time > 0)
GetObjectiveSide().setDisplayName(
ChatColor.WHITE + "§lBridges in " + C.cGreen + "§l"
@ -983,7 +999,7 @@ public class Bridge extends TeamGame implements OreObsfucation
{
return _ore;
}
@EventHandler(priority = EventPriority.HIGH)
public void CraftingDeny(PrepareItemCraftEvent event)
{
@ -1003,4 +1019,158 @@ public class Bridge extends TeamGame implements OreObsfucation
CraftingInventory inv = (CraftingInventory)event.getInventory();
inv.setResult(null);
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
//Wipe Last
for (String string : _lastScoreboard)
GetScoreboard().resetScores(Bukkit.getOfflinePlayer(string));
_lastScoreboard.clear();
//Display Players Alive
if (!_tournament)
{
for (GameTeam team : this.GetTeamList())
{
String out = team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName();
if (out.length() > 16)
out = out.substring(0, 16);
_lastScoreboard.add(out);
Score score = GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out));
score.setScore(team.GetPlayers(true).size());
}
}
//Display Kills + Players
else
{
for (GameTeam team : this.GetTeamList())
{
int kills = 0;
if (_tournamentKills.containsKey(team))
kills = _tournamentKills.get(team);
String out = kills + " " + team.GetColor() + team.GetPlayers(true).size() + " " + team.GetName();
if (out.length() > 16)
out = out.substring(0, 16);
_lastScoreboard.add(out);
if (kills == 0)
kills = -1;
Score score = GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out));
score.setScore(kills);
}
}
}
@EventHandler
public void RecordKill(CombatDeathEvent event)
{
Game game = Manager.GetGame();
if (game == null) return;
if (!(event.GetEvent().getEntity() instanceof Player))
return;
Player killed = (Player)event.GetEvent().getEntity();
GameTeam killedTeam = GetTeam(killed);
if (killedTeam == null)
return;
if (event.GetLog().GetKiller() != null)
{
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (killer != null && !killer.equals(killed))
{
GameTeam killerTeam = GetTeam(killer);
if (killerTeam == null)
return;
if (killerTeam.equals(killedTeam))
return;
if (!_tournamentKills.containsKey(killerTeam))
_tournamentKills.put(killerTeam, 1);
else
_tournamentKills.put(killerTeam, _tournamentKills.get(killerTeam) + 1);
}
}
}
@Override
public void EndCheck()
{
if (!IsLive())
return;
ArrayList<GameTeam> teamsAlive = new ArrayList<GameTeam>();
for (GameTeam team : this.GetTeamList())
if (team.GetPlayers(true).size() > 0)
teamsAlive.add(team);
if (!QuitOut)
{
//Offline Player Team
for (GameTeam team : RejoinTeam.values())
teamsAlive.add(team);
}
if (teamsAlive.size() <= 1)
{
//Announce Winner
if (!_tournament)
{
if (teamsAlive.size() > 0)
AnnounceEnd(teamsAlive.get(0));
}
else
{
GameTeam bestTeam = null;
int bestKills = 0;
for (GameTeam team : GetTeamList())
{
if (_tournamentKills.containsKey(team))
{
int kills = _tournamentKills.get(team);
if (bestTeam == null || bestKills < kills)
{
bestTeam = team;
bestKills = kills;
}
}
}
if (bestTeam != null)
AnnounceEnd(bestTeam);
}
for (GameTeam team : GetTeamList())
{
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
}
//End
SetState(GameState.End);
}
}
}

View File

@ -33,6 +33,7 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
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;
@ -45,13 +46,14 @@ 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.games.castlesiege.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
import net.minecraft.server.v1_6_R3.EntityCreature;
import net.minecraft.server.v1_6_R3.Navigation;
public class CastleSiege extends AsymTeamGame
public class CastleSiege extends TeamGame
{
private long _tntSpawn = 0;
private ArrayList<Location> _tntSpawns = new ArrayList<Location>();
@ -63,10 +65,11 @@ public class CastleSiege extends AsymTeamGame
private Location _kingLoc;
private String _kingName;
private Player _kingDamager = null;
private int _kingHealth = 30;
private ArrayList<Location> _peasantSpawns;
public CastleSiege(ArcadeManager manager, HashMap<String, ChatColor> pastTeams)
public CastleSiege(ArcadeManager manager)
{
super(manager, GameType.CastleSiege,
@ -75,24 +78,25 @@ public class CastleSiege extends AsymTeamGame
new KitHumanKnight(manager),
new KitHumanMarksman(manager),
new KitHumanElementalist(manager),
new KitHumanKnight(manager),
//new KitHumanElementalist(manager),
new KitHumanPeasant(manager),
new NullKit(manager),
new KitUndeadGhoul(manager),
new KitUndeadZombie(manager),
new KitUndeadArcher(manager),
new KitUndeadZombie(manager),
},
new String[]
{
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 peasants.",
F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as pigs.",
"",
F.elem(C.cRed + "Undead") + C.cWhite + " must kill the King.",
F.elem(C.cRed + "Undead") + C.cWhite + " lose when the sun rises.",
}, pastTeams);
});
this.HungerSet = 20;
this.DeathOut = false;
@ -100,7 +104,6 @@ public class CastleSiege extends AsymTeamGame
this.BlockPlaceAllow.add(85);
_kingName = C.cYellow + C.Bold + "King Jonalon";
}
@Override
@ -130,6 +133,8 @@ public class CastleSiege extends AsymTeamGame
{
if (kit.GetName().contains("Undead"))
team.GetRestrictedKits().add(kit);
team.SetRespawnTime(8);
}
}
}
@ -152,6 +157,7 @@ public class CastleSiege extends AsymTeamGame
_king.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
_king.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
_king.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
_king.getEquipment().setItemInHand(new ItemStack(Material.DIAMOND_SWORD));
_king.setCustomName(_kingName);
_king.setCustomNameVisible(true);
@ -159,10 +165,18 @@ public class CastleSiege extends AsymTeamGame
_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)
@ -178,20 +192,21 @@ public class CastleSiege extends AsymTeamGame
if (!event.GetDamageeEntity().equals(_king))
return;
event.SetCancelled("King Damage");
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
GameTeam team = GetTeam(damager);
if (team == null || team.GetColor() != ChatColor.RED)
{
event.SetCancelled("King Damage");
return;
}
else
if (team != null && team.GetColor() == ChatColor.RED)
{
_kingDamager = damager;
_kingHealth--;
if (_kingHealth <= 0)
_king.damage(500);
}
}
@ -213,9 +228,7 @@ public class CastleSiege extends AsymTeamGame
}
else
{
EntityCreature ec = ((CraftCreature)_king).getHandle();
Navigation nav = ec.getNavigation();
nav.a(_kingLoc.getX(), _kingLoc.getY(), _kingLoc.getZ(), 0.8f);
UtilEnt.CreatureMove(_king, _kingLoc, 1f);
}
}
@ -236,12 +249,12 @@ public class CastleSiege extends AsymTeamGame
//King
if (_king != null && _king.isValid())
{
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(C.cYellow + C.Bold + "Kings Health")).setScore((int) _king.getHealth());
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 + "Peasants", 0);
_scoreGroup.put(C.cAqua + "Wolves", 0);
_scoreGroup.put(C.cAqua + "Defenders", 0);
_scoreGroup.put(C.cRed + "Undead", 0);
@ -255,9 +268,9 @@ public class CastleSiege extends AsymTeamGame
if (kit.GetName().contains("Castle"))
{
if (kit.GetName().contains("Peasant"))
if (kit.GetName().contains("Wolf"))
{
_scoreGroup.put(C.cAqua + "Peasants", 1 + _scoreGroup.get(C.cAqua + "Peasants"));
_scoreGroup.put(C.cAqua + "Wolves", 1 + _scoreGroup.get(C.cAqua + "Wolves"));
}
else
{

View File

@ -15,25 +15,30 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkFlamingSword;
import nautilus.game.arcade.kit.perks.PerkKnockback;
import nautilus.game.arcade.kit.perks.PerkKnockbackGive;
import nautilus.game.arcade.kit.perks.PerkRegeneration;
import nautilus.game.arcade.kit.perks.PerkRepel;
public class KitHumanElementalist extends Kit
{
public KitHumanElementalist(ArcadeManager manager)
{
super(manager, "Castle Elementalist", KitAvailability.Blue,
super(manager, "Castle Paladin", KitAvailability.Blue,
new String[]
{
"Possesses a magical sword, able to incinerate enemies."
"HOLY DUDE DEALS DAT KNOCKBACK"
},
new Perk[]
{
new PerkFlamingSword()
new PerkRepel(),
new PerkKnockbackGive(2.5),
new PerkRegeneration(0)
},
EntityType.ZOMBIE, new ItemStack(Material.GOLD_SWORD));
}
@EventHandler

View File

@ -6,6 +6,9 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.disguise.disguises.DisguisePig;
import mineplex.core.disguise.disguises.DisguisePigZombie;
import mineplex.core.disguise.disguises.DisguiseWolf;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -13,22 +16,24 @@ 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.PerkKnockbackGive;
import nautilus.game.arcade.kit.perks.PerkStrength;
public class KitHumanPeasant extends Kit
{
public KitHumanPeasant(ArcadeManager manager)
{
super(manager, "Castle Peasant", KitAvailability.Hide,
super(manager, "Castle Wolf", KitAvailability.Hide,
new String[]
{
"Old and not suited for combat..."
"OINK! OINK!"
},
new Perk[]
{
new PerkStrength(2)
new PerkStrength(1),
new PerkKnockbackGive(2)
},
EntityType.ZOMBIE, new ItemStack(Material.IRON_HOE));
@ -56,6 +61,11 @@ public class KitHumanPeasant extends Kit
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_HOE));
player.setHealth(4);
DisguiseWolf disguise = new DisguiseWolf(player);
disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
}

View File

@ -1,8 +1,11 @@
package nautilus.game.arcade.game.games.castlesiege.kits;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.disguise.disguises.DisguiseSkeleton;
@ -17,7 +20,7 @@ public class KitUndeadArcher extends Kit
{
public KitUndeadArcher(ArcadeManager manager)
{
super(manager, "Undead Archer", KitAvailability.Blue,
super(manager, "Undead Archer", KitAvailability.Green,
new String[]
{
@ -44,4 +47,20 @@ public class KitUndeadArcher extends Kit
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@EventHandler
public void ArrowPickup(PlayerPickupItemEvent event)
{
if (event.getItem().getItemStack().getType() != Material.ARROW)
return;
if (!HasKit(event.getPlayer()))
return;
event.getItem().remove();
event.getPlayer().getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW));
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ITEM_PICKUP, 1f, 1f);
}
}

View File

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

View File

@ -19,7 +19,7 @@ public class KitUndeadZombie extends Kit
{
public KitUndeadZombie(ArcadeManager manager)
{
super(manager, "Undead Zombie", KitAvailability.Green,
super(manager, "Undead Zombie", KitAvailability.Blue,
new String[]
{

View File

@ -67,7 +67,6 @@ public class SuperSmash extends SoloGame
new KitSkySquid(manager),
new KitWitherSkeleton(manager),
new KitMagmaCube(manager),
},

View File

@ -340,7 +340,7 @@ public class SuperSmashTeam extends TeamGame
if (!IsLive())
return;
hungerTick = (hungerTick + 1)%10;
hungerTick = (hungerTick + 1)%6;
for (Player player : GetPlayers(true))
{
@ -370,11 +370,23 @@ public class SuperSmashTeam extends TeamGame
if (event.GetDamagerPlayer(true) == null)
return;
if (event.GetDamageePlayer() == null)
return;
if (GetTeam(event.GetDamageePlayer()) == null)
return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null)
return;
if (GetTeam(damager) == null)
return;
if (GetTeam(damager).equals(GetTeam(event.GetDamageePlayer())))
return;
if (!Recharge.Instance.use(damager, "Hunger Restore", 250, false))
return;

View File

@ -31,7 +31,7 @@ public class KitChicken extends SmashKit
new Perk[]
{
new PerkSmashStats(4, 2.0, 0.2, 1.5),
new PerkSmashStats(4, 2.0, 0.1, 1.5),
new PerkFlap(0.8, 0.8, false),
new PerkEggGun(),
new PerkChickenRocket()

View File

@ -66,6 +66,8 @@ public class ZombieSurvival extends SoloGame
this.DeathOut = false;
this.HungerSet = 20;
this.CompassEnabled = true;
}
@Override

View File

@ -0,0 +1,39 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.C;
import nautilus.game.arcade.kit.Perk;
public class PerkKnockbackGive extends Perk
{
private double _power;
public PerkKnockbackGive(double power)
{
super("Knockback", new String[]
{
C.cGray + "You deal " + (int)(power*100) + "% Knockback.",
});
_power = power;
}
@EventHandler(priority = EventPriority.HIGH)
public void Knockback(CustomDamageEvent event)
{
Player damager = event.GetDamagerPlayer(false);
if (damager == null) return;
if (!Kit.HasKit(damager))
return;
if (!Manager.IsAlive(damager))
return;
event.AddKnockback("Knockback Multiplier", _power);
}
}

View File

@ -67,7 +67,12 @@ public class PerkPigZombie extends Perk
//Disguise
DisguisePig disguise = new DisguisePig(player);
disguise.SetName(C.cYellow + player.getName());
if (Manager.GetGame().GetTeam(player) != null)
disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.SetName(player.getName());
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
@ -95,7 +100,12 @@ public class PerkPigZombie extends Perk
//Disguise
DisguisePigZombie disguise = new DisguisePigZombie(player);
disguise.SetName(C.cYellow + player.getName());
if (Manager.GetGame().GetTeam(player) != null)
disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.SetName(player.getName());
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);

View File

@ -0,0 +1,108 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import org.bukkit.Effect;
import org.bukkit.EntityEffect;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
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.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
public class PerkRepel extends Perk
{
public PerkRepel()
{
super("Holy Smite", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Sword to " + C.cGreen + "Holy Smite"
});
}
@EventHandler
public void Leap(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("_SWORD"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 10000, true))
return;
//Action
double range = 6;
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), range);
for (LivingEntity cur : targets.keySet())
{
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;
}
cur.playEffect(EntityEffect.HURT);
//Velocity
UtilAction.velocity(cur,
UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()),
1.8 * targets.get(cur), true, 0, 0.4 + 1.0 * targets.get(cur), 1.6, true);
//Condition
Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true);
//Inform
if (cur instanceof Player)
UtilPlayer.message((Player)cur, F.main("Game", F.name(player.getName()) +" hit you with " + F.skill(GetName()) + "."));
}
//Effect
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
for (Block block : UtilBlock.getInRadius(player.getLocation(), 4d).keySet())
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1);
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
}

View File

@ -556,7 +556,7 @@ public class GameFlagManager implements Listener
}
//RESPAWN
if (game.DeathSpectateSecs <= 0)
if (game.DeathSpectateSecs <= 0 && (game.GetTeam(player) == null || game.GetTeam(player).GetRespawnTime() <= 0))
{
//Teleport
if (game.IsAlive(player))
@ -580,9 +580,14 @@ public class GameFlagManager implements Listener
//TIMER
else
{
double time = game.DeathSpectateSecs;
if (game.GetTeam(player) != null)
if (game.GetTeam(player).GetRespawnTime() > time)
time = game.GetTeam(player).GetRespawnTime();
UtilInv.Clear(player);
Manager.GetCondition().Factory().Blind("Ghost", player, player, 1.5, 0, false, false, false);
Manager.GetCondition().Factory().Cloak("Ghost", player, player, game.DeathSpectateSecs, false, false);
Manager.GetCondition().Factory().Cloak("Ghost", player, player, time, false, false);
player.setGameMode(GameMode.CREATIVE);
player.setFlying(true);
@ -591,7 +596,7 @@ public class GameFlagManager implements Listener
UtilAction.velocity(player, new Vector(0,0,0), 1, true, 0.4, 0, 1, true);
UtilPlayer.message(player, C.cWhite + C.Bold + "You will respawn in " + game.DeathSpectateSecs + " seconds...");
UtilPlayer.message(player, C.cWhite + C.Bold + "You will respawn in " + time + " seconds...");
Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
@ -610,7 +615,7 @@ public class GameFlagManager implements Listener
player.setFireTicks(0);
player.setVelocity(new Vector(0,0,0));
}
}, (int)(game.DeathSpectateSecs * 20d));
}, (int)(time * 20d));
}
}

View File

@ -150,7 +150,7 @@ public class GameManager implements Listener
{
if (game.GetType() == GameType.Bridge)
{
if (UtilTime.elapsed(game.GetStateTime(), 2400000))
if (UtilTime.elapsed(game.GetStateTime(), 96000000))
{
game.SetState(GameState.End);
}
@ -162,6 +162,13 @@ public class GameManager implements Listener
game.SetState(GameState.End);
}
}
else if (game.GetType() == GameType.SmashTeams)
{
if (UtilTime.elapsed(game.GetStateTime(), 9600000))
{
game.SetState(GameState.End);
}
}
else if (game.GetType() != GameType.UHC)
{
if (UtilTime.elapsed(game.GetStateTime(), 1200000))