mcMMO/src/main/java/com/gmail/nossr50/skills/swords/SwordsCommand.java

118 lines
4.7 KiB
Java
Raw Normal View History

package com.gmail.nossr50.skills.swords;
2012-01-09 20:00:13 +01:00
2012-04-27 11:47:11 +02:00
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.SkillCommand;
import com.gmail.nossr50.skills.utilities.SkillType;
2013-01-07 02:52:31 +01:00
import com.gmail.nossr50.util.Permissions;
2012-01-09 20:00:13 +01:00
2012-05-31 21:00:01 +02:00
public class SwordsCommand extends SkillCommand {
private String counterAttackChance;
private String counterAttackChanceLucky;
private String bleedLength;
private String bleedChance;
private String bleedChanceLucky;
private String serratedStrikesLength;
private String serratedStrikesLengthEndurance;
2012-05-01 20:28:20 +02:00
private boolean canCounter;
private boolean canSerratedStrike;
private boolean canBleed;
2012-05-31 21:00:01 +02:00
public SwordsCommand() {
super(SkillType.SWORDS);
}
@Override
2012-05-31 21:00:01 +02:00
protected void dataCalculations() {
2013-01-22 16:48:10 +01:00
//SERRATED STRIKES
String[] serratedStrikesStrings = calculateLengthDisplayValues();
serratedStrikesLength = serratedStrikesStrings[0];
serratedStrikesLengthEndurance = serratedStrikesStrings[1];
//BLEED
if (skillValue >= Swords.bleedMaxBonusLevel) {
bleedLength = String.valueOf(Swords.bleedMaxTicks);
}
2013-01-22 16:48:10 +01:00
else {
bleedLength = String.valueOf(Swords.bleedBaseTicks);
}
2013-01-22 16:48:10 +01:00
String[] bleedStrings = calculateAbilityDisplayValues(Swords.bleedMaxBonusLevel, Swords.bleedMaxChance);
bleedChance = bleedStrings[0];
bleedChanceLucky = bleedStrings[1];
//COUNTER ATTACK
String[] counterAttackStrings = calculateAbilityDisplayValues(Swords.counterAttackMaxBonusLevel, Swords.counterAttackMaxChance);
counterAttackChance = counterAttackStrings[0];
counterAttackChanceLucky = counterAttackStrings[1];
2012-05-31 21:00:01 +02:00
}
2012-01-09 20:00:13 +01:00
2012-05-31 21:00:01 +02:00
@Override
protected void permissionsCheck() {
2013-01-07 02:52:31 +01:00
canBleed = Permissions.swordsBleed(player);
canCounter = Permissions.counterAttack(player);
canSerratedStrike = Permissions.serratedStrikes(player);
2012-05-31 21:00:01 +02:00
}
2012-01-09 20:00:13 +01:00
2012-05-31 21:00:01 +02:00
@Override
protected boolean effectsHeaderPermissions() {
return canBleed || canCounter || canSerratedStrike;
}
2012-05-01 20:28:20 +02:00
2012-05-31 21:00:01 +02:00
@Override
protected void effectsDisplay() {
2013-01-22 16:48:10 +01:00
luckyEffectsDisplay();
2012-11-22 22:40:55 +01:00
2012-05-01 20:28:20 +02:00
if (canCounter) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Swords.Effect.0"), LocaleLoader.getString("Swords.Effect.1", percent.format(1.0D / Swords.counterAttackModifier))));
2012-05-01 20:28:20 +02:00
}
if (canSerratedStrike) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Swords.Effect.2"), LocaleLoader.getString("Swords.Effect.3", percent.format(1.0D / Swords.serratedStrikesModifier))));
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Swords.Effect.4"), LocaleLoader.getString("Swords.Effect.5", Swords.serratedStrikesBleedTicks)));
2012-05-01 20:28:20 +02:00
}
if (canBleed) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Swords.Effect.6"), LocaleLoader.getString("Swords.Effect.7")));
2012-05-01 20:28:20 +02:00
}
2012-05-31 21:00:01 +02:00
}
2012-05-01 20:28:20 +02:00
2012-05-31 21:00:01 +02:00
@Override
protected boolean statsHeaderPermissions() {
return canBleed || canCounter || canSerratedStrike;
}
2012-05-01 20:28:20 +02:00
2012-05-31 21:00:01 +02:00
@Override
protected void statsDisplay() {
2012-05-01 20:28:20 +02:00
if (canCounter) {
2013-01-22 16:48:10 +01:00
if (isLucky) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Swords.Combat.Counter.Chance", counterAttackChance) + LocaleLoader.getString("Perks.lucky.bonus", counterAttackChanceLucky));
2013-01-22 16:48:10 +01:00
}
else {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Swords.Combat.Counter.Chance", counterAttackChance));
2013-01-22 16:48:10 +01:00
}
2012-05-01 20:28:20 +02:00
}
if (canBleed) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Length", bleedLength));
2012-05-01 20:28:20 +02:00
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Note"));
2013-01-22 16:48:10 +01:00
if (isLucky) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Chance", bleedChance) + LocaleLoader.getString("Perks.lucky.bonus", bleedChanceLucky));
2013-01-22 16:48:10 +01:00
}
else {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Chance", bleedChance));
2013-01-22 16:48:10 +01:00
}
2012-05-01 20:28:20 +02:00
}
2012-01-09 20:00:13 +01:00
2012-05-01 20:28:20 +02:00
if (canSerratedStrike) {
2013-01-22 16:48:10 +01:00
if (hasEndurance) {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Swords.SS.Length", serratedStrikesLength) + LocaleLoader.getString("Perks.activationtime.bonus", serratedStrikesLengthEndurance));
2013-01-22 16:48:10 +01:00
}
else {
2013-02-02 08:55:49 +01:00
player.sendMessage(LocaleLoader.getString("Swords.SS.Length", serratedStrikesLength));
2013-01-22 16:48:10 +01:00
}
2012-05-01 20:28:20 +02:00
}
}
2012-01-09 20:00:13 +01:00
}