2013-03-01 06:52:01 +01:00
|
|
|
package com.gmail.nossr50.commands.skills;
|
|
|
|
|
2019-01-15 07:11:58 +01:00
|
|
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
2019-01-09 04:52:52 +01:00
|
|
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
2019-01-15 07:11:58 +01:00
|
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
2019-01-09 04:52:52 +01:00
|
|
|
import com.gmail.nossr50.util.TextComponentFactory;
|
|
|
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
2019-01-02 17:06:18 +01:00
|
|
|
import net.md_5.bungee.api.chat.TextComponent;
|
2013-10-29 20:38:20 +01:00
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2019-01-15 07:11:58 +01:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
public class AcrobaticsCommand extends SkillCommand {
|
|
|
|
private String dodgeChance;
|
|
|
|
private String dodgeChanceLucky;
|
|
|
|
|
|
|
|
private boolean canDodge;
|
|
|
|
private boolean canRoll;
|
|
|
|
|
|
|
|
public AcrobaticsCommand() {
|
2019-01-13 08:54:53 +01:00
|
|
|
super(PrimarySkillType.ACROBATICS);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-29 20:38:20 +01:00
|
|
|
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
2018-12-29 14:24:55 +01:00
|
|
|
// ACROBATICS_DODGE
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canDodge) {
|
2019-01-09 04:52:52 +01:00
|
|
|
String[] dodgeStrings = SkillUtils.calculateAbilityDisplayValues(skillValue, SubSkillType.ACROBATICS_DODGE, isLucky);
|
2013-03-12 21:25:42 +01:00
|
|
|
dodgeChance = dodgeStrings[0];
|
|
|
|
dodgeChanceLucky = dodgeStrings[1];
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-29 20:38:20 +01:00
|
|
|
protected void permissionsCheck(Player player) {
|
2019-01-15 12:16:21 +01:00
|
|
|
canDodge = canUseSubskill(player, SubSkillType.ACROBATICS_DODGE);
|
|
|
|
canRoll = canUseSubskill(player, SubSkillType.ACROBATICS_ROLL);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-29 20:38:20 +01:00
|
|
|
protected List<String> effectsDisplay() {
|
|
|
|
List<String> messages = new ArrayList<String>();
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
if (canRoll) {
|
2013-10-29 20:38:20 +01:00
|
|
|
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")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canDodge) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Acrobatics.Effect.4"), LocaleLoader.getString("Acrobatics.Effect.5")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
2013-10-29 20:38:20 +01:00
|
|
|
return messages;
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-29 20:38:20 +01:00
|
|
|
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
|
|
|
List<String> messages = new ArrayList<String>();
|
|
|
|
|
2019-01-09 04:52:52 +01:00
|
|
|
/*
|
2013-03-01 06:52:01 +01:00
|
|
|
if (canRoll) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Acrobatics.Roll.Chance", rollChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", rollChanceLucky) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canGracefulRoll) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Acrobatics.Roll.GraceChance", gracefulRollChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", gracefulRollChanceLucky) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
2019-01-09 04:52:52 +01:00
|
|
|
*/
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
if (canDodge) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Acrobatics.DodgeChance", dodgeChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", dodgeChanceLucky) : ""));
|
2019-01-09 04:52:52 +01:00
|
|
|
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
2013-10-29 20:38:20 +01:00
|
|
|
|
|
|
|
return messages;
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
2019-01-02 17:06:18 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected List<TextComponent> getTextComponents(Player player) {
|
|
|
|
List<TextComponent> textComponents = new ArrayList<>();
|
2019-01-04 16:58:39 +01:00
|
|
|
|
2019-01-13 08:54:53 +01:00
|
|
|
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ACROBATICS);
|
2019-01-04 16:58:39 +01:00
|
|
|
|
2019-01-02 17:06:18 +01:00
|
|
|
return textComponents;
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|