mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Wire up Acrobatics, Archery, and Axes behaviour managers
This commit is contained in:
parent
b756938fb1
commit
148a4fd555
@ -170,4 +170,7 @@ public class DynamicSettingsManager {
|
|||||||
return skillPropertiesManager;
|
return skillPropertiesManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SkillBehaviourManager getSkillBehaviourManager() {
|
||||||
|
return skillBehaviourManager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,25 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
public class AcrobaticsBehaviour {
|
public class AcrobaticsBehaviour {
|
||||||
private final mcMMO pluginRef;
|
private final mcMMO pluginRef;
|
||||||
|
|
||||||
|
private double dodgeDamageModifier;
|
||||||
|
private int dodgeXpModifier;
|
||||||
|
|
||||||
public AcrobaticsBehaviour(mcMMO pluginRef) {
|
public AcrobaticsBehaviour(mcMMO pluginRef) {
|
||||||
this.pluginRef = pluginRef;
|
this.pluginRef = pluginRef;
|
||||||
|
|
||||||
|
dodgeDamageModifier = pluginRef.getConfigManager().getConfigAcrobatics().getDamageReductionDivisor();
|
||||||
|
dodgeXpModifier = pluginRef.getConfigManager().getConfigExperience().getDodgeXP();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double calculateModifiedDodgeDamage(double damage, double damageModifier) {
|
||||||
|
return Math.max(damage / damageModifier, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getDodgeDamageModifier() {
|
||||||
|
return dodgeDamageModifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDodgeXpModifier() {
|
||||||
|
return dodgeXpModifier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills.behaviours;
|
package com.gmail.nossr50.datatypes.skills.behaviours;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.core.MetadataConstants;
|
||||||
|
import com.gmail.nossr50.datatypes.meta.TrackedArrowMeta;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These behaviour classes are a band-aid fix for a larger problem
|
* These behaviour classes are a band-aid fix for a larger problem
|
||||||
@ -16,4 +26,46 @@ public class ArcheryBehaviour {
|
|||||||
public ArcheryBehaviour(mcMMO pluginRef) {
|
public ArcheryBehaviour(mcMMO pluginRef) {
|
||||||
this.pluginRef = pluginRef;
|
this.pluginRef = pluginRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check for arrow retrieval.
|
||||||
|
*
|
||||||
|
* @param livingEntity The entity hit by the arrows
|
||||||
|
*/
|
||||||
|
public void arrowRetrievalCheck(LivingEntity livingEntity) {
|
||||||
|
if(livingEntity.hasMetadata(MetadataConstants.ARROW_TRACKER_METAKEY)) {
|
||||||
|
Misc.dropItems(livingEntity.getLocation(), new ItemStack(Material.ARROW), livingEntity.getMetadata(MetadataConstants.ARROW_TRACKER_METAKEY).get(0).asInt());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementArrowCount(LivingEntity livingEntity) {
|
||||||
|
if(livingEntity.hasMetadata(MetadataConstants.ARROW_TRACKER_METAKEY)) {
|
||||||
|
int arrowCount = livingEntity.getMetadata(MetadataConstants.ARROW_TRACKER_METAKEY).get(0).asInt();
|
||||||
|
livingEntity.getMetadata(MetadataConstants.ARROW_TRACKER_METAKEY).set(0, new FixedMetadataValue(pluginRef, arrowCount + 1));
|
||||||
|
} else {
|
||||||
|
livingEntity.setMetadata(MetadataConstants.ARROW_TRACKER_METAKEY, new TrackedArrowMeta(pluginRef, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getSkillShotBonusDamage(Player player, double oldDamage) {
|
||||||
|
double damageBonusPercent = getDamageBonusPercent(player);
|
||||||
|
double newDamage = oldDamage + (oldDamage * damageBonusPercent);
|
||||||
|
return Math.min(newDamage, getSkillShotDamageCap());
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getDamageBonusPercent(Player player) {
|
||||||
|
return ((RankUtils.getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * pluginRef.getConfigManager().getConfigArchery().getSkillShotDamageMultiplier()) / 100.0D;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getSkillShotDamageCap() {
|
||||||
|
return pluginRef.getConfigManager().getConfigArchery().getSkillShotDamageCeiling();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getDazeBonusDamage() {
|
||||||
|
return pluginRef.getConfigManager().getConfigArchery().getDaze().getDazeBonusDamage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getDistanceXpMultiplier() {
|
||||||
|
return pluginRef.getConfigManager().getConfigExperience().getExperienceArchery().getDistanceMultiplier();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills.behaviours;
|
package com.gmail.nossr50.datatypes.skills.behaviours;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These behaviour classes are a band-aid fix for a larger problem
|
* These behaviour classes are a band-aid fix for a larger problem
|
||||||
@ -16,4 +22,24 @@ public class AxesBehaviour {
|
|||||||
public AxesBehaviour(mcMMO pluginRef) {
|
public AxesBehaviour(mcMMO pluginRef) {
|
||||||
this.pluginRef = pluginRef;
|
this.pluginRef = pluginRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasArmor(LivingEntity target) {
|
||||||
|
for (ItemStack itemStack : target.getEquipment().getArmorContents()) {
|
||||||
|
if (itemStack != null && ItemUtils.isArmor(itemStack)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For every rank in Axe Mastery we add RankDamageMultiplier to get the total bonus damage from Axe Mastery
|
||||||
|
*
|
||||||
|
* @param player The target player
|
||||||
|
* @return The axe mastery bonus damage which will be added to their attack
|
||||||
|
*/
|
||||||
|
public double getAxeMasteryBonusDamage(Player player) {
|
||||||
|
return RankUtils.getRank(player, SubSkillType.AXES_AXE_MASTERY) * pluginRef.getConfigManager().getConfigAxes().getAxeMasteryMultiplier();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,11 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class Roll extends AcrobaticsSubSkill {
|
public class Roll extends AcrobaticsSubSkill {
|
||||||
|
|
||||||
|
private final mcMMO pluginRef;
|
||||||
|
|
||||||
public Roll() {
|
public Roll(mcMMO pluginRef) {
|
||||||
super("Roll", EventPriority.HIGHEST, SubSkillType.ACROBATICS_ROLL);
|
super("Roll", EventPriority.HIGHEST, SubSkillType.ACROBATICS_ROLL);
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static double calculateModifiedRollDamage(double damage, double damageThreshold) {
|
protected static double calculateModifiedRollDamage(double damage, double damageThreshold) {
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
package com.gmail.nossr50.skills.acrobatics;
|
|
||||||
|
|
||||||
public final class Acrobatics {
|
|
||||||
public static double dodgeDamageModifier;
|
|
||||||
public static int dodgeXpModifier;
|
|
||||||
// public static boolean dodgeLightningDisabled;
|
|
||||||
|
|
||||||
private Acrobatics() {
|
|
||||||
dodgeDamageModifier = pluginRef.getConfigManager().getConfigAcrobatics().getDamageReductionDivisor();
|
|
||||||
dodgeXpModifier = pluginRef.getConfigManager().getConfigExperience().getDodgeXP();
|
|
||||||
// dodgeLightningDisabled = MainConfig.getInstance().getDodgeLightningDisabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static double calculateModifiedDodgeDamage(double damage, double damageModifier) {
|
|
||||||
return Math.max(damage / damageModifier, 1.0);
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,6 +6,7 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
|||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.behaviours.AcrobaticsBehaviour;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@ -25,9 +26,13 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
private long rollXPInterval;
|
private long rollXPInterval;
|
||||||
private long rollXPIntervalLengthen = (1000 * 10); //10 Seconds
|
private long rollXPIntervalLengthen = (1000 * 10); //10 Seconds
|
||||||
private LimitedSizeList fallLocationMap;
|
private LimitedSizeList fallLocationMap;
|
||||||
|
private AcrobaticsBehaviour acrobaticsBehaviour;
|
||||||
|
|
||||||
public AcrobaticsManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
|
public AcrobaticsManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
|
||||||
super(pluginRef, mcMMOPlayer, PrimarySkillType.ACROBATICS);
|
super(pluginRef, mcMMOPlayer, PrimarySkillType.ACROBATICS);
|
||||||
|
//Init Behaviour
|
||||||
|
acrobaticsBehaviour = pluginRef.getDynamicSettingsManager().getSkillBehaviourManager().getAcrobaticsBehaviour();
|
||||||
|
|
||||||
rollXPInterval = (1000 * pluginRef.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().getRollXPGainCooldownSeconds());
|
rollXPInterval = (1000 * pluginRef.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().getRollXPGainCooldownSeconds());
|
||||||
|
|
||||||
//Save some memory if exploit prevention is off
|
//Save some memory if exploit prevention is off
|
||||||
@ -80,7 +85,7 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
||||||
*/
|
*/
|
||||||
public double dodgeCheck(double damage) {
|
public double dodgeCheck(double damage) {
|
||||||
double modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage, Acrobatics.dodgeDamageModifier);
|
double modifiedDamage = acrobaticsBehaviour.calculateModifiedDodgeDamage(damage, acrobaticsBehaviour.getDodgeDamageModifier());
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
if (!isFatal(modifiedDamage) && RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.ACROBATICS_DODGE, player)) {
|
if (!isFatal(modifiedDamage) && RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.ACROBATICS_DODGE, player)) {
|
||||||
@ -92,10 +97,10 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
|
|
||||||
//Check respawn to prevent abuse
|
//Check respawn to prevent abuse
|
||||||
if (!pluginRef.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse())
|
if (!pluginRef.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse())
|
||||||
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVP);
|
applyXpGain((float) (damage * acrobaticsBehaviour.getDodgeXpModifier()), XPGainReason.PVP);
|
||||||
else if (SkillUtils.cooldownExpired(mcMMOPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)
|
else if (SkillUtils.cooldownExpired(mcMMOPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)
|
||||||
&& mcMMOPlayer.getTeleportATS() < System.currentTimeMillis()) {
|
&& mcMMOPlayer.getTeleportATS() < System.currentTimeMillis()) {
|
||||||
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVP);
|
applyXpGain((float) (damage * acrobaticsBehaviour.getDodgeXpModifier()), XPGainReason.PVP);
|
||||||
}
|
}
|
||||||
|
|
||||||
return modifiedDamage;
|
return modifiedDamage;
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
package com.gmail.nossr50.skills.archery;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.core.MetadataConstants;
|
|
||||||
import com.gmail.nossr50.datatypes.meta.TrackedArrowMeta;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
|
||||||
|
|
||||||
public class Archery {
|
|
||||||
/**
|
|
||||||
* Check for arrow retrieval.
|
|
||||||
*
|
|
||||||
* @param livingEntity The entity hit by the arrows
|
|
||||||
*/
|
|
||||||
public static void arrowRetrievalCheck(LivingEntity livingEntity) {
|
|
||||||
if(livingEntity.hasMetadata(MetadataConstants.ARROW_TRACKER_METAKEY)) {
|
|
||||||
Misc.dropItems(livingEntity.getLocation(), new ItemStack(Material.ARROW), livingEntity.getMetadata(MetadataConstants.ARROW_TRACKER_METAKEY).get(0).asInt());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void incrementArrowCount(LivingEntity livingEntity) {
|
|
||||||
if(livingEntity.hasMetadata(MetadataConstants.ARROW_TRACKER_METAKEY)) {
|
|
||||||
int arrowCount = livingEntity.getMetadata(MetadataConstants.ARROW_TRACKER_METAKEY).get(0).asInt();
|
|
||||||
livingEntity.getMetadata(MetadataConstants.ARROW_TRACKER_METAKEY).set(0, new FixedMetadataValue(pluginRef, arrowCount + 1));
|
|
||||||
} else {
|
|
||||||
livingEntity.setMetadata(MetadataConstants.ARROW_TRACKER_METAKEY, new TrackedArrowMeta(pluginRef, 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getSkillShotBonusDamage(Player player, double oldDamage) {
|
|
||||||
double damageBonusPercent = getDamageBonusPercent(player);
|
|
||||||
double newDamage = oldDamage + (oldDamage * damageBonusPercent);
|
|
||||||
return Math.min(newDamage, getSkillShotDamageCap());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getDamageBonusPercent(Player player) {
|
|
||||||
return ((RankUtils.getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * pluginRef.getConfigManager().getConfigArchery().getSkillShotDamageMultiplier()) / 100.0D;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getSkillShotDamageCap() {
|
|
||||||
return pluginRef.getConfigManager().getConfigArchery().getSkillShotDamageCeiling();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getDazeBonusDamage() {
|
|
||||||
return pluginRef.getConfigManager().getConfigArchery().getDaze().getDazeBonusDamage();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getDistanceXpMultiplier() {
|
|
||||||
return pluginRef.getConfigManager().getConfigExperience().getExperienceArchery().getDistanceMultiplier();
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
|||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.behaviours.ArcheryBehaviour;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@ -21,8 +22,14 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
public class ArcheryManager extends SkillManager {
|
public class ArcheryManager extends SkillManager {
|
||||||
|
|
||||||
|
private final ArcheryBehaviour archeryBehaviour;
|
||||||
|
|
||||||
public ArcheryManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
|
public ArcheryManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
|
||||||
super(pluginRef, mcMMOPlayer, PrimarySkillType.ARCHERY);
|
super(pluginRef, mcMMOPlayer, PrimarySkillType.ARCHERY);
|
||||||
|
|
||||||
|
//Init Behaviour
|
||||||
|
this.archeryBehaviour = pluginRef.getDynamicSettingsManager().getSkillBehaviourManager().getArcheryBehaviour();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canDaze(LivingEntity target) {
|
public boolean canDaze(LivingEntity target) {
|
||||||
@ -64,7 +71,7 @@ public class ArcheryManager extends SkillManager {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1 + Math.min(firedLocation.distance(targetLocation), 50) * Archery.getDistanceXpMultiplier();
|
return 1 + Math.min(firedLocation.distance(targetLocation), 50) * archeryBehaviour.getDistanceXpMultiplier();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,7 +81,7 @@ public class ArcheryManager extends SkillManager {
|
|||||||
*/
|
*/
|
||||||
public void processArrowRetrievalActivation(LivingEntity target, Projectile projectile) {
|
public void processArrowRetrievalActivation(LivingEntity target, Projectile projectile) {
|
||||||
if(projectile.hasMetadata(MetadataConstants.ARROW_TRACKER_METAKEY)) {
|
if(projectile.hasMetadata(MetadataConstants.ARROW_TRACKER_METAKEY)) {
|
||||||
Archery.incrementArrowCount(target);
|
archeryBehaviour.incrementArrowCount(target);
|
||||||
projectile.removeMetadata(MetadataConstants.ARROW_TRACKER_METAKEY, pluginRef); //Only 1 entity per projectile
|
projectile.removeMetadata(MetadataConstants.ARROW_TRACKER_METAKEY, pluginRef); //Only 1 entity per projectile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,7 +111,7 @@ public class ArcheryManager extends SkillManager {
|
|||||||
pluginRef.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Combat.TargetDazed");
|
pluginRef.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Combat.TargetDazed");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Archery.getDazeBonusDamage();
|
return archeryBehaviour.getDazeBonusDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,6 +124,6 @@ public class ArcheryManager extends SkillManager {
|
|||||||
return oldDamage;
|
return oldDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Archery.getSkillShotBonusDamage(getPlayer(), oldDamage);
|
return archeryBehaviour.getSkillShotBonusDamage(getPlayer(), oldDamage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
package com.gmail.nossr50.skills.axes;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
public class Axes {
|
|
||||||
|
|
||||||
protected static boolean hasArmor(LivingEntity target) {
|
|
||||||
for (ItemStack itemStack : target.getEquipment().getArmorContents()) {
|
|
||||||
if (itemStack != null && ItemUtils.isArmor(itemStack)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For every rank in Axe Mastery we add RankDamageMultiplier to get the total bonus damage from Axe Mastery
|
|
||||||
*
|
|
||||||
* @param player The target player
|
|
||||||
* @return The axe mastery bonus damage which will be added to their attack
|
|
||||||
*/
|
|
||||||
public static double getAxeMasteryBonusDamage(Player player) {
|
|
||||||
return RankUtils.getRank(player, SubSkillType.AXES_AXE_MASTERY) * pluginRef.getConfigManager().getConfigAxes().getAxeMasteryMultiplier();
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,6 +6,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.behaviours.AxesBehaviour;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
@ -20,8 +21,12 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class AxesManager extends SkillManager {
|
public class AxesManager extends SkillManager {
|
||||||
|
|
||||||
|
private final AxesBehaviour axesBehaviour;
|
||||||
|
|
||||||
public AxesManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
|
public AxesManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
|
||||||
super(pluginRef, mcMMOPlayer, PrimarySkillType.AXES);
|
super(pluginRef, mcMMOPlayer, PrimarySkillType.AXES);
|
||||||
|
this.axesBehaviour = pluginRef.getDynamicSettingsManager().getSkillBehaviourManager().getAxesBehaviour();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseAxeMastery() {
|
public boolean canUseAxeMastery() {
|
||||||
@ -42,14 +47,14 @@ public class AxesManager extends SkillManager {
|
|||||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT))
|
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return target.isValid() && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT) && Axes.hasArmor(target);
|
return target.isValid() && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT) && axesBehaviour.hasArmor(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canGreaterImpact(LivingEntity target) {
|
public boolean canGreaterImpact(LivingEntity target) {
|
||||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_GREATER_IMPACT))
|
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_GREATER_IMPACT))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return target.isValid() && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.AXES_GREATER_IMPACT) && !Axes.hasArmor(target);
|
return target.isValid() && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.AXES_GREATER_IMPACT) && !axesBehaviour.hasArmor(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseSkullSplitter(LivingEntity target) {
|
public boolean canUseSkullSplitter(LivingEntity target) {
|
||||||
@ -71,7 +76,7 @@ public class AxesManager extends SkillManager {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Axes.getAxeMasteryBonusDamage(getPlayer());
|
return axesBehaviour.getAxeMasteryBonusDamage(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user