From 34521eef8f1f1de20da9fd9911b31f94fbc9ab2a Mon Sep 17 00:00:00 2001 From: Chiss Date: Fri, 27 Sep 2013 17:08:32 +1000 Subject: [PATCH] minor game fixes portal method in StackerManager.java --- .../mineplex/hub/modules/StackerManager.java | 40 ++++++++++++++++- .../game/arcade/game/games/bridge/Bridge.java | 2 +- .../game/games/dragonescape/DragonEscape.java | 11 +++-- .../games/dragonescape/DragonEscapeData.java | 43 ++++++++----------- .../game/games/turfforts/TurfForts.java | 4 +- 5 files changed, 68 insertions(+), 32 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java index eae333a37..e02fb28f5 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java @@ -1,5 +1,6 @@ package mineplex.hub.modules; +import java.util.HashMap; import java.util.HashSet; import org.bukkit.GameMode; @@ -27,6 +28,7 @@ import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; @@ -44,6 +46,8 @@ public class StackerManager extends MiniPlugin implements IThrown private HashSet _disabled = new HashSet(); private HashSet _tempStackShift = new HashSet(); + private HashMap _portalTime = new HashMap(); + public StackerManager(HubManager manager) { super("Stacker", manager.GetPlugin()); @@ -91,6 +95,7 @@ public class StackerManager extends MiniPlugin implements IThrown { _disabled.remove(event.getPlayer().getName()); _tempStackShift.remove(event.getPlayer()); + _portalTime.remove(event.getPlayer().getName()); } @EventHandler @@ -163,13 +168,17 @@ public class StackerManager extends MiniPlugin implements IThrown if (!Recharge.Instance.use(stacker, "Stacker", 500, true)) return; - + top.setPassenger(stackee); UtilPlayer.message(stacker, F.main("Stacker", "You stacked " + F.name(UtilEnt.getName(stackee) + "."))); UtilPlayer.message(stackee, F.main("Stacker", "You were stacked by " + F.name(stacker.getName() + "."))); UtilPlayer.message(stackee, F.main("Stacker", "Push " + F.skill("Crouch") + " to escape!")); + //Portal Delay + SetPortalDelay(stacker); + SetPortalDelay(stackee); + event.setCancelled(true); } @@ -225,6 +234,10 @@ public class StackerManager extends MiniPlugin implements IThrown UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false); _projectileManager.AddThrow(throwee, thrower, this, -1, true, false, true, false, 2.4d); + + //Portal Delay + SetPortalDelay(thrower); + SetPortalDelay(throwee); } @Override @@ -239,6 +252,9 @@ public class StackerManager extends MiniPlugin implements IThrown Entity rider = target.getPassenger(); while (rider != null) { + //Portal Delay + SetPortalDelay(rider); + rider.leaveVehicle(); rider.setVelocity(new Vector(0.25 - Math.random()/2, Math.random()/2, 0.25 - Math.random()/2)); rider = rider.getPassenger(); @@ -248,6 +264,9 @@ public class StackerManager extends MiniPlugin implements IThrown //Effect data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT, 1f, 1f); + + //Portal Delay + SetPortalDelay(target); } @Override @@ -261,4 +280,23 @@ public class StackerManager extends MiniPlugin implements IThrown { } + + public void SetPortalDelay(Entity ent) + { + if (ent instanceof Player) + _portalTime.put(((Player)ent).getName(), System.currentTimeMillis()); + } + + public boolean CanPortal(Player player) + { + //Riding + if (player.getVehicle() != null || player.getPassenger() != null) + return false; + + //Portal Delay + if (!_portalTime.containsKey(player.getName())) + return true; + + return UtilTime.elapsed(_portalTime.get(player.getName()), 5000); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index 764df4855..8d369bcef 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -58,7 +58,7 @@ import nautilus.game.arcade.ore.OreObsfucation; public class Bridge extends TeamGame implements OreObsfucation { //Bridge Timer - private int _bridgeTime = 600000; + private int _bridgeTime = 15000; private boolean _bridgesDown = false; //Wood Bridge diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java index 37bcd6661..8ce83b23a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java @@ -111,6 +111,9 @@ public class DragonEscape extends SoloGame last = best; } + + if (WorldData.MapName.contains("Hell")) + this.WorldTimeSet = 16000; } @EventHandler @@ -165,13 +168,15 @@ public class DragonEscape extends SoloGame if (SetScore(player, playerScore)) return; - if (player.getLocation().getY() < 50) - player.damage(50); - if (dragonScore > playerScore) player.damage(50); } } + + public ArrayList GetScores() + { + return _ranks; + } public boolean SetScore(Player player, double playerScore) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeData.java index 11542178c..b1ffb556c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeData.java @@ -1,11 +1,9 @@ package nautilus.game.arcade.game.games.dragonescape; import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilMath; import org.bukkit.Location; import org.bukkit.entity.EnderDragon; -import org.bukkit.entity.Player; import org.bukkit.util.Vector; public class DragonEscapeData @@ -13,19 +11,19 @@ public class DragonEscapeData public DragonEscape Host; public EnderDragon Dragon; - + public Location Target = null; public Location Location = null; public float Pitch = 0; public Vector Velocity = new Vector(0,0,0); - + public DragonEscapeData(DragonEscape host, EnderDragon dragon, Location target) { Host = host; Dragon = dragon; - + Location temp = dragon.getLocation(); temp.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(dragon.getLocation(), target))); dragon.teleport(temp); @@ -35,32 +33,27 @@ public class DragonEscapeData Location = dragon.getLocation(); } - + public void Move() { Turn(); - - //Distance Boost - double dist = 0; - for (Player player : Host.GetPlayers(true)) - { - double offset = UtilMath.offset(Location, player.getLocation()); - - if (offset < dist || dist == -1) - { - dist = offset; - } - } - //Speed - double speed = 0.16; //+ (System.currentTimeMillis() - Host.GetStateTime())/2000000d; - + double speed = 0.16; + speed += (System.currentTimeMillis() - Host.GetStateTime())/1000d * 0.001; - - if (dist > 10) - speed += (dist-10) * 0.001; - + + //Speed Distance Boost + if (!Host.GetScores().isEmpty()) + { + double score = Host.GetScore(Dragon); + double best = Host.GetScores().get(0).Score; + + double lead = (best-score)/10000d; + + speed += lead * 0.0025; + } + Location.add(Velocity.clone().multiply(speed)); Location.add(0, -Pitch, 0); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index 72b65417b..3395f5490 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -608,11 +608,11 @@ public class TurfForts extends TeamGame if (!IsLive()) return; - if (GetRedLines() == 0) + if (GetRedLines() == 0 || GetTeam(ChatColor.RED).GetPlayers(true).size() == 0) { AnnounceEnd(GetTeam(ChatColor.AQUA)); } - else if (GetBlueLines() == 0) + else if (GetBlueLines() == 0 || GetTeam(ChatColor.AQUA).GetPlayers(true).size() == 0) { AnnounceEnd(GetTeam(ChatColor.RED)); }