2013-03-01 06:52:01 +01:00
|
|
|
package com.gmail.nossr50.commands.skills;
|
|
|
|
|
2019-01-13 08:54:53 +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;
|
|
|
|
import com.gmail.nossr50.skills.axes.Axes;
|
|
|
|
import com.gmail.nossr50.util.Permissions;
|
2019-01-09 04:52:52 +01:00
|
|
|
import com.gmail.nossr50.util.TextComponentFactory;
|
2019-01-15 11:59:00 +01:00
|
|
|
import com.gmail.nossr50.util.skills.RankUtils;
|
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 AxesCommand extends SkillCommand {
|
|
|
|
private String critChance;
|
|
|
|
private String critChanceLucky;
|
2013-11-22 18:32:23 +01:00
|
|
|
private double axeMasteryDamage;
|
2013-09-12 20:18:13 +02:00
|
|
|
private double impactDamage;
|
2013-03-01 06:52:01 +01:00
|
|
|
private String skullSplitterLength;
|
|
|
|
private String skullSplitterLengthEndurance;
|
|
|
|
|
|
|
|
private boolean canSkullSplitter;
|
|
|
|
private boolean canCritical;
|
2013-11-22 18:32:23 +01:00
|
|
|
private boolean canAxeMastery;
|
2013-03-01 06:52:01 +01:00
|
|
|
private boolean canImpact;
|
|
|
|
private boolean canGreaterImpact;
|
|
|
|
|
|
|
|
public AxesCommand() {
|
2019-01-13 08:54:53 +01:00
|
|
|
super(PrimarySkillType.AXES);
|
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) {
|
2013-11-22 18:32:23 +01:00
|
|
|
// ARMOR IMPACT
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canImpact) {
|
|
|
|
impactDamage = 1 + (skillValue / Axes.impactIncreaseLevel);
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
// SKULL SPLITTER
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canSkullSplitter) {
|
2013-10-29 20:38:20 +01:00
|
|
|
String[] skullSplitterStrings = calculateLengthDisplayValues(player, skillValue);
|
2013-03-12 21:25:42 +01:00
|
|
|
skullSplitterLength = skullSplitterStrings[0];
|
|
|
|
skullSplitterLengthEndurance = skullSplitterStrings[1];
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
2013-11-22 18:32:23 +01:00
|
|
|
// CRITICAL HIT
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canCritical) {
|
2019-01-09 04:52:52 +01:00
|
|
|
String[] criticalHitStrings = calculateAbilityDisplayValues(skillValue, SubSkillType.AXES_CRITICAL_STRIKES, isLucky);
|
2013-11-22 18:32:23 +01:00
|
|
|
critChance = criticalHitStrings[0];
|
|
|
|
critChanceLucky = criticalHitStrings[1];
|
2013-03-12 21:25:42 +01:00
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
// AXE MASTERY
|
2013-11-22 18:32:23 +01:00
|
|
|
if (canAxeMastery) {
|
2019-01-03 13:32:46 +01:00
|
|
|
axeMasteryDamage = Axes.getAxeMasteryBonusDamage(player);
|
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 11:59:00 +01:00
|
|
|
canSkullSplitter = Permissions.skullSplitter(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.AXES_SKULL_SPLITTER);
|
2019-01-15 12:16:21 +01:00
|
|
|
canCritical = canUseSubskill(player, SubSkillType.AXES_CRITICAL_STRIKES);
|
|
|
|
canAxeMastery = canUseSubskill(player, SubSkillType.AXES_AXE_MASTERY);
|
|
|
|
canImpact = canUseSubskill(player, SubSkillType.AXES_ARMOR_IMPACT);
|
|
|
|
canGreaterImpact = canUseSubskill(player, SubSkillType.AXES_GREATER_IMPACT);
|
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 (canSkullSplitter) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.0"), LocaleLoader.getString("Axes.Effect.1")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canCritical) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.2"), LocaleLoader.getString("Axes.Effect.3")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
2013-11-22 18:32:23 +01:00
|
|
|
if (canAxeMastery) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.4"), LocaleLoader.getString("Axes.Effect.5")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canImpact) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.6"), LocaleLoader.getString("Axes.Effect.7")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canGreaterImpact) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.8"), LocaleLoader.getString("Axes.Effect.9")));
|
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>();
|
|
|
|
|
2013-11-22 18:32:23 +01:00
|
|
|
if (canAxeMastery) {
|
|
|
|
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.0"), LocaleLoader.getString("Axes.Ability.Bonus.1", axeMasteryDamage)));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canImpact) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.2"), LocaleLoader.getString("Axes.Ability.Bonus.3", impactDamage)));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canGreaterImpact) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.4"), LocaleLoader.getString("Axes.Ability.Bonus.5", Axes.greaterImpactBonusDamage)));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canCritical) {
|
2019-01-21 17:52:44 +01:00
|
|
|
messages.add(getStatMessage(SubSkillType.AXES_CRITICAL_STRIKES, critChance)
|
|
|
|
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", critChanceLucky) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canSkullSplitter) {
|
2019-01-21 17:52:44 +01:00
|
|
|
messages.add(getStatMessage(SubSkillType.AXES_SKULL_SPLITTER, skullSplitterLength)
|
|
|
|
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : ""));
|
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.AXES);
|
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
|
|
|
}
|