Dragon escape update

This commit is contained in:
Chiss 2013-10-09 21:50:39 +11:00
parent 1fc446ae13
commit ed804e3336
7 changed files with 81 additions and 251 deletions

View File

@ -288,28 +288,6 @@ public class GameTeam
_spawnDistance = value;
}
public void ReplaceReference(Player player)
{
Iterator<Player> playerIterator = _players.keySet().iterator();
PlayerState state = null;
while (playerIterator.hasNext())
{
Player cur = playerIterator.next();
if (!cur.getName().equals(player.getName()))
continue;
state = _players.get(cur);
playerIterator.remove();
}
if (state != null)
{
_players.put(player, state);
}
}
public void SetVisible(boolean b)
{
_visible = b;

View File

@ -58,8 +58,8 @@ public class DragonEscape extends SoloGame
new Kit[]
{
new KitLeaper(manager),
new KitDisruptor(manager),
new KitWarper(manager),
new KitDisruptor(manager)
},
new String[]
@ -100,7 +100,7 @@ public class DragonEscape extends SoloGame
}
//Ignore Close
if (bestDist < 6 && WorldData.GetDataLocs("BLACK").size() > 1)
if (bestDist < 3 && WorldData.GetDataLocs("BLACK").size() > 1)
{
System.out.println("Ignoring Node");
WorldData.GetDataLocs("BLACK").remove(best);
@ -202,7 +202,7 @@ public class DragonEscape extends SoloGame
}
//Shortcut
if (postNode - preNode >= 2)
if (postNode - preNode >= 3)
{
if (!_warpTime.containsKey(score.Player) || UtilTime.elapsed(_warpTime.get(score.Player), 1000))
{
@ -214,12 +214,16 @@ public class DragonEscape extends SoloGame
//Finish
if (GetWaypointIndex(player.getLocation()) == _waypoints.size() - 1)
{
//Only if NEAR end.
if (UtilMath.offset(player.getLocation(), _waypoints.get(_waypoints.size()-1)) < 3)
{
_winner = player;
this.SetCustomWinLine(player.getName() + " reached the end of the course!");
return true;
}
}
score.Score = playerScore;
return false;

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.dragonescape;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilWorld;
import org.bukkit.Location;
import org.bukkit.entity.EnderDragon;
@ -39,9 +40,9 @@ public class DragonEscapeData
Turn();
//Speed
double speed = 0.2;
double speed = 0.20;
speed += (System.currentTimeMillis() - Host.GetStateTime())/1000d * 0.001;
//speed += (System.currentTimeMillis() - Host.GetStateTime())/1000d * 0.001;
//Speed Distance Boost
/*
@ -65,6 +66,8 @@ public class DragonEscapeData
Location.setYaw(180 + UtilAlg.GetYaw(Velocity));
Dragon.teleport(Location);
System.out.println("Flying towards: " + UtilWorld.locToStrClean(Target));
}
private void Turn()

View File

@ -17,7 +17,7 @@ public class KitDisruptor extends Kit
{
public KitDisruptor(ArcadeManager manager)
{
super(manager, "Disruptor", KitAvailability.Blue,
super(manager, "Disruptor", KitAvailability.Green,
new String[]
{
@ -26,7 +26,7 @@ public class KitDisruptor extends Kit
new Perk[]
{
new PerkLeap("Leap", 1, 1, 8000, 2),
new PerkLeap("Leap", 1, 1, 8000, 3),
new PerkDisruptor(8, 2)
},
EntityType.ZOMBIE,

View File

@ -16,7 +16,7 @@ public class KitWarper extends Kit
{
public KitWarper(ArcadeManager manager)
{
super(manager, "Warper", KitAvailability.Green,
super(manager, "Warper", KitAvailability.Blue,
new String[]
{

View File

@ -17,6 +17,7 @@ import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.event.EventHandler;
@ -31,6 +32,7 @@ import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerLoginEvent;
@ -85,6 +87,7 @@ public class UHC extends TeamGame
private NautHashMap<String, Long> _deathTime = new NautHashMap<String, Long>();
private NautHashMap<String, Long> _rejoinTime = new NautHashMap<String, Long>();
private NautHashMap<String, GameTeam> _rejoinTeam = new NautHashMap<String, GameTeam>();
private NautHashMap<String, Long> _combatTime = new NautHashMap<String, Long>();
@ -222,13 +225,10 @@ public class UHC extends TeamGame
WorldData.World.setTime(2000);
//Kill Mobs
//Kill Evil Mobs
for (Entity ent : WorldData.World.getEntities())
{
if (!(ent instanceof LivingEntity))
continue;
if (ent instanceof Player)
if (!(ent instanceof Monster))
continue;
ent.remove();
@ -245,25 +245,6 @@ public class UHC extends TeamGame
}
}
@EventHandler
public void KillMobs(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
//Kill Mobs
for (Entity ent : WorldData.World.getEntities())
{
if (!(ent instanceof LivingEntity))
continue;
if (ent instanceof Player)
continue;
ent.remove();
}
}
@EventHandler
public void WorldBoundaryCheck(PlayerMoveEvent event)
{
@ -599,11 +580,13 @@ public class UHC extends TeamGame
GameTeam team = GetTeam(player);
if (team == null) return;
if (team.GetColor() == ChatColor.DARK_GRAY)
{
team.RemovePlayer(player);
if (!team.IsAlive(player))
return;
team.RemovePlayer(player);
if (team.GetColor() == ChatColor.DARK_GRAY)
return;
}
if (player.isDead())
return;
@ -614,17 +597,12 @@ public class UHC extends TeamGame
Announce(team.GetColor() + C.Bold + player.getName() + " was killed for disconnecting during combat.");
player.damage(5000);
team.SetPlayerState(player, PlayerState.OUT);
return;
}
if (!team.IsAlive(player))
{
team.RemovePlayer(player);
return;
}
//Store
_rejoinTime.put(player.getName(), System.currentTimeMillis());
_rejoinTeam.put(player.getName(), team);
GetLocationStore().put(player.getName(), player.getLocation());
//Announcement
@ -713,55 +691,32 @@ public class UHC extends TeamGame
rejoinIterator.remove();
//Get Team (By Name)
GameTeam team = GetTeam(name, false);
GameTeam team = _rejoinTeam.remove(name);
if (team != null)
{
Announce(team.GetColor() + C.Bold + name + " did not reconnent in time!");
team.SetPlayerState(team.GetPlayer(name), PlayerState.OUT);
}
}
}
@EventHandler(priority = EventPriority.LOW)
@EventHandler(priority = EventPriority.LOWEST)
public void PlayerLoginAllow(PlayerLoginEvent event)
{
if (!InProgress())
return;
//Get Team and OldPlayer
GameTeam team = null;
Player oldPlayer = null;
for (GameTeam curTeam : GetTeamList())
//Rejoined
GameTeam team = _rejoinTeam.remove(event.getPlayer().getName());
if (team != null && _rejoinTime.remove(event.getPlayer().getName()) != null)
{
for (Player curPlayer : curTeam.GetPlayers(true))
{
if (curPlayer.getName().equals(event.getPlayer().getName()))
{
oldPlayer = curPlayer;
team = curTeam;
break;
}
}
if (oldPlayer != null)
break;
}
if (team != null && oldPlayer != null)
{
team.ReplaceReference(event.getPlayer());
if (_rejoinTime.remove(oldPlayer.getName()) != null)
{
//Announcement
team.AddPlayer(event.getPlayer());
Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!");
return;
}
}
//Owner Bypass
if (Manager.GetClients().Get(event.getPlayer()).GetRank().Has(Rank.OWNER))
return;
//Disallow
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, ChatColor.YELLOW + "You cannot join this UHC.");
}
@ -872,6 +827,13 @@ public class UHC extends TeamGame
event.setCancelled(true);
}
@EventHandler
public void HeadPlaceCancel(BlockPlaceEvent event)
{
if (event.getItemInHand().getType() == Material.SKULL || event.getItemInHand().getType() == Material.SKULL_ITEM)
event.setCancelled(true);
}
@EventHandler
public void ConsumeHeadApple(PlayerItemConsumeEvent event)
{
@ -1122,23 +1084,6 @@ public class UHC extends TeamGame
}
}
/*
@EventHandler
public void TabHealth(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (!InProgress())
return;
for (Player player : GetPlayers(true))
{
_listHealth.getScore(player).setScore((int)player.getHealth());
}
}
*/
@EventHandler
public void HungerHurt(UpdateEvent event)
{
@ -1218,37 +1163,6 @@ public class UHC extends TeamGame
}
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
/*
for (GameTeam team : this.GetTeamList())
{
String name = team.GetColor() + team.GetName();
if (name.length() > 16)
name = name.substring(0, 16);
int health = 0;
for (Player player : team.GetPlayers(true))
{
health += (int)player.getHealth();
}
if (health <= 0)
{
GetScoreboard().resetScores(Bukkit.getOfflinePlayer(name));
continue;
}
Score score = GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(name));
score.setScore(health);
}
*/
}
@Override
public boolean CanJoinTeam(GameTeam team)
{
@ -1353,22 +1267,16 @@ public class UHC extends TeamGame
ArrayList<GameTeam> teamsAlive = new ArrayList<GameTeam>();
//Online Teams
for (GameTeam team : this.GetTeamList())
if (team.GetColor() != ChatColor.DARK_GRAY)
if (team.GetPlayers(true).size() > 0)
teamsAlive.add(team);
/*
{
for (Player player : team.GetPlayers(true))
{
if (player.isOnline())
{
//Offline Player Team
for (GameTeam team : _rejoinTeam.values())
if (team.GetColor() != ChatColor.DARK_GRAY)
teamsAlive.add(team);
break;
}
}
}
*/
if (teamsAlive.size() <= 1)
{
@ -1393,72 +1301,4 @@ public class UHC extends TeamGame
SetState(GameState.End);
}
}
/*
@EventHandler
public void PlayersDisplay(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
return;
for (GameTeam team : GetTeamList())
{
for (Player player : team.GetPlayers(false))
{
Announce(team.GetColor() + player.getName() + ": " + (IsAlive(player)));
}
}
}
private NautHashMap<Entity, Long> _portalTime = new NautHashMap<Entity, Long>();
private NautHashMap<Entity, Integer> _portalTick = new NautHashMap<Entity, Integer>();
@EventHandler
public void NetherPortal(EntityPortalEnterEvent event)
{
_portalTime.put(event.getEntity(), System.currentTimeMillis());
int ticks = 1;
if (_portalTick.containsKey(event.getEntity()))
ticks += _portalTick.get(event.getEntity());
_portalTick.put(event.getEntity(), ticks);
}
@EventHandler
public void NetherUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
Iterator<Entity> netherIterator = _portalTime.keySet().iterator();
while (netherIterator.hasNext())
{
Entity ent = netherIterator.next();
//Left Portal
if (UtilTime.elapsed(_portalTime.get(ent), 1000))
{
netherIterator.remove();
_portalTick.remove(ent);
continue;
}
int ticks = _portalTick.get(ent);
if (ticks < 80)
continue;
netherIterator.remove();
_portalTick.remove(ent);
Vector vec = ent.getLocation().toVector().multiply(1d/16d);
Block nether = vec.toLocation(UtilWorld.getWorldType(Environment.NETHER)).getBlock();
//ent.teleport(nether, TeleportCause.NETHER_PORTAL);
}
}
*/
}

View File

@ -6,6 +6,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState;
@ -89,6 +90,10 @@ public class GameChatManager implements Listener
else
{
globalMessage = true;
if (Manager.GetGame().GetType() == GameType.UHC && team.GetColor() == ChatColor.WHITE)
event.setFormat(dead + rankStr + ChatColor.YELLOW + "%1$s " + C.cWhite + "%2$s");
else
event.setFormat(dead + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s");
}
}