From 65a1441e1ff86d3d8d4ec44a4cfeff2e0f3eab2c Mon Sep 17 00:00:00 2001 From: Cheese Date: Thu, 26 Nov 2015 12:56:26 +1100 Subject: [PATCH 1/2] -Fixed smoke being removed when bomb was planted in it -Fixed being unable to defuse bomb in smoke -Fixed older smokes removing newer intersecting smokes -Grenades will still detonate after being burned -Bizon now gives $600 per kill -Added replacement smoke on gun fire -Added shell ejecting particles on gun fire -Removed gun bobbing when firing -Changed ammo display location --- .../game/games/minestrike/MineStrike.java | 54 +++++++++++++------ .../game/games/minestrike/data/Bomb.java | 16 ++++-- .../minestrike/items/grenades/FlashBang.java | 5 +- .../minestrike/items/grenades/Grenade.java | 14 +++-- .../items/grenades/HighExplosive.java | 3 +- .../minestrike/items/grenades/Smoke.java | 7 +-- .../game/games/minestrike/items/guns/Gun.java | 46 ++++++++++++---- .../games/minestrike/items/guns/Shotgun.java | 2 +- 8 files changed, 108 insertions(+), 39 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index b1f6b1e6f..12f7bcdc2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -1429,6 +1429,9 @@ public class MineStrike extends TeamGame if (event.GetLog().GetLastDamager().GetReason().contains("AWP")) amount = 100; + else if (event.GetLog().GetLastDamager().GetReason().contains("PP-Bizon")) + amount = 600; + else if (event.GetLog().GetLastDamager().GetReason().contains("Nova")) amount = 900; @@ -1501,14 +1504,6 @@ public class MineStrike extends TeamGame UtilParticle.PlayParticle(ParticleType.CRIT, grenadeItem.getLocation(), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); - //Expired - if (!grenadeItem.isValid() || grenadeItem.getTicksLived() > 400) - { - grenadeItem.remove(); - grenadeIterator.remove(); - continue; - } - //Completed Grenade grenade = _grenadesThrown.get(grenadeItem); if (grenade.update(this, grenadeItem)) @@ -1680,11 +1675,15 @@ public class MineStrike extends TeamGame { for (Player player : GetTeam(ChatColor.AQUA).GetPlayers(true)) { - Block block = player.getTargetBlock((HashSet) null, 5); + HashSet ignoreBlocks = new HashSet(); + ignoreBlocks.add(Material.AIR); + ignoreBlocks.add(Material.PORTAL); + + Block block = player.getTargetBlock(ignoreBlocks, 5); if (block == null || !_bomb.isBlock(block)) continue; - + if (UtilMath.offset(player.getLocation(), block.getLocation().add(0.5, 0, 0.5)) > 3) continue; @@ -1725,15 +1724,19 @@ public class MineStrike extends TeamGame if (_bombDefuser == null) return; - Block block = _bombDefuser.getTargetBlock((HashSet) null, 5); - + HashSet ignoreBlocks = new HashSet(); + ignoreBlocks.add(Material.AIR); + ignoreBlocks.add(Material.PORTAL); + + Block block = _bombDefuser.getTargetBlock(ignoreBlocks, 5); + if (!IsAlive(_bombDefuser) || block == null || !_bomb.isBlock(block) || !_bombDefuser.isOnline() || UtilMath.offset(_bombDefuser.getLocation(), block.getLocation().add(0.5, 0, 0.5)) > 3) { _bombDefuser.setExp(0f); - _bombDefuser = null; + _bombDefuser = null; return; } - + //Kit or Not? float defuseRate = 0.005f; if (UtilGear.isMat(_bombDefuser.getInventory().getItem(8), Material.SHEARS)) @@ -2429,6 +2432,21 @@ public class MineStrike extends TeamGame } } + @EventHandler + public void gunUpdate(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.TICK) + return; + + for (Gun gun : _gunsEquipped.keySet()) + { + gun.displayAmmo(_gunsEquipped.get(gun)); + } + } + @EventHandler public void smokeUpdate(UpdateEvent event) { @@ -2443,9 +2461,15 @@ public class MineStrike extends TeamGame if (System.currentTimeMillis() > _smokeBlocks.get(block)) { - block.setTypeIdAndData(0, (byte)0, false); + if (block.getType() == Material.PORTAL) + block.setTypeIdAndData(0, (byte)0, false); + smokeIterator.remove(); } + else if (block.getType() == Material.AIR) + { + block.setTypeIdAndData(90, (byte)UtilMath.r(2), false); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/data/Bomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/data/Bomb.java index 65dee38f0..a22be532f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/data/Bomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/data/Bomb.java @@ -34,10 +34,18 @@ public class Bomb Block = planter.getLocation().getBlock(); - Type = Block.getType(); - Data = Block.getData(); + if (Block.getType() != Material.PORTAL) + { + Type = Block.getType(); + Data = Block.getData(); + } + else + { + Type = Material.AIR; + Data = 0; + } - Block.setType(Material.DAYLIGHT_DETECTOR); + Block.setTypeIdAndData(Material.DAYLIGHT_DETECTOR.getId(), (byte)0, false); StartTime = System.currentTimeMillis(); } @@ -45,7 +53,7 @@ public class Bomb public boolean update() { if (Block.getType() != Material.DAYLIGHT_DETECTOR) - Block.setType(Material.DAYLIGHT_DETECTOR); + Block.setTypeIdAndData(Material.DAYLIGHT_DETECTOR.getId(), (byte)0, false); double scale = (double)(System.currentTimeMillis() - StartTime)/(double)BombTime; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/FlashBang.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/FlashBang.java index 638edf7f6..21c4d3dab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/FlashBang.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/FlashBang.java @@ -7,6 +7,7 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.minestrike.MineStrike; import nautilus.game.arcade.game.games.minestrike.Radio; @@ -34,7 +35,7 @@ public class FlashBang extends Grenade @Override public boolean updateCustom(MineStrike game, Entity ent) { - if (ent.getTicksLived() > 40) + if (UtilTime.elapsed(_throwTime, 2000)) { FireworkEffect effect = FireworkEffect.builder().flicker(true).withColor(Color.WHITE).with(Type.BALL_LARGE).trail(false).build(); UtilFirework.playFirework(ent.getLocation().add(0, 0.5, 0), effect); @@ -46,7 +47,7 @@ public class FlashBang extends Grenade continue; //Line of Sight - Location loc = player.getEyeLocation(); + Location loc = player.getEyeLocation(); boolean sight = true; while (UtilMath.offset(loc, ent.getLocation()) > 0.5) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Grenade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Grenade.java index 47b1f818c..f8110807b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Grenade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Grenade.java @@ -19,6 +19,7 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; import nautilus.game.arcade.game.games.minestrike.MineStrike; import nautilus.game.arcade.game.games.minestrike.items.StrikeItem; import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType; @@ -75,6 +76,8 @@ public abstract class Grenade extends StrikeItem protected int _limit; + protected long _throwTime = 0; + public Grenade(String name, String[] desc, int cost, int gemCost, Material skin, int limit) { super(StrikeItemType.GRENADE, name, desc, cost, gemCost, skin); @@ -154,14 +157,19 @@ public abstract class Grenade extends StrikeItem //Sound playSound(game, player); + + _throwTime = System.currentTimeMillis(); } public boolean update(MineStrike game, Entity ent) { - //Invalid - if (!ent.isValid()) + if (UtilTime.elapsed(_throwTime, 20000)) return true; + //Invalid (Burned) + if (!ent.isValid()) + return updateCustom(game, ent); + //Rebound Off Blocks rebound(ent); @@ -174,7 +182,7 @@ public abstract class Grenade extends StrikeItem public void rebound(Entity ent) { - if (UtilEnt.isGrounded(ent) || ent.getVelocity().length() < 0.1 || ent.getTicksLived() < 4) + if (UtilEnt.isGrounded(ent) || ent.getVelocity().length() < 0.1 || !UtilTime.elapsed(_throwTime, 200)) return; if (Math.abs(_vel.getX()) < 0.1 && Math.abs(_vel.getX()) < 0.1) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java index bff72ca57..02c7b7300 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java @@ -6,6 +6,7 @@ import java.util.List; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; @@ -35,7 +36,7 @@ public class HighExplosive extends Grenade @Override public boolean updateCustom(MineStrike game, Entity ent) { - if (ent.getTicksLived() > 40) + if (UtilTime.elapsed(_throwTime, 2000)) { UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, ent.getLocation(), 0, 0, 0, 0, 1, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Smoke.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Smoke.java index 62b2b08f1..792e9df85 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Smoke.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Smoke.java @@ -6,6 +6,7 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import nautilus.game.arcade.game.GameTeam; @@ -37,7 +38,7 @@ public class Smoke extends Grenade @Override public boolean updateCustom(final MineStrike game, Entity ent) { - if (ent.getTicksLived() > 40 && UtilEnt.isGrounded(ent)) + if (UtilTime.elapsed(_throwTime, 2000) && (UtilEnt.isGrounded(ent) || !ent.isValid())) { // UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, ent.getLocation(), 0.3f, 0.3f, 0.3f, 0, 1, // ViewDist.MAX, UtilServer.getPlayers()); @@ -55,7 +56,7 @@ public class Smoke extends Grenade final int round = game.getRound(); for (final Block block : blocks.keySet()) { - if (block.getType() != Material.AIR) + if (block.getType() != Material.AIR && block.getType() != Material.PORTAL && block.getType() != Material.FIRE) continue; UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(game.Manager.getPlugin(), new Runnable() @@ -84,7 +85,7 @@ public class Smoke extends Grenade } //18 seconds - return ent.getTicksLived() > 360; + return UtilTime.elapsed(_throwTime, 18000); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java index 408033016..d8f9bf7a2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java @@ -47,6 +47,8 @@ public class Gun extends StrikeItem protected long _lastMoveTime; protected boolean _reloading = false; + + protected boolean _reloadTick = false; public Gun(GunStats gunStats) { @@ -124,17 +126,25 @@ public class Gun extends StrikeItem //Use Ammo _loadedAmmo--; - updateWeaponName(player); + //updateWeaponName(player); //Effect soundFire(player.getLocation()); - //Visual + //Smoke Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(1.2)); loc.add(UtilAlg.getRight(player.getLocation().getDirection()).multiply(0.5)); - loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(0.3)); - UtilParticle.PlayParticle(ParticleType.EXPLODE, loc, 0, 0, 0, 0, 1, + loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(0.4)); + UtilParticle.PlayParticle(Math.random() > 0.5 ? ParticleType.ANGRY_VILLAGER : ParticleType.HEART, loc, 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); + + //Shell + loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(0.6)); + loc.add(UtilAlg.getRight(player.getLocation().getDirection()).multiply(0.7)); + loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(0.5)); + UtilParticle.PlayParticle(ParticleType.SPLASH, loc, 0, 0, 0, 0, 1, + ViewDist.LONG, UtilServer.getPlayers()); + game.registerBullet(fireBullet(player, game)); @@ -265,7 +275,7 @@ public class Gun extends StrikeItem } //Recharge - Recharge.Instance.use(player, getName() + " Reload", getReloadTime(), false, true, true); + Recharge.Instance.use(player, getName() + " Reload", getReloadTime(), false, true); //Sound soundReload(player.getLocation()); @@ -284,17 +294,33 @@ public class Gun extends StrikeItem { updateWeaponName(null); } + + public void displayAmmo(Player player) + { + if (!UtilGear.isMat(player.getItemInHand(), getStack().getType())) + return; + + //Weapon Bob during reload + if (_reloading) + updateWeaponName(player); + + if (!Recharge.Instance.usable(player, getName() + " Reload")) + return; + + UtilTextBottom.display(C.cGreen + _loadedAmmo + ChatColor.RESET + " / " + C.cYellow + _reserveAmmo, player); + } public void updateWeaponName(Player player) { ItemMeta meta = getStack().getItemMeta(); - meta.setDisplayName(ChatColor.RESET + (getOwnerName() == null ? "" : getOwnerName() + "'s ") + C.Bold + getName() + ChatColor.RESET + " " + C.cGreen + _loadedAmmo + ChatColor.RESET + " / " + C.cYellow + _reserveAmmo); + meta.setDisplayName(ChatColor.RESET + (getOwnerName() == null ? "" : getOwnerName() + "'s ") + C.Bold + getName() + (_reloadTick ? ChatColor.RED : ChatColor.WHITE)); getStack().setItemMeta(meta); - getStack().setAmount(Math.max(1, _loadedAmmo)); - if (player != null) + { player.getInventory().setItem(_slot, getStack()); + _reloadTick = !_reloadTick; + } } public double getDropOff() @@ -349,7 +375,7 @@ public class Gun extends StrikeItem _reserveAmmo = Math.max(0, ammo - _gunStats.getClipSize()); //Update - updateWeaponName(player); + //updateWeaponName(player); //Sound player.getWorld().playSound(player.getEyeLocation(), Sound.PISTON_EXTEND, 1f, 1.6f); @@ -417,7 +443,7 @@ public class Gun extends StrikeItem _loadedAmmo = _gunStats.getClipSize(); _reserveAmmo = _gunStats.getClipReserve() * _gunStats.getClipSize(); - updateWeaponName(player); + //updateWeaponName(player); } public double getDamage() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Shotgun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Shotgun.java index 579843cc3..78f565db2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Shotgun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Shotgun.java @@ -43,7 +43,7 @@ public class Shotgun extends Gun //Use Ammo _loadedAmmo--; - updateWeaponName(player); + //updateWeaponName(false); //Effect soundFire(player.getLocation()); From 55f5f958690744a3b83dec73d8947d565083caf2 Mon Sep 17 00:00:00 2001 From: Cheese Date: Thu, 26 Nov 2015 13:05:27 +1100 Subject: [PATCH 2/2] added no ammo display --- .../game/arcade/game/games/minestrike/items/guns/Gun.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java index d8f9bf7a2..04016f60a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java @@ -307,7 +307,10 @@ public class Gun extends StrikeItem if (!Recharge.Instance.usable(player, getName() + " Reload")) return; - UtilTextBottom.display(C.cGreen + _loadedAmmo + ChatColor.RESET + " / " + C.cYellow + _reserveAmmo, player); + if (_loadedAmmo > 0 || _reserveAmmo > 0) + UtilTextBottom.display(C.cGreen + _loadedAmmo + ChatColor.RESET + " / " + C.cYellow + _reserveAmmo, player); + else + UtilTextBottom.display(C.cRed + "No Ammo", player); } public void updateWeaponName(Player player)