package com.gmail.nossr50.commands.skills; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.axes.Axes; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.text.TextComponentFactory; import com.neetgames.mcmmo.player.OnlineMMOPlayer; import net.kyori.adventure.text.Component; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; public class AxesCommand extends SkillCommand { private String critChance; private String critChanceLucky; private double axeMasteryDamage; private double impactDamage; private String skullSplitterLength; private String skullSplitterLengthEndurance; private boolean canSkullSplitter; private boolean canCritical; private boolean canAxeMastery; private boolean canImpact; private boolean canGreaterImpact; public AxesCommand() { super(CoreSkills.AXES); } @Override protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) { // ARMOR IMPACT if (canImpact) { impactDamage = ((McMMOPlayer) (mmoPlayer)).getArcheryManager().getImpactDurabilityDamage(); } // AXE MASTERY if (canAxeMastery) { axeMasteryDamage = Axes.getAxeMasteryBonusDamage(mmoPlayer.getPlayer()); } // CRITICAL HIT if (canCritical) { String[] criticalHitStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.AXES_CRITICAL_STRIKES); critChance = criticalHitStrings[0]; critChanceLucky = criticalHitStrings[1]; } // SKULL SPLITTER if (canSkullSplitter) { String[] skullSplitterStrings = calculateLengthDisplayValues(mmoPlayer, skillValue); skullSplitterLength = skullSplitterStrings[0]; skullSplitterLengthEndurance = skullSplitterStrings[1]; } } @Override protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) { canSkullSplitter = Permissions.skullSplitter(mmoPlayer.getPlayer()) && RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.AXES_SKULL_SPLITTER); canCritical = canUseSubskill(mmoPlayer, SubSkillType.AXES_CRITICAL_STRIKES); canAxeMastery = canUseSubskill(mmoPlayer, SubSkillType.AXES_AXE_MASTERY); canImpact = canUseSubskill(mmoPlayer, SubSkillType.AXES_ARMOR_IMPACT); canGreaterImpact = canUseSubskill(mmoPlayer, SubSkillType.AXES_GREATER_IMPACT); } @Override protected @NotNull List statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); if (canImpact) { messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.2"), LocaleLoader.getString("Axes.Ability.Bonus.3", impactDamage))); } if (canAxeMastery) { messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.0"), LocaleLoader.getString("Axes.Ability.Bonus.1", axeMasteryDamage))); } if (canCritical) { messages.add(getStatMessage(SubSkillType.AXES_CRITICAL_STRIKES, critChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", critChanceLucky) : "")); } if (canGreaterImpact) { messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.4"), LocaleLoader.getString("Axes.Ability.Bonus.5", Axes.greaterImpactBonusDamage))); } if (canSkullSplitter) { messages.add(getStatMessage(SubSkillType.AXES_SKULL_SPLITTER, skullSplitterLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : "")); } if(canUseSubskill(mmoPlayer, SubSkillType.AXES_AXES_LIMIT_BREAK)) { messages.add(getStatMessage(SubSkillType.AXES_AXES_LIMIT_BREAK, String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(mmoPlayer, SubSkillType.AXES_AXES_LIMIT_BREAK, 1000)))); } return messages; } @Override protected @NotNull List getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { List textComponents = new ArrayList<>(); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.AXES); return textComponents; } }