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
|
if(mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0) //Unarmed
|
||||||
Unarmed.unarmedBonus(attacker, eventb);
|
Unarmed.unarmedBonus(attacker, eventb);
|
||||||
if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker) && Users.getProfile(attacker).getSkillLevel(SkillType.AXES) >= 500)
|
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
|
//If there are any abilities to activate
|
||||||
combatAbilityChecks(attacker, PPa, pluginx);
|
combatAbilityChecks(attacker, PPa, pluginx);
|
||||||
@ -69,7 +72,7 @@ public class Combat
|
|||||||
if(!(((EntityDamageByEntityEvent) event).getDamager() instanceof Arrow))
|
if(!(((EntityDamageByEntityEvent) event).getDamager() instanceof Arrow))
|
||||||
{
|
{
|
||||||
if(mcPermissions.getInstance().axes(attacker))
|
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
|
if(!pluginx.misc.bleedTracker.contains((LivingEntity) event.getEntity())) //Swords Bleed
|
||||||
Swords.bleedCheck(attacker, (LivingEntity)event.getEntity(), pluginx);
|
Swords.bleedCheck(attacker, (LivingEntity)event.getEntity(), pluginx);
|
||||||
@ -389,6 +392,7 @@ public class Combat
|
|||||||
public static void dealDamage(LivingEntity target, int dmg, Player attacker) {
|
public static void dealDamage(LivingEntity target, int dmg, Player attacker) {
|
||||||
EntityDamageEvent ede = new EntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg);
|
EntityDamageEvent ede = new EntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg);
|
||||||
Bukkit.getPluginManager().callEvent(ede);
|
Bukkit.getPluginManager().callEvent(ede);
|
||||||
|
if(ede.isCancelled()) return;
|
||||||
|
|
||||||
target.damage(ede.getDamage());
|
target.damage(ede.getDamage());
|
||||||
}
|
}
|
||||||
|
@ -225,8 +225,7 @@ public class mcEntityListener implements Listener
|
|||||||
int skillLevel = plugin.misc.tntTracker.get(block);
|
int skillLevel = plugin.misc.tntTracker.get(block);
|
||||||
BlastMining.biggerBombs(skillLevel, event);
|
BlastMining.biggerBombs(skillLevel, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.LOW)
|
@EventHandler (priority = EventPriority.LOW)
|
||||||
@ -234,8 +233,8 @@ public class mcEntityListener implements Listener
|
|||||||
{
|
{
|
||||||
if(event.getEntity() instanceof TNTPrimed)
|
if(event.getEntity() instanceof TNTPrimed)
|
||||||
{
|
{
|
||||||
Block block = event.getLocation().getBlock();;
|
Block block = event.getLocation().getBlock();
|
||||||
|
|
||||||
if(plugin.misc.tntTracker.get(block) != null)
|
if(plugin.misc.tntTracker.get(block) != null)
|
||||||
{
|
{
|
||||||
int skillLevel = plugin.misc.tntTracker.get(block);
|
int skillLevel = plugin.misc.tntTracker.get(block);
|
||||||
|
@ -72,6 +72,7 @@ public class Axes {
|
|||||||
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx)
|
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx)
|
||||||
{
|
{
|
||||||
Entity x = event.getEntity();
|
Entity x = event.getEntity();
|
||||||
|
|
||||||
if(x instanceof Wolf){
|
if(x instanceof Wolf){
|
||||||
Wolf wolf = (Wolf)x;
|
Wolf wolf = (Wolf)x;
|
||||||
if(Taming.getOwner(wolf, pluginx) != null)
|
if(Taming.getOwner(wolf, pluginx) != null)
|
||||||
@ -85,27 +86,29 @@ public class Axes {
|
|||||||
PlayerProfile PPa = Users.getProfile(attacker);
|
PlayerProfile PPa = Users.getProfile(attacker);
|
||||||
if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
||||||
if(PPa.getSkillLevel(SkillType.AXES) >= 750){
|
if(PPa.getSkillLevel(SkillType.AXES) >= 750){
|
||||||
if(Math.random() * 1000 <= 750){
|
if(Math.random() * 1000 <= 750 && !x.isDead()){
|
||||||
if(x instanceof Player){
|
if(x instanceof Player){
|
||||||
|
int damage = (event.getDamage() * 2) - (event.getDamage() / 2);
|
||||||
|
event.setDamage(damage);
|
||||||
Player player = (Player)x;
|
Player player = (Player)x;
|
||||||
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
|
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
|
||||||
}
|
}
|
||||||
if(x instanceof Player){
|
else {
|
||||||
event.setDamage(event.getDamage() * 2 - event.getDamage() / 2);
|
int damage = event.getDamage() * 2;
|
||||||
} else {
|
event.setDamage(damage);
|
||||||
event.setDamage(event.getDamage() * 2);
|
|
||||||
}
|
}
|
||||||
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
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){
|
if(x instanceof Player){
|
||||||
|
int damage = (event.getDamage() * 2) - (event.getDamage() / 2);
|
||||||
|
event.setDamage(damage);
|
||||||
Player player = (Player)x;
|
Player player = (Player)x;
|
||||||
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
|
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
|
||||||
}
|
}
|
||||||
if(x instanceof Player){
|
else {
|
||||||
event.setDamage(event.getDamage() * 2 - event.getDamage() / 2);
|
int damage = event.getDamage() * 2;
|
||||||
} else {
|
event.setDamage(damage);
|
||||||
event.setDamage(event.getDamage() * 2);
|
|
||||||
}
|
}
|
||||||
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
}
|
}
|
||||||
@ -121,53 +124,52 @@ public class Axes {
|
|||||||
LivingEntity x = (LivingEntity) event.getEntity();
|
LivingEntity x = (LivingEntity) event.getEntity();
|
||||||
targets = m.getTier(attacker);
|
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)
|
||||||
|
{
|
||||||
|
Wolf hurrDurr = (Wolf)derp;
|
||||||
//Make sure the Wolf is not friendly
|
if(Taming.getOwner(hurrDurr, pluginx) == attacker)
|
||||||
if(derp instanceof Wolf)
|
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;
|
Player target = (Player)derp;
|
||||||
if(Taming.getOwner(hurrDurr, pluginx) == attacker)
|
|
||||||
continue;
|
if(Users.getProfile(target).getGodMode())
|
||||||
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, pluginx)))
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//Damage nearby LivingEntities
|
|
||||||
if(derp instanceof LivingEntity && targets >= 1)
|
|
||||||
{
|
|
||||||
if(derp instanceof Player)
|
|
||||||
{
|
|
||||||
Player target = (Player)derp;
|
|
||||||
|
|
||||||
if(Users.getProfile(target).getGodMode())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(target.getName().equals(attacker.getName()))
|
if(target.getName().equals(attacker.getName()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(Party.getInstance().inSameParty(attacker, target))
|
if(Party.getInstance().inSameParty(attacker, target))
|
||||||
continue;
|
continue;
|
||||||
if(targets >= 1 && derp.getWorld().getPVP())
|
|
||||||
{
|
if(target.isDead())
|
||||||
Combat.dealDamage(target, event.getDamage() / 2, attacker);
|
continue;
|
||||||
target.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!");
|
|
||||||
targets--;
|
if(targets >= 1 && derp.getWorld().getPVP() && !target.isDead())
|
||||||
continue;
|
{
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LivingEntity target = (LivingEntity)derp;
|
|
||||||
Combat.dealDamage(target, event.getDamage() / 2, attacker);
|
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(mcPermissions.getInstance().swords(attacker) && m.isSwords(attacker.getItemInHand())){
|
||||||
if(PPa.getSkillLevel(SkillType.SWORDS) >= 750)
|
if(PPa.getSkillLevel(SkillType.SWORDS) >= 750)
|
||||||
{
|
{
|
||||||
if(Math.random() * 1000 >= 750)
|
if(Math.random() * 1000 <= 750)
|
||||||
{
|
{
|
||||||
if(!(x instanceof Player))
|
if(!(x instanceof Player))
|
||||||
pluginx.misc.addToBleedQue(x);
|
pluginx.misc.addToBleedQue(x);
|
||||||
@ -118,59 +118,54 @@ public class Swords
|
|||||||
LivingEntity x = (LivingEntity) event.getEntity();
|
LivingEntity x = (LivingEntity) event.getEntity();
|
||||||
targets = m.getTier(attacker);
|
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)
|
||||||
|
{
|
||||||
|
Wolf hurrDurr = (Wolf)derp;
|
||||||
//Make sure the Wolf is not friendly
|
if(Taming.getOwner(hurrDurr, pluginx) == attacker)
|
||||||
if(derp instanceof Wolf)
|
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;
|
Player target = (Player)derp;
|
||||||
if(Taming.getOwner(hurrDurr, pluginx) == attacker)
|
|
||||||
continue;
|
if(target.getName().equals(attacker.getName()))
|
||||||
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, pluginx)))
|
continue;
|
||||||
continue;
|
|
||||||
}
|
if(Users.getProfile(target).getGodMode())
|
||||||
//Damage nearby LivingEntities
|
continue;
|
||||||
if(derp instanceof LivingEntity && targets >= 1)
|
|
||||||
{
|
if(Party.getInstance().inSameParty(attacker, target))
|
||||||
if(derp instanceof Player)
|
continue;
|
||||||
{
|
if(targets >= 1 && derp.getWorld().getPVP())
|
||||||
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;
|
|
||||||
Combat.dealDamage(target, event.getDamage() / 4, attacker);
|
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)
|
public static void counterAttackChecks(EntityDamageByEntityEvent event)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user