From d75d7a2c8fe4971e50ba60571c0793f64b6c0e24 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 7 Dec 2015 17:56:35 +1100 Subject: [PATCH] snowfight finish --- .../game/games/snowfight/SnowFight.java | 66 ++++++++++++++----- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index bd9edcc7e..dce28ada5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -72,7 +72,7 @@ import org.bukkit.util.Vector; public class SnowFight extends TeamGame { - private long _meteorTime = 10000; + private long _meteorTime = 240000; private boolean _meteors = false; private HashSet _meteorSet = new HashSet(); @@ -104,20 +104,20 @@ public class SnowFight extends TeamGame this.TeamArmor = true; this.TeamArmorHotbar = true; - this.WorldWeatherEnabled = true; - this.WorldTimeSet = 4000; +// this.WorldWeatherEnabled = true; +// this.WorldTimeSet = 4000; } - @EventHandler - public void weather(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - - WorldData.World.setStorm(true); - WorldData.World.setThundering(false); - WorldData.World.setWeatherDuration(10); - } +// @EventHandler +// public void weather(UpdateEvent event) +// { +// if (event.getType() != UpdateType.SEC) +// return; +// +// WorldData.World.setStorm(true); +// WorldData.World.setThundering(false); +// WorldData.World.setWeatherDuration(12); +// } @EventHandler public void battleAnnounce(GameStateChangeEvent event) @@ -243,7 +243,36 @@ public class SnowFight extends TeamGame private boolean isOnIce(Player player) { - return player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.PACKED_ICE; + //Side Standing + double xMod = player.getLocation().getX() % 1; + if (player.getLocation().getX() < 0) + xMod += 1; + + double zMod = player.getLocation().getZ() % 1; + if (player.getLocation().getZ() < 0) + zMod += 1; + + int xMin = 0; + int xMax = 0; + int zMin = 0; + int zMax = 0; + + if (xMod < 0.3) xMin = -1; + if (xMod > 0.7) xMax = 1; + + if (zMod < 0.3) zMin = -1; + if (zMod > 0.7) zMax = 1; + + for (int x=xMin ; x<=xMax ; x++) + { + for (int z=zMin ; z<=zMax ; z++) + { + if (player.getLocation().add(x, -0.5, z).getBlock().getType() == Material.PACKED_ICE) + return true; + } + } + + return false; } private Location getMeteorTargetLocation() @@ -362,7 +391,7 @@ public class SnowFight extends TeamGame float multiplier = 1 + Math.min(3f, timePassed / 60f); - float size = 2 + multiplier; + float size = 1.5f + multiplier; if (projectile.hasMetadata("Meteor")) { @@ -391,8 +420,11 @@ public class SnowFight extends TeamGame int i = 5; while (block.getY() > 0 && i>0) { - if (block.getType() == Material.LADDER) + if (block.getType() == Material.LADDER || + block.getType() == Material.STAINED_GLASS || + block.getType() == Material.STAINED_GLASS_PANE) block.breakNaturally(); + //Has air above it if (UtilBlock.solid(block) && UtilBlock.isVisible(block)) @@ -423,7 +455,7 @@ public class SnowFight extends TeamGame //XXX DO BETTER CHECK, hanging off block, ladders, etc. if(isOnIce(player)) { - Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, null, DamageCause.CUSTOM, 0.5, false, true, true, "Ice", "Ice", false)); + Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, null, DamageCause.CUSTOM, 1, false, true, true, "Ice", "Ice", false)); } } }