Improve Island rot and misc fixes
This commit is contained in:
parent
acd588ff1a
commit
4775fccb9a
@ -41,8 +41,8 @@ import nautilus.game.arcade.game.Game.GameState;
|
|||||||
*/
|
*/
|
||||||
public class BoosterRing extends Crumbleable implements Listener
|
public class BoosterRing extends Crumbleable implements Listener
|
||||||
{
|
{
|
||||||
private static int MAX_RING_BOUNDS = 15;
|
private static int MAX_RING_BOUNDS = 18;
|
||||||
private static int SEARCH_OUTER_RING_RANGE = 10;
|
private static int SEARCH_OUTER_RING_RANGE = 12;
|
||||||
|
|
||||||
private Game _host;
|
private Game _host;
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import java.util.HashSet;
|
|||||||
|
|
||||||
import net.minecraft.server.v1_8_R3.Chunk;
|
import net.minecraft.server.v1_8_R3.Chunk;
|
||||||
|
|
||||||
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -125,8 +126,6 @@ public abstract class Crumbleable
|
|||||||
|
|
||||||
crumblePercentage();
|
crumblePercentage();
|
||||||
|
|
||||||
Material material = replacements[UtilMath.r(replacements.length)];
|
|
||||||
|
|
||||||
if (_realBlocks.isEmpty())
|
if (_realBlocks.isEmpty())
|
||||||
{
|
{
|
||||||
crumbledAway();
|
crumbledAway();
|
||||||
@ -148,6 +147,7 @@ public abstract class Crumbleable
|
|||||||
|
|
||||||
for (int i = 0; i < blocks; i++)
|
for (int i = 0; i < blocks; i++)
|
||||||
{
|
{
|
||||||
|
Material material = replacements[UtilMath.r(replacements.length)];
|
||||||
if (_realBlocks.isEmpty())
|
if (_realBlocks.isEmpty())
|
||||||
{
|
{
|
||||||
crumbledAway();
|
crumbledAway();
|
||||||
@ -168,7 +168,16 @@ public abstract class Crumbleable
|
|||||||
|| toRemove.getBlock().getType() == Material.STATIONARY_LAVA)
|
|| toRemove.getBlock().getType() == Material.STATIONARY_LAVA)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MapUtil.ChunkBlockChange(toRemove, material.getId(), (byte) 0, false);
|
byte id = 0;
|
||||||
|
|
||||||
|
if (toRemove.getBlock().getType() == Material.STAINED_GLASS ||
|
||||||
|
toRemove.getBlock().getType() == Material.GLASS)
|
||||||
|
{
|
||||||
|
material = Material.STAINED_GLASS;
|
||||||
|
id = DyeColor.BLACK.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
MapUtil.ChunkBlockChange(toRemove, material.getId(), id, false);
|
||||||
_chunksToUpdate.add(((CraftChunk) toRemove.getChunk()).getHandle());
|
_chunksToUpdate.add(((CraftChunk) toRemove.getChunk()).getHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ public class Island extends Crumbleable
|
|||||||
if (UtilMath.offset2d(location, _location) > _bounds + 1)
|
if (UtilMath.offset2d(location, _location) > _bounds + 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (int y = ((int) (Math.round(_location.getY()) - _height)); y <= _location.getBlockY(); y++)
|
for (int y = (_location.getBlockY() - _height); y <= _location.getBlockY(); y++)
|
||||||
{
|
{
|
||||||
if (location.getBlockY() == y)
|
if (location.getBlockY() == y)
|
||||||
return true;
|
return true;
|
||||||
|
@ -42,6 +42,7 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import com.avaje.ebeaninternal.server.persist.dml.UpdatePlan;
|
||||||
import com.mineplex.anticheat.checks.move.Glide;
|
import com.mineplex.anticheat.checks.move.Glide;
|
||||||
import com.mineplex.anticheat.checks.move.HeadRoll;
|
import com.mineplex.anticheat.checks.move.HeadRoll;
|
||||||
import com.mineplex.anticheat.checks.move.Speed;
|
import com.mineplex.anticheat.checks.move.Speed;
|
||||||
@ -105,8 +106,10 @@ public abstract class Skyfall extends Game
|
|||||||
private static final long CHEST_REFILL_TIME = 1000*60*3; // 3 minutes
|
private static final long CHEST_REFILL_TIME = 1000*60*3; // 3 minutes
|
||||||
private static final long CHEST_REFILL_ANNOUNCE_TIME = 1000*60*3; // 3 minutes
|
private static final long CHEST_REFILL_ANNOUNCE_TIME = 1000*60*3; // 3 minutes
|
||||||
private static final long ELYTRA_TAKEAWAY = 1000;
|
private static final long ELYTRA_TAKEAWAY = 1000;
|
||||||
|
private static final int ROT_START = 256;
|
||||||
|
private static final int ROT_Y_OFFSET = 25;
|
||||||
|
|
||||||
private static final long ISLAND_ROT_TIME = 1000*60*5; // 3 Minutes
|
private static final long ISLAND_ROT_TIME = 1000*60*5; // 5 Minutes
|
||||||
|
|
||||||
private static final int RING_CRUMBLE_RATE = 10;
|
private static final int RING_CRUMBLE_RATE = 10;
|
||||||
|
|
||||||
@ -157,6 +160,8 @@ public abstract class Skyfall extends Game
|
|||||||
|
|
||||||
private boolean _supplyOpened;
|
private boolean _supplyOpened;
|
||||||
|
|
||||||
|
private double _rotY;
|
||||||
|
|
||||||
//private int _ringCrumbleRate;
|
//private int _ringCrumbleRate;
|
||||||
|
|
||||||
public Skyfall(ArcadeManager manager, GameType type)
|
public Skyfall(ArcadeManager manager, GameType type)
|
||||||
@ -238,6 +243,8 @@ public abstract class Skyfall extends Game
|
|||||||
|
|
||||||
_bigIslandBounds = 25;
|
_bigIslandBounds = 25;
|
||||||
_bigIslandHeight = 15;
|
_bigIslandHeight = 15;
|
||||||
|
|
||||||
|
_rotY = ROT_START;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -246,6 +253,9 @@ public abstract class Skyfall extends Game
|
|||||||
if(GetState() != GameState.Live)
|
if(GetState() != GameState.Live)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!UtilServer.isTestServer())
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.getMessage().contains("/Rate"))
|
if(event.getMessage().contains("/Rate"))
|
||||||
{
|
{
|
||||||
int rate = Integer.parseInt(event.getMessage().split(" ")[1]);
|
int rate = Integer.parseInt(event.getMessage().split(" ")[1]);
|
||||||
@ -255,6 +265,13 @@ public abstract class Skyfall extends Game
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(event.getMessage().contains("/Rot"))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(event.getPlayer(), "Current Rot value " + _rotY);
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(event.getMessage().contains("/Boost"))
|
if(event.getMessage().contains("/Boost"))
|
||||||
{
|
{
|
||||||
float rate = Float.parseFloat(event.getMessage().split(" ")[1]);
|
float rate = Float.parseFloat(event.getMessage().split(" ")[1]);
|
||||||
@ -398,55 +415,87 @@ public abstract class Skyfall extends Game
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void lowerRot(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SEC_05)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!IsLive())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_rotY <= (0 - ROT_Y_OFFSET))
|
||||||
|
return;
|
||||||
|
|
||||||
|
long startTime = GetStateTime() + MAP_CRUMBLE_DELAY;
|
||||||
|
//System.out.println("starttime " + startTime);
|
||||||
|
double current = System.currentTimeMillis() - startTime;
|
||||||
|
//System.out.println("current " + current);
|
||||||
|
|
||||||
|
double percentage = current/((double) ISLAND_ROT_TIME);
|
||||||
|
//System.out.println("precentage " + percentage);
|
||||||
|
double value = ROT_START * percentage;
|
||||||
|
//System.out.println("value " + value);
|
||||||
|
|
||||||
|
_rotY = (ROT_START - value);
|
||||||
|
}
|
||||||
|
|
||||||
public ArrayList<Island> islandCrumble()
|
public ArrayList<Island> islandCrumble()
|
||||||
{
|
{
|
||||||
ArrayList<Island> islands = new ArrayList<>();
|
ArrayList<Island> islands = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
for (Island island : _islands.get(_upperIsland).keySet())
|
for (Island island : _islands.get(_upperIsland).keySet())
|
||||||
{
|
{
|
||||||
if (island.isCrumbledAway())
|
if (island.isCrumbledAway())
|
||||||
islands.add(island);
|
islands.add(island);
|
||||||
|
|
||||||
Material[] mats = new Material[]{Material.COAL_BLOCK, Material.ENDER_STONE};
|
if (island.getLocation().getBlockY() < (_rotY + ROT_Y_OFFSET))
|
||||||
// if (island.getLocation().getBlockY() >= GetTeamList().get(0).GetSpawns().get(0).getBlockY())
|
continue;
|
||||||
// mats = new Material[] {Material.AIR};
|
|
||||||
|
|
||||||
if (!island.crumble(_islandCrumbleRate, mats))
|
island.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE);
|
||||||
{
|
|
||||||
return islands;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (_upperIsland.isCrumbledAway())
|
if (_upperIsland.isCrumbledAway())
|
||||||
islands.add(_upperIsland);
|
islands.add(_upperIsland);
|
||||||
|
|
||||||
if (!_upperIsland.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE))
|
|
||||||
|
if (_upperIsland.getLocation().getBlockY() > (_rotY + ROT_Y_OFFSET))
|
||||||
{
|
{
|
||||||
return islands;
|
if (_upperIsland.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE))
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while (!_upperIsland.getBoosterRing().isCrumbledAway())
|
|
||||||
{
|
{
|
||||||
_upperIsland.getBoosterRing().crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE);
|
while (!_upperIsland.getBoosterRing().isCrumbledAway())
|
||||||
|
{
|
||||||
|
_upperIsland.getBoosterRing().crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (Island island : _islands.get(_lowerIsland).keySet())
|
for (Island island : _islands.get(_lowerIsland).keySet())
|
||||||
{
|
{
|
||||||
if (island.isCrumbledAway())
|
if (island.isCrumbledAway())
|
||||||
islands.add(island);
|
islands.add(island);
|
||||||
|
|
||||||
if (!island.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE))
|
if (island.getLocation().getBlockY() < (_rotY + ROT_Y_OFFSET))
|
||||||
{
|
continue;
|
||||||
return islands;
|
|
||||||
}
|
island.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (_lowerIsland.isCrumbledAway())
|
if (_lowerIsland.isCrumbledAway())
|
||||||
islands.add(_lowerIsland);
|
islands.add(_lowerIsland);
|
||||||
|
|
||||||
if (_lowerIsland.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE))
|
if (_lowerIsland.getLocation().getBlockY() > (_rotY + ROT_Y_OFFSET))
|
||||||
{
|
{
|
||||||
while (!_lowerIsland.getBoosterRing().isCrumbledAway())
|
if (_lowerIsland.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE))
|
||||||
{
|
{
|
||||||
_lowerIsland.getBoosterRing().crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE);
|
while (!_lowerIsland.getBoosterRing().isCrumbledAway())
|
||||||
|
{
|
||||||
|
_lowerIsland.getBoosterRing().crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return islands;
|
return islands;
|
||||||
@ -932,6 +981,8 @@ public abstract class Skyfall extends Game
|
|||||||
|
|
||||||
if (_islandCrumbleRate < 1)
|
if (_islandCrumbleRate < 1)
|
||||||
_islandCrumbleRate = 1;
|
_islandCrumbleRate = 1;
|
||||||
|
|
||||||
|
_islandCrumbleRate = _islandCrumbleRate * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Island getCurrentIsland(Player player)
|
public Island getCurrentIsland(Player player)
|
||||||
|
Loading…
Reference in New Issue
Block a user