mcMMO/src/main/java/com/gmail/nossr50/skills/axes/AxeManager.java

68 lines
2.2 KiB
Java
Raw Normal View History

2013-01-10 15:26:28 +01:00
package com.gmail.nossr50.skills.axes;
import org.bukkit.entity.LivingEntity;
2013-01-11 04:39:08 +01:00
import org.bukkit.event.entity.EntityDamageByEntityEvent;
2013-01-10 15:26:28 +01:00
import com.gmail.nossr50.datatypes.McMMOPlayer;
2013-01-11 04:39:08 +01:00
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.skills.utilities.SkillType;
2013-01-11 04:39:08 +01:00
import com.gmail.nossr50.util.Misc;
public class AxeManager extends SkillManager {
public AxeManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.AXES);
2013-01-11 04:39:08 +01:00
}
/**
* Apply bonus to damage done by axes.
*
* @param event The event to modify
*/
public void bonusDamage(EntityDamageByEntityEvent event) {
AxeBonusDamageEventHandler eventHandler = new AxeBonusDamageEventHandler(this, event);
eventHandler.calculateDamageBonus();
eventHandler.modifyEventDamage();
}
/**
* Check for critical chances on axe damage.
*
* @param event The event to modify
*/
public void criticalHitCheck(EntityDamageByEntityEvent event, LivingEntity target) {
CriticalHitEventHandler eventHandler = new CriticalHitEventHandler(this, event, target);
double chance = (Axes.criticalHitMaxChance / Axes.criticalHitMaxBonusLevel) * eventHandler.skillModifier;
if (chance > Misc.getRandom().nextInt(activationChance)) {
eventHandler.modifyEventDamage();
eventHandler.sendAbilityMessages();
}
}
2013-01-15 22:16:46 +01:00
/**
* Check for Impact ability.
*
* @param event The event to modify
*/
public void impact(EntityDamageByEntityEvent event, LivingEntity target) {
ImpactEventHandler eventHandler = new ImpactEventHandler(this, event, target);
2013-01-15 22:16:46 +01:00
if (!eventHandler.applyImpact()) {
2013-01-15 22:16:46 +01:00
eventHandler.applyGreaterImpact();
}
}
/**
* Check for Skull Splitter ability.
*
* @param target The entity hit by Skull Splitter
* @param damage The base damage to deal
*/
public void skullSplitter(LivingEntity target, int damage) {
SkullSplitterEventHandler eventHandler = new SkullSplitterEventHandler(mcMMOPlayer.getPlayer(), damage, target);
eventHandler.applyAbilityEffects();
}
2013-01-10 15:26:28 +01:00
}