Delay glass removal when obsidian is far away

On Lava Run, when obsidian is generated far away from the last
created obsidian block, a delay of 1 second will be added to the
total delay until the platform is removed, because normally glass
is removed very quick.
This commit is contained in:
Thanos Paravantis 2016-07-05 12:32:44 +03:00
parent d393ffcc51
commit dd55d96ccf

View File

@ -28,13 +28,31 @@ import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType;
*/
public class ChallengeLavaRun extends Challenge
{
// The starting size of the arena, stored to be used later in the code.
private int _arenaStartSize;
// The current obsidian block in the platform.
private Block _obsidian;
// The last obsidian location to detect if the new one is too far.
private Location _lastObsidianLocation;
// Keeps track of whether the obsidian should be moved or not.
private boolean _shouldMoveObsidian;
// The list of blocks - including osbidian - generated to make a platform.
private List<Block> _platform;
// The map height of the challenge.
private int _mapY = 4;
// The duration until the platform is regenerated/destroyed.
private long _delay;
// The minimum delay until the platform is destroyed.
private long _delayMin;
// The amount of blocks (or speed) disappearing.
private int _disappearingBlocks;
public ChallengeLavaRun(BawkBawkBattles host)
@ -90,6 +108,7 @@ public class ChallengeLavaRun extends Challenge
public void onEnd()
{
_obsidian = null;
_lastObsidianLocation = null;
_shouldMoveObsidian = false;
_platform.clear();
_delay = 0;
@ -119,6 +138,11 @@ public class ChallengeLavaRun extends Challenge
_delay = System.currentTimeMillis();
if (UtilMath.offset(_obsidian.getLocation(), _lastObsidianLocation) > 4) // Add 1 second if the obsidian is too far.
{
_delay += 1000;
}
if (_delayMin > 0)
{
_delayMin -= 100;
@ -133,6 +157,7 @@ public class ChallengeLavaRun extends Challenge
if (isPlatformEmpty())
{
_delay = System.currentTimeMillis() + 1500;
_lastObsidianLocation = _obsidian.getLocation();
_shouldMoveObsidian = true;
}
else
@ -262,7 +287,7 @@ public class ChallengeLavaRun extends Challenge
{
Block block = _platform.get(0);
if (!block.equals(_obsidian))
if (!block.equals(_obsidian)) // We do not want to remove the obsidian block.
{
_platform.remove(0);
resetBlock(block);