more edits to MM
- displaying more information - permanent safezones around the map - spawn now does not deteriorate, is permanent
This commit is contained in:
parent
549435224f
commit
9e3f87b71e
@ -1,9 +1,11 @@
|
||||
package nautilus.game.arcade.game.games.monstermaze;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
@ -17,7 +19,6 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Creeper;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Snowman;
|
||||
import org.bukkit.entity.Zombie;
|
||||
@ -30,9 +31,13 @@ import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEnum;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTextTop;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
@ -49,7 +54,8 @@ public class Maze implements Listener
|
||||
private HashSet<Block> _disabledWaypoints;
|
||||
private ArrayList<Location> _borders;
|
||||
|
||||
private Location _safeZoneCenter;
|
||||
private Location _center;
|
||||
|
||||
private ArrayList<Block> _safeZoneGlass = new ArrayList<>(); // game start safe zone stuff
|
||||
|
||||
private ArrayList<Location> _playerContainmentUnitLocations = new ArrayList<>(); // probably could use a longer variable name...
|
||||
@ -66,7 +72,7 @@ public class Maze implements Listener
|
||||
|
||||
private HashMap<Entity, MazeMobWaypoint> _ents = new HashMap<Entity, MazeMobWaypoint>();
|
||||
|
||||
public Maze(MonsterMaze host, ArrayList<Location> map, ArrayList<Location> spawns, ArrayList<Location> goals, Location safeZone, ArrayList<Location> _glassBounds)
|
||||
public Maze(MonsterMaze host, ArrayList<Location> map, ArrayList<Location> spawns, ArrayList<Location> goals, Location center, ArrayList<Location> _glassBounds)
|
||||
{
|
||||
Host = host;
|
||||
|
||||
@ -98,11 +104,11 @@ public class Maze implements Listener
|
||||
|
||||
for (Location loc : _glassBounds)
|
||||
{
|
||||
_playerContainmentUnitLocations.add(loc.clone().add(0, -1, 0));
|
||||
loc.getBlock().getRelative(BlockFace.DOWN).setType(Material.STAINED_GLASS);
|
||||
loc.getBlock().getRelative(BlockFace.DOWN).setData((byte)3);
|
||||
_playerContainmentUnitLocations.add(loc);
|
||||
loc.getBlock().setType(Material.STAINED_GLASS);
|
||||
loc.getBlock().setData((byte)3);
|
||||
}
|
||||
_safeZoneCenter = safeZone;
|
||||
_center = center;
|
||||
}
|
||||
|
||||
public void update()
|
||||
@ -115,18 +121,24 @@ public class Maze implements Listener
|
||||
bump();
|
||||
if(_phaseTimer <= -1)
|
||||
{
|
||||
UtilTextTop.display(C.cAqua + C.Bold + "Be the first player to get to the safe pad!", Host.GetPlayers(false).toArray(new Player[Host.GetPlayers(false).size()]));
|
||||
for(Player p : Host.GetPlayers(true))
|
||||
{
|
||||
p.setExp(0);
|
||||
}
|
||||
UtilTextTop.displayProgress(C.cAqua + C.Bold + "Be the first player to get to the Safe Pad!", 100, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()]));
|
||||
}
|
||||
else
|
||||
{
|
||||
double percentage = _phaseTimer/20d;
|
||||
for(Player p : Host.GetPlayers(true))
|
||||
{
|
||||
p.setExp((float)percentage);
|
||||
if(_safePad.isOn(p))
|
||||
{
|
||||
UtilTextTop.display(C.cGreen + C.Bold + "Stay on the safe pad for " + _phaseTimer + " more seconds!", p);
|
||||
UtilTextTop.displayProgress(C.cGreen + C.Bold + "Stay on the Safe Pad for " + _phaseTimer + " more seconds!", percentage, p);
|
||||
}
|
||||
else {
|
||||
UtilTextTop.display(C.cRed + C.Bold + "You have " + _phaseTimer + " seconds to get to the safe pad!", p);
|
||||
UtilTextTop.displayProgress(C.cRed + C.Bold + "You have " + _phaseTimer + " seconds to get to the Safe Pad!", percentage, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -293,7 +305,7 @@ public class Maze implements Listener
|
||||
Iterator<Location> iter = validSpawns.iterator();
|
||||
while (iter.hasNext()) {
|
||||
Location b = iter.next();
|
||||
if(UtilMath.offset(b, _safeZoneCenter) < 7.5)
|
||||
if(UtilMath.offset(b, _center) < 7.5)
|
||||
{
|
||||
iter.remove();
|
||||
}
|
||||
@ -366,7 +378,6 @@ public class Maze implements Listener
|
||||
|
||||
public void spawnSafePad()
|
||||
{
|
||||
System.out.println("creating safe pad");
|
||||
if(_safePad != null)
|
||||
{
|
||||
_oldSafePad = _safePad;
|
||||
@ -380,7 +391,6 @@ public class Maze implements Listener
|
||||
{
|
||||
for(Block b : _disabledWaypoints)
|
||||
{
|
||||
System.out.println("remove");
|
||||
_waypoints.add(b);
|
||||
}
|
||||
_disabledWaypoints.clear();
|
||||
@ -395,7 +405,6 @@ public class Maze implements Listener
|
||||
Block b = iter.next();
|
||||
if(UtilBlock.getInBoundingBox(_safePad.getLocation().clone().add(2, 0, 2), _safePad.getLocation().clone().add(-2, 0, -2)).contains(b.getRelative(BlockFace.DOWN)))
|
||||
{
|
||||
System.out.println("block");
|
||||
_disabledWaypoints.add(b);
|
||||
iter.remove();
|
||||
}
|
||||
@ -406,7 +415,7 @@ public class Maze implements Listener
|
||||
Entity e = it.next();
|
||||
if(_safePad.isOn(e))
|
||||
{
|
||||
System.out.println("ent");
|
||||
System.out.println("entity on newly spawned safepad removed");
|
||||
_ents.remove(_ents.get(e));
|
||||
it.remove();
|
||||
e.remove();
|
||||
@ -447,7 +456,7 @@ public class Maze implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
public void decrementZoneTime()
|
||||
/*public void decrementZoneTime()
|
||||
{
|
||||
if(_zoneDecayTimer == -1) return;
|
||||
|
||||
@ -476,33 +485,39 @@ public class Maze implements Listener
|
||||
{
|
||||
_padDecayTimer = -1;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public void decrementPhaseTime()
|
||||
{
|
||||
if(_phaseTimer == -1) return;
|
||||
/*if(_phaseTimer == -1)
|
||||
{
|
||||
_safePad = new SafePad(Host, this, UtilAlg.Random(_goals).clone().subtract(0,1,0));
|
||||
_safePad.build();
|
||||
UtilFirework.playFirework(_safePad.getLocation(), FireworkEffect.builder().withColor(Color.LIME).build());
|
||||
|
||||
Iterator<Block> iter = _waypoints.iterator();
|
||||
while (iter.hasNext()) {
|
||||
Block b = iter.next();
|
||||
if(UtilBlock.getInBoundingBox(_safePad.getLocation().clone().add(2, 0, 2), _safePad.getLocation().clone().add(-2, 0, -2)).contains(b.getRelative(BlockFace.DOWN)))
|
||||
{
|
||||
System.out.println("block");
|
||||
_disabledWaypoints.add(b);
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
_phaseTimer = 11;
|
||||
return;
|
||||
}*/
|
||||
|
||||
_phaseTimer--;
|
||||
|
||||
if(_phaseTimer == 15 || _phaseTimer == 10)
|
||||
{
|
||||
UtilTextMiddle.display("", C.cGray + C.Bold + _phaseTimer + " seconds to get to the Safe Zone!", 0, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()]));
|
||||
}
|
||||
|
||||
if(_phaseTimer == 5 || _phaseTimer == 4)
|
||||
{
|
||||
UtilTextMiddle.display("", C.cGreen + C.Bold + _phaseTimer + "...", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()]));
|
||||
}
|
||||
|
||||
if(_phaseTimer == 3)
|
||||
{
|
||||
UtilTextMiddle.display("", C.cYellow + C.Bold + _phaseTimer + "...", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()]));
|
||||
}
|
||||
|
||||
if(_phaseTimer == 2)
|
||||
{
|
||||
UtilTextMiddle.display("", C.cGold + C.Bold + _phaseTimer + "...", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()]));
|
||||
}
|
||||
|
||||
if(_phaseTimer == 1)
|
||||
{
|
||||
UtilTextMiddle.display("", C.cRed + _phaseTimer + "...", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()]));
|
||||
}
|
||||
|
||||
if(_phaseTimer == 0)
|
||||
{
|
||||
for(Player p : Host.GetPlayers(true))
|
||||
@ -510,14 +525,15 @@ public class Maze implements Listener
|
||||
if(_safePad.isOn(p))
|
||||
{
|
||||
// maybe send them a happy message? =)
|
||||
UtilPlayer.message(p, F.main("Game", C.cGreen + "Since you were on the safe pad, you didn't die!"));
|
||||
UtilPlayer.message(p, F.main("Game", C.cGreen + "Since you were on the Safe Pad, you didn't die!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Host.Manager.GetDamage().NewDamageEvent(p, null, null,
|
||||
DamageCause.CUSTOM, 500, false, false, false,
|
||||
"Game", "Map damage");
|
||||
UtilPlayer.message(p, F.main("Game", C.cRed + "You died because you weren't on the safe pad!"));
|
||||
UtilTextMiddle.display(C.cDRed + C.Bold + "Failure", C.cRed + "You didn't make it to the Safe Pad in time!", 5, 40, 5, p);
|
||||
UtilPlayer.message(p, F.main("Game", C.cRed + "You died because you weren't on the Safe Pad!"));
|
||||
}
|
||||
}
|
||||
spawn(15);
|
||||
@ -537,29 +553,38 @@ public class Maze implements Listener
|
||||
_playersOnPad.add(p);
|
||||
if(_playersOnPad.size() == 1) // first player
|
||||
{
|
||||
UtilTextMiddle.display(C.cGold + C.Bold + "AWESOME!", C.cGold + "You were the first to make it to the safe pad!", p);
|
||||
_phaseTimer = 21; // start the countdown
|
||||
|
||||
UtilTextMiddle.display(C.cGold + C.Bold + "AWESOME!", C.cGold + "You were the first to make it to the Safe Pad!", 5, 40, 5, p);
|
||||
p.playSound(p.getLocation(), Sound.SUCCESSFUL_HIT, 1.0f, 1.0f);
|
||||
_phaseTimer = 16;
|
||||
Host.Announce(C.cRed + C.Bold + p.getName() + " was the first to make it to the safe pad! Everyone not on the safe pad in 20 seconds will die!");
|
||||
UtilPlayer.message(p, F.main("Game", C.cGreen + "Great, you made it. Stay on the Safe Pad!"));
|
||||
|
||||
ArrayList<Player> pElse = Host.GetPlayers(false);
|
||||
pElse.remove(p);
|
||||
for(Player i : pElse)
|
||||
{
|
||||
UtilPlayer.message(i, C.cRed + C.Bold + p.getName() + " was the first to make it to the Safe Pad!");
|
||||
UtilPlayer.message(i, C.cRed + "Everyone not on the Safe Pad in 20 seconds will die!"); // I don't like this message
|
||||
}
|
||||
} else // not the first
|
||||
{
|
||||
p.playSound(p.getLocation(), Sound.SUCCESSFUL_HIT, 1.0f, 1.0f);
|
||||
UtilTextMiddle.display(C.cGreen + C.Bold + "Great!", C.cGreen + "Stay on the safe pad!", p);
|
||||
UtilTextMiddle.display(C.cGreen + C.Bold + "Great!", C.cGreen + "Stay on the Safe Pad!", 5, 40, 5, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setSafeZoneColor(byte data)
|
||||
/*private void setSafeZoneColor(byte data)
|
||||
{
|
||||
if(_safeZoneGlass.size() <= 0) return;
|
||||
for(Block bl : _safeZoneGlass)
|
||||
{
|
||||
bl.setData(data);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
private void destroySafeZone()
|
||||
/*private void destroySafeZone()
|
||||
{
|
||||
if(_safeZoneGlass.size() <= 0) return;
|
||||
for(Block bl : _safeZoneGlass)
|
||||
@ -567,7 +592,7 @@ public class Maze implements Listener
|
||||
bl.setType(Material.AIR);
|
||||
}
|
||||
_safeZoneGlass.clear();
|
||||
}
|
||||
}*/
|
||||
|
||||
public void removePlayerContainmentUnit()
|
||||
{
|
||||
@ -577,24 +602,6 @@ public class Maze implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
public void createSafeZone()
|
||||
{
|
||||
System.out.println("creating safe zone");
|
||||
_safeZoneGlass = UtilBlock.getInBoundingBox(_safeZoneCenter.clone().add(5, 0, 5), _safeZoneCenter.clone().add(-5, 0, -5), false);
|
||||
Iterator<Block> iter = _safeZoneGlass.iterator();
|
||||
while (iter.hasNext()) {
|
||||
Block b = iter.next();
|
||||
if(b.getType() == Material.AIR)
|
||||
{
|
||||
b.setType(Material.STAINED_GLASS);
|
||||
b.setData((byte)5);
|
||||
}
|
||||
else iter.remove();
|
||||
}
|
||||
|
||||
// TODO bounds
|
||||
}
|
||||
|
||||
public Set<Entity> getMonsters()
|
||||
{
|
||||
return _ents.keySet();
|
||||
|
@ -17,7 +17,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.snowsprint.kits.KitHyper;
|
||||
import nautilus.game.arcade.game.games.monstermaze.kits.KitHyper;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class MonsterMaze extends SoloGame
|
||||
@ -62,10 +62,10 @@ public class MonsterMaze extends SoloGame
|
||||
if(event.GetState() == GameState.Prepare)
|
||||
{
|
||||
//if(WorldData.MapName.contains("MonsterTest")) _monsterType = EntityType.CREEPER;
|
||||
_maze.spawnSafePad();
|
||||
}
|
||||
else if(event.GetState() == GameState.Live)
|
||||
{
|
||||
_maze.spawnSafePad();
|
||||
_maze.removePlayerContainmentUnit();
|
||||
}
|
||||
else if(event.GetState() == GameState.Recruit)
|
||||
@ -74,8 +74,7 @@ public class MonsterMaze extends SoloGame
|
||||
_maze = new Maze(this, WorldData.GetDataLocs("GRAY"), WorldData.GetDataLocs("YELLOW"), WorldData.GetDataLocs("RED"), WorldData.GetDataLocs("ORANGE").get(0), WorldData.GetDataLocs("PINK"));
|
||||
|
||||
UtilServer.getServer().getPluginManager().registerEvents(_maze, getArcadeManager().getPlugin());
|
||||
_maze.createSafeZone();
|
||||
_maze.fillSpawn(200);
|
||||
_maze.fillSpawn(150);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +94,6 @@ public class MonsterMaze extends SoloGame
|
||||
if(!IsLive()) return;
|
||||
_maze.decrementPhaseTime();
|
||||
_maze.decrementSafePadTime();
|
||||
_maze.decrementZoneTime();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.game.games.snowsprint.kits;
|
||||
package nautilus.game.arcade.game.games.monstermaze.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
Loading…
Reference in New Issue
Block a user