mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Reworking the AxeManager.
This commit is contained in:
parent
55138f1599
commit
a28d673eb7
@ -65,6 +65,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
public int getGreaterImpactBonusDamage() { return config.getInt("Skills.Axes.GreaterImpact_BonusDamage", 2); }
|
public int getGreaterImpactBonusDamage() { return config.getInt("Skills.Axes.GreaterImpact_BonusDamage", 2); }
|
||||||
|
|
||||||
public int getArmorImpactIncreaseLevel() { return config.getInt("Skills.Axes.ArmorImpact_IncreaseLevel", 50); }
|
public int getArmorImpactIncreaseLevel() { return config.getInt("Skills.Axes.ArmorImpact_IncreaseLevel", 50); }
|
||||||
|
public double getImpactChance() { return config.getDouble("Skills.Axes.ArmorImpact_Chance", 25.0D); }
|
||||||
public double getArmorImpactMaxDurabilityDamage() { return config.getDouble("Skills.Axes.ArmorImpact_MaxPercentageDurabilityDamage", 20.0D); }
|
public double getArmorImpactMaxDurabilityDamage() { return config.getDouble("Skills.Axes.ArmorImpact_MaxPercentageDurabilityDamage", 20.0D); }
|
||||||
|
|
||||||
public int getSkullSplitterModifier() { return config.getInt("Skills.Axes.SkullSplitter_DamagerModifier", 2); }
|
public int getSkullSplitterModifier() { return config.getInt("Skills.Axes.SkullSplitter_DamagerModifier", 2); }
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
package com.gmail.nossr50.skills.axes;
|
|
||||||
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
|
|
||||||
public class AxeBonusDamageEventHandler {
|
|
||||||
private int skillLevel;
|
|
||||||
private EntityDamageByEntityEvent event;
|
|
||||||
private int damageBonus;
|
|
||||||
|
|
||||||
public AxeBonusDamageEventHandler(AxeManager manager, EntityDamageByEntityEvent event) {
|
|
||||||
this.skillLevel = manager.getSkillLevel();
|
|
||||||
this.event = event;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void calculateDamageBonus() {
|
|
||||||
int increaseLevel = Axes.bonusDamageMaxBonusLevel / Axes.bonusDamageMaxBonus;
|
|
||||||
|
|
||||||
/* Add 1 DMG for every 50 skill levels (default value) */
|
|
||||||
damageBonus = skillLevel / increaseLevel;
|
|
||||||
|
|
||||||
if (damageBonus > Axes.bonusDamageMaxBonus) {
|
|
||||||
damageBonus = Axes.bonusDamageMaxBonus;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void modifyEventDamage() {
|
|
||||||
int damage = event.getDamage();
|
|
||||||
|
|
||||||
event.setDamage(damage + damageBonus);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,67 +1,148 @@
|
|||||||
package com.gmail.nossr50.skills.axes;
|
package com.gmail.nossr50.skills.axes;
|
||||||
|
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mods.ModChecks;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
|
import com.gmail.nossr50.skills.utilities.AbilityType;
|
||||||
|
import com.gmail.nossr50.skills.utilities.CombatTools;
|
||||||
|
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.skills.utilities.ToolType;
|
||||||
|
import com.gmail.nossr50.util.ItemChecks;
|
||||||
|
import com.gmail.nossr50.util.ParticleEffectUtils;
|
||||||
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
public class AxeManager extends SkillManager {
|
public class AxeManager extends SkillManager {
|
||||||
public AxeManager(McMMOPlayer mcMMOPlayer) {
|
public AxeManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, SkillType.AXES);
|
super(mcMMOPlayer, SkillType.AXES);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public boolean canUseAxeMastery() {
|
||||||
* Apply bonus to damage done by axes.
|
return Permissions.bonusDamage(getPlayer(), skill);
|
||||||
*
|
}
|
||||||
* @param event The event to modify
|
|
||||||
*/
|
|
||||||
public void bonusDamage(EntityDamageByEntityEvent event) {
|
|
||||||
AxeBonusDamageEventHandler eventHandler = new AxeBonusDamageEventHandler(this, event);
|
|
||||||
|
|
||||||
eventHandler.calculateDamageBonus();
|
public boolean canCriticalHit(LivingEntity target) {
|
||||||
eventHandler.modifyEventDamage();
|
return target.isValid() && Permissions.criticalStrikes(getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canImpact(LivingEntity target) {
|
||||||
|
return target.isValid() && Permissions.armorImpact(getPlayer()) && Axes.hasArmor(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canGreaterImpact(LivingEntity target) {
|
||||||
|
return target.isValid() && Permissions.greaterImpact(getPlayer()) && !Axes.hasArmor(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canUseSkullSplitter(LivingEntity target) {
|
||||||
|
return target.isValid() && getProfile().getAbilityMode(AbilityType.SKULL_SPLITTER) && Permissions.skullSplitter(getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canActivateAbility() {
|
||||||
|
return getProfile().getToolPreparationMode(ToolType.AXE) && Permissions.skullSplitter(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for critical chances on axe damage.
|
* Handle the effects of the Axe Mastery ability
|
||||||
*
|
*
|
||||||
* @param event The event to modify
|
* @param damage The amount of damage initially dealt by the event
|
||||||
|
* @return the modified event damage
|
||||||
*/
|
*/
|
||||||
public void criticalHitCheck(EntityDamageByEntityEvent event, LivingEntity target) {
|
public int axeMasteryCheck(int damage) {
|
||||||
CriticalHitEventHandler eventHandler = new CriticalHitEventHandler(this, event, target);
|
int axeBonus = Math.min(getSkillLevel() / (Axes.bonusDamageMaxBonusLevel / Axes.bonusDamageMaxBonus), Axes.bonusDamageMaxBonus);
|
||||||
|
|
||||||
double chance = (Axes.criticalHitMaxChance / Axes.criticalHitMaxBonusLevel) * eventHandler.skillModifier;
|
return damage + axeBonus;
|
||||||
|
}
|
||||||
|
|
||||||
if (chance > Misc.getRandom().nextInt(activationChance)) {
|
/**
|
||||||
eventHandler.modifyEventDamage();
|
* Handle the effects of the Critical Hit ability
|
||||||
eventHandler.sendAbilityMessages();
|
*
|
||||||
|
* @param target The {@link LivingEntity} being affected by the ability
|
||||||
|
* @param damage The amount of damage initially dealt by the event
|
||||||
|
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
||||||
|
*/
|
||||||
|
public int criticalHitCheck(LivingEntity target, int damage) {
|
||||||
|
Player player = getPlayer();
|
||||||
|
|
||||||
|
if (SkillTools.activationSuccessful(player, skill, Axes.criticalHitMaxChance, Axes.criticalHitMaxBonusLevel)) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Axes.Combat.CriticalHit"));
|
||||||
|
|
||||||
|
if (target instanceof Player) {
|
||||||
|
((Player) target).sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck"));
|
||||||
|
|
||||||
|
return (int) (damage * Axes.criticalHitPVPModifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int) (damage * Axes.criticalHitPVEModifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the effects of the Impact ability
|
||||||
|
*
|
||||||
|
* @param target The {@link LivingEntity} being affected by Impact
|
||||||
|
*/
|
||||||
|
public void impactCheck(LivingEntity target) {
|
||||||
|
int durabilityDamage = 1 + (getSkillLevel() / Axes.impactIncreaseLevel);
|
||||||
|
|
||||||
|
for (ItemStack armor : target.getEquipment().getArmorContents()) {
|
||||||
|
if (ItemChecks.isArmor(armor) && SkillTools.activationSuccessful(getPlayer(), skill, Axes.impactChance)) {
|
||||||
|
double durabilityModifier = 1 / (armor.getEnchantmentLevel(Enchantment.DURABILITY) + 1); // Modifier to simulate the durability enchantment behavior
|
||||||
|
double modifiedDurabilityDamage = durabilityDamage * durabilityModifier;
|
||||||
|
double maxDurabilityDamage = (ModChecks.isCustomArmor(armor) ? ModChecks.getArmorFromItemStack(armor).getDurability() : armor.getType().getMaxDurability()) * Axes.impactMaxDurabilityDamageModifier;
|
||||||
|
|
||||||
|
armor.setDurability((short) (Math.min(modifiedDurabilityDamage, maxDurabilityDamage) + armor.getDurability()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for Impact ability.
|
* Handle the effects of the Greater Impact ability
|
||||||
*
|
*
|
||||||
* @param event The event to modify
|
* @param target The {@link LivingEntity} being affected by the ability
|
||||||
|
* @param damage The amount of damage initially dealt by the event
|
||||||
|
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
||||||
*/
|
*/
|
||||||
public void impact(EntityDamageByEntityEvent event, LivingEntity target) {
|
public int greaterImpactCheck(LivingEntity target, int damage) {
|
||||||
ImpactEventHandler eventHandler = new ImpactEventHandler(this, event, target);
|
Player player = getPlayer();
|
||||||
|
|
||||||
if (!eventHandler.applyImpact()) {
|
if (SkillTools.activationSuccessful(player, skill, Axes.greaterImpactChance)) {
|
||||||
eventHandler.applyGreaterImpact();
|
ParticleEffectUtils.playGreaterImpactEffect(target);
|
||||||
|
target.setVelocity(player.getLocation().getDirection().normalize().multiply(Axes.greaterImpactKnockbackMultiplier));
|
||||||
|
|
||||||
|
if (getProfile().useChatNotifications()) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target instanceof Player) {
|
||||||
|
Player defender = (Player) target;
|
||||||
|
|
||||||
|
if (Users.getPlayer(defender).getProfile().useChatNotifications()) {
|
||||||
|
defender.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Struck"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return damage + Axes.greaterImpactBonusDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for Skull Splitter ability.
|
* Handle the effects of the Skull Splitter ability
|
||||||
*
|
*
|
||||||
* @param target The entity hit by Skull Splitter
|
* @param target The {@link LivingEntity} being affected by the ability
|
||||||
* @param damage The base damage to deal
|
* @param damage The amount of damage initially dealt by the event
|
||||||
*/
|
*/
|
||||||
public void skullSplitter(LivingEntity target, int damage) {
|
public void skullSplitterCheck(LivingEntity target, int damage) {
|
||||||
SkullSplitterEventHandler eventHandler = new SkullSplitterEventHandler(mcMMOPlayer.getPlayer(), damage, target);
|
CombatTools.applyAbilityAoE(getPlayer(), target, damage / Axes.skullSplitterModifier, skill);
|
||||||
eventHandler.applyAbilityEffects();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package com.gmail.nossr50.skills.axes;
|
package com.gmail.nossr50.skills.axes;
|
||||||
|
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
|
import com.gmail.nossr50.util.ItemChecks;
|
||||||
|
|
||||||
public class Axes {
|
public class Axes {
|
||||||
public static int bonusDamageMaxBonus = AdvancedConfig.getInstance().getBonusDamageAxesBonusMax();
|
public static int bonusDamageMaxBonus = AdvancedConfig.getInstance().getBonusDamageAxesBonusMax();
|
||||||
@ -12,6 +16,7 @@ public class Axes {
|
|||||||
public static double criticalHitPVEModifier = AdvancedConfig.getInstance().getAxesCriticalPVEModifier();
|
public static double criticalHitPVEModifier = AdvancedConfig.getInstance().getAxesCriticalPVEModifier();
|
||||||
|
|
||||||
public static int impactIncreaseLevel = AdvancedConfig.getInstance().getArmorImpactIncreaseLevel();
|
public static int impactIncreaseLevel = AdvancedConfig.getInstance().getArmorImpactIncreaseLevel();
|
||||||
|
public static double impactChance = AdvancedConfig.getInstance().getImpactChance();
|
||||||
public static double impactMaxDurabilityDamageModifier = AdvancedConfig.getInstance().getArmorImpactMaxDurabilityDamage() / 100D;
|
public static double impactMaxDurabilityDamageModifier = AdvancedConfig.getInstance().getArmorImpactMaxDurabilityDamage() / 100D;
|
||||||
|
|
||||||
public static double greaterImpactChance = AdvancedConfig.getInstance().getGreaterImpactChance();
|
public static double greaterImpactChance = AdvancedConfig.getInstance().getGreaterImpactChance();
|
||||||
@ -19,4 +24,14 @@ public class Axes {
|
|||||||
public static int greaterImpactBonusDamage = AdvancedConfig.getInstance().getGreaterImpactBonusDamage();
|
public static int greaterImpactBonusDamage = AdvancedConfig.getInstance().getGreaterImpactBonusDamage();
|
||||||
|
|
||||||
public static int skullSplitterModifier = AdvancedConfig.getInstance().getSkullSplitterModifier();
|
public static int skullSplitterModifier = AdvancedConfig.getInstance().getSkullSplitterModifier();
|
||||||
|
|
||||||
|
protected static boolean hasArmor(LivingEntity target) {
|
||||||
|
for (ItemStack itemStack : target.getEquipment().getArmorContents()) {
|
||||||
|
if (ItemChecks.isArmor(itemStack)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
package com.gmail.nossr50.skills.axes;
|
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
|
||||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
|
||||||
import com.gmail.nossr50.util.Users;
|
|
||||||
|
|
||||||
public class CriticalHitEventHandler {
|
|
||||||
private AxeManager manager;
|
|
||||||
private EntityDamageByEntityEvent event;
|
|
||||||
private int damage;
|
|
||||||
|
|
||||||
protected LivingEntity defender;
|
|
||||||
protected int skillModifier;
|
|
||||||
|
|
||||||
public CriticalHitEventHandler(AxeManager manager, EntityDamageByEntityEvent event, LivingEntity defender) {
|
|
||||||
this.manager = manager;
|
|
||||||
this.event = event;
|
|
||||||
this.defender = defender;
|
|
||||||
this.damage = event.getDamage();
|
|
||||||
|
|
||||||
calculateSkillModifier();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void modifyEventDamage() {
|
|
||||||
if (defender instanceof Player) {
|
|
||||||
event.setDamage((int) (damage * Axes.criticalHitPVPModifier));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
event.setDamage((int) (damage * Axes.criticalHitPVEModifier));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void sendAbilityMessages() {
|
|
||||||
McMMOPlayer mcMMOPlayer = manager.getMcMMOPlayer();
|
|
||||||
Player attacker = mcMMOPlayer.getPlayer();
|
|
||||||
|
|
||||||
attacker.playEffect(defender.getEyeLocation(), Effect.MOBSPAWNER_FLAMES, 0);
|
|
||||||
|
|
||||||
if (mcMMOPlayer.getProfile().useChatNotifications()) {
|
|
||||||
attacker.sendMessage(LocaleLoader.getString("Axes.Combat.CriticalHit"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defender instanceof Player) {
|
|
||||||
Player defendingPlayer = (Player) defender;
|
|
||||||
|
|
||||||
if (Users.getPlayer(defendingPlayer).getProfile().useChatNotifications()) {
|
|
||||||
defendingPlayer.sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void calculateSkillModifier() {
|
|
||||||
this.skillModifier = SkillTools.skillCheck(manager.getSkillLevel(), Axes.criticalHitMaxBonusLevel);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,104 +0,0 @@
|
|||||||
package com.gmail.nossr50.skills.axes;
|
|
||||||
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.inventory.EntityEquipment;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
|
||||||
import com.gmail.nossr50.mods.ModChecks;
|
|
||||||
import com.gmail.nossr50.util.ItemChecks;
|
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
import com.gmail.nossr50.util.ParticleEffectUtils;
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.Users;
|
|
||||||
|
|
||||||
public class ImpactEventHandler {
|
|
||||||
private AxeManager manager;
|
|
||||||
private Player player;
|
|
||||||
private EntityDamageByEntityEvent event;
|
|
||||||
private short durabilityDamage = 1;
|
|
||||||
private EntityEquipment entityEquipment;
|
|
||||||
protected LivingEntity defender;
|
|
||||||
boolean impactApplied;
|
|
||||||
|
|
||||||
public ImpactEventHandler(AxeManager manager, EntityDamageByEntityEvent event, LivingEntity defender) {
|
|
||||||
this.manager = manager;
|
|
||||||
this.player = manager.getMcMMOPlayer().getPlayer();
|
|
||||||
this.event = event;
|
|
||||||
this.defender = defender;
|
|
||||||
this.entityEquipment = defender.getEquipment();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean applyImpact() {
|
|
||||||
// Every 50 Skill Levels you gain 1 durability damage (default values)
|
|
||||||
durabilityDamage += (short) (manager.getSkillLevel() / Axes.impactIncreaseLevel);
|
|
||||||
// getArmorContents.length can't be used because it's always equal to 4 (no armor = air block)
|
|
||||||
boolean hasArmor = false;
|
|
||||||
|
|
||||||
for (ItemStack itemStack : entityEquipment.getArmorContents()) {
|
|
||||||
if (ItemChecks.isArmor(itemStack)) {
|
|
||||||
hasArmor = true;
|
|
||||||
|
|
||||||
if (Misc.getRandom().nextInt(100) < 25) {
|
|
||||||
damageArmor(itemStack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return hasArmor;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void damageArmor(ItemStack armor) {
|
|
||||||
// Modifier simulate the durability enchantment behavior
|
|
||||||
float modifier = 1;
|
|
||||||
|
|
||||||
if (armor.containsEnchantment(Enchantment.DURABILITY)) {
|
|
||||||
modifier /= armor.getEnchantmentLevel(Enchantment.DURABILITY) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
float modifiedDurabilityDamage = durabilityDamage * modifier;
|
|
||||||
short maxDurabilityDamage = ModChecks.isCustomArmor(armor) ? ModChecks.getArmorFromItemStack(armor).getDurability() : armor.getType().getMaxDurability();
|
|
||||||
maxDurabilityDamage *= Axes.impactMaxDurabilityDamageModifier;
|
|
||||||
|
|
||||||
if (modifiedDurabilityDamage > maxDurabilityDamage) {
|
|
||||||
modifiedDurabilityDamage = maxDurabilityDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
armor.setDurability((short) (modifiedDurabilityDamage + armor.getDurability()));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void applyGreaterImpact() {
|
|
||||||
if (!Permissions.greaterImpact(player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Misc.getRandom().nextInt(manager.getActivationChance()) <= Axes.greaterImpactChance) {
|
|
||||||
handleGreaterImpactEffect();
|
|
||||||
sendAbilityMessge();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleGreaterImpactEffect() {
|
|
||||||
event.setDamage(event.getDamage() + Axes.greaterImpactBonusDamage);
|
|
||||||
|
|
||||||
ParticleEffectUtils.playGreaterImpactEffect(defender);
|
|
||||||
defender.setVelocity(player.getLocation().getDirection().normalize().multiply(Axes.greaterImpactKnockbackMultiplier));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendAbilityMessge() {
|
|
||||||
if (manager.getMcMMOPlayer().getProfile().useChatNotifications()) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defender instanceof Player) {
|
|
||||||
Player defendingPlayer = (Player) defender;
|
|
||||||
|
|
||||||
if (Users.getPlayer(defendingPlayer).getProfile().useChatNotifications()) {
|
|
||||||
defendingPlayer.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Struck"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
package com.gmail.nossr50.skills.axes;
|
|
||||||
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.skills.utilities.CombatTools;
|
|
||||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
|
||||||
|
|
||||||
public class SkullSplitterEventHandler {
|
|
||||||
private Player player;
|
|
||||||
private LivingEntity target;
|
|
||||||
private int damage;
|
|
||||||
|
|
||||||
protected SkullSplitterEventHandler(Player player, int damage, LivingEntity target) {
|
|
||||||
this.player = player;
|
|
||||||
this.target = target;
|
|
||||||
this.damage = damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void applyAbilityEffects() {
|
|
||||||
CombatTools.applyAbilityAoE(player, target, damage / Axes.skullSplitterModifier, SkillType.AXES);
|
|
||||||
}
|
|
||||||
}
|
|
@ -28,6 +28,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
|||||||
import com.gmail.nossr50.mods.ModChecks;
|
import com.gmail.nossr50.mods.ModChecks;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
import com.gmail.nossr50.skills.SkillManagerStore;
|
import com.gmail.nossr50.skills.SkillManagerStore;
|
||||||
|
import com.gmail.nossr50.skills.axes.AxeManager;
|
||||||
import com.gmail.nossr50.skills.runnables.BleedTimer;
|
import com.gmail.nossr50.skills.runnables.BleedTimer;
|
||||||
import com.gmail.nossr50.skills.runnables.CombatXpGiver;
|
import com.gmail.nossr50.skills.runnables.CombatXpGiver;
|
||||||
import com.gmail.nossr50.skills.swords.Swords;
|
import com.gmail.nossr50.skills.swords.Swords;
|
||||||
@ -106,32 +107,32 @@ public final class CombatTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.skillEnabled(player, SkillType.AXES)) {
|
if (Permissions.skillEnabled(player, SkillType.AXES)) {
|
||||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
|
AxeManager axeManager = SkillManagerStore.getInstance().getAxeManager(player.getName());
|
||||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
|
||||||
String playerName = player.getName();
|
|
||||||
|
|
||||||
boolean canSkullSplit = Permissions.skullSplitter(player); //So we don't have to check the same permission twice
|
if (axeManager.canActivateAbility()) {
|
||||||
if (profile.getToolPreparationMode(ToolType.AXE) && canSkullSplit) {
|
|
||||||
SkillTools.abilityCheck(player, SkillType.AXES);
|
SkillTools.abilityCheck(player, SkillType.AXES);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.bonusDamage(player, SkillType.AXES)) {
|
if (axeManager.canUseAxeMastery()) {
|
||||||
SkillManagerStore.getInstance().getAxeManager(playerName).bonusDamage(event);
|
event.setDamage(axeManager.axeMasteryCheck(event.getDamage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!target.isDead() && Permissions.criticalStrikes(player)) {
|
if (axeManager.canCriticalHit(target)) {
|
||||||
SkillManagerStore.getInstance().getAxeManager(playerName).criticalHitCheck(event, target);
|
event.setDamage(axeManager.criticalHitCheck(target, event.getDamage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!target.isDead() && Permissions.armorImpact(player)) {
|
if (axeManager.canImpact(target)) {
|
||||||
SkillManagerStore.getInstance().getAxeManager(playerName).impact(event, target);
|
axeManager.impactCheck(target);
|
||||||
|
}
|
||||||
|
else if (axeManager.canGreaterImpact(target)){
|
||||||
|
event.setDamage(axeManager.greaterImpactCheck(target, event.getDamage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!target.isDead() && profile.getAbilityMode(AbilityType.SKULL_SPLITTER) && canSkullSplit) {
|
if (axeManager.canUseSkullSplitter(target)) {
|
||||||
SkillManagerStore.getInstance().getAxeManager(playerName).skullSplitter(target, event.getDamage());
|
axeManager.skullSplitterCheck(target, event.getDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
startGainXp(mcMMOPlayer, target, SkillType.AXES);
|
startGainXp(axeManager.getMcMMOPlayer(), target, SkillType.AXES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (heldItemType == Material.AIR) {
|
else if (heldItemType == Material.AIR) {
|
||||||
|
@ -95,8 +95,10 @@ Skills:
|
|||||||
GreaterImpact_BonusDamage: 2
|
GreaterImpact_BonusDamage: 2
|
||||||
|
|
||||||
# ArmorImpact_IncreaseLevel: Every "IncreaseLevel" the durability damage goes up with 1
|
# ArmorImpact_IncreaseLevel: Every "IncreaseLevel" the durability damage goes up with 1
|
||||||
|
# ArmorImpact_Chance: Chance of hitting with ArmorImpact
|
||||||
# ArmorImpact_MaxPercentageDurabilityDamage: Durability damage cap for ArmorImpact, 20% means that you can never destroy a piece of armor in less than 5 hits
|
# ArmorImpact_MaxPercentageDurabilityDamage: Durability damage cap for ArmorImpact, 20% means that you can never destroy a piece of armor in less than 5 hits
|
||||||
ArmorImpact_IncreaseLevel: 50
|
ArmorImpact_IncreaseLevel: 50
|
||||||
|
ArmorImpact_Chance: 25.0
|
||||||
ArmorImpact_MaxPercentageDurabilityDamage: 20.0
|
ArmorImpact_MaxPercentageDurabilityDamage: 20.0
|
||||||
|
|
||||||
# SkullSplitter_DamageModifier: Damage will get divided by this modifier
|
# SkullSplitter_DamageModifier: Damage will get divided by this modifier
|
||||||
|
Loading…
Reference in New Issue
Block a user