Merge branch 'monster-maze' of

http://Mysticate@184.154.0.242:7990/scm/min/mineplex.git into
monster-maze

Conflicts:
	Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MMMazes.java
	Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java
	Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java
This commit is contained in:
Mysticate 2015-09-23 15:23:08 -04:00
commit 81e780d400
2 changed files with 72 additions and 2 deletions

View File

@ -3,10 +3,13 @@ package nautilus.game.arcade.game.games.monstermaze;
import java.util.ArrayList;
import java.util.Iterator;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
public class MMMazes
@ -26,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;
@ -92,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;
}
}
}
}
@SuppressWarnings("deprecation")
@ -125,6 +171,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

@ -25,6 +25,7 @@ import mineplex.core.common.util.UtilRadar;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
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.events.AbilityUseEvent;
@ -127,7 +128,13 @@ public class Maze implements Listener
for(Player p : Host.GetPlayers(true))
{
p.setCompassTarget(_nextSafePadLoc);
UtilRadar.displayRadar(p, Arrays.asList(_safePadRadarData), true);
if(Host.GetState() == GameState.Live)
{
UtilRadar.displayRadar(p, Arrays.asList(_safePadRadarData), false);
}
}
}
@ -436,7 +443,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' + "");
@ -535,7 +554,6 @@ public class Maze implements Listener
{
_oldSafePad.setCrackedProgress(-1);
_oldSafePad.destroy();
_oldSafePad = null;
if(_oldDisabledWaypoints.size() > 0)
{