Adds duration values to AcrobatStance and WarriorStance (#980)

## Additions
* Adds duration value to `AcrobatStance` and `WarriorStance`.
This commit is contained in:
ArchBear-Vega 2018-10-03 18:07:57 -07:00 committed by Christopher Martin
parent 016f48c415
commit 433fc5cb21
3 changed files with 31 additions and 0 deletions

View file

@ -15,6 +15,8 @@ public class AcrobatStance extends ChiAbility {
@Attribute(Attribute.COOLDOWN) @Attribute(Attribute.COOLDOWN)
private long cooldown; private long cooldown;
@Attribute(Attribute.DURATION)
private long duration;
@Attribute(Attribute.SPEED) @Attribute(Attribute.SPEED)
private int speed; private int speed;
@Attribute("Jump") @Attribute("Jump")
@ -30,6 +32,7 @@ public class AcrobatStance extends ChiAbility {
return; return;
} }
this.cooldown = getConfig().getLong("Abilities.Chi.AcrobatStance.Cooldown"); this.cooldown = getConfig().getLong("Abilities.Chi.AcrobatStance.Cooldown");
this.duration = getConfig().getLong("Abilities.Chi.AcrobatStance.Duration");
this.speed = getConfig().getInt("Abilities.Chi.AcrobatStance.Speed") + 1; this.speed = getConfig().getInt("Abilities.Chi.AcrobatStance.Speed") + 1;
this.jump = getConfig().getInt("Abilities.Chi.AcrobatStance.Jump") + 1; this.jump = getConfig().getInt("Abilities.Chi.AcrobatStance.Jump") + 1;
this.chiBlockBoost = getConfig().getDouble("Abilities.Chi.AcrobatStance.ChiBlockBoost"); this.chiBlockBoost = getConfig().getDouble("Abilities.Chi.AcrobatStance.ChiBlockBoost");
@ -54,6 +57,9 @@ public class AcrobatStance extends ChiAbility {
if (!this.bPlayer.canBendIgnoreBinds(this) || !this.bPlayer.hasElement(Element.CHI)) { if (!this.bPlayer.canBendIgnoreBinds(this) || !this.bPlayer.hasElement(Element.CHI)) {
this.remove(); this.remove();
return; return;
} else if (this.duration != 0 && System.currentTimeMillis() > this.getStartTime() + this.duration) {
remove();
return;
} }
if (!this.player.hasPotionEffect(PotionEffectType.SPEED)) { if (!this.player.hasPotionEffect(PotionEffectType.SPEED)) {
@ -116,6 +122,14 @@ public class AcrobatStance extends ChiAbility {
this.jump = jump; this.jump = jump;
} }
public long getDuration() {
return this.duration;
}
public void setDuration(final long duration) {
this.duration = duration;
}
public double getChiBlockBoost() { public double getChiBlockBoost() {
return this.chiBlockBoost; return this.chiBlockBoost;
} }

View file

@ -15,17 +15,21 @@ public class WarriorStance extends ChiAbility {
@Attribute(Attribute.COOLDOWN) @Attribute(Attribute.COOLDOWN)
private long cooldown; private long cooldown;
@Attribute(Attribute.DURATION)
private long duration;
@Attribute("Strength") @Attribute("Strength")
private int strength; private int strength;
@Attribute("Resistance") @Attribute("Resistance")
private int resistance; private int resistance;
public WarriorStance(final Player player) { public WarriorStance(final Player player) {
super(player); super(player);
if (!this.bPlayer.canBend(this)) { if (!this.bPlayer.canBend(this)) {
return; return;
} }
this.cooldown = getConfig().getLong("Abilities.Chi.WarriorStance.Cooldown"); this.cooldown = getConfig().getLong("Abilities.Chi.WarriorStance.Cooldown");
this.duration = getConfig().getLong("Abilities.Chi.WarriorStance.Duration");
this.strength = getConfig().getInt("Abilities.Chi.WarriorStance.Strength") - 1; this.strength = getConfig().getInt("Abilities.Chi.WarriorStance.Strength") - 1;
this.resistance = getConfig().getInt("Abilities.Chi.WarriorStance.Resistance"); this.resistance = getConfig().getInt("Abilities.Chi.WarriorStance.Resistance");
@ -48,6 +52,9 @@ public class WarriorStance extends ChiAbility {
if (!this.bPlayer.canBendIgnoreBinds(this) || !this.bPlayer.hasElement(Element.CHI)) { if (!this.bPlayer.canBendIgnoreBinds(this) || !this.bPlayer.hasElement(Element.CHI)) {
this.remove(); this.remove();
return; return;
} else if (this.duration != 0 && System.currentTimeMillis() > this.getStartTime() + this.duration) {
remove();
return;
} }
if (!this.player.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) { if (!this.player.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) {
@ -112,4 +119,12 @@ public class WarriorStance extends ChiAbility {
this.resistance = resistance; this.resistance = resistance;
} }
public long getDuration() {
return this.duration;
}
public void setDuration(final long duration) {
this.duration = duration;
}
} }

View file

@ -1429,6 +1429,7 @@ public class ConfigManager {
config.addDefault("Abilities.Chi.AcrobatStance.Enabled", true); config.addDefault("Abilities.Chi.AcrobatStance.Enabled", true);
config.addDefault("Abilities.Chi.AcrobatStance.Cooldown", 0); config.addDefault("Abilities.Chi.AcrobatStance.Cooldown", 0);
config.addDefault("Abilities.Chi.AcrobatStance.Duration", 0);
config.addDefault("Abilities.Chi.AcrobatStance.ChiBlockBoost", 3); config.addDefault("Abilities.Chi.AcrobatStance.ChiBlockBoost", 3);
config.addDefault("Abilities.Chi.AcrobatStance.Speed", 1); config.addDefault("Abilities.Chi.AcrobatStance.Speed", 1);
config.addDefault("Abilities.Chi.AcrobatStance.Jump", 1); config.addDefault("Abilities.Chi.AcrobatStance.Jump", 1);
@ -1454,6 +1455,7 @@ public class ConfigManager {
config.addDefault("Abilities.Chi.WarriorStance.Enabled", true); config.addDefault("Abilities.Chi.WarriorStance.Enabled", true);
config.addDefault("Abilities.Chi.WarriorStance.Cooldown", 0); config.addDefault("Abilities.Chi.WarriorStance.Cooldown", 0);
config.addDefault("Abilities.Chi.WarriorStance.Duration", 0);
config.addDefault("Abilities.Chi.WarriorStance.Strength", 1); config.addDefault("Abilities.Chi.WarriorStance.Strength", 1);
config.addDefault("Abilities.Chi.WarriorStance.Resistance", -3); config.addDefault("Abilities.Chi.WarriorStance.Resistance", -3);