Some scoreboard fixes

This commit is contained in:
Chiss 2013-09-26 12:38:32 +10:00
parent f0e6a7294e
commit 2a3d7426d5
4 changed files with 77 additions and 23 deletions

View File

@ -286,7 +286,7 @@ public class DragonEscape extends SoloGame
SortScores();
//Write New
for (int i=0 ; i<_ranks.size() ; i++)
for (int i=0 ; i<_ranks.size() && i<15 ; i++)
{
DragonScore score = _ranks.get(i);

View File

@ -50,8 +50,10 @@ public class HungerGames extends SoloGame
private ArrayList<Location> _redLocations = new ArrayList<Location>();
private int _spreadType = 0;
private String _spreadName = "";
private boolean _ignoreLiquids = true;
private ArrayList<Entry<Integer, Integer>> _spreadTypeBlocks;
private Location _spreadSafe = null;
private HashMap<Player, Long> _redOutTime = new HashMap<Player, Long>();
public HungerGames(ArcadeManager manager)
@ -80,7 +82,6 @@ public class HungerGames extends SoloGame
this.SpawnDistanceRequirement = 48;
this.Damage = false;
this.DamageSelf = true;
this.DamageTeamSelf = true;
@ -97,10 +98,12 @@ public class HungerGames extends SoloGame
if (_spreadType == 0)
{
_spreadName = "Red";
_spreadTypeBlocks.add(new AbstractMap.SimpleEntry<Integer, Integer>(159, 14));
}
else if (_spreadType == 1)
{
_spreadName = "Deep Freeze";
_ignoreLiquids = false;
_spreadTypeBlocks.add(new AbstractMap.SimpleEntry<Integer, Integer>(78, 0));
_spreadTypeBlocks.add(new AbstractMap.SimpleEntry<Integer, Integer>(79, 0));
@ -109,6 +112,7 @@ public class HungerGames extends SoloGame
}
else if (_spreadType == 2)
{
_spreadName = "Nether Corruption";
_spreadTypeBlocks.add(new AbstractMap.SimpleEntry<Integer, Integer>(87, 0));
_spreadTypeBlocks.add(new AbstractMap.SimpleEntry<Integer, Integer>(88, 0));
_spreadTypeBlocks.add(new AbstractMap.SimpleEntry<Integer, Integer>(89, 0));
@ -130,7 +134,7 @@ public class HungerGames extends SoloGame
event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, event.getBlock().getTypeId());
}
@EventHandler
//@EventHandler
public void CreateChests(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Recruit)
@ -327,27 +331,31 @@ public class HungerGames extends SoloGame
for (int x=WorldData.MinX ; x<=WorldData.MaxX ; x++)
{
block = WorldData.World.getHighestBlockAt(x, WorldData.MinZ);
while (!UtilBlock.solid(block))
while (!UtilBlock.solid(block) && block.getY() > 0)
block = block.getRelative(BlockFace.DOWN);
_redLocations.add(block.getLocation());
if (block.getY() > 0)
_redLocations.add(block.getLocation());
block = WorldData.World.getHighestBlockAt(x, WorldData.MaxZ);
while (!UtilBlock.solid(block))
while (!UtilBlock.solid(block) && block.getY() > 0)
block = block.getRelative(BlockFace.DOWN);
_redLocations.add(block.getLocation());
if (block.getY() > 0)
_redLocations.add(block.getLocation());
}
for (int z=WorldData.MinZ ; z<=WorldData.MaxZ ; z++)
{
block = WorldData.World.getHighestBlockAt(WorldData.MinX, z);
while (!UtilBlock.solid(block))
while (!UtilBlock.solid(block) && block.getY() > 0)
block = block.getRelative(BlockFace.DOWN);
_redLocations.add(block.getLocation());
if (block.getY() > 0)
_redLocations.add(block.getLocation());
block = WorldData.World.getHighestBlockAt(WorldData.MaxX, z);
while (!UtilBlock.solid(block))
while (!UtilBlock.solid(block) && block.getY() > 0)
block = block.getRelative(BlockFace.DOWN);
_redLocations.add(block.getLocation());
if (block.getY() > 0)
_redLocations.add(block.getLocation());
}
}
@ -417,9 +425,26 @@ public class HungerGames extends SoloGame
public boolean RedSpread(Block block)
{
//Liquid
if (_ignoreLiquids && block.isLiquid())
if (block.isLiquid())
{
return false;
if (_ignoreLiquids)
return false;
//Only freeze surface water
boolean surroundedByWater = true;
for (Block other : UtilBlock.getSurrounding(block, false))
{
if (other.getY() < block.getY())
continue;
if (!other.isLiquid() && !IsRed(other))
{
surroundedByWater = false;
break;
}
}
if (surroundedByWater)
return false;
}
//Pre-Red
@ -453,10 +478,14 @@ public class HungerGames extends SoloGame
}
//Inside Boundary
if (block.getChunk().getX() == 0 && block.getChunk().getZ() == 0)
if (_spreadSafe == null)
{
return false;
_spreadSafe = GetSpectatorLocation().clone();
_spreadSafe.setY(GetTeamList().get(0).GetSpawn().getY());
}
if (UtilMath.offset(_spreadSafe, block.getLocation()) < 32)
return false;
//Not Visible
if (!UtilBlock.isVisible(block))
@ -591,11 +620,23 @@ public class HungerGames extends SoloGame
if (near)
{
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.VOID, 1, false, true, false,
"Hunger Games", "Border");
player.sendMessage("INFECTION!");
if (!_redOutTime.containsKey(player))
{
_redOutTime.put(player, System.currentTimeMillis());
}
else
{
if (UtilTime.elapsed(_redOutTime.get(player), 5000))
{
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.VOID, 1, false, true, false,
"Hunger Games", _spreadName);
}
}
}
else
{
_redOutTime.remove(player);
}
}
}
@ -609,7 +650,7 @@ public class HungerGames extends SoloGame
if (!(event.GetProjectile() instanceof Snowball))
return;
event.AddMod("Snowball", "Snowball", 1, false);
event.AddMod("Snowball", _spreadName, 1, true);
event.AddKnockback("Snowball", 4);
}

View File

@ -30,6 +30,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.dragonescape.DragonScore;
import nautilus.game.arcade.game.games.quiver.kits.*;
import nautilus.game.arcade.kit.Kit;
@ -266,8 +267,10 @@ public class Quiver extends SoloGame
SortScores();
//Write New
for (QuiverScore score : _ranks)
for (int i=0 ; i<_ranks.size() && i<15 ; i++)
{
QuiverScore score = _ranks.get(i);
String out = score.Kills + " " + C.cGreen + score.Player.getName();
if (out.length() >= 16)

View File

@ -21,6 +21,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -360,8 +361,17 @@ public class SuperSmash extends SoloGame
if (event.IsCancelled())
return;
if (event.GetDamagerPlayer(true) != null)
UtilPlayer.hunger(event.GetDamagerPlayer(true), (int)(event.GetDamage()/2));
return;
Player damager = event.GetDamagerPlayer(true);
if (!Recharge.Instance.use(damager, "Hunger Restore", 250, false))
return;
int amount = Math.max(1, (int)(event.GetDamage()/2));
UtilPlayer.hunger(damager, amount);
}
}