more changes! :D

This commit is contained in:
fooify 2015-09-23 07:10:48 -07:00
parent 1f84907309
commit 0ad91a6b0b
3 changed files with 71 additions and 5 deletions

View File

@ -5,10 +5,12 @@ import java.util.Iterator;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilWorld;
public class MMMazes
{
@ -27,6 +29,7 @@ public class MMMazes
private ArrayList<Location> _centerSafeZone = new ArrayList<Location>();
private ArrayList<Location> _glassBounds = new ArrayList<Location>();
private ArrayList<Location> _safeZones = new ArrayList<Location>();
private Location _center;
@ -93,6 +96,48 @@ public class MMMazes
}
}
}
ArrayList<Location> locsToPickFrom = new ArrayList<>(_validSafePadSpawns);
int numberOfSafeZones = 4;
for(int i = 0; i < numberOfSafeZones; i++)
{
Location l = UtilAlg.Random(locsToPickFrom);
for(Block b : UtilBlock.getInBoundingBox(l.clone().add(1, 0, 1), l.clone().subtract(1, 0, 1), false))
{
_safeZones.add(b.getLocation());
}
for(Block b : UtilBlock.getInRadius(l.getBlock(), 6).keySet())
{
locsToPickFrom.remove(b.getLocation());
}
}
System.out.println("_safeZones.size() = " + _safeZones.size());
Iterator<Location> it = _maze.iterator();
while(it.hasNext())
{
Location lo = it.next();
if(_safeZones.contains(lo.getBlock().getLocation())) it.remove();
}
Iterator<Location> iter2 = _validSafePadSpawns.iterator();
removeLoop: while(iter2.hasNext())
{
Location l = iter2.next();
for(Location s : _safeZones)
{
if(UtilMath.offset2d(l, s) < 7)
{
iter2.remove();
continue removeLoop;
}
}
}
}
public void build()
@ -112,6 +157,12 @@ public class MMMazes
loc.getBlock().getRelative(BlockFace.DOWN).setType(Material.STAINED_GLASS);
loc.getBlock().getRelative(BlockFace.DOWN).setData((byte)8);
}
for(Location loc : _safeZones)
{
loc.getBlock().getRelative(BlockFace.DOWN).setType(Material.STAINED_GLASS);
loc.getBlock().getRelative(BlockFace.DOWN).setData((byte)8);
}
_built = true;
}

View File

@ -46,6 +46,7 @@ import mineplex.core.common.util.UtilTextTop;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.monstermaze.MMMazes.MazePreset;
import nautilus.game.arcade.game.games.monstermaze.MazeMobWaypoint.CardinalDirection;
import nautilus.game.arcade.game.games.monstermaze.kits.KitSmasher;
@ -117,7 +118,10 @@ public class Maze implements Listener
for(Player p : Host.GetPlayers(true))
{
p.setCompassTarget(_nextSafePadLoc);
UtilRadar.displayRadar(p, Arrays.asList(_safePadRadarData), false);
if(Host.GetState() == GameState.Live)
{
UtilRadar.displayRadar(p, Arrays.asList(_safePadRadarData), false);
}
}
}
@ -423,7 +427,19 @@ public class Maze implements Listener
private void pickNextLocForSafePad() // short method name
{
ArrayList<Location> goals = new ArrayList<Location>(_goals);
if(_oldSafePad != null) goals.remove(_oldSafePad.getLocation().clone().add(0, 1, 0));
if(_oldSafePad != null)
{
goals.clear();
for(Location loc : _goals)
{
if(UtilMath.offset2d(loc, _oldSafePad.getLocation()) > 60)
{
goals.add(loc);
}
}
}
System.out.println("Picking next goal from " + goals.size() + " goals.");
_nextSafePadLoc = UtilAlg.Random(goals);
_safePadRadarData = new RadarData(_nextSafePadLoc, '\u25A0' + "");
@ -520,7 +536,6 @@ public class Maze implements Listener
{
_oldSafePad.setCrackedProgress(-1);
_oldSafePad.destroy();
_oldSafePad = null;
if(_oldDisabledWaypoints.size() > 0)
{
@ -566,7 +581,6 @@ public class Maze implements Listener
if(_phaseTimer == 2)
{
pickNextLocForSafePad();
UtilFirework.playFirework(_nextSafePadLoc, Type.BALL, Color.ORANGE, false, false);
UtilTextMiddle.display("", C.cGold + C.Bold + _phaseTimer + "...", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()]));
}

View File

@ -156,6 +156,7 @@ public class MonsterMaze extends SoloGame
{
pl.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1000000000, 250));
pl.getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.AIR, (byte)0, 1, "" ));
if(_jumperData.containsKey(pl.getUniqueId())) _jumperData.remove(pl.getUniqueId());
}
if(GetPlayers(true).size() > 4)
{