add saturation support

This commit is contained in:
Enderaoe
2021-11-10 23:13:30 +08:00
parent d185c7538c
commit adc480fd03
5 changed files with 113 additions and 52 deletions

View File

@ -79,7 +79,7 @@ public final class SkillUtils {
* Others
*/
public static int handleFoodSkills(Player player, int eventFoodLevel, SubSkillType subSkillType) {
public static int handleFoodSkillsHunger(Player player, int eventFoodLevel, SubSkillType subSkillType) {
int curRank = RankUtils.getRank(player, subSkillType);
int currentFoodLevel = player.getFoodLevel();
@ -90,6 +90,17 @@ public final class SkillUtils {
return currentFoodLevel + foodChange;
}
public static float handleFoodSkillsSaturation(Player player, float eventSaturationLevel, SubSkillType subSkillType) {
int curRank = RankUtils.getRank(player, subSkillType);
float currentSaturationLevel = player.getSaturation();
float saturationChange = eventSaturationLevel - currentSaturationLevel;
saturationChange += curRank;
return currentSaturationLevel + saturationChange;
}
/**
* Calculate the time remaining until the cooldown expires.
*