Adding ranks to Fisherman/Farmer's Diet and Green Thumb

This commit is contained in:
nossr50 2019-01-15 05:35:41 -08:00
parent 4137cc0d3d
commit 13a3e9a790
8 changed files with 25 additions and 36 deletions

View File

@ -64,9 +64,11 @@ Version 2.1.0
! (Item) Improved some of the messages sent to the player regarding the Chimaera Wing
! (Party) Party member list will only include members of the party that you can see (aren't vanished)
! (Skills) Some skill level rank requirements have changed
! (Skills) Green Thumb now uses a rank system
! (Skills) Farmer's Diet & Fisherman's Diet now use a rank system
! (Skills) Fixed an edge case bug where Blast Mining wouldn't inform the player that it was on cooldown
! (Skills) mcMMO skills will now be on a scale from 1-100 instead of 0-1000 (for existing mcMMO installs this is opt-in and off by default)
! (Skills) Skill Super Powers are now unlockabled skills, unlocking at level 10
! (Skills) Skill Super Powers now use a rank system, almost all of them unlocking first at level 10
! (Skills) Acrobatics' Roll exploit detection was tweaked to still allow for Roll to trigger even if it rewards no XP
! (Skills) Acrobatics' Roll & Gracefull Roll are now considered the same skill (both mechanics are still there)
! (Skills) Woodcutting's Double Drop subskill is now named Harvest Lumber

View File

@ -51,12 +51,12 @@ public class HerbalismCommand extends SkillCommand {
// FARMERS DIET
if (canFarmersDiet) {
farmersDietRank = calculateRank(skillValue, Herbalism.farmersDietMaxLevel, Herbalism.farmersDietRankLevel1);
farmersDietRank = RankUtils.getRank(player, SubSkillType.HERBALISM_FARMERS_DIET);
}
// GREEN THUMB
if (canGreenThumbBlocks || canGreenThumbPlants) {
greenThumbStage = calculateRank(skillValue, Herbalism.greenThumbStageMaxLevel, Herbalism.greenThumbStageChangeLevel);
greenThumbStage = RankUtils.getRank(player, SubSkillType.HERBALISM_GREEN_THUMB);
String[] greenThumbStrings = calculateAbilityDisplayValues(skillValue, SubSkillType.HERBALISM_GREEN_THUMB, isLucky);
greenThumbChance = greenThumbStrings[0];

View File

@ -39,12 +39,12 @@ public enum SubSkillType {
FISHING_SHAKE,
/* Herbalism */
HERBALISM_FARMERS_DIET,
HERBALISM_GREEN_THUMB,
HERBALISM_FARMERS_DIET(5),
HERBALISM_GREEN_THUMB(4),
HERBALISM_DOUBLE_DROPS,
HERBALISM_HYLIAN_LUCK,
HERBALISM_SHROOM_THUMB,
HERBALISM_GREEN_TERRA,
HERBALISM_GREEN_TERRA(1),
/* Mining */
MINING_DOUBLE_DROPS,

View File

@ -237,7 +237,7 @@ public class FishingManager extends SkillManager {
* @return the modified change in hunger for the event
*/
public int handleFishermanDiet(int rankChange, int eventFoodLevel) {
return SkillUtils.handleFoodSkills(getPlayer(), skill, eventFoodLevel, Fishing.fishermansDietRankLevel1, Fishing.fishermansDietMaxLevel, rankChange);
return SkillUtils.handleFoodSkills(getPlayer(), eventFoodLevel, SubSkillType.FISHING_FISHERMANS_DIET);
}
public void iceFishing(FishHook hook, Block block) {

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.skills.herbalism;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.Material;
@ -12,13 +11,6 @@ import java.util.HashSet;
public class Herbalism {
public static int farmersDietRankLevel1 = AdvancedConfig.getInstance().getFarmerDietRankChange();
public static int farmersDietRankLevel2 = farmersDietRankLevel1 * 2;
public static int farmersDietMaxLevel = farmersDietRankLevel1 * 5;
public static int greenThumbStageChangeLevel = AdvancedConfig.getInstance().getGreenThumbStageChange();
public static int greenThumbStageMaxLevel = greenThumbStageChangeLevel * 4;
/**
* Convert blocks affected by the Green Thumb & Green Terra abilities.
*

View File

@ -13,6 +13,7 @@ import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.*;
import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.Location;
@ -75,7 +76,7 @@ public class HerbalismManager extends SkillManager {
* @return the modified change in hunger for the event
*/
public int farmersDiet(int rankChange, int eventFoodLevel) {
return SkillUtils.handleFoodSkills(getPlayer(), skill, eventFoodLevel, Herbalism.farmersDietRankLevel1, Herbalism.farmersDietMaxLevel, rankChange);
return SkillUtils.handleFoodSkills(getPlayer(), eventFoodLevel, SubSkillType.HERBALISM_FARMERS_DIET);
}
/**
@ -315,7 +316,7 @@ public class HerbalismManager extends SkillManager {
}
private boolean handleBlockState(BlockState blockState, boolean greenTerra) {
byte greenThumbStage = getGreenThumbStage();
int greenThumbStage = getGreenThumbStage();
blockState.setMetadata(mcMMO.greenThumbDataKey, new FixedMetadataValue(mcMMO.p, (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR)));
Ageable crops = (Ageable) blockState.getBlockData();
@ -365,7 +366,7 @@ public class HerbalismManager extends SkillManager {
return true;
}
private byte getGreenThumbStage() {
return (byte) Math.min(Math.min(getSkillLevel(), Herbalism.greenThumbStageMaxLevel) / Herbalism.greenThumbStageChangeLevel, 4);
private int getGreenThumbStage() {
return RankUtils.getRank(getPlayer(), SubSkillType.HERBALISM_GREEN_THUMB);
}
}

View File

@ -86,17 +86,13 @@ public class SkillUtils {
* Others
*/
public static int handleFoodSkills(Player player, PrimarySkillType skill, int eventFoodLevel, int baseLevel, int maxLevel, int rankChange) {
int skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
public static int handleFoodSkills(Player player, int eventFoodLevel, SubSkillType subSkillType) {
int curRank = RankUtils.getRank(player, subSkillType);
int currentFoodLevel = player.getFoodLevel();
int foodChange = eventFoodLevel - currentFoodLevel;
for (int i = baseLevel; i <= maxLevel; i += rankChange) {
if (skillLevel >= i) {
foodChange++;
}
}
foodChange+=curRank;
return currentFoodLevel + foodChange;
}

View File

@ -238,17 +238,15 @@ Herbalism:
Rank_1: 100
GreenThumb:
Standard:
Rank_1: 20
Rank_2: 40
Rank_3: 60
Rank_4: 80
Rank_5: 100
Rank_1: 25
Rank_2: 50
Rank_3: 75
Rank_4: 100
RetroMode:
Rank_1: 200
Rank_2: 400
Rank_3: 600
Rank_4: 800
Rank_5: 1000
Rank_1: 250
Rank_2: 500
Rank_3: 750
Rank_4: 1000
FarmersDiet:
Standard:
Rank_1: 20