mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-01 20:15:28 +02:00
Tweaks to the random chance classes
This commit is contained in:
@@ -17,6 +17,7 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -32,28 +33,28 @@ public class AxesManager extends SkillManager {
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.AXES_AXE_MASTERY);
|
||||
}
|
||||
|
||||
public boolean canCriticalHit(LivingEntity target) {
|
||||
public boolean canCriticalHit(@NotNull LivingEntity target) {
|
||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_CRITICAL_STRIKES))
|
||||
return false;
|
||||
|
||||
return target.isValid() && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.AXES_CRITICAL_STRIKES);
|
||||
}
|
||||
|
||||
public boolean canImpact(LivingEntity target) {
|
||||
public boolean canImpact(@NotNull LivingEntity target) {
|
||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT))
|
||||
return false;
|
||||
|
||||
return target.isValid() && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT) && Axes.hasArmor(target);
|
||||
}
|
||||
|
||||
public boolean canGreaterImpact(LivingEntity target) {
|
||||
public boolean canGreaterImpact(@NotNull LivingEntity target) {
|
||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_GREATER_IMPACT))
|
||||
return false;
|
||||
|
||||
return target.isValid() && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.AXES_GREATER_IMPACT) && !Axes.hasArmor(target);
|
||||
}
|
||||
|
||||
public boolean canUseSkullSplitter(LivingEntity target) {
|
||||
public boolean canUseSkullSplitter(@NotNull LivingEntity target) {
|
||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_SKULL_SPLITTER))
|
||||
return false;
|
||||
|
||||
@@ -68,7 +69,7 @@ public class AxesManager extends SkillManager {
|
||||
* Handle the effects of the Axe Mastery ability
|
||||
*/
|
||||
public double axeMastery() {
|
||||
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.ALWAYS_FIRES, SubSkillType.AXES_AXE_MASTERY, getPlayer(), mmoPlayer.getAttackStrength())) {
|
||||
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.ALWAYS_FIRES, SubSkillType.AXES_AXE_MASTERY, getPlayer())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ public class AxesManager extends SkillManager {
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
*/
|
||||
public double criticalHit(LivingEntity target, double damage) {
|
||||
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.AXES_CRITICAL_STRIKES, getPlayer(), mmoPlayer.getAttackStrength())) {
|
||||
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.AXES_CRITICAL_STRIKES, getPlayer())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -113,12 +114,12 @@ public class AxesManager extends SkillManager {
|
||||
*
|
||||
* @param target The {@link LivingEntity} being affected by Impact
|
||||
*/
|
||||
public void impactCheck(LivingEntity target) {
|
||||
public void impactCheck(@NotNull LivingEntity target) {
|
||||
double durabilityDamage = getImpactDurabilityDamage();
|
||||
|
||||
for (ItemStack armor : target.getEquipment().getArmorContents()) {
|
||||
if (armor != null && ItemUtils.isArmor(armor)) {
|
||||
if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.AXES_ARMOR_IMPACT, getPlayer(), mmoPlayer.getAttackStrength())) {
|
||||
if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.AXES_ARMOR_IMPACT, getPlayer())) {
|
||||
SkillUtils.handleDurabilityChange(armor, durabilityDamage, 1);
|
||||
}
|
||||
}
|
||||
@@ -134,9 +135,9 @@ public class AxesManager extends SkillManager {
|
||||
*
|
||||
* @param target The {@link LivingEntity} being affected by the ability
|
||||
*/
|
||||
public double greaterImpact(LivingEntity target) {
|
||||
public double greaterImpact(@NotNull LivingEntity target) {
|
||||
//static chance (3rd param)
|
||||
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.AXES_GREATER_IMPACT, getPlayer(), mmoPlayer.getAttackStrength())) {
|
||||
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.AXES_GREATER_IMPACT, getPlayer())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -166,7 +167,7 @@ public class AxesManager extends SkillManager {
|
||||
* @param target The {@link LivingEntity} being affected by the ability
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
*/
|
||||
public void skullSplitterCheck(LivingEntity target, double damage, Map<DamageModifier, Double> modifiers) {
|
||||
public void skullSplitterCheck(@NotNull LivingEntity target, double damage, Map<DamageModifier, Double> modifiers) {
|
||||
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Axes.skullSplitterModifier, modifiers, skill);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user