package com.gmail.nossr50.commands.skills; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.skills.SkillUtils; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.List; public class AcrobaticsCommand extends SkillCommand { private String dodgeChance; private String dodgeChanceLucky; private boolean canDodge; private boolean canRoll; public AcrobaticsCommand() { super(PrimarySkillType.ACROBATICS); } @Override protected void dataCalculations(Player player, float skillValue, boolean isLucky) { // ACROBATICS_DODGE if (canDodge) { String[] dodgeStrings = SkillUtils.calculateAbilityDisplayValues(skillValue, SubSkillType.ACROBATICS_DODGE, isLucky); dodgeChance = dodgeStrings[0]; dodgeChanceLucky = dodgeStrings[1]; } } @Override protected void permissionsCheck(Player player) { canDodge = canUseSubskill(player, SubSkillType.ACROBATICS_DODGE); canRoll = canUseSubskill(player, SubSkillType.ACROBATICS_ROLL); } @Override protected List effectsDisplay() { List messages = new ArrayList(); if (canRoll) { messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Acrobatics.Effect.0"), LocaleLoader.getString("Acrobatics.Effect.1"))); messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Acrobatics.Effect.2"), LocaleLoader.getString("Acrobatics.Effect.3"))); } if (canDodge) { messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Acrobatics.Effect.4"), LocaleLoader.getString("Acrobatics.Effect.5"))); } return messages; } @Override protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList(); /*if (canRoll) { messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, dazeChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", dazeChanceLucky) : "")); messages.add(LocaleLoader.getString("Acrobatics.Roll.Chance", rollChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", rollChanceLucky) : "")); } if (canRoll) { messages.add(LocaleLoader.getString("Acrobatics.Roll.GraceChance", gracefulRollChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", gracefulRollChanceLucky) : "")); }*/ if (canDodge) { messages.add(getStatMessage(SubSkillType.ACROBATICS_DODGE, dodgeChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", dodgeChanceLucky) : "")); } return messages; } @Override protected List getTextComponents(Player player) { List textComponents = new ArrayList<>(); TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ACROBATICS); return textComponents; } }