-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability descriptions to level up message
- Loading branch information
Showing
9 changed files
with
237 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
common/src/main/java/dev/aurelium/auraskills/common/ability/AbilityUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package dev.aurelium.auraskills.common.ability; | ||
|
||
import dev.aurelium.auraskills.api.ability.Ability; | ||
import dev.aurelium.auraskills.api.mana.ManaAbilities; | ||
import dev.aurelium.auraskills.api.mana.ManaAbility; | ||
import dev.aurelium.auraskills.api.util.NumberUtil; | ||
import dev.aurelium.auraskills.common.util.text.TextUtil; | ||
|
||
public class AbilityUtil { | ||
|
||
public static String getUpgradeValue(Ability ability, int level, String format) { | ||
String currentValue = getCurrentValue(ability, level); | ||
String nextValue = NumberUtil.format1(ability.getValue(level + 1)); | ||
return TextUtil.replace(format, | ||
"{current}", currentValue, | ||
"{next}", nextValue); | ||
} | ||
|
||
public static String getUpgradeValue2(Ability ability, int level, String format) { | ||
String currentValue = getCurrentValue2(ability, level); | ||
String nextValue = NumberUtil.format1(ability.getSecondaryValue(level + 1)); | ||
return TextUtil.replace(format, | ||
"{current}", currentValue, | ||
"{next}", nextValue); | ||
} | ||
|
||
public static String getCurrentValue(Ability ability, int level) { | ||
return NumberUtil.format1(ability.getValue(level)); | ||
} | ||
|
||
public static String getCurrentValue2(Ability ability, int level) { | ||
return NumberUtil.format1(ability.getSecondaryValue(level)); | ||
} | ||
|
||
public static String getUpgradeValue(ManaAbility manaAbility, int level, String format) { | ||
String currentValue = NumberUtil.format1(manaAbility.getDisplayValue(level)); | ||
String nextValue = NumberUtil.format1(manaAbility.getDisplayValue(level + 1)); | ||
return TextUtil.replace(format, | ||
"{current}", currentValue, | ||
"{next}", nextValue); | ||
} | ||
|
||
public static String getUpgradeDuration(ManaAbility manaAbility, int level, String format) { | ||
String currentDuration = NumberUtil.format1(getDuration(manaAbility, level)); | ||
String nextDuration = NumberUtil.format1(getDuration(manaAbility, level + 1)); | ||
return TextUtil.replace(format, | ||
"{current}", currentDuration, | ||
"{next}", nextDuration); | ||
} | ||
|
||
public static double getDuration(ManaAbility manaAbility, int level) { | ||
if (manaAbility == ManaAbilities.LIGHTNING_BLADE) { | ||
double baseDuration = ManaAbilities.LIGHTNING_BLADE.optionDouble("base_duration"); | ||
double durationPerLevel = ManaAbilities.LIGHTNING_BLADE.optionDouble("duration_per_level"); | ||
return baseDuration + (durationPerLevel * (level - 1)); | ||
} else { | ||
return manaAbility.getValue(level); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.