Several updates and bug fixes. Evolution of Combat rework (See ChallengeNewEvolutionOfCombat).

This commit is contained in:
Thanos paravantis 2015-11-06 20:25:38 +02:00
parent 5c2c5ab280
commit 7009e46693
4 changed files with 155 additions and 32 deletions

View File

@ -28,7 +28,12 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.holeinwall.KitNormal;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeAnvilDance;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBlockRunner;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeEvolutionOfCombat;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeFallingBlocks;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeFastFood;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeNewEvolutionOfCombat;
import nautilus.game.arcade.game.games.mineware.events.challengeEndEvent;
import nautilus.game.arcade.kit.Kit;
@ -143,7 +148,8 @@ public class MineWare extends SoloGame implements IThrown
public void PopulateOrders()
{
_challenges.add(ChallengeFastFood.class);
_challenges.add(ChallengeNewEvolutionOfCombat.class);
// _challenges.add(ChallengeFastFood.class);
// _challenges.add(ChallengeEvolutionOfCombat.class);
// _challenges.add(ChallengeBlockRunner.class);
// _challenges.add(ChallengeAnvilDance.class);

View File

@ -109,7 +109,6 @@ public class ChallengeBlockRunner extends Challenge
}
}
@SuppressWarnings("deprecation")
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
@ -162,37 +161,11 @@ public class ChallengeBlockRunner extends Challenge
// Third Check
// Checking if the player is trying to make a tower up to the sky.
Block bottom1 = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
Block bottom2 = bottom1.getRelative(BlockFace.DOWN);
Block bottom3 = bottom2.getRelative(BlockFace.DOWN);
if(!bottom1.isEmpty() && !bottom2.isEmpty() && !bottom3.isEmpty() && block.getY() < player.getLocation().getY())
if(block.getLocation().getY() >= 4)
{
// Adding broken blocks back to inventory even if he didn't placed them.
// This is so we can prevent quick block farming.
ItemStack handItem = player.getItemInHand();
UtilInv.remove(player, handItem.getType(), handItem.getData().getData(), 1);
if(bottom1.getType() != Material.GRASS)
{
UtilInv.insert(player, new ItemStack(bottom1.getType()));
blockBreakEffect(bottom1);
}
if(bottom2.getType() != Material.GRASS)
{
UtilInv.insert(player, new ItemStack(bottom2.getType()));
blockBreakEffect(bottom2);
}
if(bottom3.getType() != Material.GRASS && bottom3.getType() != Material.DIRT)
{
UtilInv.insert(player, new ItemStack(bottom3.getType()));
blockBreakEffect(bottom3);
}
UtilTextMiddle.display("", C.cRed + "You can't build a tower that high.", 5, 40, 5, player);
blockBreakEffect(block);
event.setCancelled(true);
return;
}

View File

@ -195,7 +195,7 @@ public class ChallengeFastFood extends Challenge
{
double random = Math.random() * 100;
if(random < 30)
if(random < 30.0)
{
Location drop = item.getLocation();
Block block = drop.getBlock();

View File

@ -0,0 +1,144 @@
package nautilus.game.arcade.game.games.mineware.challenges;
import java.util.ArrayList;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilShapes;
import nautilus.game.arcade.game.games.mineware.Challenge;
import nautilus.game.arcade.game.games.mineware.MineWare;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
public class ChallengeNewEvolutionOfCombat extends Challenge
{
public ChallengeNewEvolutionOfCombat(MineWare host)
{
super(host, ChallengeType.LastStanding, "Evolution of Combat", "Find supplies and attack others quickly.",
"Be the last person to stay alive.");
}
@Override
public ArrayList<Location> getSpawns()
{
ArrayList<Location> spawns = new ArrayList<Location>();
Location center = new Location(Host.WorldData.World, 0, 0, 0);
for(Location location : UtilShapes.getCircle(center, true, getArenaSize() - 2))
{
double x = location.getX() + 0.5;
double y = 3.1;
double z = location.getZ() + 0.5;
Location spawn = getCenter().add(x, y, z);
spawns.add(spawn);
}
return spawns;
}
@Override
public void generateRoom()
{
Location center = new Location(Host.WorldData.World, 0, 0, 0);
for(int i = 0; i < 6; i++)
{
if(i > 0)
{
center = center.clone();
center.setY(0);
center.add(0, i, 0);
}
for(Location location : UtilShapes.getCircle(center, false, getArenaSize()))
{
Block map = location.getBlock();
double chance = Math.random() * 100;
if(i == 0)
{
map.setType(Material.BEDROCK);
}
else if(i == 1)
{
map.setType(Material.SAND);
if(chance < 3.0)
{
map.setType(Material.CHEST);
}
else if(chance < 20.0)
{
map.setType(Material.SANDSTONE);
}
}
else if(i == 2)
{
map.setType(Material.SAND);
}
else if(i == 3)
{
if(chance < 2.0 && !getSpawns().contains(map.getLocation()))
{
if(UtilMath.random.nextBoolean())
map.setType(Material.DEAD_BUSH);
else
map.setType(Material.CACTUS);
}
}
else if(i == 4)
{
if(map.getRelative(BlockFace.DOWN).getType() == Material.CACTUS && UtilMath.random.nextBoolean())
{
map.setType(Material.CACTUS);
}
}
addBlock(map);
}
}
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event)
{
Block block = event.getBlock();
Block above = block.getRelative(BlockFace.UP);
if(above.getType() == Material.CACTUS)
{
above.setType(Material.AIR);
}
block.setType(Material.AIR);
}
@Override
public void setupPlayers()
{
Host.InventoryOpenChest = true;
Host.BlockBreak = true;
Host.InventoryOpenBlock = true;
Host.InventoryClick = true;
Host.WorldBlockBurn = true;
Host.WorldFireSpread = true;
}
@Override
public void cleanupRoom()
{
Host.InventoryOpenChest = false;
Host.BlockBreak = false;
Host.InventoryOpenBlock = false;
Host.InventoryClick = false;
Host.DamagePvP = false;
Host.WorldBlockBurn = false;
Host.WorldFireSpread = false;
}
}