Updates to Swords & Axes skills, optimizations.

This commit is contained in:
GJ 2012-02-09 00:58:05 -05:00
parent 6382bec05a
commit 716e6296e5
4 changed files with 109 additions and 109 deletions

View File

@ -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());
}

View File

@ -226,7 +226,6 @@ public class mcEntityListener implements Listener
BlastMining.biggerBombs(skillLevel, event);
}
}
}
@EventHandler (priority = EventPriority.LOW)
@ -234,7 +233,7 @@ 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)
{

View File

@ -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,12 +124,8 @@ public class Axes {
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)
{
@ -151,7 +150,11 @@ public class Axes {
if(Party.getInstance().inSameParty(attacker, target))
continue;
if(targets >= 1 && derp.getWorld().getPVP())
if(target.isDead())
continue;
if(targets >= 1 && derp.getWorld().getPVP() && !target.isDead())
{
Combat.dealDamage(target, event.getDamage() / 2, attacker);
target.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!");
@ -169,5 +172,4 @@ public class Axes {
}
}
}
}
}

View File

@ -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,12 +118,8 @@ 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)
{
@ -170,7 +166,6 @@ public class Swords
}
}
}
}
public static void counterAttackChecks(EntityDamageByEntityEvent event)
{