Finish Axe restructuring, modify a little bit of Swords stuff as well.

This commit is contained in:
GJ 2013-01-15 16:38:44 -05:00
parent 105f088576
commit 5bdf4b5dcc
5 changed files with 41 additions and 8 deletions

View File

@ -82,4 +82,18 @@ public class AxeManager extends SkillManager {
eventHandler.applyGreaterImpact(); eventHandler.applyGreaterImpact();
} }
} }
/**
* Check for Skull Splitter ability.
*
* @param event The event to process
*/
public void skullSplitter(EntityDamageByEntityEvent event) {
if (Misc.isNPC(player) || !Permissions.skullSplitter(player)) {
return;
}
SkullSplitterEventHandler eventHandler = new SkullSplitterEventHandler(this, event);
eventHandler.applyAbilityEffects();
}
} }

View File

@ -0,0 +1,24 @@
package com.gmail.nossr50.skills.axes;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.util.Combat;
public class SkullSplitterEventHandler {
private Player player;
private LivingEntity target;
private int damage;
protected SkullSplitterEventHandler(AxeManager manager, EntityDamageByEntityEvent event) {
this.player = manager.getPlayer();
this.target = (LivingEntity) event.getEntity();
this.damage = event.getDamage();
}
protected void applyAbilityEffects() {
Combat.applyAbilityAoE(player, target, damage / 2, SkillType.AXES);
}
}

View File

@ -19,9 +19,6 @@ public class SerratedStrikesEventHandler {
} }
protected void applyAbilityEffects() { protected void applyAbilityEffects() {
if (player == null)
return;
Combat.applyAbilityAoE(player, target, damage / Swords.SERRATED_STRIKES_MODIFIER, SkillType.SWORDS); Combat.applyAbilityAoE(player, target, damage / Swords.SERRATED_STRIKES_MODIFIER, SkillType.SWORDS);
BleedTimer.add(target, Swords.SERRATED_STRIKES_BLEED_TICKS); BleedTimer.add(target, Swords.SERRATED_STRIKES_BLEED_TICKS);
} }

View File

@ -76,10 +76,7 @@ public class SwordsManager extends SkillManager {
} }
public void serratedStrikes(LivingEntity target, int damage) { public void serratedStrikes(LivingEntity target, int damage) {
if (player == null) if (Misc.isNPC(player) || !Permissions.serratedStrikes(player)) {
return;
if (!Permissions.serratedStrikes(player)) {
return; return;
} }

View File

@ -102,7 +102,8 @@ public class Combat {
axeManager.criticalHitCheck(event); axeManager.criticalHitCheck(event);
axeManager.impact(event); axeManager.impact(event);
if (attackerProfile.getAbilityMode(AbilityType.SKULL_SPLIITER) && Permissions.skullSplitter(attacker)) { if (attackerProfile.getAbilityMode(AbilityType.SKULL_SPLIITER)) {
axeManager.skullSplitter(event);
applyAbilityAoE(attacker, target, event.getDamage() / 2, SkillType.AXES); applyAbilityAoE(attacker, target, event.getDamage() / 2, SkillType.AXES);
} }