diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/Cannon.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/Cannon.java index 65b73de5d..552047bad 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/Cannon.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/Cannon.java @@ -2,6 +2,7 @@ package mineplex.game.clans.clans.siege.cannon; import java.util.ArrayList; import java.util.Arrays; +import java.util.LinkedList; import java.util.List; import org.bukkit.Location; @@ -235,7 +236,6 @@ public class Cannon implements Listener _craters.add(new CannonCrater(this, UtilBlock.nearestFloor(_projectile.getLocation()))); - UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, _projectile.getLocation(), new Vector(0, 0, 0), .1f, 4, ViewDist.MAX); UtilServer.getServer().getOnlinePlayers().forEach(player -> player.playSound(_projectile.getLocation(), Sound.EXPLODE, 1.f, 1.f)); _projectile.remove(); @@ -244,6 +244,21 @@ public class Cannon implements Listener } } + private List circleAround(Vector origin, int points, double radius) + { + List list = new LinkedList<>(); + + double slice = 2 * Math.PI / points; + + for (int point = 0; point < points; point++) + { + double angle = slice * point; + list.add(new Vector(origin.getX() + radius * Math.cos(angle), 0, origin.getZ() + radius * Math.sin(angle))); + } + + return list; + } + private void attemptFire() { if (canBeFired()) @@ -307,6 +322,20 @@ public class Cannon implements Listener @EventHandler public void updateState(UpdateEvent event) { +// if (event.getType() == UpdateType.FASTEST) +// { +// if (_state == CannonState.LOADED) +// { +// double yaw = getArmorStand().getHeadPose().getY() - 7.75d; +// +// Location loc = new Location(_location.getWorld(), getArmorStand().getLocation().getX() + (0.5 * Math.cos(yaw)), _location.getY() + 1.12, getArmorStand().getLocation().getZ() + (0.5 * Math.sin(yaw))); +// +// loc = UtilAlg.moveForward(loc, 0.1, (float) Math.toDegrees(yaw + 7.75), false); +// +// UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, new Vector(0, 0, 0), 0.f, 1, ViewDist.MAX); +// } +// } + if (event.getType() != UpdateType.TICK) { return; @@ -483,11 +512,12 @@ public class Cannon implements Listener } ArmorStand armorStand = (ArmorStand) UtilMath.getFirst(_entities); - double standYaw = Math.toDegrees(armorStand.getHeadPose().getY()) % 360; - double riderYaw = _rider.getLocation().getYaw() % 360; + double standYaw = Math.abs(Math.toDegrees(armorStand.getHeadPose().getY()) % 360); + double riderYaw = Math.abs(_rider.getLocation().getYaw() % 360); double dif = riderYaw - standYaw; - double yaw = standYaw + (dif / 20.f); + + double yaw = standYaw + Math.min(dif / 20.f, 5f); Location pos = armorStand.getLocation(); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CannonCrater.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CannonCrater.java index 6826067a2..db67311e5 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CannonCrater.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/cannon/CannonCrater.java @@ -15,6 +15,7 @@ import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.util.Vector; +import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; @@ -29,6 +30,8 @@ public class CannonCrater implements Listener { private static final double EXPL_RADIUS = 3; + public static final Material CHARRED_TYPE = Material.OBSIDIAN; + private Cannon _host; private Location _origin; @@ -57,15 +60,26 @@ public class CannonCrater implements Listener return; } - _blocks.stream().filter(block -> block.Type == Material.COAL_BLOCK).forEach(block -> { + _blocks.stream().filter(block -> block.Type == CHARRED_TYPE).forEach(block -> { long lifetime = System.currentTimeMillis() - _birthTime; - long max = 25000 - (long) ((block.DistanceToOrigin * 1000) * 3.5); + long max = 80000; + + if (block.Location.getBlock().getType() != CHARRED_TYPE) + { + return; + } + + // Water touching the charred blocks + if (UtilBlock.getInRadius(block.Location, 1.6).keySet().stream().filter(water -> water.getType() == Material.WATER).iterator().hasNext()) + { + return; + } if (lifetime < max) { - UtilParticle.PlayParticleToAll(ParticleType.FLAME, block.Location.clone().add(.5, 1.1, .5), new Vector(0, 0, 0), .4f, 1, ViewDist.MAX); - UtilParticle.PlayParticleToAll(ParticleType.SMOKE, block.Location.clone().add(.5, 1.1, .5), new Vector(0, 0, 0), .4f, 1, ViewDist.MAX); + UtilParticle.PlayParticleToAll(ParticleType.FLAME, block.Location.clone().add(.5, 1, .5), new Vector(0, 0, 0), .0f, 3, ViewDist.MAX); + UtilParticle.PlayParticleToAll(lifetime >= max / 1.4 ? ParticleType.SMOKE : ParticleType.LARGE_SMOKE, block.Location.clone().add(.5, .8, .5), new Vector(0, 0, 0), .0f, 1, ViewDist.MAX); } }); } @@ -131,10 +145,10 @@ public class CannonCrater implements Listener Math.random() > .75 && UtilItem.isBoundless(block.getRelative(BlockFace.UP).getType()) && !UtilItem.isBoundless(block.getRelative(BlockFace.DOWN).getType()) && - !block.getRelative(BlockFace.UP).getType().equals(Material.COAL_BLOCK) && - !block.getRelative(BlockFace.DOWN).getType().equals(Material.COAL_BLOCK)) + !block.getRelative(BlockFace.UP).getType().equals(CHARRED_TYPE) && + !block.getRelative(BlockFace.DOWN).getType().equals(CHARRED_TYPE)) { - _blocks.add(new CraterBlock(block.getLocation(), distance, Material.COAL_BLOCK)); + _blocks.add(new CraterBlock(block.getLocation(), distance, CHARRED_TYPE)); } }