Change some more loot, not weapon doubles, 25% more boost from booster rings, fixed decay times for rings, let the complete surface of islands rot at once, specific items come with another item and a dynamic rot rate

This commit is contained in:
Sarah 2017-03-24 18:04:44 +01:00
parent f8f7c04f58
commit b389041392
4 changed files with 116 additions and 26 deletions

View File

@ -1,14 +1,21 @@
package nautilus.game.arcade.game.games.skyfall;
import java.util.ArrayList;
import java.util.HashSet;
import net.minecraft.server.v1_8_R3.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_8_R3.CraftChunk;
import org.bukkit.entity.Player;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
/**
* Crumbleable is a Superclass to create decayable/crumleable Objects like Sky Islands
@ -17,14 +24,19 @@ import mineplex.core.common.util.UtilMath;
*/
public abstract class Crumbleable
{
private static final long CHUNK_CRUMBLE_DELAY = 1000;
private boolean _crumble;
private ArrayList<Location> _initBlocks;
private ArrayList<Location> _realBlocks;
private HashSet<Chunk> _chunksToUpdate;
private boolean _onlyTop;
private int _height;
private long _lastChunk;
public Crumbleable()
{
this(false, 0);
@ -36,6 +48,9 @@ public abstract class Crumbleable
_height = height;
_realBlocks = new ArrayList<>();
_chunksToUpdate = new HashSet<>();
_lastChunk = System.currentTimeMillis();
}
/**
@ -114,6 +129,19 @@ public abstract class Crumbleable
if (_realBlocks.isEmpty())
{
crumbledAway();
if (!_chunksToUpdate.isEmpty())
{
if (UtilTime.elapsed(_lastChunk, CHUNK_CRUMBLE_DELAY))
{
Chunk chunk = _chunksToUpdate.iterator().next();
_chunksToUpdate.remove(chunk);
for (Player player : UtilServer.getPlayers())
{
MapUtil.SendChunkForPlayer(chunk, player);
}
_lastChunk = System.currentTimeMillis();
}
}
return true;
}
@ -139,8 +167,10 @@ public abstract class Crumbleable
|| toRemove.getBlock().getType() == Material.STATIONARY_LAVA)
continue;
MapUtil.QuickChangeBlockAt(toRemove, material);
MapUtil.ChunkBlockChange(toRemove, material.getId(), (byte) 0, false);
_chunksToUpdate.add(((CraftChunk) toRemove.getChunk()).getHandle());
}
return false;
}

View File

@ -11,6 +11,7 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.loot.ChestLoot;
@ -95,7 +96,7 @@ public class Island extends Crumbleable
Inventory inventory = chest.getBlockInventory();
inventory.clear();
int items = 6;
int items = 5;
if (Math.random() > 0.50)
items++;
if (Math.random() > 0.65)
@ -109,15 +110,14 @@ public class Island extends Crumbleable
for (int i = 0; i < items; i++)
{
int trys = 0;
int slot = UtilMath.r(27);
int slot = UtilMath.r(26);
while (inventory.getItem(slot) != null && trys <= 5)
{
trys++;
slot = UtilMath.r(27);
slot = UtilMath.r(26);
}
ItemStack item = _loot.getLoot(exclude);
exclude.add(item.getType());
inventory.setItem(slot, item);
if (item.getType() == Material.DIAMOND)
{
@ -127,6 +127,56 @@ public class Island extends Crumbleable
{
inventory.setItem(slot + 1, new ItemStack(Material.ARROW, UtilMath.r(6) + 1));
}
if (UtilItem.isHelmet(item))
{
exclude.add(Material.CHAINMAIL_HELMET);
exclude.add(Material.GOLD_HELMET);
exclude.add(Material.IRON_HELMET);
exclude.add(Material.LEATHER_HELMET);
exclude.add(Material.DIAMOND_HELMET);
}
if (UtilItem.isChestplate(item))
{
exclude.add(Material.CHAINMAIL_CHESTPLATE);
exclude.add(Material.GOLD_CHESTPLATE);
exclude.add(Material.IRON_CHESTPLATE);
exclude.add(Material.LEATHER_CHESTPLATE);
exclude.add(Material.DIAMOND_CHESTPLATE);
}
if (UtilItem.isLeggings(item))
{
exclude.add(Material.CHAINMAIL_LEGGINGS);
exclude.add(Material.GOLD_LEGGINGS);
exclude.add(Material.IRON_LEGGINGS);
exclude.add(Material.LEATHER_LEGGINGS);
exclude.add(Material.DIAMOND_LEGGINGS);
}
if (UtilItem.isBoots(item))
{
exclude.add(Material.CHAINMAIL_BOOTS);
exclude.add(Material.GOLD_BOOTS);
exclude.add(Material.IRON_BOOTS);
exclude.add(Material.LEATHER_BOOTS);
exclude.add(Material.DIAMOND_BOOTS);
}
if (UtilItem.isSword(item))
{
exclude.add(Material.WOOD_SWORD);
exclude.add(Material.STONE_SWORD);
exclude.add(Material.IRON_SWORD);
exclude.add(Material.DIAMOND_SWORD);
}
if (UtilItem.isAxe(item))
{
exclude.add(Material.WOOD_AXE);
exclude.add(Material.STONE_AXE);
exclude.add(Material.IRON_AXE);
exclude.add(Material.DIAMOND_AXE);
}
if (item.getType() == Material.BOW)
exclude.add(Material.BOW);
}
}

View File

@ -25,7 +25,6 @@ public class LootTable
new RandomItem(Material.COOKED_CHICKEN, 30, 1, 2),
new RandomItem(Material.CARROT_ITEM, 30, 1, 3),
new RandomItem(Material.MUSHROOM_SOUP, 15, 1, 1),
new RandomItem(Material.WHEAT, 30, 1, 6),
new RandomItem(Material.APPLE, 30, 1, 4),
new RandomItem(Material.ROTTEN_FLESH, 40, 1, 6),

View File

@ -46,7 +46,6 @@ 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;
@ -73,8 +72,6 @@ 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;
@ -84,8 +81,6 @@ 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;
@ -99,17 +94,18 @@ import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker;
*/
public abstract class Skyfall extends Game
{
private static final long MAP_CRUMBLE_DELAY = 1000*60*2; // 2 Minutes
private static final long MAP_CRUMBLE_DELAY = 1000*20; // 2 Minutes
private static final long RING_CRUMBLE_DELAY = 1000*60*2; // 2 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 ELYTRA_TAKEAWAY = 1000;
private static final long ISLAND_ROT_TIME = 1000*60*5; // 3 Minutes
private static final int RING_CRUMBLE_RATE = 3;
private static final int RING_CRUMBLE_RATE = 10;
private static final float RING_BOOST_STRENGTH = 2.5F;
private static final float BIG_RING_BOOST_STRENGTH = 3.5F;
private static final float RING_BOOST_STRENGTH = 3.25F;
private static final float BIG_RING_BOOST_STRENGTH = 4.3F;
private static final long BOOSTER_COOLDOWN_TIME = 1000*20; // 20 Seconds
@ -295,10 +291,9 @@ public abstract class Skyfall extends Game
_chestsRefilled = System.currentTimeMillis();
_refillAnnounced = false;
_upperIsland.refillChests();
_lowerIsland.refillChests();
Announce(ChatColor.AQUA + "" + ChatColor.BOLD + "Chests on the middle Islands have been refilled!", true);
Announce(ChatColor.AQUA + "" + ChatColor.BOLD + "Chests on the lower middle Island have been refilled!", true);
}
@EventHandler
@ -387,7 +382,7 @@ public abstract class Skyfall extends Game
ArrayList<Island> islands = new ArrayList<>();
for (Island island : _islands.get(_upperIsland).keySet())
{
if (island.crumblePercentage() <= 0.5)
if (island.isCrumbledAway())
islands.add(island);
Material[] mats = new Material[]{Material.COAL_BLOCK, Material.ENDER_STONE};
@ -399,7 +394,7 @@ public abstract class Skyfall extends Game
return islands;
}
}
if (_upperIsland.crumblePercentage() <= 0.5)
if (_upperIsland.isCrumbledAway())
islands.add(_upperIsland);
if (!_upperIsland.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE))
@ -416,7 +411,7 @@ public abstract class Skyfall extends Game
}
for (Island island : _islands.get(_lowerIsland).keySet())
{
if (island.crumblePercentage() <= 0.5)
if (island.isCrumbledAway())
islands.add(island);
if (!island.crumble(_islandCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE))
@ -424,7 +419,7 @@ public abstract class Skyfall extends Game
return islands;
}
}
if (_lowerIsland.crumblePercentage() <= 0.5)
if (_lowerIsland.isCrumbledAway())
islands.add(_lowerIsland);
_currentCrumble = (_lowerIsland.getLocation().getBlockY() - _lowerIsland.getHeight());
@ -507,19 +502,35 @@ public abstract class Skyfall extends Game
@EventHandler
public void ringCrumble(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (!UtilTime.elapsed(GetStateTime(), MAP_CRUMBLE_DELAY))
if (event.getType() != UpdateType.TICK)
return;
for (BoosterRing ring : _boosterRings)
{
if (ring.getMiddle().getBlockY() < _currentCrumble)
if (!UtilTime.elapsed(GetStateTime(), RING_CRUMBLE_DELAY))
return;
if (ring.getMiddle().getBlockY() > (_upperIsland.getLocation().getBlockY() - (_upperIsland.getHeight()*2)))
{
if (!ring.crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE))
break;
}
if (!UtilTime.elapsed(GetStateTime(), (RING_CRUMBLE_DELAY*2)))
continue;
if (ring.getMiddle().getBlockY() > (_lowerIsland.getLocation().getBlockY() - (_lowerIsland.getHeight()*2)))
{
if (!ring.crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE))
break;
}
if (!UtilTime.elapsed(GetStateTime(), (RING_CRUMBLE_DELAY*3)))
continue;
if (!ring.crumble(RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE))
break;
}
}