diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java index 7e0638f3e..8e2ee5398 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java @@ -1,8 +1,10 @@ package nautilus.game.arcade.game.games.monsterleague; +import java.util.ArrayList; import java.util.HashMap; import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilMath; @@ -13,6 +15,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.monsterleague.kits.LeagueKit; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -21,10 +24,14 @@ import org.bukkit.EntityEffect; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.FireworkEffect.Type; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; import org.bukkit.entity.Slime; import org.bukkit.util.Vector; +import sun.rmi.runtime.Log; + public class Ball { private MonsterLeague _host; @@ -33,18 +40,28 @@ public class Ball private Slime _ball; private Vector _ballVel; + + private boolean _firstSpawn = true; + private long _ballDeadTime = -1; - private HashMap _kickLog = new HashMap(); - - private HashMap _lastKickTeamPlayer = new HashMap(); - private GameTeam _lastKickTeam = null; - private Player _lastKickPlayer = null; + private ArrayList _kickHistory = new ArrayList(); + + //Kick + protected int _kickTickDelay = 0; + + //Particle + protected Location _lastParticle = null; //Ball Rebound + protected boolean _ignoreReboundForTick = false; protected Location _lastLoc = null; + protected int _reboundX = 0; + protected int _reboundY = 0; + protected int _reboundZ = 0; + public Ball(MonsterLeague monsterLeague, Location ballSpawn) { _host = monsterLeague; @@ -52,19 +69,11 @@ public class Ball _ballSpawn = ballSpawn; } - private BallKickLog getKickLog(Player player) - { - if (!_kickLog.containsKey(player)) - _kickLog.put(player, new BallKickLog()); - - return _kickLog.get(player); - } - - private void changeBallVelocity(Vector vel) + private void changeBallVelocity(Vector vel, boolean canGoNegativeY) { _ballVel = vel; - if (UtilEnt.isGrounded(_ball) && _ballVel.getY() <= 0) + if (!canGoNegativeY && UtilEnt.isGrounded(_ball) && _ballVel.getY() <= 0) _ballVel.setY(0); _ballVel.setY(Math.min(_ballVel.getY(), 1)); @@ -72,7 +81,7 @@ public class Ball //Rebound Data _lastLoc = _ball.getLocation(); } - + public void update() { //New Ball Needed @@ -92,7 +101,7 @@ public class Ball //Movement/Rebounds/etc ballPhysics(); - + //Goal scoreGoalUpdate(); } @@ -111,72 +120,87 @@ public class Ball private void displayParticles() { if (_lastKickTeam == null) + { + _lastParticle = _ball.getLocation(); return; - - if (_lastKickTeam.GetColor() == ChatColor.BLUE) - { - for (int i = 0 ; i < 3 ; i++) - UtilParticle.PlayParticle(ParticleType.RED_DUST, _ball.getLocation().add(0.0, 0.5, 0.0), -1, 1, 1, 1, 0, - ViewDist.NORMAL, UtilServer.getPlayers()); } - else if (_lastKickTeam.GetColor() == ChatColor.RED) + + while (UtilMath.offset(_ball.getLocation().add(0, 0.5, 0), _lastParticle) > 0.15) { - for (int i = 0 ; i < 3 ; i++) - UtilParticle.PlayParticle(ParticleType.RED_DUST, _ball.getLocation().add(0.0, 0.5, 0.0), 0, 0, 0, 0, 1, - ViewDist.NORMAL, UtilServer.getPlayers()); - } - else if (_lastKickTeam.GetColor() == ChatColor.GREEN) //XXX CHANGE COLOR OF DUST - { - for (int i = 0 ; i < 3 ; i++) - UtilParticle.PlayParticle(ParticleType.RED_DUST, _ball.getLocation().add(0.0, 0.5, 0.0), 0, 0, 0, 0, 1, - ViewDist.NORMAL, UtilServer.getPlayers()); - } - else if (_lastKickTeam.GetColor() == ChatColor.YELLOW) //XXX CHANGE COLOR OF DUST - { - for (int i = 0 ; i < 3 ; i++) - UtilParticle.PlayParticle(ParticleType.RED_DUST, _ball.getLocation().add(0.0, 0.5, 0.0), 0, 0, 0, 0, 1, - ViewDist.NORMAL, UtilServer.getPlayers()); + _lastParticle.add(UtilAlg.getTrajectory(_lastParticle, _ball.getLocation().add(0,0.5,0)).multiply(0.15)); + + if (_lastKickTeam.GetColor() == ChatColor.AQUA) + { + UtilParticle.PlayParticle(ParticleType.RED_DUST, _lastParticle, -1, 1, 1, 1, 0, + ViewDist.MAX, UtilServer.getPlayers()); + } + else if (_lastKickTeam.GetColor() == ChatColor.RED) + { + UtilParticle.PlayParticle(ParticleType.RED_DUST, _lastParticle, 0, 0, 0, 0, 1, + ViewDist.MAX, UtilServer.getPlayers()); + } + else if (_lastKickTeam.GetColor() == ChatColor.GREEN) + { + UtilParticle.PlayParticle(ParticleType.RED_DUST, _lastParticle, 0, 1, 0, 0, 1, + ViewDist.MAX, UtilServer.getPlayers()); + } + else if (_lastKickTeam.GetColor() == ChatColor.YELLOW) + { + UtilParticle.PlayParticle(ParticleType.RED_DUST, _lastParticle, -1, 1, -1, 0, 1, + ViewDist.MAX, UtilServer.getPlayers()); + } } } private void spawnBallUpdate() { - if (_ballDeadTime > 0 && UtilTime.elapsed(_ballDeadTime, 4000)) + if (_ballDeadTime > 0 && (_firstSpawn || UtilTime.elapsed(_ballDeadTime, 6000))) { //Spawn _host.CreatureAllowOverride = true; _ball = _ballSpawn.getWorld().spawn(_ballSpawn, Slime.class); - _ball.setSize(2); + _ball.setSize(3); UtilEnt.Vegetate(_ball); - UtilEnt.ghost(_ball, true, false); + UtilEnt.ghost(_ball, false, false); _host.CreatureAllowOverride = false; - + _lastParticle = _ball.getLocation(); //Set Ball to Alive _ballDeadTime = -1; //Velocity Downwards - changeBallVelocity(new Vector(0,-0.1,0)); - + changeBallVelocity(new Vector(0,-0.1,0), true); + //Effect UtilFirework.playFirework(_ballSpawn, Type.BALL, Color.WHITE, true, true); + + _firstSpawn = false; } } private void kickBallUpdate() { + if (_kickTickDelay > 0) + { + _kickTickDelay--; + return; + } + for (Player player : _host.GetPlayers(true)) { - if (UtilMath.offset(player, _ball) < 1.5 || - UtilMath.offset(player.getEyeLocation(), _ball.getLocation()) < 1.25) + if (UtilMath.offset(player, _ball) < 2 || + UtilMath.offset(player.getEyeLocation(), _ball.getLocation()) < 1.5) { if (Recharge.Instance.use(player, "Football Kick", 600, false, false)) { - //Set Ball Velocity - changeBallVelocity(player.getLocation().getDirection().add(new Vector(0, 0.4, 0))); + //Kick Power + LeagueKit kit = (LeagueKit)_host.GetKit(player); + //Set Ball Velocity + changeBallVelocity(player.getLocation().getDirection().multiply(kit.getKickPower()).add(new Vector(0, 0.4, 0)), false); + //Sound _ball.getWorld().playSound(_ball.getLocation(), Sound.ZOMBIE_WOOD, 0.5f, 1.5f); @@ -184,20 +208,24 @@ public class Ball UtilParticle.PlayParticle(ParticleType.SLIME, _ball.getLocation(), 0, 0, 0, 0, 5, ViewDist.NORMAL, UtilServer.getPlayers()); - + //Flash Ball _ball.playEffect(EntityEffect.HURT); - + //Zero Player Vel UtilAction.zeroVelocity(player); - //Record Kick - getKickLog(player).addKick();; - //Record - _lastKickPlayer = player; _lastKickTeam = _host.GetTeam(player); - _lastKickTeamPlayer.put(_lastKickTeam, player); + _kickHistory.add(new KickLog(player, _lastKickTeam)); + + //Ignore Rebound + _ignoreReboundForTick = true; + + //This creates a small delay that no one else can kick it. + _kickTickDelay = 2; + + return; } } } @@ -210,14 +238,92 @@ public class Ball //Ground Drag if (UtilEnt.isGrounded(_ball)) - _ballVel = _ballVel.multiply(0.98); + _ballVel = _ballVel.multiply(0.97); - //Rebound Y - if (UtilEnt.isGrounded(_ball)) + if (!_ignoreReboundForTick) { - if (_ballVel.getY() < -0.1) + double lenience = 0.1; + + //Rebound Y + if (_ballVel.getY() > 0.15 && _ball.getLocation().getY() <= _lastLoc.getY() || + _ballVel.getY() < -lenience && _ball.getLocation().getY() >= _lastLoc.getY()) { - _ballVel.setY(_ballVel.getY() * -0.65); + _reboundY++; + + if (_reboundY > 1) + { + if (_ballVel.getY() > 0) + + _ballVel = _ballVel.multiply(_ballVel.getY() > 0 ? 0.9 : 0.75); //Lose extra when bouncing on ground. + + //Sound + _ball.getWorld().playSound(_ball.getLocation(), Sound.ZOMBIE_WOOD, 0.5f, 1.5f); + + //Effect + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, _ball.getLocation(), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + + _reboundY = 0; + } + } + else + { + _reboundY = 0; + } + + + if (UtilEnt.isGrounded(_ball)) + { + //lenience = 0.1; + } + + //Rebound X + if (_ballVel.getX() > lenience && _ball.getLocation().getX() <= _lastLoc.getX() || + _ballVel.getX() < -lenience && _ball.getLocation().getX() >= _lastLoc.getX()) + { + _reboundX++; + + if (_reboundX > 1) + { + _ballVel.setX(_ballVel.getX() * -1); + _ballVel = _ballVel.multiply(0.9); + + //Sound + _ball.getWorld().playSound(_ball.getLocation(), Sound.ZOMBIE_WOOD, 0.5f, 1.5f); + + //Effect + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, _ball.getLocation(), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + + _reboundX = 0; + } + } + else + { + _reboundX = 0; + } + + //Rebound Z + if (_ballVel.getZ() > lenience && _ball.getLocation().getZ() <= _lastLoc.getZ() || + _ballVel.getZ() < -lenience && _ball.getLocation().getZ() >= _lastLoc.getZ()) + { + _reboundZ++; + + if (_reboundZ > 1) + { + _ballVel.setZ(_ballVel.getZ() * -1); + _ballVel = _ballVel.multiply(0.9); + + //Sound + _ball.getWorld().playSound(_ball.getLocation(), Sound.ZOMBIE_WOOD, 0.5f, 1.5f); + + //Effect + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, _ball.getLocation(), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + + _reboundZ = 0; + } + } + else + { + _reboundZ = 0; } } @@ -225,80 +331,88 @@ public class Ball if (!UtilEnt.isGrounded(_ball)) _ballVel.setY(_ballVel.getY() - 0.04); - //Rebound X - if (_ballVel.getX() > 0 && _ball.getLocation().getX() <= _lastLoc.getX() || - _ballVel.getX() < 0 && _ball.getLocation().getX() >= _lastLoc.getX()) - { - _ballVel.setX(_ballVel.getX() * -1); - _ballVel = _ballVel.multiply(0.9); - - //Sound - _ball.getWorld().playSound(_ball.getLocation(), Sound.ZOMBIE_WOOD, 0.5f, 1.5f); - - //Effect - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, _ball.getLocation(), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); - } - - //Rebound Z - if (_ballVel.getZ() > 0 && _ball.getLocation().getZ() <= _lastLoc.getZ() || - _ballVel.getZ() < 0 && _ball.getLocation().getZ() >= _lastLoc.getZ()) - { - _ballVel.setZ(_ballVel.getZ() * -1); - _ballVel = _ballVel.multiply(0.9); - - //Sound - _ball.getWorld().playSound(_ball.getLocation(), Sound.ZOMBIE_WOOD, 0.5f, 1.5f); - - //Effect - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, _ball.getLocation(), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); - } - //Store Current Location _lastLoc = _ball.getLocation(); - + + _ignoreReboundForTick = false; + //Move Ball _ball.setVelocity(_ballVel); } - + private boolean scoreGoalUpdate() { for (GameTeam team : _host.GetTeamList()) { if (!_host.getGoalRegions().containsKey(team)) continue; - + if (_host.getGoalRegions().get(team).contains(_ball.getLocation().getBlock())) { //Score - _host.scoreGoal(team, this); - + if (!_host.scoreGoal(team, this)) + return false; + //Effect UtilFirework.playFirework(_ball.getLocation(), Type.BALL, team.GetColorBase(), true, true); - + //Clean _ball.remove(); _ball = null; - - _kickLog.clear(); - + _lastLoc = null; - - _lastKickTeamPlayer.clear(); + _lastKickTeam = null; - _lastKickPlayer = null; - + _kickHistory.clear(); + return true; } } - + return false; } - public Player getLastKicker(GameTeam team) + public Player getLastKickerNotOnTeam(GameTeam goalTeam) { - if (_lastKickTeamPlayer.containsKey(team)) - return _lastKickTeamPlayer.get(team); - - return _lastKickPlayer; + for (KickLog log : _kickHistory) + { + if (log.Team.equals(goalTeam)) + continue; + + return log.Player; + } + + return _kickHistory.get(0).Player; + } + + public void arrowHit(LivingEntity ent, Projectile proj) + { + if (_ball != null && _ball.equals(ent)) + { + Player player = (Player)proj.getShooter(); + + changeBallVelocity(proj.getVelocity().multiply(0.6), true); + + //Sound + _ball.getWorld().playSound(_ball.getLocation(), Sound.ZOMBIE_WOOD, 0.5f, 1.5f); + + //Effect + UtilParticle.PlayParticle(ParticleType.SLIME, + _ball.getLocation(), + 0, 0, 0, 0, 5, ViewDist.NORMAL, UtilServer.getPlayers()); + + //Flash Ball + _ball.playEffect(EntityEffect.HURT); + + //Zero Player Vel + UtilAction.zeroVelocity(player); + + //Record + _lastKickTeam = _host.GetTeam(player); + _kickHistory.add(new KickLog(player, _lastKickTeam)); + + //Ignore Rebound + _ignoreReboundForTick = true; + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/BallKickLog.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/BallKickLog.java deleted file mode 100644 index 5c2d5e31e..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/BallKickLog.java +++ /dev/null @@ -1,13 +0,0 @@ -package nautilus.game.arcade.game.games.monsterleague; - -import java.util.ArrayList; - -public class BallKickLog -{ - ArrayList _kicks = new ArrayList(); - - public void addKick() - { - _kicks.add(0, System.currentTimeMillis()); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/KickLog.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/KickLog.java new file mode 100644 index 000000000..192590c20 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/KickLog.java @@ -0,0 +1,18 @@ +package nautilus.game.arcade.game.games.monsterleague; + +import nautilus.game.arcade.game.GameTeam; +import org.bukkit.entity.Player; + +public class KickLog +{ + Player Player; + GameTeam Team; + long Time; + + public KickLog(Player player, GameTeam team) + { + Player = player; + Team = team; + Time = System.currentTimeMillis(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java index 06066860e..5839636c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java @@ -5,46 +5,28 @@ import java.util.HashMap; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.Color; -import org.bukkit.EntityEffect; import org.bukkit.Material; -import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; -import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.entity.Entity; +import org.bukkit.entity.Arrow; import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.util.Vector; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ProjectileHitEvent; import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.common.util.UtilTime; -import mineplex.core.gadget.gadgets.OutfitTeam; -import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +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.GameTeam; import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.games.monsterleague.kits.KitPlayer; +import nautilus.game.arcade.game.games.monsterleague.kits.*; import nautilus.game.arcade.kit.Kit; public class MonsterLeague extends TeamGame @@ -62,7 +44,9 @@ public class MonsterLeague extends TeamGame new Kit[] { - new KitPlayer(manager), + new KitSkeleton(manager), + new KitGolem(manager), + new KitEnderman(manager), }, new String[] @@ -72,12 +56,23 @@ public class MonsterLeague extends TeamGame this.PrepareFreeze = false; this.Damage = false; + + this.TeamArmor = true; + this.TeamArmorHotbar = true; } //Supports anywhere from 2-4 teams on a map @Override public void ParseData() { + //parse200 56 73 14 129 + + //Scores + for (GameTeam team : GetTeamList()) + { + _teamScores.put(team, 0); + } + //Red if (GetTeam(ChatColor.RED) != null) { @@ -86,22 +81,24 @@ public class MonsterLeague extends TeamGame for (Location loc : WorldData.GetCustomLocs("" + Material.REDSTONE_ORE.getId())) { goalBlocks.add(loc.getBlock()); + loc.getBlock().setType(Material.AIR); } _teamGoalRegions.put(GetTeam(ChatColor.RED), goalBlocks); } //Blue - if (GetTeam(ChatColor.BLUE) != null) + if (GetTeam(ChatColor.AQUA) != null) { ArrayList goalBlocks = new ArrayList(); for (Location loc : WorldData.GetCustomLocs("" + Material.DIAMOND_ORE.getId())) { goalBlocks.add(loc.getBlock()); + loc.getBlock().setType(Material.AIR); } - _teamGoalRegions.put(GetTeam(ChatColor.BLUE), goalBlocks); + _teamGoalRegions.put(GetTeam(ChatColor.AQUA), goalBlocks); } //Yellow @@ -112,6 +109,7 @@ public class MonsterLeague extends TeamGame for (Location loc : WorldData.GetCustomLocs("" + Material.GOLD_ORE.getId())) { goalBlocks.add(loc.getBlock()); + loc.getBlock().setType(Material.AIR); } _teamGoalRegions.put(GetTeam(ChatColor.YELLOW), goalBlocks); @@ -125,6 +123,7 @@ public class MonsterLeague extends TeamGame for (Location loc : WorldData.GetCustomLocs("" + Material.EMERALD_ORE.getId())) { goalBlocks.add(loc.getBlock()); + loc.getBlock().setType(Material.AIR); } _teamGoalRegions.put(GetTeam(ChatColor.GREEN), goalBlocks); @@ -134,16 +133,6 @@ public class MonsterLeague extends TeamGame _balls.add(new Ball(this, WorldData.GetDataLocs("GREEN").get(0))); } - //Support for multiple balls - @EventHandler - public void createInitialBalls(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Live) - return; - - - } - @EventHandler public void ballUpdate(UpdateEvent event) { @@ -157,21 +146,32 @@ public class MonsterLeague extends TeamGame ball.update(); } - public void scoreGoal(final GameTeam team, final Ball ball) + public boolean scoreGoal(final GameTeam goalOwnerTeam, final Ball ball) { - //Add Score - _teamScores.put(team, 1 + _teamScores.get(team)); - - Player lastKicker = ball.getLastKicker(team); + Player lastKicker = ball.getLastKickerNotOnTeam(goalOwnerTeam); GameTeam kickerTeam = GetTeam(lastKicker); - //Check Win - if (_teamScores.get(team) > _scoreToWin) + //Dont allow self score (will only happen if NO ONE else kicked it) + if (kickerTeam.equals(goalOwnerTeam)) + return false; + + //Add Score + _teamScores.put(kickerTeam, 1 + _teamScores.get(kickerTeam)); + + //Against for 3+ teams + String against = ""; + if (GetTeamList().size() >= 3) { - SetCustomWinLine(kickerTeam.GetColor() + lastKicker.getName() + ChatColor.RESET + " scored the final goal for " + team.GetColor() + team.GetName()); + against = "against " + goalOwnerTeam.GetColor() + goalOwnerTeam.GetName() + ChatColor.RESET + " "; + } + + //Check Win + if (_teamScores.get(kickerTeam) > _scoreToWin) + { + SetCustomWinLine(kickerTeam.GetColor() + lastKicker.getName() + ChatColor.RESET + " scored the final goal " + against + "for " + kickerTeam.GetColor() + kickerTeam.GetName()); //Announce - AnnounceEnd(team); + AnnounceEnd(kickerTeam); for (GameTeam curTeam : GetTeamList()) { @@ -189,11 +189,11 @@ public class MonsterLeague extends TeamGame //End SetState(GameState.End); - return; + return true; } UtilTextMiddle.display("GOAL", - kickerTeam.GetColor() + lastKicker.getName() + C.cWhite + " scored for " + team.GetColor() + team.GetName(), + kickerTeam.GetColor() + lastKicker.getName() + C.cWhite + " scored " + against + "for " + kickerTeam.GetColor() + kickerTeam.GetName(), 0, 80, 20, UtilServer.getPlayers()); Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() @@ -211,15 +211,32 @@ public class MonsterLeague extends TeamGame if (scores.length() > 0) scores = scores.substring(0, scores.length()-3); - UtilTextMiddle.display("GOAL", + UtilTextMiddle.display("SCORES", scores, - 0, 60, 20, UtilServer.getPlayers()); + 0, 40, 20, UtilServer.getPlayers()); } }, 80); + + return true; } public HashMap> getGoalRegions() { return _teamGoalRegions; } + + @EventHandler + public void arrowDeflect(CustomDamageEvent event) + { + if (!(event.GetDamageeEntity() instanceof Slime)) + return; + + if (event.GetProjectile() == null || !(event.GetProjectile() instanceof Arrow) || event.GetProjectile().getShooter() == null) + return; + + for (Ball ball : _balls) + { + ball.arrowHit(event.GetDamageeEntity(), event.GetProjectile()); + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java new file mode 100644 index 000000000..b9b27716a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java @@ -0,0 +1,55 @@ +package nautilus.game.arcade.game.games.monsterleague.kits; + +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.DisguiseEnderman; +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.perks.PerkBlink; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; + +public class KitEnderman extends LeagueKit +{ + public KitEnderman(ArcadeManager manager) + { + super(manager, "Enderman", KitAvailability.Free, 5000, + + new String[] + { + "WARPY", + }, + + new Perk[] + { + new PerkDoubleJump("Double Jump", 1, 0.8, true), + new PerkBlink("Blink", 32, 16000), + }, + EntityType.ENDERMAN, + new ItemStack(Material.AIR), 1.2); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.EYE_OF_ENDER, (byte)0, 1, + C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Blink")); + + //Disguise + DisguiseEnderman disguise = new DisguiseEnderman(player); + + 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); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitGolem.java new file mode 100644 index 000000000..d182d1728 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitGolem.java @@ -0,0 +1,57 @@ +package nautilus.game.arcade.game.games.monsterleague.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.DisguiseIronGolem; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.monsterleague.perks.PerkStoneWall; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; + +public class KitGolem extends LeagueKit +{ + public KitGolem(ArcadeManager manager) + { + super(manager, "Golem", KitAvailability.Free, 5000, + + new String[] + { + "Strong Kicks", + }, + + new Perk[] + { + new PerkDoubleJump("Double Jump", 0.9, 0.7, true), + new PerkStoneWall(), + }, + EntityType.IRON_GOLEM, + new ItemStack(Material.AIR), 1.6); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_INGOT, (byte)0, 1, + C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Iron Wall")); + + //Disguise + DisguiseIronGolem disguise = new DisguiseIronGolem(player); + + 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); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitPlayer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitPlayer.java deleted file mode 100644 index 293b0b769..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitPlayer.java +++ /dev/null @@ -1,38 +0,0 @@ -package nautilus.game.arcade.game.games.monsterleague.kits; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkDoubleJump; - -public class KitPlayer extends Kit -{ - public KitPlayer(ArcadeManager manager) - { - super(manager, "Player", KitAvailability.Free, - - new String[] - { - "Play as a player!...yay." - }, - - new Perk[] - { - new PerkDoubleJump("Double Jump", 0.9, 0.9, true) - }, - EntityType.ZOMBIE, - new ItemStack(Material.AIR)); - - } - - @Override - public void GiveItems(Player player) - { - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitSkeleton.java new file mode 100644 index 000000000..905248969 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitSkeleton.java @@ -0,0 +1,55 @@ +package nautilus.game.arcade.game.games.monsterleague.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.DisguiseSkeleton; +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.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkFletcher; + +public class KitSkeleton extends LeagueKit +{ + public KitSkeleton(ArcadeManager manager) + { + super(manager, "Skeleton", KitAvailability.Free, 5000, + + new String[] + { + "Medium Kick Power", + }, + + new Perk[] + { + new PerkDoubleJump("Double Jump", 1.1, 0.9, true), + new PerkFletcher(12, 2, true), + }, + EntityType.SKELETON, + new ItemStack(Material.BOW), 0.8); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, C.cGreen + C.Bold + "Ball Shooter")); + + //Disguise + DisguiseSkeleton disguise = new DisguiseSkeleton(player); + + 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); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/LeagueKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/LeagueKit.java new file mode 100644 index 000000000..fdd6030d9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/LeagueKit.java @@ -0,0 +1,29 @@ +package nautilus.game.arcade.game.games.monsterleague.kits; + +import org.bukkit.entity.EntityType; +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; + +public abstract class LeagueKit extends Kit +{ + private double _kickPower; + + public LeagueKit(ArcadeManager manager, String name, + KitAvailability kitAvailability, int cost, String[] kitDesc, + Perk[] kitPerks, EntityType entityType, ItemStack itemInHand, + double kickPower) + { + super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); + + _kickPower = kickPower; + } + + public double getKickPower() + { + return _kickPower; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlink.java new file mode 100644 index 000000000..75e0654a9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlink.java @@ -0,0 +1,119 @@ +package nautilus.game.arcade.game.games.monsterleague.perks; + +import org.bukkit.Color; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.kit.SmashPerk; + +public class PerkBlink extends SmashPerk +{ + private double _range = 32; + private long _recharge = 24000; + + public PerkBlink(String name, double range, long recharge) + { + super("Blink", new String[] + { + C.cYellow + "Click" + C.cGray + " to use " + C.cGreen + "Blink" + }); + + _range = range; + _recharge = recharge; + } + + @EventHandler + public void Blink(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK && + event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + Player player = event.getPlayer(); + + if (isSuperActive(player)) + return; + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), _recharge, true, true)) + return; + + Recharge.Instance.setDisplayForce(player, GetName(), true); + + //Smoke Trail + Block lastSmoke = player.getLocation().getBlock(); + + double curRange = 0; + while (curRange <= _range) + { + Location newTarget = player.getLocation().add(new Vector(0,0.2,0)).add(player.getLocation().getDirection().multiply(curRange)); + + if (!UtilBlock.airFoliage(newTarget.getBlock()) || + !UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP))) + break; + + //Progress Forwards + curRange += 0.2; + + //Smoke Trail + if (!lastSmoke.equals(newTarget.getBlock())) + { + lastSmoke.getWorld().playEffect(lastSmoke.getLocation(), Effect.SMOKE, 4); + } + + lastSmoke = newTarget.getBlock(); + } + + //Modify Range + curRange -= 0.4; + if (curRange < 0) + curRange = 0; + + //Destination + Location loc = player.getLocation().add(player.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0))); + + if (curRange > 0) + { + //Firework + UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false); + + player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f); + player.teleport(loc); + player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f); + + //Firework + UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false); + } + + + player.setFallDistance(0); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } +} + + diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkStoneWall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkStoneWall.java new file mode 100644 index 000000000..8488cc9f8 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkStoneWall.java @@ -0,0 +1,111 @@ +package nautilus.game.arcade.game.games.monsterleague.perks; + +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +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.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.data.IcePathData; + +public class PerkStoneWall extends Perk +{ + private HashSet _data = new HashSet(); + + public PerkStoneWall() + { + super("Iron Wall", new String[] + { + C.cYellow + "Click" + C.cGray + " to use " + C.cGreen + "Iron Wall" + }); + } + + @EventHandler + public void Skill(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK && + event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 24000, true, true)) + return; + + Recharge.Instance.setDisplayForce(player, GetName(), true); + + //Get Player Direction + Vector dir = null; + + if (Math.abs(player.getLocation().getDirection().getX()) > Math.abs(player.getLocation().getDirection().getZ())) + { + if (player.getLocation().getDirection().getX() > 0) + { + dir = new Vector(1,0,0); + } + else + { + dir = new Vector(-1,0,0); + } + } + else + { + if (player.getLocation().getDirection().getZ() > 0) + { + dir = new Vector(0,0,1); + } + else + { + dir = new Vector(0,0,-1); + } + } + + for (int i=-2 ; i<=2 ; i++) + for (int j=-2 ; j<=2 ; j++) + { + if (Math.abs(i) == 2 && Math.abs(j) == 2) + continue; + + Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(3)); + loc.add(UtilAlg.getLeft(dir).multiply(i)); + loc.add(UtilAlg.getUp(dir).multiply(j)); + + Manager.GetBlockRestore().Add(loc.getBlock(), Material.IRON_BLOCK.getId(), (byte)0, 4000); + + loc.getWorld().playEffect(loc, Effect.STEP_SOUND, Material.IRON_BLOCK); + } + + player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 2f, 1f); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java index 8d6e783c8..4890bc63e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java @@ -19,9 +19,9 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.kit.Perk; -public class PerkBlink extends SmashPerk +public class PerkBlink extends Perk { private String _name = ""; private double _range; @@ -29,7 +29,7 @@ public class PerkBlink extends SmashPerk public PerkBlink(String name, double range, long recharge) { - super("Leaper", new String[] + super("name", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + name }); @@ -45,23 +45,15 @@ public class PerkBlink extends SmashPerk if (event.isCancelled()) return; - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; + if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK && + 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 (isSuperActive(player)) - return; - if (!Kit.HasKit(player)) return;