This commit is contained in:
Chiss 2013-11-22 23:12:39 +11:00
parent 9c9e5f1ae0
commit 3d13fb0dc9
6 changed files with 108 additions and 72 deletions

View File

@ -8,9 +8,7 @@ import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.Material;
@ -34,7 +32,6 @@ import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
@ -45,6 +42,8 @@ import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
@ -59,10 +58,12 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
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.SoloGame;
import nautilus.game.arcade.game.games.hungergames.kit.*;
import nautilus.game.arcade.kit.Kit;
@ -127,7 +128,7 @@ public class HungerGames extends SoloGame
Manager.GetAntiStack().SetEnabled(false);
this.WorldTimeSet = 13000;
this.WorldTimeSet = 0;
this.SpawnDistanceRequirement = 48;
@ -145,6 +146,9 @@ public class HungerGames extends SoloGame
this.GemMultiplier = 2;
//Blocks
this.BlockBreakAllow.add(46); //TNT
this.BlockPlaceAllow.add(46);
this.BlockBreakAllow.add(30); //Web
this.BlockPlaceAllow.add(30);
@ -162,6 +166,8 @@ public class HungerGames extends SoloGame
this.BlockBreakAllow.add(69); //Lever
this.BlockPlaceAllow.add(69);
this.BlockBreakAllow.add(18); //Leaves
//SPREAD
_spreadType = 1;//UtilMath.r(3);
@ -222,30 +228,41 @@ public class HungerGames extends SoloGame
System.out.println("Map Chest Locations: " + chests.size());
//Enchants
System.out.println("Enchanting Tables: " + Math.min(10, chests.size()));
for (int i=0 ; i<10 && !chests.isEmpty() ; i++)
System.out.println("Enchanting Tables: " + Math.min(5, chests.size()));
for (int i=0 ; i<5 && !chests.isEmpty() ; i++)
{
Location loc = chests.remove(UtilMath.r(chests.size()));
loc.getBlock().setType(Material.ENCHANTMENT_TABLE);
}
//Crafting
System.out.println("Crafting Benches: " + Math.min(20, chests.size()));
for (int i=0 ; i<20 && !chests.isEmpty() ; i++)
System.out.println("Crafting Benches: " + Math.min(10, chests.size()));
for (int i=0 ; i<10 && !chests.isEmpty() ; i++)
{
Location loc = chests.remove(UtilMath.r(chests.size()));
loc.getBlock().setType(Material.WORKBENCH);
}
int spawn = 0;
//Chests
System.out.println("Chests: " + Math.min(180, chests.size()));
for (int i=0 ; i<180 && !chests.isEmpty() ; i++)
{
chests.remove(UtilMath.r(chests.size()));
Location loc = chests.remove(UtilMath.r(chests.size()));
if (UtilMath.offset2d(loc, GetSpectatorLocation()) < 10)
spawn++;
}
for (Location loc : chests)
{
if (spawn < 10 && UtilMath.offset2d(loc, GetSpectatorLocation()) < 10)
{
spawn++;
continue;
}
loc.getBlock().setType(Material.AIR);
}
}
@ -299,17 +316,26 @@ public class HungerGames extends SoloGame
chest.getBlockInventory().clear();
int count = 1 + UtilMath.r(3);
int count = 2;
if (Math.random() > 0.50) count++;
if (Math.random() > 0.65) count++;
if (Math.random() > 0.80) count++;
if (Math.random() > 0.95) count++;
Announce("Offset from Spec: " + UtilMath.offset2d(chest.getLocation(), GetSpectatorLocation()));
if (UtilMath.offset2d(chest.getLocation(), GetSpectatorLocation()) < 10)
count += 2;
if (GetKit(event.getPlayer()) instanceof KitLooter)
{
count += UtilMath.r(2);
count += UtilMath.r(3);
}
for (int i = 0; i < count; i++)
chest.getBlockInventory().setItem(UtilMath.r(27), GetChestItem(_supplyChests.contains(event.getClickedBlock())));
_supplyChests.remove(event.getClickedBlock());
if (_supplyChests.remove(event.getClickedBlock()))
_openedChest.remove(event.getClickedBlock().getLocation());
}
private ItemStack GetChestItem(boolean superChest)
@ -317,61 +343,70 @@ public class HungerGames extends SoloGame
if (_baseChestLoot.isEmpty())
{
//Armor
for (int i = 0; i < 2; i++) _baseChestLoot.add(new ItemStack(Material.IRON_HELMET));
for (int i = 0; i < 2; i++) _baseChestLoot.add(new ItemStack(Material.IRON_CHESTPLATE));
for (int i = 0; i < 2; i++) _baseChestLoot.add(new ItemStack(Material.IRON_LEGGINGS));
for (int i = 0; i < 2; i++) _baseChestLoot.add(new ItemStack(Material.IRON_BOOTS));
for (int i = 0; i < 12; i++) _baseChestLoot.add(new ItemStack(Material.CHAINMAIL_HELMET));
for (int i = 0; i < 12; i++) _baseChestLoot.add(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
for (int i = 0; i < 12; i++) _baseChestLoot.add(new ItemStack(Material.CHAINMAIL_LEGGINGS));
for (int i = 0; i < 12; i++) _baseChestLoot.add(new ItemStack(Material.CHAINMAIL_BOOTS));
for (int i = 0; i < 15; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_HELMET));
for (int i = 0; i < 15; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_CHESTPLATE));
for (int i = 0; i < 15; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_LEGGINGS));
for (int i = 0; i < 15; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_BOOTS));
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_HELMET));
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_CHESTPLATE));
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_LEGGINGS));
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_BOOTS));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.LEATHER_HELMET));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.LEATHER_CHESTPLATE));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.LEATHER_LEGGINGS));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.LEATHER_BOOTS));
for (int i = 0; i < 96; i++) _baseChestLoot.add(new ItemStack(Material.LEATHER_HELMET));
for (int i = 0; i < 96; i++) _baseChestLoot.add(new ItemStack(Material.LEATHER_CHESTPLATE));
for (int i = 0; i < 96; i++) _baseChestLoot.add(new ItemStack(Material.LEATHER_LEGGINGS));
for (int i = 0; i < 96; i++) _baseChestLoot.add(new ItemStack(Material.LEATHER_BOOTS));
//Weapons
for (int i = 0; i < 48; i++) _baseChestLoot.add(new ItemStack(Material.WOOD_AXE));
for (int i = 0; i < 128; i++) _baseChestLoot.add(new ItemStack(Material.WOOD_AXE));
for (int i = 0; i < 48; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_AXE));
for (int i = 0; i < 12; i++) _baseChestLoot.add(new ItemStack(Material.STONE_AXE));
for (int i = 0; i < 6; i++) _baseChestLoot.add(new ItemStack(Material.IRON_AXE));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.STONE_AXE));
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.IRON_AXE));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.WOOD_SWORD));
for (int i = 0; i < 128; i++) _baseChestLoot.add(new ItemStack(Material.WOOD_SWORD));
for (int i = 0; i < 48; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_SWORD));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.STONE_SWORD));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.IRON_SWORD));
for (int i = 0; i < 12; i++) _baseChestLoot.add(new ItemStack(Material.IRON_SWORD));
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.BOW));
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.ARROW, 8));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.BOW));
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.ARROW, 4));
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.TNT, 1));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.TNT, 1));
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.WEB, 2));
//Food
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.MUSHROOM_SOUP));
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.COOKED_CHICKEN));
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.RAW_BEEF, 1));
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.GRILLED_PORK, 2));
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.BREAD, 3));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.MUSHROOM_SOUP));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.COOKED_CHICKEN));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.RAW_BEEF));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.GRILLED_PORK));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.BREAD));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.PUMPKIN_PIE));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.COOKIE));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.ROTTEN_FLESH));
for (int i = 0; i < 128; i++) _baseChestLoot.add(new ItemStack(Material.WHEAT, 2));
//Misc
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.EXP_BOTTLE, 1));
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_INGOT, 2));
for (int i = 0; i < 12; i++) _baseChestLoot.add(new ItemStack(Material.IRON_INGOT, 2));
for (int i = 0; i < 48; i++) _baseChestLoot.add(new ItemStack(Material.EXP_BOTTLE, 1));
for (int i = 0; i < 36; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_INGOT, 2));
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.IRON_INGOT));
for (int i = 0; i < 3; i++) _baseChestLoot.add(new ItemStack(Material.DIAMOND));
for (int i = 0; i < 128; i++) _baseChestLoot.add(new ItemStack(Material.STICK, 4));
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.FLINT, 4));
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.FEATHER, 4));
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.FLINT, 3));
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.FEATHER, 3));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.BOAT));
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.FISHING_ROD));
//Building Supplies
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.PISTON_BASE, 4));
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.REDSTONE, 4));
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.STRING, 4));
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.TRIPWIRE_HOOK, 4));
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.WOOD_PLATE));
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.LEVER));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.PISTON_BASE, 4));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.STRING, 4));
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.TRIPWIRE_HOOK, 4));
}
if (_superChestLoot.isEmpty())
@ -398,7 +433,7 @@ public class HungerGames extends SoloGame
int amount = 1;
if (stack.getType().getMaxStackSize() > 1)
amount = stack.getAmount() + UtilMath.r(stack.getAmount());
amount = Math.max(1, UtilMath.r(stack.getAmount()));
return ItemStackFactory.Instance.CreateStack(stack.getTypeId(), amount);
}
@ -486,12 +521,7 @@ public class HungerGames extends SoloGame
long time = System.currentTimeMillis();
if (_redLocations.isEmpty())
{
if (UtilTime.elapsed(GetStateTime(), 6000))
SetState(GameState.End);
return;
}
int max = Math.max(5, Math.min(_maxSpreadRate, _redLocations.size()/100));
@ -979,8 +1009,7 @@ public class HungerGames extends SoloGame
@EventHandler
public void TNTThrow(PlayerInteractEvent event)
{
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK &&
event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_AIR)
if (!UtilEvent.isAction(event, ActionType.L))
return;
Player player = event.getPlayer();
@ -1072,11 +1101,26 @@ public class HungerGames extends SoloGame
{
event.setCancelled(true);
}
//XXX REMOVE ME
@Override
public void EndCheck()
@EventHandler
public void PlayerKillAward(CombatDeathEvent event)
{
Game game = Manager.GetGame();
if (game == null) return;
if (!(event.GetEvent().getEntity() instanceof Player))
return;
if (event.GetLog().GetKiller() == null)
return;
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (killer == null)
return;
if (killer.equals(event.GetEvent().getEntity()))
return;
killer.giveExpLevels(1);
}
}

View File

@ -97,10 +97,4 @@ public class PerkBomberHG extends Perk
for (org.bukkit.inventory.ItemStack item : remove)
event.getDrops().remove(item);
}
@EventHandler
public void TNTInvClick(InventoryClickEvent event)
{
UtilInv.DisallowMovementOf(event, "Throwing TNT", Material.TNT, (byte)0, true);
}
}

View File

@ -67,6 +67,8 @@ public class PerkSkeletons extends Perk
Skeleton skel = killer.getWorld().spawn(killed.getLocation(), Skeleton.class);
Manager.GetGame().CreatureAllowOverride = false;
UtilEnt.removeGoalSelectors(skel);
skel.setMaxHealth(30);
skel.setHealth(skel.getMaxHealth());

View File

@ -96,7 +96,7 @@ public class PerkTNTArrow extends Perk
//TNT
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(0, 2, 0), TNTPrimed.class);
//XXX ((CraftTNTPrimed)tnt).getHandle().spectating = true;
((CraftTNTPrimed)tnt).getHandle().spectating = true;
event.getProjectile().setPassenger(tnt);

View File

@ -99,7 +99,7 @@ public class GameManager implements Listener
//Stop Countdown!
if (game.GetCountdown() != -1 &&
UtilServer.getPlayers().length < Manager.GetPlayerMin() &&
!game.GetCountdownForce() && game.GetType() != GameType.HungerGames) //XXX REMOVE ME
!game.GetCountdownForce())
{
game.SetCountdown(-1);
Manager.GetLobby().DisplayWaiting();
@ -107,11 +107,7 @@ public class GameManager implements Listener
if (game.GetCountdown() != -1)
StateCountdown(game, -1, false);
else if (game.GetType() == GameType.HungerGames) //XXX REMOVE ME
{
StateCountdown(game, 1, false);
return;
}
else if (game.AutoStart)
{
if (UtilServer.getPlayers().length >= Manager.GetPlayerFull())
@ -128,7 +124,7 @@ public class GameManager implements Listener
for (Player player : UtilServer.getPlayers())
player.playSound(player.getLocation(), Sound.NOTE_PLING, 2f, 2f);
if (game.GetPlayers(true).size() < 2 && game.GetType() != GameType.HungerGames) // XXX REMOVE HG
if (game.GetPlayers(true).size() < 2)
{
game.Announce(C.cWhite + C.Bold + game.GetName() + " ended, not enough players!");
game.SetState(GameState.Dead);

View File

@ -43,8 +43,8 @@ public class WorldParser
int processed = 0;
caller.sendMessage("Scanning for Blocks...");
for (int x=-500 ; x < 500 ; x++)
for (int z=-500 ; z < 500 ; z++)
for (int x=-600 ; x < 600 ; x++)
for (int z=-600 ; z < 600 ; z++)
for (int y=0 ; y < 256 ; y++)
{
processed++;