Change block rates and add Rate command

This commit is contained in:
Sarah 2017-03-15 21:30:48 +01:00
parent 1a061f6e2f
commit 4f9cf987bd
2 changed files with 46 additions and 18 deletions

View File

@ -355,6 +355,9 @@ public class BoosterRing extends Crumbleable implements Listener
if (!_disabled)
return;
if (isCrumbling())
return;
double blocks = (double) _ring.size() / (double)(_disabledFor/1000);
_blocksToFill += blocks;

View File

@ -33,6 +33,7 @@ import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemStack;
@ -45,6 +46,7 @@ import com.mineplex.anticheat.checks.move.Speed;
import mineplex.core.Managers;
import mineplex.core.antihack.AntiHack;
import mineplex.core.common.MinecraftVersion;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
@ -71,6 +73,8 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.skyfall.kits.KitAeronaught;
import nautilus.game.arcade.game.games.skyfall.kits.KitBooster;
import nautilus.game.arcade.game.games.skyfall.kits.KitDeadeye;
@ -80,6 +84,8 @@ import nautilus.game.arcade.game.games.skyfall.kits.KitStunner;
import nautilus.game.arcade.game.games.skyfall.stats.AeronaughtStatTracker;
import nautilus.game.arcade.game.games.skyfall.stats.RingStatTracker;
import nautilus.game.arcade.game.games.survivalgames.SupplyChestOpenEvent;
import nautilus.game.arcade.game.games.typewars.Minion;
import nautilus.game.arcade.game.games.typewars.MinionSize;
import nautilus.game.arcade.game.modules.VersionModule;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker;
@ -100,8 +106,9 @@ public abstract class Skyfall extends Game
private static final long RING_ROT_TIME = 1000*60*3; // 3 Minutes
private static final int ISLAND_CRUMBLE_RATE = 7;
private static final int BIG_ISLAND_CRUMBLE_RATE = 5;
private static int ISLAND_CRUMBLE_RATE = 20;
private static int BIG_ISLAND_CRUMBLE_RATE = 20;
private static final int RING_CRUMBLE_RATE = 3;
private static final float RING_BOOST_STRENGTH = 2.5F;
private static final float BIG_RING_BOOST_STRENGTH = 3.5F;
@ -149,7 +156,7 @@ public abstract class Skyfall extends Game
private int _currentCrumble = 300;
private boolean _supplyOpened;
private int _ringCrumbleRate;
//private int _ringCrumbleRate;
public Skyfall(ArcadeManager manager, GameType type)
{
@ -228,6 +235,24 @@ public abstract class Skyfall extends Game
_bigIslandHeight = 15;
}
@EventHandler
public void testCommands(PlayerCommandPreprocessEvent event)
{
if(GetState() != GameState.Live)
return;
if(event.getMessage().contains("/Rate"))
{
int rate = Integer.parseInt(event.getMessage().split(" ")[1]);
ISLAND_CRUMBLE_RATE = rate;
BIG_ISLAND_CRUMBLE_RATE = rate;
UtilPlayer.message(event.getPlayer(), "Crumble rate changed to " + rate);
event.setCancelled(true);
return;
}
}
@EventHandler
public void gameStart(GameStateChangeEvent event)
{
@ -380,14 +405,14 @@ public abstract class Skyfall extends Game
if (!_upperIsland.crumble(BIG_ISLAND_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE))
{
_currentCrumble = _upperIsland.getLocation().getBlockY();
_currentCrumble = (_upperIsland.getLocation().getBlockY() - _upperIsland.getHeight());
return islands;
}
else
{
while (!_upperIsland.getBoosterRing().isCrumbledAway())
{
_upperIsland.getBoosterRing().crumble(_ringCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE);
_upperIsland.getBoosterRing().crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE);
}
}
for (Island island : _islands.get(_lowerIsland).keySet())
@ -403,12 +428,12 @@ public abstract class Skyfall extends Game
if (_lowerIsland.crumblePercentage() <= 0.5)
islands.add(_lowerIsland);
_currentCrumble = _lowerIsland.getLocation().getBlockY();
_currentCrumble = (_lowerIsland.getLocation().getBlockY() - _lowerIsland.getHeight());
if (_lowerIsland.crumble(BIG_ISLAND_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE))
{
while (!_lowerIsland.getBoosterRing().isCrumbledAway())
{
_lowerIsland.getBoosterRing().crumble(_ringCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE);
_lowerIsland.getBoosterRing().crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE);
}
_currentCrumble = 0;
}
@ -483,7 +508,7 @@ public abstract class Skyfall extends Game
@EventHandler
public void ringCrumble(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
if (event.getType() != UpdateType.FAST)
return;
if (!UtilTime.elapsed(GetStateTime(), MAP_CRUMBLE_DELAY))
@ -491,10 +516,10 @@ public abstract class Skyfall extends Game
for (BoosterRing ring : _boosterRings)
{
// if (ring.getMiddle().getBlockY() < _currentCrumble)
// continue;
if (ring.getMiddle().getBlockY() < _currentCrumble)
continue;
if (!ring.crumble(_ringCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE))
if (!ring.crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE))
break;
}
}
@ -715,7 +740,7 @@ public abstract class Skyfall extends Game
public void registerBoosters()
{
int blocks = 0;
//int blocks = 0;
ArrayList<Location> boosters = WorldData.GetDataLocs("ORANGE");
for (Location boosterMid : boosters)
{
@ -733,12 +758,12 @@ public abstract class Skyfall extends Game
ring.setBoostStrength(BIG_RING_BOOST_STRENGTH);
}
blocks += ring.getBlocks().size();
int secs = (int) (RING_ROT_TIME / 1000);
_ringCrumbleRate = blocks / secs;
if (_ringCrumbleRate < 1)
_ringCrumbleRate = 1;
// blocks += ring.getBlocks().size();
// int secs = (int) (RING_ROT_TIME / 1000);
// _ringCrumbleRate = blocks / secs;
//
// if (_ringCrumbleRate < 1)
// _ringCrumbleRate = 1;
_boosterRings.add(ring);
}