|
@@ -17,11 +17,13 @@
|
|
|
package com.gmail.nossr50.skills;
|
|
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
+import org.bukkit.Material;
|
|
|
import org.bukkit.entity.Entity;
|
|
|
import org.bukkit.entity.LivingEntity;
|
|
|
import org.bukkit.entity.Player;
|
|
|
import org.bukkit.entity.Wolf;
|
|
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
|
+import org.bukkit.inventory.ItemStack;
|
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
|
|
import com.gmail.nossr50.Combat;
|
|
@@ -80,6 +82,53 @@ public class Axes {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static void impact(Player attacker, LivingEntity target)
|
|
|
+ {
|
|
|
+ boolean didImpact = false;
|
|
|
+
|
|
|
+ if(target instanceof Player)
|
|
|
+ {
|
|
|
+ Player targetPlayer = (Player) target;
|
|
|
+ int emptySlots = 0;
|
|
|
+
|
|
|
+ for(ItemStack x : targetPlayer.getInventory().getArmorContents())
|
|
|
+ {
|
|
|
+ System.out.println("[mcMMO] DEBUG: "+x.getType().toString());
|
|
|
+ if(x.getType() == Material.AIR)
|
|
|
+ {
|
|
|
+ emptySlots++;
|
|
|
+ } else {
|
|
|
+ x.setDurability((short) (x.getDurability()+30)); //Damage armor piece
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(emptySlots == 4)
|
|
|
+ {
|
|
|
+ targetPlayer.sendMessage("**HIT BY IMPACT**");
|
|
|
+ didImpact = applyImpact(target);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //Since mobs are technically unarmored this will always trigger
|
|
|
+ didImpact = applyImpact(target);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(didImpact)
|
|
|
+ {
|
|
|
+ attacker.sendMessage("STRUCK WITH GREAT FORCE!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static boolean applyImpact(LivingEntity target)
|
|
|
+ {
|
|
|
+ if(Math.random() * 100 > 75)
|
|
|
+ {
|
|
|
+ target.teleport(target.getLocation());
|
|
|
+ target.damage(2);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
public static void applyAoeDamage(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx)
|
|
|
{
|
|
|
int targets = 0;
|