2013-03-01 06:52:01 +01:00
|
|
|
package com.gmail.nossr50.commands.skills;
|
|
|
|
|
2013-10-29 20:38:20 +01:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2013-03-01 06:52:01 +01:00
|
|
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
|
|
|
import com.gmail.nossr50.skills.axes.Axes;
|
|
|
|
import com.gmail.nossr50.util.Permissions;
|
|
|
|
|
|
|
|
public class AxesCommand extends SkillCommand {
|
|
|
|
private String critChance;
|
|
|
|
private String critChanceLucky;
|
2013-09-12 20:18:13 +02:00
|
|
|
private double bonusDamage;
|
|
|
|
private double impactDamage;
|
2013-03-01 06:52:01 +01:00
|
|
|
private String skullSplitterLength;
|
|
|
|
private String skullSplitterLengthEndurance;
|
|
|
|
|
|
|
|
private boolean canSkullSplitter;
|
|
|
|
private boolean canCritical;
|
|
|
|
private boolean canBonusDamage;
|
|
|
|
private boolean canImpact;
|
|
|
|
private boolean canGreaterImpact;
|
|
|
|
|
|
|
|
public AxesCommand() {
|
|
|
|
super(SkillType.AXES);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-29 20:38:20 +01:00
|
|
|
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
2013-03-01 06:52:01 +01:00
|
|
|
// 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
|
|
|
|
|
|
|
// CRITICAL STRIKES
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canCritical) {
|
2013-10-29 20:38:20 +01:00
|
|
|
String[] criticalStrikeStrings = calculateAbilityDisplayValues(skillValue, Axes.criticalHitMaxBonusLevel, Axes.criticalHitMaxChance, isLucky);
|
2013-03-12 21:25:42 +01:00
|
|
|
critChance = criticalStrikeStrings[0];
|
|
|
|
critChanceLucky = criticalStrikeStrings[1];
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
// AXE MASTERY
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canBonusDamage) {
|
|
|
|
bonusDamage = Math.min(skillValue / (Axes.bonusDamageMaxBonusLevel / Axes.bonusDamageMaxBonus), Axes.bonusDamageMaxBonus);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-29 20:38:20 +01:00
|
|
|
protected void permissionsCheck(Player player) {
|
2013-03-01 06:52:01 +01:00
|
|
|
canSkullSplitter = Permissions.skullSplitter(player);
|
|
|
|
canCritical = Permissions.criticalStrikes(player);
|
|
|
|
canBonusDamage = Permissions.bonusDamage(player, skill);
|
|
|
|
canImpact = Permissions.armorImpact(player);
|
|
|
|
canGreaterImpact = Permissions.greaterImpact(player);
|
|
|
|
}
|
|
|
|
|
|
|
|
@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
|
|
|
}
|
|
|
|
|
|
|
|
if (canBonusDamage) {
|
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-03-01 06:52:01 +01:00
|
|
|
if (canBonusDamage) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.0"), LocaleLoader.getString("Axes.Ability.Bonus.1", bonusDamage)));
|
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) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Axes.Combat.CritChance", critChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", critChanceLucky) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canSkullSplitter) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Axes.Combat.SS.Length", 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
|
|
|
}
|
|
|
|
}
|