mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +01:00
Starting work on Impact subskill for Axes
This commit is contained in:
parent
d56fe82bfd
commit
652a27eb38
@ -82,6 +82,10 @@ public class Combat
|
|||||||
|
|
||||||
Axes.axeCriticalCheck(attacker, event, pluginx); //Critical hit
|
Axes.axeCriticalCheck(attacker, event, pluginx); //Critical hit
|
||||||
|
|
||||||
|
//Impact
|
||||||
|
if(event.getEntity() instanceof LivingEntity)
|
||||||
|
Axes.impact(attacker, (LivingEntity)event.getEntity());
|
||||||
|
|
||||||
if (!(event instanceof FakeEntityDamageByEntityEvent) && PPa.getSkullSplitterMode())
|
if (!(event instanceof FakeEntityDamageByEntityEvent) && PPa.getSkullSplitterMode())
|
||||||
Axes.applyAoeDamage(attacker, event, pluginx);
|
Axes.applyAoeDamage(attacker, event, pluginx);
|
||||||
|
|
||||||
|
@ -17,11 +17,13 @@
|
|||||||
package com.gmail.nossr50.skills;
|
package com.gmail.nossr50.skills;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Wolf;
|
import org.bukkit.entity.Wolf;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import com.gmail.nossr50.Combat;
|
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)
|
public static void applyAoeDamage(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx)
|
||||||
{
|
{
|
||||||
int targets = 0;
|
int targets = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user