From 939344816e71e6f68d2f4b2d8396168df4087d51 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 14 Feb 2012 10:33:49 -0800 Subject: [PATCH] Tweaks to SkullSplitter/SerratedStrikes --- src/main/java/com/gmail/nossr50/Combat.java | 30 +------------------ src/main/java/com/gmail/nossr50/m.java | 13 ++++---- .../java/com/gmail/nossr50/skills/Axes.java | 17 ++++++++--- .../com/gmail/nossr50/skills/Fishing.java | 2 +- .../java/com/gmail/nossr50/skills/Swords.java | 10 +++++-- 5 files changed, 30 insertions(+), 42 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/Combat.java b/src/main/java/com/gmail/nossr50/Combat.java index 8402d22a0..5266690e4 100644 --- a/src/main/java/com/gmail/nossr50/Combat.java +++ b/src/main/java/com/gmail/nossr50/Combat.java @@ -358,35 +358,7 @@ public class Combat } } - /** - * Attempt to damage target for value dmg with reason CUSTOM - * - * @param target LivingEntity which to attempt to damage - * @param dmg Amount of damage to attempt to do - */ - public static void dealDamage(LivingEntity target, int dmg){ - dealDamage(target, dmg, EntityDamageEvent.DamageCause.CUSTOM); - } - - /** - * Attempt to damage target for value dmg with reason cause - * - * @param target LivingEntity which to attempt to damage - * @param dmg Amount of damage to attempt to do - * @param cause DamageCause to pass to damage event - */ - public static void dealDamage(LivingEntity target, int dmg, DamageCause cause) { - target.damage(dmg); - } - - /** - * Attempt to damage target for value dmg with reason ENTITY_ATTACK with damager attacker - * - * @param target LivingEntity which to attempt to damage - * @param dmg Amount of damage to attempt to do - * @param attacker Player to pass to event as damager - */ - public static void dealDamage(LivingEntity target, int dmg, Player attacker) { + public static void dealDamage(LivingEntity target, int dmg) { target.damage(dmg); } diff --git a/src/main/java/com/gmail/nossr50/m.java b/src/main/java/com/gmail/nossr50/m.java index 11b03917d..93097f06c 100644 --- a/src/main/java/com/gmail/nossr50/m.java +++ b/src/main/java/com/gmail/nossr50/m.java @@ -164,6 +164,7 @@ public class m } } } + public static Integer getTier(Player player) { int i = player.getItemInHand().getTypeId(); @@ -181,6 +182,7 @@ public class m return 1; //UNRECOGNIZED } } + public static Integer getMaxDurability(Integer tier, ItemStack item) { int id = item.getTypeId(); @@ -250,6 +252,7 @@ public class m return health-newvalue; } } + public static boolean isInt(String string) { try @@ -262,6 +265,7 @@ public class m } return true; } + public static void mcDropItem(Location location, int id) { if(location == null) return; @@ -270,6 +274,7 @@ public class m ItemStack item = new ItemStack(mat, 1, (byte) 0, (byte) 0); mcDropItem(location, item); } + public static void mcDropItem(Location location, ItemStack itemStack) { // We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event. McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(location, itemStack); @@ -308,11 +313,7 @@ public class m int id = is.getTypeId(); return id == 270 || id == 274 || id == 285 || id == 257 || id == 278; } -// public boolean isGold(ItemStack is) -// { -// int id = is.getTypeId(); -// return id == 283 || id == 284 || id == 285 || id == 286 || id == 294 || id == 314 || id == 315 || id == 316 || id == 317; -// } + public static void convertToMySQL() { if(!LoadProperties.useMySQL) @@ -525,4 +526,4 @@ public class m } }, 1); } -} +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/skills/Axes.java b/src/main/java/com/gmail/nossr50/skills/Axes.java index 01ce3cc95..c15f2236b 100644 --- a/src/main/java/com/gmail/nossr50/skills/Axes.java +++ b/src/main/java/com/gmail/nossr50/skills/Axes.java @@ -69,6 +69,7 @@ public class Axes { } } } + public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx) { Entity x = event.getEntity(); @@ -118,6 +119,12 @@ public class Axes { public static void applyAoeDamage(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx) { int targets = 0; + + int dmgAmount = (event.getDamage()/2); + + //Setup minimum damage + if(dmgAmount < 1) + dmgAmount = 1; if(event.getEntity() instanceof LivingEntity) { @@ -135,6 +142,7 @@ public class Axes { if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, pluginx))) continue; } + //Damage nearby LivingEntities if(derp instanceof LivingEntity && targets >= 1) { @@ -154,18 +162,19 @@ public class Axes { if(target.isDead()) continue; - if(targets >= 1 && derp.getWorld().getPVP() && !target.isDead()) + if(targets >= 1 && derp.getWorld().getPVP()) { - Combat.dealDamage(target, event.getDamage() / 2, attacker); + Combat.dealDamage(target, dmgAmount); target.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!"); targets--; continue; } - } + } + else { LivingEntity target = (LivingEntity)derp; - Combat.dealDamage(target, event.getDamage() / 2, attacker); + Combat.dealDamage(target, dmgAmount); targets--; } } diff --git a/src/main/java/com/gmail/nossr50/skills/Fishing.java b/src/main/java/com/gmail/nossr50/skills/Fishing.java index 2763ea44d..1d0099a85 100644 --- a/src/main/java/com/gmail/nossr50/skills/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/Fishing.java @@ -1119,7 +1119,7 @@ public class Fishing { if(le instanceof Player) return; - Combat.dealDamage(le, 1, event.getPlayer()); + Combat.dealDamage(le, 1); Location loc = le.getLocation(); /* Neutral Mobs */ diff --git a/src/main/java/com/gmail/nossr50/skills/Swords.java b/src/main/java/com/gmail/nossr50/skills/Swords.java index 34ec0e50f..c3065e94e 100644 --- a/src/main/java/com/gmail/nossr50/skills/Swords.java +++ b/src/main/java/com/gmail/nossr50/skills/Swords.java @@ -113,6 +113,12 @@ public class Swords { int targets = 0; + int dmgAmount = (event.getDamage()/4); + + //Setup minimum damage + if(dmgAmount < 1) + dmgAmount = 1; + if(event.getEntity() instanceof LivingEntity) { LivingEntity x = (LivingEntity) event.getEntity(); @@ -146,7 +152,7 @@ public class Swords continue; if(targets >= 1 && derp.getWorld().getPVP()) { - Combat.dealDamage(target, event.getDamage() / 4, attacker); + Combat.dealDamage(target, dmgAmount); target.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!"); Users.getProfile(target).addBleedTicks(5); targets--; @@ -159,7 +165,7 @@ public class Swords pluginx.misc.addToBleedQue((LivingEntity)derp); LivingEntity target = (LivingEntity)derp; - Combat.dealDamage(target, event.getDamage() / 4, attacker); + Combat.dealDamage(target, dmgAmount); targets--; } }