From d4be749edc098ff12da94ec795085b61384ac89d Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Sat, 2 Jul 2016 17:39:04 -0400 Subject: [PATCH] Update Iron Wizard attack priority to use Earthquake when surrounded, lower blocks thrown during Cave In and implement Iron Skin arrow resistance --- .../core/boss/ironwizard/GolemCreature.java | 22 +- .../ironwizard/abilities/GolemCaveIn.java | 204 +++++++++--------- 2 files changed, 123 insertions(+), 103 deletions(-) diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/ironwizard/GolemCreature.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/ironwizard/GolemCreature.java index 06f1dc23d..bd311f6bf 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/ironwizard/GolemCreature.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/ironwizard/GolemCreature.java @@ -6,6 +6,7 @@ import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.Map.Entry; +import java.util.Random; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; @@ -30,7 +31,9 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.Sound; import org.bukkit.block.BlockFace; +import org.bukkit.entity.Arrow; import org.bukkit.entity.IronGolem; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -153,7 +156,14 @@ public class GolemCreature extends EventCreature if (!players.isEmpty()) { - weight.put(GolemMeleeAttack.class, 999); + if (players.size() >= 4) + { + weight.put(GolemEarthquake.class, 999); + } + else + { + weight.put(GolemMeleeAttack.class, 999); + } } } @@ -502,6 +512,16 @@ public class GolemCreature extends EventCreature { if (event.GetDamageePlayer() != null) { + if (event.GetProjectile() != null && event.GetProjectile() instanceof Arrow) + { + if (new Random().nextDouble() <= .5) + { + event.SetCancelled("Iron Skin Reflection"); + getEntity().getWorld().playSound(getEntity().getLocation(), Sound.ZOMBIE_METAL, 0.5f, 1.6f); + return; + } + } + double dist = event.GetDamageePlayer().getLocation().distance(getEntity().getLocation()); double maxRange = _usedFinalAttack ? 20 : 45; diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/ironwizard/abilities/GolemCaveIn.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/ironwizard/abilities/GolemCaveIn.java index 622d52dc3..6b6e0a11a 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/ironwizard/abilities/GolemCaveIn.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/ironwizard/abilities/GolemCaveIn.java @@ -223,108 +223,108 @@ public class GolemCaveIn extends BossAbility @Override public void tick() { -// if (_tick++ == 0) -// { -// Location l = getLocation(); -// -// ArrayList blocks = UtilShapes.getSphereBlocks(l, 3, 3, true); -// -// for (Location loc : blocks) -// { -// if (loc.getBlockY() >= l.getBlockY()) -// { -// Block b = loc.getBlock(); -// -// if (b.getType() == Material.AIR) -// { -// _blocks.add(b); -// -// loc.setY(l.getY() - 1); -// -// b.setType(loc.getBlock().getType()); -// -// b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, loc.getBlock().getTypeId()); -// } -// } -// } -// } -// -// if (_tick % 5 == 0) -// -// { -// for (Player player : UtilPlayer.getNearby(getLocation(), 2.5, true)) -// { -// player.teleport(player.getLocation().add(0, 4, 0)); -// UtilAction.velocity(player, new Vector(UtilMath.r(10) - 5, 3, UtilMath.r(10) - 5).normalize()); -// } -// } -// -// if (_tick < 200) -// -// { -// Location loc = getLocation(); -// loc.setY(loc.getY() + 4); -// -// for (int i = 0; i < 30; i++) -// { -// loc.setY(loc.getY() + 1); -// Block b = loc.getBlock(); -// -// if (UtilBlock.solid(b)) -// { -// break; -// } -// } -// -// if (!UtilBlock.solid(loc.getBlock())) -// { -// return; -// } -// -// List players = UtilPlayer.getNearby(getLocation(), 50, true); -// -// for (int i = 0; i < players.size() * 4; i++) -// { -// int dist = UtilMath.r(10); -// -// if (dist < 3) -// { -// dist = 2; -// } -// else if (dist < 5) -// { -// dist = 5; -// } -// else -// { -// dist = 10; -// } -// -// Location l = players.get(UtilMath.r(players.size())).getLocation().add(UtilMath.r(dist * 2) - dist, 0, -// UtilMath.r(dist * 2) - dist); -// l.setY(loc.getY()); -// -// Block b = l.getBlock(); -// l.subtract(0, 1, 0); -// -// if (UtilBlock.solid(b)) -// { -// if (l.getBlock().getType() == Material.AIR) -// { -// if (UtilAlg.HasSight(l, getLocation().add(0, 4, 0))) -// { -// FallingBlock block = b.getWorld().spawnFallingBlock(b.getLocation().add(0.5, -1, 0.5), b.getTypeId(), -// b.getData()); -// -// block.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, block.getBlockId()); -// block.setDropItem(false); -// -// _fallingBlocks.add(block); -// } -// } -// } -// } -// } + if (_tick++ == 0) + { + Location l = getLocation(); + + ArrayList blocks = UtilShapes.getSphereBlocks(l, 3, 3, true); + + for (Location loc : blocks) + { + if (loc.getBlockY() >= l.getBlockY()) + { + Block b = loc.getBlock(); + + if (b.getType() == Material.AIR) + { + _blocks.add(b); + + loc.setY(l.getY() - 1); + + b.setType(loc.getBlock().getType()); + + b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, loc.getBlock().getTypeId()); + } + } + } + } + + if (_tick % 5 == 0) + + { + for (Player player : UtilPlayer.getNearby(getLocation(), 2.5, true)) + { + player.teleport(player.getLocation().add(0, 4, 0)); + UtilAction.velocity(player, new Vector(UtilMath.r(10) - 5, 3, UtilMath.r(10) - 5).normalize()); + } + } + + if (_tick < 200) + + { + Location loc = getLocation(); + loc.setY(loc.getY() + 4); + + for (int i = 0; i < 30; i++) + { + loc.setY(loc.getY() + 1); + Block b = loc.getBlock(); + + if (UtilBlock.solid(b)) + { + break; + } + } + + if (!UtilBlock.solid(loc.getBlock())) + { + return; + } + + List players = UtilPlayer.getNearby(getLocation(), 50, true); + + for (int i = 0; i < players.size() * 2; i++) + { + int dist = UtilMath.r(10); + + if (dist < 3) + { + dist = 2; + } + else if (dist < 5) + { + dist = 5; + } + else + { + dist = 10; + } + + Location l = players.get(UtilMath.r(players.size())).getLocation().add(UtilMath.r(dist * 2) - dist, 0, + UtilMath.r(dist * 2) - dist); + l.setY(loc.getY()); + + Block b = l.getBlock(); + l.subtract(0, 1, 0); + + if (UtilBlock.solid(b)) + { + if (l.getBlock().getType() == Material.AIR) + { + if (UtilAlg.HasSight(l, getLocation().add(0, 4, 0))) + { + FallingBlock block = b.getWorld().spawnFallingBlock(b.getLocation().add(0.5, -1, 0.5), b.getTypeId(), + b.getData()); + + block.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, block.getBlockId()); + block.setDropItem(false); + + _fallingBlocks.add(block); + } + } + } + } + } }