From ecb0fb340bf3118dbf61e7638466806055f974b9 Mon Sep 17 00:00:00 2001 From: Brendan Wilson Date: Thu, 20 Nov 2014 18:57:45 -0500 Subject: [PATCH] Tweaked MetalClips Made the interval for 4-clip damage twice as fast by default. Made the damage for 4-clip go through armor. --- .../ProjectKorra/ConfigManager.java | 2 +- .../ProjectKorra/earthbending/MetalClips.java | 30 +++++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/com/projectkorra/ProjectKorra/ConfigManager.java b/src/com/projectkorra/ProjectKorra/ConfigManager.java index 94de0340..60b4ead5 100644 --- a/src/com/projectkorra/ProjectKorra/ConfigManager.java +++ b/src/com/projectkorra/ProjectKorra/ConfigManager.java @@ -460,7 +460,7 @@ public class ConfigManager { config.addDefault("Abilities.Earth.MetalClips.Enabled", true); config.addDefault("Abilities.Earth.MetalClips.Description", "Shoot multiple metal clips at your enemy to slowly encase them in metal, allowing you to control their movements. This ability only works on Zombies, Skeletons, and Players. You need iron in your inventory to use this ability."); config.addDefault("Abilities.Earth.MetalClips.Damage", 2); - config.addDefault("Abilities.Earth.MetalClips.DamageInterval", 1000); + config.addDefault("Abilities.Earth.MetalClips.DamageInterval", 500); config.addDefault("Abilities.Earth.MetalClips.MagnetRange", 20); config.addDefault("Abilities.Earth.MetalClips.Cooldown", 1000); config.addDefault("Abilities.Earth.MetalClips.Duration", 10000); diff --git a/src/com/projectkorra/ProjectKorra/earthbending/MetalClips.java b/src/com/projectkorra/ProjectKorra/earthbending/MetalClips.java index 72690bbe..2f6df79a 100644 --- a/src/com/projectkorra/ProjectKorra/earthbending/MetalClips.java +++ b/src/com/projectkorra/ProjectKorra/earthbending/MetalClips.java @@ -254,17 +254,7 @@ public class MetalClips { Vector v = Methods.getDirection(e.getLocation(), player.getLocation()); - if(e instanceof Item) - { - Item iron = (Item) e; - - if(Arrays.asList(metalItems).contains(iron.getItemStack().getType())) - { - iron.setVelocity(v.normalize().multiply(0.4)); - } - } - - else if(e instanceof Player && player.hasPermission("bending.ability.MetalClips.loot") + if(e instanceof Player && player.hasPermission("bending.ability.MetalClips.loot") && player.getInventory().getItemInHand().getType() == Material.IRON_BLOCK) { Player p = (Player) e; @@ -276,6 +266,9 @@ public class MetalClips for(ItemStack is : inventory) { + if(is == null) + continue; + if(Arrays.asList(metalItems).contains(is.getType())) { p.getWorld().dropItem(p.getLocation(), is); @@ -306,7 +299,7 @@ public class MetalClips } } - else if((e instanceof Zombie || e instanceof Skeleton) && player.hasPermission("bending.ability.MetalClips.loot") + if((e instanceof Zombie || e instanceof Skeleton) && player.hasPermission("bending.ability.MetalClips.loot") && player.getInventory().getItemInHand().getType() == Material.IRON_BLOCK) { LivingEntity le = (LivingEntity) e; @@ -331,6 +324,16 @@ public class MetalClips le.getEquipment().setItemInHand(new ItemStack(Material.AIR, 1)); } } + + if(e instanceof Item) + { + Item iron = (Item) e; + + if(Arrays.asList(metalItems).contains(iron.getItemStack().getType())) + { + iron.setVelocity(v.normalize().multiply(0.4)); + } + } } } @@ -397,7 +400,8 @@ public class MetalClips if(System.currentTimeMillis() > time + crushInterval) { time = System.currentTimeMillis(); - Methods.damageEntity(player, target, crushDamage); + Methods.damageEntity(player, target, 0); + target.setHealth((target.getHealth() - crushDamage < 0) ? 0 : target.getHealth() - crushDamage); } } }