From 3070835662e44f11185bbea0cceb1401ac67063e Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Fri, 15 Jul 2016 04:39:53 +0200 Subject: [PATCH] enable armor protection and fix shotguns --- .../game/games/minestrike/GunModule.java | 38 +++++++++++++++++-- .../survivalgames/modes/StrikeGames.java | 14 ++++++- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java index 4f80d15d5..93860fbba 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java @@ -136,6 +136,7 @@ public class GunModule implements Listener public boolean CustomHitbox = true; public boolean BulletAlternate = false; + public boolean EnableNormalArmor = false; public boolean BlockRegeneration = true; public boolean EnablePickup = true; public boolean EnableDrop = true; @@ -1022,6 +1023,28 @@ public class GunModule implements Listener { UtilAction.zeroVelocity(event.GetDamageeEntity()); } + + if (EnableNormalArmor) + { + for (ItemStack item : event.GetDamageePlayer().getInventory().getArmorContents()) + { + if (item == null) + continue; + + double armomrDamage = 0; + + if (item.getType().toString().contains("DIAMOND")) armomrDamage -= 1; + if (item.getType().toString().contains("GOLD")) armomrDamage -= 0.5; + if (item.getType().toString().contains("IRON")) armomrDamage -= 0.75; + if (item.getType().toString().contains("LEATHER")) armomrDamage -= 0.25; + if (item.getType().toString().contains("CHAIN")) armomrDamage -= 0.5; + + if (event.GetDamage() - armomrDamage <= 0) + armomrDamage = -(event.GetDamage() - 1); + + event.AddMod(event.GetDamageePlayer().getName(), "Armor", armomrDamage, false); + } + } event.SetKnockback(false); event.SetIgnoreRate(true); @@ -1383,12 +1406,19 @@ public class GunModule implements Listener if (event.getType() != UpdateType.TICK) return; - for (Player player : _host.GetPlayers(true)) + for (Player player : UtilServer.getPlayers()) { - if (UtilGear.isMat(player.getItemInHand(), Material.IRON_AXE) || UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD)) - Manager.GetCondition().Factory().Speed("Knife", player, player, 1.9, 0, false, false, false); + if (_host.IsAlive(player)) + { + if (UtilGear.isMat(player.getItemInHand(), Material.IRON_AXE) || UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD)) + player.setWalkSpeed(0.2F); + else + player.setWalkSpeed(0.1F); + } else - Manager.GetCondition().EndCondition(player, ConditionType.SPEED, null); + { + player.setWalkSpeed(0.1F); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/StrikeGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/StrikeGames.java index 9bc472390..c5deefa69 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/StrikeGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/StrikeGames.java @@ -43,6 +43,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.PlayerKitGiveEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.minestrike.GunModule; +import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType; import nautilus.game.arcade.game.games.minestrike.items.grenades.FlashBang; import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade; import nautilus.game.arcade.game.games.minestrike.items.grenades.HighExplosive; @@ -51,6 +52,8 @@ import nautilus.game.arcade.game.games.minestrike.items.grenades.Molotov; import nautilus.game.arcade.game.games.minestrike.items.grenades.Smoke; import nautilus.game.arcade.game.games.minestrike.items.guns.Gun; import nautilus.game.arcade.game.games.minestrike.items.guns.GunStats; +import nautilus.game.arcade.game.games.minestrike.items.guns.GunType; +import nautilus.game.arcade.game.games.minestrike.items.guns.Shotgun; import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames; import nautilus.game.arcade.game.games.survivalgames.SupplyChestOpenEvent; import nautilus.game.arcade.game.games.survivalgames.kit.KitLooter; @@ -90,6 +93,7 @@ public class StrikeGames extends SoloSurvivalGames _gunModule.EnableDrop = false; _gunModule.EnablePickup = false; _gunModule.BlockRegeneration = false; + _gunModule.EnableNormalArmor = true; } @EventHandler @@ -460,7 +464,15 @@ public class StrikeGames extends SoloSurvivalGames { if (stat.getSkin() == stack.getType()) { - Gun gun = new Gun(stat, _gunModule); + Gun gun = null; + if (stat.getGunType() == GunType.SHOTGUN) + { + gun = new Shotgun(stat, _gunModule); + } + else + { + gun = new Gun(stat, _gunModule); + } gun.setStack(stack); gun.updateWeaponName(player, null, false); gun.addID();