From dd8eff7ab36ca8b8661efd05969b70a5a567bbb7 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Sun, 2 Feb 2014 04:42:44 -0700 Subject: [PATCH] Swords as a weapon has been nerfed. In place for the 'upgrading' patch for swords. (Makes swords more costly and weapons more valuable) Sharpness (and critical strikes in general) are now very valuable. --- .../src/me/kaZep/Base/PlayerListener.java | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index 3aab704..f022de5 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -9811,6 +9811,37 @@ implements Listener e.setCancelled(true); return; } + if (p.getItemInHand()!=null) { + if (p.getItemInHand().getType().toString().toLowerCase().contains("sword")) { + //Divide damage by 4. + e.setDamage(e.getDamage()/4.0d); + //Increase damage based on power level of weapon. + double dmg_ratio = 0; + if (p.getItemInHand().getType()==Material.WOOD_SWORD) { + //Damage increases by 0.5 per Power level. + dmg_ratio = 0.5; + } + if (p.getItemInHand().getType()==Material.STONE_SWORD) { + //Damage increases by 1.0 per Power level. + dmg_ratio = 1; + } + if (p.getItemInHand().getType()==Material.IRON_SWORD) { + //Damage increases by 1.5 per Power level. + dmg_ratio = 1.5; + } + if (p.getItemInHand().getType()==Material.DIAMOND_SWORD) { + //Damage increases by 2.0 per Power level. + dmg_ratio = 2; + } + if (p.getItemInHand().getType()==Material.GOLD_SWORD) { + //Damage increases by 8.0 per Power level. + dmg_ratio = 8; + } + if (p.getItemInHand().containsEnchantment(Enchantment.ARROW_DAMAGE)) { + e.setDamage(e.getDamage()+(p.getItemInHand().getEnchantmentLevel(Enchantment.ARROW_DAMAGE)*dmg_ratio)); + } + } + } if (p.getItemInHand()!=null && this.plugin.hasBonusEnchantment(p.getItemInHand(), this.plugin.ENCHANT_EXECUTE)) { if (e.getEntity() instanceof LivingEntity) { LivingEntity l = (LivingEntity)e.getEntity(); @@ -11112,7 +11143,7 @@ implements Listener int starty=l.getLocation().getBlockY(); int checky=l.getLocation().getBlockY(); /*16 is max height that a mob will be set to.*/ - while (checky-starty<19 && l.getWorld().getBlockAt(l.getLocation().getBlockX(),l.getLocation().getBlockY()+checky,l.getLocation().getBlockZ()).getType()==Material.AIR) { + while (checky-starty<19 && l.getWorld().getBlockAt(l.getLocation().getBlockX(),checky,l.getLocation().getBlockZ()).getType()==Material.AIR) { checky++; } @@ -11509,7 +11540,7 @@ implements Listener int starty=l.getLocation().getBlockY(); int checky=l.getLocation().getBlockY(); /*16 is max height that a mob will be set to.*/ - while (checky-starty<19 && l.getWorld().getBlockAt(l.getLocation().getBlockX(),l.getLocation().getBlockY()+checky,l.getLocation().getBlockZ()).getType()==Material.AIR) { + while (checky-starty<19 && l.getWorld().getBlockAt(l.getLocation().getBlockX(),checky,l.getLocation().getBlockZ()).getType()==Material.AIR) { checky++; }