enable armor protection and fix shotguns

This commit is contained in:
xXVevzZXx 2016-07-15 04:39:53 +02:00
parent 6c7f2d8b0d
commit 3070835662
2 changed files with 47 additions and 5 deletions

View File

@ -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);
}
}
}

View File

@ -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();