public static void applySerratedStrikes( Player attacker, EntityDamageByEntityEvent event, mcMMO pluginx) { int targets = 0; if (event.getEntity() instanceof LivingEntity) { LivingEntity x = (LivingEntity) event.getEntity(); targets = Utils.getTier(attacker); for (Entity derp : x.getWorld().getEntities()) { if (Utils.getDistance(x.getLocation(), derp.getLocation()) < 5) { // Make sure the Wolf is not friendly if (derp instanceof Wolf) { Wolf hurrDurr = (Wolf) derp; if (Taming.getOwner(hurrDurr, pluginx) == attacker) continue; // if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, // pluginx))) // continue; } // Damage nearby LivingEntities if (derp instanceof LivingEntity && targets >= 1) { if (derp instanceof Player) { Player target = (Player) derp; if (target.getName().equals(attacker.getName())) continue; if (Users.getProfile(target).getGodMode()) continue; // if(Party.getInstance().inSameParty(attacker, target)) // continue; if (targets >= 1 && derp.getWorld().getPVP()) { target.damage(event.getDamage() / 4); target.sendMessage(ChatColor.DARK_RED + "Struck by Serrated Strikes!"); if (Combat.dealDamage(attacker, target, 0)) target.increaseBleedTicks(5); target.setLastCustomDamageCause( new EntityDamageByEntityEvent(attacker, target, DamageCause.ENTITY_ATTACK, 0)); targets--; continue; } } else { LivingEntity target = (LivingEntity) derp; target.increaseBleedTicks(5); target.damage(event.getDamage() / 4); target.setLastCustomDamageCause( new EntityDamageByEntityEvent(attacker, target, DamageCause.ENTITY_ATTACK, 0)); targets--; } } } } } }
public static void parryCheck(EntityDamageByEntityEvent event, Player defender) { Entity y = event.getDamager(); PlayerProfile PPd = Users.getProfile(defender); if (defender != null && Utils.isSword(defender.getItemInHand()) && mcPermissions.skillPermission(SkillType.SWORDS, defender)) { if (PPd.getSkillLevel(SkillType.SWORDS) >= 900) { if (Math.random() * 3000 <= 900) { event.setCancelled(true); defender.sendMessage(ChatColor.GREEN + "**PARRIED**"); defender .getItemInHand() .setDurability((short) (defender.getItemInHand().getDurability() + 1)); if (y instanceof Player) { Player attacker = (Player) y; attacker.sendMessage(ChatColor.GREEN + "**PARRIED**"); } } } else { if (Math.random() * 3000 <= PPd.getSkillLevel(SkillType.SWORDS)) { event.setCancelled(true); defender.sendMessage(ChatColor.YELLOW + "*CLANG* SUCCESSFUL PARRY *CLANG*"); defender .getItemInHand() .setDurability((short) (defender.getItemInHand().getDurability() + 1)); if (y instanceof Player) { Player attacker = (Player) y; attacker.sendMessage(ChatColor.DARK_RED + "**TARGET HAS PARRIED THAT ATTACK**"); } } } } }
public static void bleedCheck(Player attacker, LivingEntity damaged, mcMMO pluginx) { PlayerProfile PPa = Users.getProfile(attacker); if (damaged.getBleedTicks() > 0) return; if (damaged instanceof Wolf) { Wolf wolf = (Wolf) damaged; if (Taming.getOwner(wolf, pluginx) != null) { if (Taming.getOwner(wolf, pluginx) == attacker) return; // if(Party.getInstance().inSameParty(attacker, Taming.getOwner(wolf, pluginx))) // return; } } if (mcPermissions.skillPermission(SkillType.SWORDS, attacker) && Utils.isSword(attacker.getItemInHand())) { if (Math.random() * 1000 <= Math.min(PPa.getSkillLevel(SkillType.SWORDS), 750)) { if (!(damaged instanceof Player) || Combat.dealDamage(attacker, damaged, 0)) damaged.increaseBleedTicks(5); attacker.sendMessage(ChatColor.GREEN + "**ENEMY BLEEDING**"); damaged.setLastCustomDamageCause( new EntityDamageByEntityEvent(attacker, damaged, DamageCause.ENTITY_ATTACK, 0)); } } }
public static void counterAttackChecks(EntityDamageByEntityEvent event) { // Don't want to counter attack arrows if (event.getDamager() instanceof Projectile) return; if (event instanceof EntityDamageByEntityEvent) { Entity damager = ((EntityDamageByEntityEvent) event).getDamager(); if (event.getEntity() instanceof Player) { Player damaged = (Player) event.getEntity(); PlayerProfile PPd = Users.getProfile(damaged); if (Utils.isSword(damaged.getItemInHand()) && mcPermissions.skillPermission(SkillType.SWORDS, damaged)) { if (Math.random() * 2000 <= Math.min(PPd.getSkillLevel(SkillType.SWORDS), 600)) { Combat.dealDamage(damaged, damager, event.getDamage() / 2); damaged.sendMessage(ChatColor.GREEN + "**COUNTER-ATTACKED**"); if (damager instanceof Player) { ((Player) damager).sendMessage(ChatColor.DARK_RED + "Hit with counterattack!"); } } } } } }