mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 18:24:43 +02:00
Skills which used to unlock at level 5 now unlock at level 1 and some
tweaks to ranks of other skills, and length scaling for super abilities. Early game boost has also been modified.
This commit is contained in:
@ -138,7 +138,6 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
public boolean isEarlyGameBoostEnabled() { return config.getBoolean("EarlyGameBoost.Enabled", true); }
|
||||
public double getEarlyGameBoostMultiplier() { return config.getDouble("EarlyGameBoost.MaxLevelMultiplier", 0.05D); }
|
||||
|
||||
/*
|
||||
* FORMULA SETTINGS
|
||||
@ -151,6 +150,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
public boolean isFishingExploitingPrevented() { return config.getBoolean("ExploitFix.Fishing", true); }
|
||||
public boolean isAcrobaticsExploitingPrevented() { return config.getBoolean("ExploitFix.Acrobatics", true); }
|
||||
public boolean isTreeFellerXPReduced() { return config.getBoolean("ExploitFix.TreeFellerReducedXP", true); }
|
||||
|
||||
/* Curve settings */
|
||||
public FormulaType getFormulaType() { return FormulaType.getFormulaType(config.getString("Experience_Formula.Curve")); }
|
||||
|
@ -41,7 +41,7 @@ public enum SubSkillType {
|
||||
FISHING_SHAKE(1),
|
||||
|
||||
/* Herbalism */
|
||||
HERBALISM_DOUBLE_DROPS,
|
||||
HERBALISM_DOUBLE_DROPS(1),
|
||||
HERBALISM_FARMERS_DIET(5),
|
||||
HERBALISM_GREEN_TERRA(1),
|
||||
HERBALISM_GREEN_THUMB(4),
|
||||
@ -52,7 +52,7 @@ public enum SubSkillType {
|
||||
MINING_BIGGER_BOMBS(1),
|
||||
MINING_BLAST_MINING(8),
|
||||
MINING_DEMOLITIONS_EXPERTISE(1),
|
||||
MINING_DOUBLE_DROPS,
|
||||
MINING_DOUBLE_DROPS(1),
|
||||
MINING_SUPER_BREAKER(1),
|
||||
|
||||
/* Repair */
|
||||
|
@ -10,7 +10,6 @@ import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -19,25 +18,17 @@ import java.util.Set;
|
||||
|
||||
public final class Woodcutting {
|
||||
public static int treeFellerThreshold = Config.getInstance().getTreeFellerThreshold();
|
||||
|
||||
|
||||
protected static boolean treeFellerReachedThreshold = false;
|
||||
|
||||
protected enum ExperienceGainMethod {
|
||||
DEFAULT,
|
||||
TREE_FELLER,
|
||||
}
|
||||
|
||||
private Woodcutting() {}
|
||||
|
||||
/**
|
||||
* Retrieves the experience reward from a log
|
||||
*
|
||||
* @param blockState Log being broken
|
||||
* @param experienceGainMethod How the log is being broken
|
||||
* @return Amount of experience
|
||||
*/
|
||||
protected static int getExperienceFromLog(BlockState blockState, ExperienceGainMethod experienceGainMethod) {
|
||||
protected static int getExperienceFromLog(BlockState blockState) {
|
||||
if (mcMMO.getModManager().isCustomLog(blockState)) {
|
||||
return mcMMO.getModManager().getBlock(blockState).getXpGain();
|
||||
}
|
||||
@ -45,6 +36,33 @@ public final class Woodcutting {
|
||||
return ExperienceConfig.getInstance().getXp(PrimarySkillType.WOODCUTTING, blockState.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the experience reward from logging via Tree Feller
|
||||
* Experience is reduced per log processed so far
|
||||
* Experience is only reduced if the config option to reduce Tree Feller XP is set
|
||||
* Experience per log will not fall below 1 unless the experience for that log is set to 0 in the config
|
||||
*
|
||||
* @param blockState Log being broken
|
||||
* @param woodCount how many logs have given out XP for this tree feller so far
|
||||
* @return Amount of experience
|
||||
*/
|
||||
protected static int processTreeFellerXPGains(BlockState blockState, int woodCount) {
|
||||
int rawXP = ExperienceConfig.getInstance().getXp(PrimarySkillType.WOODCUTTING, blockState.getType());
|
||||
|
||||
if(rawXP <= 0)
|
||||
return 0;
|
||||
|
||||
if(ExperienceConfig.getInstance().isTreeFellerXPReduced()) {
|
||||
int reducedXP = 1 + (woodCount * 5);
|
||||
rawXP = Math.max(1, rawXP - reducedXP);
|
||||
return rawXP;
|
||||
} else {
|
||||
return ExperienceConfig.getInstance().getXp(PrimarySkillType.WOODCUTTING, blockState.getType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Checks for double drops
|
||||
*
|
||||
|
@ -9,7 +9,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.woodcutting.Woodcutting.ExperienceGainMethod;
|
||||
import com.gmail.nossr50.util.*;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
@ -54,7 +53,7 @@ public class WoodcuttingManager extends SkillManager {
|
||||
* @param blockState Block being broken
|
||||
*/
|
||||
public void woodcuttingBlockCheck(BlockState blockState) {
|
||||
int xp = Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.DEFAULT);
|
||||
int xp = Woodcutting.getExperienceFromLog(blockState);
|
||||
|
||||
switch (blockState.getType()) {
|
||||
case BROWN_MUSHROOM_BLOCK:
|
||||
@ -116,6 +115,7 @@ public class WoodcuttingManager extends SkillManager {
|
||||
private void dropBlocks(Set<BlockState> treeFellerBlocks) {
|
||||
Player player = getPlayer();
|
||||
int xp = 0;
|
||||
int processedLogCount = 0;
|
||||
|
||||
for (BlockState blockState : treeFellerBlocks) {
|
||||
Block block = blockState.getBlock();
|
||||
@ -126,30 +126,18 @@ public class WoodcuttingManager extends SkillManager {
|
||||
|
||||
Material material = blockState.getType();
|
||||
|
||||
//TODO: Update this to drop the correct items/blocks via NMS
|
||||
if (material == Material.BROWN_MUSHROOM_BLOCK || material == Material.RED_MUSHROOM_BLOCK) {
|
||||
xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
|
||||
xp += Woodcutting.processTreeFellerXPGains(blockState, processedLogCount);
|
||||
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
||||
}
|
||||
else if (mcMMO.getModManager().isCustomLog(blockState)) {
|
||||
if (canGetDoubleDrops()) {
|
||||
Woodcutting.checkForDoubleDrop(blockState);
|
||||
}
|
||||
|
||||
CustomBlock customBlock = mcMMO.getModManager().getBlock(blockState);
|
||||
xp = customBlock.getXpGain();
|
||||
|
||||
} else if (mcMMO.getModManager().isCustomLeaf(blockState)) {
|
||||
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
||||
}
|
||||
else if (mcMMO.getModManager().isCustomLeaf(blockState)) {
|
||||
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
||||
}
|
||||
else {
|
||||
|
||||
} else {
|
||||
if (BlockUtils.isLog(blockState)) {
|
||||
if (canGetDoubleDrops()) {
|
||||
Woodcutting.checkForDoubleDrop(blockState);
|
||||
}
|
||||
xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
|
||||
xp += Woodcutting.processTreeFellerXPGains(blockState, processedLogCount);
|
||||
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
||||
}
|
||||
if (BlockUtils.isLeaves(blockState)) {
|
||||
@ -159,6 +147,7 @@ public class WoodcuttingManager extends SkillManager {
|
||||
|
||||
blockState.setType(Material.AIR);
|
||||
blockState.update(true);
|
||||
processedLogCount+=1;
|
||||
}
|
||||
|
||||
applyXpGain(xp, XPGainReason.PVE);
|
||||
|
@ -1,43 +1,38 @@
|
||||
package com.gmail.nossr50.util.player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class PlayerLevelUtils {
|
||||
HashMap<PrimarySkillType, Integer> earlyGameBoostCutoffs;
|
||||
|
||||
public PlayerLevelUtils()
|
||||
{
|
||||
earlyGameBoostCutoffs = new HashMap<>();
|
||||
calculateEarlyGameBoostCutoffs();
|
||||
}
|
||||
|
||||
private void calculateEarlyGameBoostCutoffs()
|
||||
{
|
||||
for(PrimarySkillType primarySkillType : PrimarySkillType.values())
|
||||
{
|
||||
int levelCap = Config.getInstance().getLevelCap(primarySkillType);
|
||||
int cap;
|
||||
|
||||
if(levelCap == Integer.MAX_VALUE || levelCap <= 0)
|
||||
{
|
||||
cap = Config.getInstance().getIsRetroMode() ? 50 : 5;
|
||||
} else {
|
||||
cap = (int) (levelCap * ExperienceConfig.getInstance().getEarlyGameBoostMultiplier());
|
||||
}
|
||||
|
||||
earlyGameBoostCutoffs.put(primarySkillType, cap);
|
||||
}
|
||||
}
|
||||
// HashMap<PrimarySkillType, Integer> earlyGameBoostCutoffs;
|
||||
//
|
||||
// public PlayerLevelUtils()
|
||||
// {
|
||||
// earlyGameBoostCutoffs = new HashMap<>();
|
||||
// calculateEarlyGameBoostCutoffs();
|
||||
// }
|
||||
// private void calculateEarlyGameBoostCutoffs()
|
||||
// {
|
||||
// for(PrimarySkillType primarySkillType : PrimarySkillType.values())
|
||||
// {
|
||||
// int levelCap = Config.getInstance().getLevelCap(primarySkillType);
|
||||
// int cap;
|
||||
//
|
||||
// if(levelCap == Integer.MAX_VALUE || levelCap <= 0)
|
||||
// {
|
||||
// cap = Config.getInstance().getIsRetroMode() ? 50 : 5;
|
||||
// } else {
|
||||
// cap = (int) (levelCap * ExperienceConfig.getInstance().getEarlyGameBoostMultiplier());
|
||||
// }
|
||||
//
|
||||
// earlyGameBoostCutoffs.put(primarySkillType, cap);
|
||||
// }
|
||||
// }
|
||||
|
||||
public int getEarlyGameCutoff(PrimarySkillType primarySkillType)
|
||||
{
|
||||
return earlyGameBoostCutoffs.get(primarySkillType);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user