mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-02 00:30:07 +01:00
Updates to Swords & Axes skills, optimizations.
This commit is contained in:
parent
6382bec05a
commit
716e6296e5
@ -60,7 +60,10 @@ public class Combat
|
||||
if(mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0) //Unarmed
|
||||
Unarmed.unarmedBonus(attacker, eventb);
|
||||
if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker) && Users.getProfile(attacker).getSkillLevel(SkillType.AXES) >= 500)
|
||||
event.setDamage(event.getDamage()+4);
|
||||
{
|
||||
int damage = event.getDamage()+4;
|
||||
event.setDamage(damage);
|
||||
}
|
||||
|
||||
//If there are any abilities to activate
|
||||
combatAbilityChecks(attacker, PPa, pluginx);
|
||||
@ -69,7 +72,7 @@ public class Combat
|
||||
if(!(((EntityDamageByEntityEvent) event).getDamager() instanceof Arrow))
|
||||
{
|
||||
if(mcPermissions.getInstance().axes(attacker))
|
||||
Axes.axeCriticalCheck(attacker, eventb, pluginx); //Axe Criticals
|
||||
Axes.axeCriticalCheck(attacker, eventb, pluginx); //Axe Critical Checks
|
||||
|
||||
if(!pluginx.misc.bleedTracker.contains((LivingEntity) event.getEntity())) //Swords Bleed
|
||||
Swords.bleedCheck(attacker, (LivingEntity)event.getEntity(), pluginx);
|
||||
@ -389,6 +392,7 @@ public class Combat
|
||||
public static void dealDamage(LivingEntity target, int dmg, Player attacker) {
|
||||
EntityDamageEvent ede = new EntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg);
|
||||
Bukkit.getPluginManager().callEvent(ede);
|
||||
if(ede.isCancelled()) return;
|
||||
|
||||
target.damage(ede.getDamage());
|
||||
}
|
||||
|
@ -225,8 +225,7 @@ public class mcEntityListener implements Listener
|
||||
int skillLevel = plugin.misc.tntTracker.get(block);
|
||||
BlastMining.biggerBombs(skillLevel, event);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.LOW)
|
||||
@ -234,8 +233,8 @@ public class mcEntityListener implements Listener
|
||||
{
|
||||
if(event.getEntity() instanceof TNTPrimed)
|
||||
{
|
||||
Block block = event.getLocation().getBlock();;
|
||||
|
||||
Block block = event.getLocation().getBlock();
|
||||
|
||||
if(plugin.misc.tntTracker.get(block) != null)
|
||||
{
|
||||
int skillLevel = plugin.misc.tntTracker.get(block);
|
||||
|
@ -72,6 +72,7 @@ public class Axes {
|
||||
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx)
|
||||
{
|
||||
Entity x = event.getEntity();
|
||||
|
||||
if(x instanceof Wolf){
|
||||
Wolf wolf = (Wolf)x;
|
||||
if(Taming.getOwner(wolf, pluginx) != null)
|
||||
@ -85,27 +86,29 @@ public class Axes {
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
||||
if(PPa.getSkillLevel(SkillType.AXES) >= 750){
|
||||
if(Math.random() * 1000 <= 750){
|
||||
if(Math.random() * 1000 <= 750 && !x.isDead()){
|
||||
if(x instanceof Player){
|
||||
int damage = (event.getDamage() * 2) - (event.getDamage() / 2);
|
||||
event.setDamage(damage);
|
||||
Player player = (Player)x;
|
||||
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
|
||||
}
|
||||
if(x instanceof Player){
|
||||
event.setDamage(event.getDamage() * 2 - event.getDamage() / 2);
|
||||
} else {
|
||||
event.setDamage(event.getDamage() * 2);
|
||||
else {
|
||||
int damage = event.getDamage() * 2;
|
||||
event.setDamage(damage);
|
||||
}
|
||||
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||
}
|
||||
} else if(Math.random() * 1000 <= PPa.getSkillLevel(SkillType.AXES)){
|
||||
} else if(Math.random() * 1000 <= PPa.getSkillLevel(SkillType.AXES) && !x.isDead()){
|
||||
if(x instanceof Player){
|
||||
int damage = (event.getDamage() * 2) - (event.getDamage() / 2);
|
||||
event.setDamage(damage);
|
||||
Player player = (Player)x;
|
||||
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
|
||||
}
|
||||
if(x instanceof Player){
|
||||
event.setDamage(event.getDamage() * 2 - event.getDamage() / 2);
|
||||
} else {
|
||||
event.setDamage(event.getDamage() * 2);
|
||||
else {
|
||||
int damage = event.getDamage() * 2;
|
||||
event.setDamage(damage);
|
||||
}
|
||||
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||
}
|
||||
@ -121,53 +124,52 @@ public class Axes {
|
||||
LivingEntity x = (LivingEntity) event.getEntity();
|
||||
targets = m.getTier(attacker);
|
||||
|
||||
for(Entity derp : x.getWorld().getEntities())
|
||||
{
|
||||
if(m.getDistance(x.getLocation(), derp.getLocation()) < 5)
|
||||
{
|
||||
|
||||
|
||||
//Make sure the Wolf is not friendly
|
||||
if(derp instanceof Wolf)
|
||||
for(Entity derp : x.getNearbyEntities(2.5, 2.5, 2.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)
|
||||
{
|
||||
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(Users.getProfile(target).getGodMode())
|
||||
continue;
|
||||
Player target = (Player)derp;
|
||||
|
||||
if(Users.getProfile(target).getGodMode())
|
||||
continue;
|
||||
|
||||
if(target.getName().equals(attacker.getName()))
|
||||
continue;
|
||||
|
||||
if(Party.getInstance().inSameParty(attacker, target))
|
||||
continue;
|
||||
if(targets >= 1 && derp.getWorld().getPVP())
|
||||
{
|
||||
Combat.dealDamage(target, event.getDamage() / 2, attacker);
|
||||
target.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!");
|
||||
targets--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LivingEntity target = (LivingEntity)derp;
|
||||
if(target.getName().equals(attacker.getName()))
|
||||
continue;
|
||||
|
||||
if(Party.getInstance().inSameParty(attacker, target))
|
||||
continue;
|
||||
|
||||
if(target.isDead())
|
||||
continue;
|
||||
|
||||
if(targets >= 1 && derp.getWorld().getPVP() && !target.isDead())
|
||||
{
|
||||
Combat.dealDamage(target, event.getDamage() / 2, attacker);
|
||||
targets--;
|
||||
}
|
||||
target.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!");
|
||||
targets--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LivingEntity target = (LivingEntity)derp;
|
||||
Combat.dealDamage(target, event.getDamage() / 2, attacker);
|
||||
targets--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class Swords
|
||||
if(mcPermissions.getInstance().swords(attacker) && m.isSwords(attacker.getItemInHand())){
|
||||
if(PPa.getSkillLevel(SkillType.SWORDS) >= 750)
|
||||
{
|
||||
if(Math.random() * 1000 >= 750)
|
||||
if(Math.random() * 1000 <= 750)
|
||||
{
|
||||
if(!(x instanceof Player))
|
||||
pluginx.misc.addToBleedQue(x);
|
||||
@ -118,59 +118,54 @@ public class Swords
|
||||
LivingEntity x = (LivingEntity) event.getEntity();
|
||||
targets = m.getTier(attacker);
|
||||
|
||||
for(Entity derp : x.getWorld().getEntities())
|
||||
for(Entity derp : x.getNearbyEntities(2.5, 2.5, 2.5))
|
||||
{
|
||||
if(m.getDistance(x.getLocation(), derp.getLocation()) < 5)
|
||||
{
|
||||
|
||||
|
||||
//Make sure the Wolf is not friendly
|
||||
if(derp instanceof Wolf)
|
||||
//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)
|
||||
{
|
||||
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())
|
||||
{
|
||||
Combat.dealDamage(target, event.getDamage() / 4, attacker);
|
||||
target.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!");
|
||||
Users.getProfile(target).addBleedTicks(5);
|
||||
targets--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!pluginx.misc.bleedTracker.contains(derp))
|
||||
pluginx.misc.addToBleedQue((LivingEntity)derp);
|
||||
|
||||
LivingEntity target = (LivingEntity)derp;
|
||||
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())
|
||||
{
|
||||
Combat.dealDamage(target, event.getDamage() / 4, attacker);
|
||||
targets--;
|
||||
}
|
||||
target.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!");
|
||||
Users.getProfile(target).addBleedTicks(5);
|
||||
targets--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!pluginx.misc.bleedTracker.contains(derp))
|
||||
pluginx.misc.addToBleedQue((LivingEntity)derp);
|
||||
|
||||
LivingEntity target = (LivingEntity)derp;
|
||||
Combat.dealDamage(target, event.getDamage() / 4, attacker);
|
||||
targets--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void counterAttackChecks(EntityDamageByEntityEvent event)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user