2013-01-10 15:26:28 +01:00
|
|
|
package com.gmail.nossr50.skills.axes;
|
|
|
|
|
2013-01-25 02:10:50 +01:00
|
|
|
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
|
|
|
|
2013-02-01 06:38:25 +01:00
|
|
|
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
2013-01-11 04:39:08 +01:00
|
|
|
import com.gmail.nossr50.skills.SkillManager;
|
2013-01-30 17:53:51 +01:00
|
|
|
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 {
|
2013-02-01 06:38:25 +01:00
|
|
|
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();
|
|
|
|
}
|
2013-01-14 17:55:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check for critical chances on axe damage.
|
|
|
|
*
|
|
|
|
* @param event The event to modify
|
|
|
|
*/
|
2013-01-25 02:10:50 +01:00
|
|
|
public void criticalHitCheck(EntityDamageByEntityEvent event, LivingEntity target) {
|
|
|
|
CriticalHitEventHandler eventHandler = new CriticalHitEventHandler(this, event, target);
|
2013-01-14 17:55:43 +01:00
|
|
|
|
|
|
|
double chance = (Axes.criticalHitMaxChance / Axes.criticalHitMaxBonusLevel) * eventHandler.skillModifier;
|
|
|
|
|
2013-01-25 02:10:50 +01:00
|
|
|
if (chance > Misc.getRandom().nextInt(activationChance)) {
|
2013-01-14 17:55:43 +01:00
|
|
|
eventHandler.modifyEventDamage();
|
|
|
|
eventHandler.sendAbilityMessages();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-15 22:16:46 +01:00
|
|
|
/**
|
|
|
|
* Check for Impact ability.
|
|
|
|
*
|
|
|
|
* @param event The event to modify
|
|
|
|
*/
|
2013-01-25 02:10:50 +01:00
|
|
|
public void impact(EntityDamageByEntityEvent event, LivingEntity target) {
|
|
|
|
ImpactEventHandler eventHandler = new ImpactEventHandler(this, event, target);
|
2013-01-15 22:16:46 +01:00
|
|
|
|
2013-02-12 19:06:30 +01:00
|
|
|
if (!eventHandler.applyImpact()) {
|
2013-01-15 22:16:46 +01:00
|
|
|
eventHandler.applyGreaterImpact();
|
|
|
|
}
|
|
|
|
}
|
2013-01-15 22:38:44 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check for Skull Splitter ability.
|
|
|
|
*
|
2013-01-31 01:42:40 +01:00
|
|
|
* @param target The entity hit by Skull Splitter
|
|
|
|
* @param damage The base damage to deal
|
2013-01-15 22:38:44 +01:00
|
|
|
*/
|
2013-01-25 02:10:50 +01:00
|
|
|
public void skullSplitter(LivingEntity target, int damage) {
|
2013-02-01 06:38:25 +01:00
|
|
|
SkullSplitterEventHandler eventHandler = new SkullSplitterEventHandler(mcMMOPlayer.getPlayer(), damage, target);
|
2013-01-15 22:38:44 +01:00
|
|
|
eventHandler.applyAbilityEffects();
|
|
|
|
}
|
2013-01-10 15:26:28 +01:00
|
|
|
}
|