Max ticks for abilities

This commit is contained in:
NuclearW 2012-05-21 09:16:58 -04:00
parent 16ad8502d2
commit 0bb5f9f297
4 changed files with 39 additions and 2 deletions

View File

@ -113,6 +113,16 @@ public class Config extends ConfigLoader {
public int getAbilityCooldownSkullSplitter() { return config.getInt("Abilities.Cooldowns.Skull_Splitter", 240); } public int getAbilityCooldownSkullSplitter() { return config.getInt("Abilities.Cooldowns.Skull_Splitter", 240); }
public int getAbilityCooldownBlastMining() { return config.getInt("Abilities.Cooldowns.Blast_Mining", 60); } public int getAbilityCooldownBlastMining() { return config.getInt("Abilities.Cooldowns.Blast_Mining", 60); }
/* Max ticks */
public int getAbilityMaxTicksGreenTerra() { return config.getInt("Abilities.Max_Ticks.Green_Terra", 0); }
public int getAbilityMaxTicksSuperBreaker() { return config.getInt("Abilities.Max_Ticks.Super_Breaker", 0); }
public int getAbilityMaxTicksGigaDrillBreaker() { return config.getInt("Abilities.Max_Ticks.Giga_Drill_Breaker", 0); }
public int getAbilityMaxTicksTreeFeller() { return config.getInt("Abilities.Max_Ticks.Tree_Feller", 0); }
public int getAbilityMaxTicksBerserk() { return config.getInt("Abilities.Max_Ticks.Berserk", 0); }
public int getAbilityMaxTicksSerratedStrikes() { return config.getInt("Abilities.Max_Ticks.Serrated_Strikes", 0); }
public int getAbilityMaxTicksSkullSplitter() { return config.getInt("Abilities.Max_Ticks.Skull_Splitter", 0); }
public int getAbilityMaxTicksBlastMining() { return config.getInt("Abilities.Max_Ticks.Blast_Mining", 0); }
/* Thresholds */ /* Thresholds */
public int getTreeFellerThreshold() { return config.getInt("Abilities.Limits.Tree_Feller_Threshold", 500); } public int getTreeFellerThreshold() { return config.getInt("Abilities.Limits.Tree_Feller_Threshold", 500); }

View File

@ -12,6 +12,7 @@ import com.gmail.nossr50.util.Permissions;
public enum AbilityType { public enum AbilityType {
BERSERK( BERSERK(
Config.getInstance().getAbilityCooldownBerserk(), Config.getInstance().getAbilityCooldownBerserk(),
Config.getInstance().getAbilityMaxTicksBerserk(),
"Unarmed.Skills.Berserk.On", "Unarmed.Skills.Berserk.On",
"Unarmed.Skills.Berserk.Off", "Unarmed.Skills.Berserk.Off",
"Unarmed.Skills.Berserk.Other.On", "Unarmed.Skills.Berserk.Other.On",
@ -20,6 +21,7 @@ public enum AbilityType {
SUPER_BREAKER( SUPER_BREAKER(
Config.getInstance().getAbilityCooldownSuperBreaker(), Config.getInstance().getAbilityCooldownSuperBreaker(),
Config.getInstance().getAbilityMaxTicksSuperBreaker(),
"Mining.Skills.SuperBreaker.On", "Mining.Skills.SuperBreaker.On",
"Mining.Skills.SuperBreaker.Off", "Mining.Skills.SuperBreaker.Off",
"Mining.Skills.SuperBreaker.Other.On", "Mining.Skills.SuperBreaker.Other.On",
@ -28,6 +30,7 @@ public enum AbilityType {
GIGA_DRILL_BREAKER( GIGA_DRILL_BREAKER(
Config.getInstance().getAbilityCooldownGigaDrillBreaker(), Config.getInstance().getAbilityCooldownGigaDrillBreaker(),
Config.getInstance().getAbilityMaxTicksGigaDrillBreaker(),
"Excavation.Skills.GigaDrillBreaker.On", "Excavation.Skills.GigaDrillBreaker.On",
"Excavation.Skills.GigaDrillBreaker.Off", "Excavation.Skills.GigaDrillBreaker.Off",
"Excavation.Skills.GigaDrillBreaker.Other.On", "Excavation.Skills.GigaDrillBreaker.Other.On",
@ -36,6 +39,7 @@ public enum AbilityType {
GREEN_TERRA( GREEN_TERRA(
Config.getInstance().getAbilityCooldownGreenTerra(), Config.getInstance().getAbilityCooldownGreenTerra(),
Config.getInstance().getAbilityMaxTicksGreenTerra(),
"Herbalism.Skills.GTe.On", "Herbalism.Skills.GTe.On",
"Herbalism.Skills.GTe.Off", "Herbalism.Skills.GTe.Off",
"Herbalism.Skills.GTe.Other.On", "Herbalism.Skills.GTe.Other.On",
@ -44,6 +48,7 @@ public enum AbilityType {
SKULL_SPLIITER( SKULL_SPLIITER(
Config.getInstance().getAbilityCooldownSkullSplitter(), Config.getInstance().getAbilityCooldownSkullSplitter(),
Config.getInstance().getAbilityMaxTicksSkullSplitter(),
"Axes.Skills.SS.On", "Axes.Skills.SS.On",
"Axes.Skills.SS.Off", "Axes.Skills.SS.Off",
"Axes.Skills.SS.Other.On", "Axes.Skills.SS.Other.On",
@ -52,6 +57,7 @@ public enum AbilityType {
TREE_FELLER( TREE_FELLER(
Config.getInstance().getAbilityCooldownTreeFeller(), Config.getInstance().getAbilityCooldownTreeFeller(),
Config.getInstance().getAbilityMaxTicksTreeFeller(),
"Woodcutting.Skills.TreeFeller.On", "Woodcutting.Skills.TreeFeller.On",
"Woodcutting.Skills.TreeFeller.Off", "Woodcutting.Skills.TreeFeller.Off",
"Woodcutting.Skills.TreeFeller.Other.On", "Woodcutting.Skills.TreeFeller.Other.On",
@ -60,6 +66,7 @@ public enum AbilityType {
SERRATED_STRIKES( SERRATED_STRIKES(
Config.getInstance().getAbilityCooldownSerratedStrikes(), Config.getInstance().getAbilityCooldownSerratedStrikes(),
Config.getInstance().getAbilityMaxTicksSerratedStrikes(),
"Swords.Skills.SS.On", "Swords.Skills.SS.On",
"Swords.Skills.SS.Off", "Swords.Skills.SS.Off",
"Swords.Skills.SS.Other.On", "Swords.Skills.SS.Other.On",
@ -68,6 +75,7 @@ public enum AbilityType {
BLAST_MINING( BLAST_MINING(
Config.getInstance().getAbilityCooldownBlastMining(), Config.getInstance().getAbilityCooldownBlastMining(),
Config.getInstance().getAbilityMaxTicksBlastMining(),
null, null,
null, null,
"Mining.Blast.Other.On", "Mining.Blast.Other.On",
@ -75,6 +83,7 @@ public enum AbilityType {
null), null),
LEAF_BLOWER( LEAF_BLOWER(
0,
0, 0,
null, null,
null, null,
@ -83,14 +92,16 @@ public enum AbilityType {
null); null);
private int cooldown; private int cooldown;
private int maxTicks;
private String abilityOn; private String abilityOn;
private String abilityOff; private String abilityOff;
private String abilityPlayer; private String abilityPlayer;
private String abilityRefresh; private String abilityRefresh;
private String abilityPlayerOff; private String abilityPlayerOff;
private AbilityType(int cooldown, String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) { private AbilityType(int cooldown, int maxTicks, String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
this.cooldown = cooldown; this.cooldown = cooldown;
this.maxTicks = maxTicks;
this.abilityOn = abilityOn; this.abilityOn = abilityOn;
this.abilityOff = abilityOff; this.abilityOff = abilityOff;
this.abilityPlayer = abilityPlayer; this.abilityPlayer = abilityPlayer;
@ -122,6 +133,10 @@ public enum AbilityType {
return LocaleLoader.getString(this.abilityRefresh); return LocaleLoader.getString(this.abilityRefresh);
} }
public int getMaxTicks() {
return this.maxTicks;
}
/** /**
* Get the permissions for this ability. * Get the permissions for this ability.
* *

View File

@ -389,6 +389,9 @@ public class Skills {
} }
int ticks = 2 + (PP.getSkillLevel(type) / 50); int ticks = 2 + (PP.getSkillLevel(type) / 50);
if (ability.getMaxTicks() != 0 && ticks > ability.getMaxTicks()) {
ticks = ability.getMaxTicks();
}
if (!PP.getAbilityMode(ability) && cooldownOver(PP.getSkillDATS(ability), ability.getCooldown())) { if (!PP.getAbilityMode(ability) && cooldownOver(PP.getSkillDATS(ability), ability.getCooldown())) {
player.sendMessage(ability.getAbilityOn()); player.sendMessage(ability.getAbilityOn());

View File

@ -110,6 +110,15 @@ Abilities:
Serrated_Strikes: 240 Serrated_Strikes: 240
Tree_Feller: 240 Tree_Feller: 240
Super_Breaker: 240 Super_Breaker: 240
Max_Ticks:
Blast_Mining: 0
Giga_Drill_Breaker: 0
Berserk: 0
Green_Terra: 0
Skull_Splitter: 0
Serrated_Strikes: 0
Tree_Feller: 0
Super_Breaker: 0
Limits: Limits:
Tree_Feller_Threshold: 500 Tree_Feller_Threshold: 500
Tools: Tools: