mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-19 08:55:26 +01:00
Cleanup of HerbalismCommand, added config options for Hylian Luck
This commit is contained in:
parent
cedfb1a538
commit
5a9ca96a0f
@ -9,10 +9,12 @@ Key:
|
|||||||
|
|
||||||
Version 1.4.00-dev
|
Version 1.4.00-dev
|
||||||
+ Added new cancellable McMMOPlayerDisarmEvent for Citizens compatibility - fires whenever a player is disarmed.
|
+ Added new cancellable McMMOPlayerDisarmEvent for Citizens compatibility - fires whenever a player is disarmed.
|
||||||
|
+ Added config options for Hylian Luck skill
|
||||||
= Fixed bug where Impact was applied incorrectly due to an inverted method call
|
= Fixed bug where Impact was applied incorrectly due to an inverted method call
|
||||||
= Fixed bug where Impact improperly determined the defender's armor
|
= Fixed bug where Impact improperly determined the defender's armor
|
||||||
= Fixed ArrayIndexOutOfBoundsException resulting from being unranked in a skill when using FlatFile
|
= Fixed ArrayIndexOutOfBoundsException resulting from being unranked in a skill when using FlatFile
|
||||||
! Changed how Tree Feller is handled, it should now put less stress on the CPU
|
! Changed how Tree Feller is handled, it should now put less stress on the CPU
|
||||||
|
! Changed Fisherman's Diet and Farmer's Diet to use two seperate config values
|
||||||
|
|
||||||
Version 1.3.14
|
Version 1.3.14
|
||||||
+ Added new Hylian Luck skill to Herbalism.
|
+ Added new Hylian Luck skill to Herbalism.
|
||||||
|
@ -81,6 +81,14 @@ public abstract class SkillCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String calculateRank(int maxLevel, int rankChangeLevel) {
|
||||||
|
if (skillValue >= maxLevel) {
|
||||||
|
return String.valueOf(maxLevel / rankChangeLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.valueOf((int) (skillValue / rankChangeLevel));
|
||||||
|
}
|
||||||
|
|
||||||
protected String[] calculateAbilityDisplayValues(double chance) {
|
protected String[] calculateAbilityDisplayValues(double chance) {
|
||||||
if (isLucky) {
|
if (isLucky) {
|
||||||
double luckyChance = chance * 1.3333D;
|
double luckyChance = chance * 1.3333D;
|
||||||
|
@ -19,9 +19,6 @@ public class FishingCommand extends SkillCommand {
|
|||||||
private String shakeChanceLucky;
|
private String shakeChanceLucky;
|
||||||
private String fishermansDietRank;
|
private String fishermansDietRank;
|
||||||
|
|
||||||
private int fishermansDietRankChange = AdvancedConfig.getInstance().getFarmerDietRankChange();
|
|
||||||
private int fishermansDietRankMaxLevel = fishermansDietRankChange * 5;
|
|
||||||
|
|
||||||
private boolean canTreasureHunt;
|
private boolean canTreasureHunt;
|
||||||
private boolean canMagicHunt;
|
private boolean canMagicHunt;
|
||||||
private boolean canShake;
|
private boolean canShake;
|
||||||
@ -53,12 +50,7 @@ public class FishingCommand extends SkillCommand {
|
|||||||
shakeChanceLucky = shakeStrings[1];
|
shakeChanceLucky = shakeStrings[1];
|
||||||
|
|
||||||
//FISHERMAN'S DIET
|
//FISHERMAN'S DIET
|
||||||
if (skillValue >= fishermansDietRankMaxLevel) {
|
fishermansDietRank = calculateRank(Fishing.fishermanDietMaxLevel, Fishing.fishermanDietRankChangeLevel);
|
||||||
fishermansDietRank = "5";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fishermansDietRank = String.valueOf((int) (skillValue / fishermansDietRankChange));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,8 +5,8 @@ import com.gmail.nossr50.config.AdvancedConfig;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.SkillType;
|
import com.gmail.nossr50.datatypes.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.skills.gathering.Herbalism;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.Skills;
|
|
||||||
|
|
||||||
public class HerbalismCommand extends SkillCommand {
|
public class HerbalismCommand extends SkillCommand {
|
||||||
AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
||||||
@ -22,16 +22,6 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
private String hylianLuckChance;
|
private String hylianLuckChance;
|
||||||
private String hylianLuckChanceLucky;
|
private String hylianLuckChanceLucky;
|
||||||
|
|
||||||
private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength();
|
|
||||||
private int farmersDietRankChange = advancedConfig.getFarmerDietRankChange();
|
|
||||||
private int farmersDietMaxLevel = farmersDietRankChange * 5;
|
|
||||||
private int greenThumbStageChange = advancedConfig.getGreenThumbStageChange();
|
|
||||||
private int greenThumbStageMaxLevel = greenThumbStageChange * 4;
|
|
||||||
private double greenThumbMaxBonus = advancedConfig.getGreenThumbChanceMax();
|
|
||||||
private int greenThumbMaxLevel = advancedConfig.getGreenThumbMaxLevel();
|
|
||||||
private double doubleDropsMaxBonus = advancedConfig.getHerbalismDoubleDropsChanceMax();
|
|
||||||
private int doubleDropsMaxLevel = advancedConfig.getHerbalismDoubleDropsMaxLevel();
|
|
||||||
|
|
||||||
private boolean hasHylianLuck;
|
private boolean hasHylianLuck;
|
||||||
private boolean canGreenTerra;
|
private boolean canGreenTerra;
|
||||||
private boolean canGreenThumbWheat;
|
private boolean canGreenThumbWheat;
|
||||||
@ -39,8 +29,6 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
private boolean canFarmersDiet;
|
private boolean canFarmersDiet;
|
||||||
private boolean canDoubleDrop;
|
private boolean canDoubleDrop;
|
||||||
private boolean doubleDropsDisabled;
|
private boolean doubleDropsDisabled;
|
||||||
private boolean lucky;
|
|
||||||
private boolean endurance;
|
|
||||||
|
|
||||||
public HerbalismCommand() {
|
public HerbalismCommand() {
|
||||||
super(SkillType.HERBALISM);
|
super(SkillType.HERBALISM);
|
||||||
@ -48,50 +36,30 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dataCalculations() {
|
protected void dataCalculations() {
|
||||||
float greenThumbChanceF;
|
//GREEN TERRA
|
||||||
float doubleDropChanceF;
|
String[] greenTerraStrings = calculateLengthDisplayValues();
|
||||||
float hylianLuckChanceF;
|
greenTerraLength = greenTerraStrings[0];
|
||||||
|
greenTerraLengthEndurance = greenTerraStrings[1];
|
||||||
|
|
||||||
int length = 2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel);
|
|
||||||
greenTerraLength = String.valueOf(length);
|
|
||||||
|
|
||||||
if (Permissions.activationTwelve(player)) {
|
|
||||||
length = length + 12;
|
|
||||||
}
|
|
||||||
else if (Permissions.activationEight(player)) {
|
|
||||||
length = length + 8;
|
|
||||||
}
|
|
||||||
else if (Permissions.activationFour(player)) {
|
|
||||||
length = length + 4;
|
|
||||||
}
|
|
||||||
int maxLength = SkillType.HERBALISM.getAbility().getMaxTicks();
|
|
||||||
if (maxLength != 0 && length > maxLength) {
|
|
||||||
length = maxLength;
|
|
||||||
}
|
|
||||||
greenTerraLengthEndurance = String.valueOf(length);
|
|
||||||
//FARMERS DIET
|
//FARMERS DIET
|
||||||
if (skillValue >= farmersDietMaxLevel) farmersDietRank = "5";
|
farmersDietRank = calculateRank(Herbalism.farmersDietMaxLevel, Herbalism.farmersDietRankChangeLevel);
|
||||||
else farmersDietRank = String.valueOf((int) ((double) skillValue / (double) farmersDietRankChange));
|
|
||||||
//GREEN THUMB
|
//GREEN THUMB
|
||||||
if (skillValue >= greenThumbStageMaxLevel) greenThumbStage = "4";
|
greenThumbStage = calculateRank(Herbalism.greenThumbStageMaxLevel, Herbalism.greenThumbStageMaxLevel);
|
||||||
else greenThumbStage = String.valueOf((int) ((double) skillValue / (double) greenThumbStageChange));
|
|
||||||
|
String[] greenThumbStrings = calculateAbilityDisplayValues(Herbalism.greenThumbMaxLevel, Herbalism.greenThumbMaxChance);
|
||||||
|
greenThumbChance = greenThumbStrings[0];
|
||||||
|
greenThumbChanceLucky = greenThumbStrings[1];
|
||||||
|
|
||||||
if (skillValue >= greenThumbMaxLevel) greenThumbChanceF = (float) (greenThumbMaxBonus);
|
|
||||||
else greenThumbChanceF = (float) ((greenThumbMaxBonus / greenThumbMaxLevel) * skillValue);
|
|
||||||
greenThumbChance = percent.format(greenThumbChanceF / 100D);
|
|
||||||
if (greenThumbChanceF * 1.3333D >= 100D) greenThumbChanceLucky = percent.format(1D);
|
|
||||||
else greenThumbChanceLucky = percent.format(greenThumbChanceF * 1.3333D / 100D);
|
|
||||||
//DOUBLE DROPS
|
//DOUBLE DROPS
|
||||||
if (skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
|
String[] doubleDropStrings = calculateAbilityDisplayValues(Herbalism.doubleDropsMaxLevel, Herbalism.doubleDropsMaxChance);
|
||||||
else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
|
doubleDropChance = doubleDropStrings[0];
|
||||||
doubleDropChance = percent.format(doubleDropChanceF / 100D);
|
doubleDropChanceLucky = doubleDropStrings[1];
|
||||||
if (doubleDropChanceF * 1.3333D >= 100D) doubleDropChanceLucky = percent.format(1D);
|
|
||||||
else doubleDropChanceLucky = percent.format(doubleDropChanceF * 1.3333D / 100D);
|
|
||||||
//HYLIAN LUCK
|
//HYLIAN LUCK
|
||||||
hylianLuckChanceF = (skillValue / 100);
|
String[] hylianLuckStrings = calculateAbilityDisplayValues(Herbalism.hylianLuckMaxLevel, Herbalism.hylianLuckMaxChance);
|
||||||
hylianLuckChance = percent.format(hylianLuckChanceF / 100D);
|
hylianLuckChance = hylianLuckStrings[0];
|
||||||
if (hylianLuckChanceF * 1.3333D >= 100D) hylianLuckChanceLucky = percent.format(1D);
|
hylianLuckChanceLucky = hylianLuckStrings[1];
|
||||||
else hylianLuckChanceLucky = percent.format(hylianLuckChanceF * 1.3333D / 100D);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -105,8 +73,6 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
canFarmersDiet = Permissions.farmersDiet(player);
|
canFarmersDiet = Permissions.farmersDiet(player);
|
||||||
canDoubleDrop = Permissions.herbalismDoubleDrops(player);
|
canDoubleDrop = Permissions.herbalismDoubleDrops(player);
|
||||||
doubleDropsDisabled = configInstance.herbalismDoubleDropsDisabled();
|
doubleDropsDisabled = configInstance.herbalismDoubleDropsDisabled();
|
||||||
lucky = Permissions.luckyHerbalism(player);
|
|
||||||
endurance = Permissions.activationTwelve(player) || Permissions.activationEight(player) || Permissions.activationFour(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -116,10 +82,7 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void effectsDisplay() {
|
protected void effectsDisplay() {
|
||||||
if (lucky) {
|
luckyEffectsDisplay();
|
||||||
String perkPrefix = LocaleLoader.getString("MOTD.PerksPrefix");
|
|
||||||
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { Skills.localizeSkillName(SkillType.HERBALISM) }) }));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (canGreenTerra) {
|
if (canGreenTerra) {
|
||||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.0"), LocaleLoader.getString("Herbalism.Effect.1") }));
|
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.0"), LocaleLoader.getString("Herbalism.Effect.1") }));
|
||||||
@ -154,18 +117,22 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void statsDisplay() {
|
protected void statsDisplay() {
|
||||||
if (canGreenTerra) {
|
if (canGreenTerra) {
|
||||||
if (endurance)
|
if (hasEndurance) {
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.Length", new Object[] { greenTerraLength }) + LocaleLoader.getString("Perks.activationtime.bonus", new Object[] { greenTerraLengthEndurance }));
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.Length", new Object[] { greenTerraLength }) + LocaleLoader.getString("Perks.activationtime.bonus", new Object[] { greenTerraLengthEndurance }));
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.Length", new Object[] { greenTerraLength }));
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.Length", new Object[] { greenTerraLength }));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (canGreenThumbBlocks || canGreenThumbWheat) {
|
if (canGreenThumbBlocks || canGreenThumbWheat) {
|
||||||
if (lucky)
|
if (isLucky) {
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", new Object[] { greenThumbChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { greenThumbChanceLucky }));
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", new Object[] { greenThumbChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { greenThumbChanceLucky }));
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", new Object[] { greenThumbChance }));
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", new Object[] { greenThumbChance }));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (canGreenThumbWheat) {
|
if (canGreenThumbWheat) {
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Stage", new Object[] { greenThumbStage }));
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Stage", new Object[] { greenThumbStage }));
|
||||||
@ -176,16 +143,20 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hasHylianLuck) {
|
if (hasHylianLuck) {
|
||||||
if (lucky)
|
if (isLucky) {
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.HylianLuck", new Object[] { hylianLuckChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { hylianLuckChanceLucky }));
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.HylianLuck", new Object[] { hylianLuckChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { hylianLuckChanceLucky }));
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.HylianLuck", new Object[] { hylianLuckChance }));
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.HylianLuck", new Object[] { hylianLuckChance }));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (canDoubleDrop && !doubleDropsDisabled) {
|
if (canDoubleDrop && !doubleDropsDisabled) {
|
||||||
if (lucky)
|
if (isLucky) {
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", new Object[] { doubleDropChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { doubleDropChanceLucky }));
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", new Object[] { doubleDropChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { doubleDropChanceLucky }));
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", new Object[] { doubleDropChance }));
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", new Object[] { doubleDropChance }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -91,12 +91,15 @@ public class AdvancedConfig extends ConfigLoader {
|
|||||||
public int getFarmerDietRankChange() { return config.getInt("Skills.Herbalism.Farmer_Diet_RankChange", 200); }
|
public int getFarmerDietRankChange() { return config.getInt("Skills.Herbalism.Farmer_Diet_RankChange", 200); }
|
||||||
|
|
||||||
public int getGreenThumbStageChange() { return config.getInt("Skills.Herbalism.GreenThumb_StageChange", 200); }
|
public int getGreenThumbStageChange() { return config.getInt("Skills.Herbalism.GreenThumb_StageChange", 200); }
|
||||||
public int getGreenThumbChanceMax() { return config.getInt("Skills.Herbalism.GreenThumb_ChanceMax", 100); }
|
public double getGreenThumbChanceMax() { return config.getDouble("Skills.Herbalism.GreenThumb_ChanceMax", 100.0D); }
|
||||||
public int getGreenThumbMaxLevel() { return config.getInt("Skills.Herbalism.GreenThumb_MaxBonusLevel", 1500); }
|
public int getGreenThumbMaxLevel() { return config.getInt("Skills.Herbalism.GreenThumb_MaxBonusLevel", 1500); }
|
||||||
|
|
||||||
public int getHerbalismDoubleDropsChanceMax() { return config.getInt("Skills.Herbalism.DoubleDrops_ChanceMax", 100); }
|
public double getHerbalismDoubleDropsChanceMax() { return config.getDouble("Skills.Herbalism.DoubleDrops_ChanceMax", 100.0D); }
|
||||||
public int getHerbalismDoubleDropsMaxLevel() { return config.getInt("Skills.Herbalism.DoubleDrops_MaxBonusLevel", 1000); }
|
public int getHerbalismDoubleDropsMaxLevel() { return config.getInt("Skills.Herbalism.DoubleDrops_MaxBonusLevel", 1000); }
|
||||||
|
|
||||||
|
public double getHylianLuckChanceMax() { return config.getDouble("Skills.Herbalism.HylianLuck_ChanceMax", 10.0D); }
|
||||||
|
public int getHylianLucksMaxLevel() { return config.getInt("Skills.Herbalism.HylianLuck_MaxBonusLevel", 1000); }
|
||||||
|
|
||||||
/* MINING */
|
/* MINING */
|
||||||
public int getMiningDoubleDropChance() { return config.getInt("Skills.Mining.DoubleDrops_ChanceMax", 100); }
|
public int getMiningDoubleDropChance() { return config.getInt("Skills.Mining.DoubleDrops_ChanceMax", 100); }
|
||||||
public int getMiningDoubleDropMaxLevel() { return config.getInt("Skills.Mining.DoubleDrops_MaxBonusLevel", 1000); }
|
public int getMiningDoubleDropMaxLevel() { return config.getInt("Skills.Mining.DoubleDrops_MaxBonusLevel", 1000); }
|
||||||
|
@ -49,6 +49,9 @@ public class Fishing {
|
|||||||
public static int shakeChanceLevel5 = AdvancedConfig.getInstance().getShakeChanceRank5();
|
public static int shakeChanceLevel5 = AdvancedConfig.getInstance().getShakeChanceRank5();
|
||||||
public static int shakeUnlockLevel = AdvancedConfig.getInstance().getShakeUnlockLevel();
|
public static int shakeUnlockLevel = AdvancedConfig.getInstance().getShakeUnlockLevel();
|
||||||
|
|
||||||
|
public static int fishermanDietRankChangeLevel = AdvancedConfig.getInstance().getFishermanDietRankChange();
|
||||||
|
public static int fishermanDietMaxLevel = fishermanDietRankChangeLevel * 5;
|
||||||
|
|
||||||
public static int magicHunterMultiplier = AdvancedConfig.getInstance().getFishingMagicMultiplier();
|
public static int magicHunterMultiplier = AdvancedConfig.getInstance().getFishingMagicMultiplier();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,7 +28,20 @@ import com.gmail.nossr50.util.Skills;
|
|||||||
import com.gmail.nossr50.util.Users;
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
public class Herbalism {
|
public class Herbalism {
|
||||||
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
public static int farmersDietRankChangeLevel = AdvancedConfig.getInstance().getFarmerDietRankChange();
|
||||||
|
public static int farmersDietMaxLevel = farmersDietRankChangeLevel * 5;
|
||||||
|
|
||||||
|
public static int greenThumbStageChangeLevel = AdvancedConfig.getInstance().getGreenThumbStageChange();
|
||||||
|
public static int greenThumbStageMaxLevel = greenThumbStageChangeLevel * 4;
|
||||||
|
|
||||||
|
public static double greenThumbMaxChance = AdvancedConfig.getInstance().getGreenThumbChanceMax();
|
||||||
|
public static int greenThumbMaxLevel = AdvancedConfig.getInstance().getGreenThumbMaxLevel();
|
||||||
|
|
||||||
|
public static double doubleDropsMaxChance = AdvancedConfig.getInstance().getHerbalismDoubleDropsChanceMax();
|
||||||
|
public static int doubleDropsMaxLevel = AdvancedConfig.getInstance().getHerbalismDoubleDropsMaxLevel();
|
||||||
|
|
||||||
|
public static double hylianLuckMaxChance = AdvancedConfig.getInstance().getHylianLuckChanceMax();
|
||||||
|
public static int hylianLuckMaxLevel = AdvancedConfig.getInstance().getHylianLucksMaxLevel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activate the Green Terra ability.
|
* Activate the Green Terra ability.
|
||||||
@ -84,8 +97,6 @@ public class Herbalism {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
final PlayerProfile profile = Users.getProfile(player);
|
final PlayerProfile profile = Users.getProfile(player);
|
||||||
final double MAX_CHANCE = advancedConfig.getHerbalismDoubleDropsChanceMax();
|
|
||||||
final int MAX_BONUS_LEVEL = advancedConfig.getHerbalismDoubleDropsMaxLevel();
|
|
||||||
|
|
||||||
int herbLevel = profile.getSkillLevel(SkillType.HERBALISM);
|
int herbLevel = profile.getSkillLevel(SkillType.HERBALISM);
|
||||||
int id = block.getTypeId();
|
int id = block.getTypeId();
|
||||||
@ -103,8 +114,8 @@ public class Herbalism {
|
|||||||
|
|
||||||
int activationChance = Misc.calculateActivationChance(Permissions.luckyHerbalism(player));
|
int activationChance = Misc.calculateActivationChance(Permissions.luckyHerbalism(player));
|
||||||
|
|
||||||
float chance = (float) ((MAX_CHANCE / MAX_BONUS_LEVEL) * herbLevel);
|
float chance = (float) ((doubleDropsMaxChance / doubleDropsMaxLevel) * herbLevel);
|
||||||
if (chance > MAX_CHANCE) chance = (float) MAX_CHANCE;
|
if (chance > doubleDropsMaxChance) chance = (float) doubleDropsMaxChance;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BROWN_MUSHROOM:
|
case BROWN_MUSHROOM:
|
||||||
@ -406,9 +417,6 @@ public class Herbalism {
|
|||||||
* @param plugin mcMMO plugin instance
|
* @param plugin mcMMO plugin instance
|
||||||
*/
|
*/
|
||||||
private static void greenThumbWheat(Block block, Player player, BlockBreakEvent event, mcMMO plugin) {
|
private static void greenThumbWheat(Block block, Player player, BlockBreakEvent event, mcMMO plugin) {
|
||||||
final int MAX_CHANCE = advancedConfig.getGreenThumbChanceMax();
|
|
||||||
final int MAX_BONUS_LEVEL = advancedConfig.getGreenThumbMaxLevel();
|
|
||||||
|
|
||||||
PlayerProfile profile = Users.getProfile(player);
|
PlayerProfile profile = Users.getProfile(player);
|
||||||
int herbLevel = profile.getSkillLevel(SkillType.HERBALISM);
|
int herbLevel = profile.getSkillLevel(SkillType.HERBALISM);
|
||||||
PlayerInventory inventory = player.getInventory();
|
PlayerInventory inventory = player.getInventory();
|
||||||
@ -446,8 +454,8 @@ public class Herbalism {
|
|||||||
|
|
||||||
int activationChance = Misc.calculateActivationChance(Permissions.luckyHerbalism(player));
|
int activationChance = Misc.calculateActivationChance(Permissions.luckyHerbalism(player));
|
||||||
|
|
||||||
float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * herbLevel);
|
float chance = (float) ((greenThumbMaxChance / greenThumbMaxLevel) * herbLevel);
|
||||||
if (chance > MAX_CHANCE) chance = MAX_CHANCE;
|
if (chance > greenThumbMaxChance) chance = (float) greenThumbMaxChance;
|
||||||
|
|
||||||
if (hasSeeds && profile.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (chance > Misc.getRandom().nextInt(activationChance))) {
|
if (hasSeeds && profile.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (chance > Misc.getRandom().nextInt(activationChance))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -505,9 +513,6 @@ public class Herbalism {
|
|||||||
* @param block The block being used in the ability
|
* @param block The block being used in the ability
|
||||||
*/
|
*/
|
||||||
public static void greenThumbBlocks(ItemStack is, Player player, Block block) {
|
public static void greenThumbBlocks(ItemStack is, Player player, Block block) {
|
||||||
final int MAX_CHANCE = advancedConfig.getGreenThumbChanceMax();
|
|
||||||
final int MAX_BONUS_LEVEL = advancedConfig.getGreenThumbMaxLevel();
|
|
||||||
|
|
||||||
PlayerProfile profile = Users.getProfile(player);
|
PlayerProfile profile = Users.getProfile(player);
|
||||||
int skillLevel = profile.getSkillLevel(SkillType.HERBALISM);
|
int skillLevel = profile.getSkillLevel(SkillType.HERBALISM);
|
||||||
int seeds = is.getAmount();
|
int seeds = is.getAmount();
|
||||||
@ -516,8 +521,8 @@ public class Herbalism {
|
|||||||
|
|
||||||
int activationChance = Misc.calculateActivationChance(Permissions.luckyHerbalism(player));
|
int activationChance = Misc.calculateActivationChance(Permissions.luckyHerbalism(player));
|
||||||
|
|
||||||
float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * skillLevel);
|
float chance = (float) ((greenThumbMaxChance / greenThumbMaxLevel) * skillLevel);
|
||||||
if (chance > MAX_CHANCE) chance = MAX_CHANCE;
|
if (chance > greenThumbMaxChance) chance = (float) greenThumbMaxChance;
|
||||||
|
|
||||||
if (chance > Misc.getRandom().nextInt(activationChance)) {
|
if (chance > Misc.getRandom().nextInt(activationChance)) {
|
||||||
greenTerraConvert(player, block);
|
greenTerraConvert(player, block);
|
||||||
@ -528,7 +533,10 @@ public class Herbalism {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void hylianLuck(Block block, Player player, BlockBreakEvent event) {
|
public static void hylianLuck(Block block, Player player, BlockBreakEvent event) {
|
||||||
int chance = Users.getProfile(player).getSkillLevel(SkillType.HERBALISM) / 100;
|
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.HERBALISM);
|
||||||
|
|
||||||
|
float chance = (float) ((hylianLuckMaxChance / hylianLuckMaxLevel) * skillLevel);
|
||||||
|
if (chance > hylianLuckMaxChance) chance = (float) hylianLuckMaxChance;
|
||||||
|
|
||||||
int activationChance = Misc.calculateActivationChance(Permissions.luckyHerbalism(player));
|
int activationChance = Misc.calculateActivationChance(Permissions.luckyHerbalism(player));
|
||||||
|
|
||||||
|
@ -128,15 +128,20 @@ Skills:
|
|||||||
|
|
||||||
# GreenThumb_StageChange: Level value when the GreenThumb stage level goes up
|
# GreenThumb_StageChange: Level value when the GreenThumb stage level goes up
|
||||||
# GreenThumb_ChanceMax: Maximum chance of GreenThumb
|
# GreenThumb_ChanceMax: Maximum chance of GreenThumb
|
||||||
# GreenThumb_MaxBonusLevel: On this level, greenthumb chance will be GreenThumb_ChanceMax
|
# GreenThumb_MaxBonusLevel: On this level, GreenThumb chance will be GreenThumb_ChanceMax
|
||||||
GreenThumb_StageChange: 200
|
GreenThumb_StageChange: 200
|
||||||
GreenThumb_ChanceMax: 100
|
GreenThumb_ChanceMax: 100.0
|
||||||
GreenThumb_MaxBonusLevel: 1500
|
GreenThumb_MaxBonusLevel: 1500
|
||||||
|
|
||||||
# DoubleDrops_ChanceMax: Maximum chance of receiving double drops
|
# DoubleDrops_ChanceMax: Maximum chance of receiving double drops
|
||||||
# DoubleDrops_MaxBonusLevel: Level when the maximum chance of receiving double drops is reached
|
# DoubleDrops_MaxBonusLevel: Level when the maximum chance of receiving double drops is reached
|
||||||
DoubleDrops_ChanceMax: 100
|
DoubleDrops_ChanceMax: 100.0
|
||||||
DoubleDrops_MaxBonusLevel: 1000
|
DoubleDrops_MaxBonusLevel: 1000
|
||||||
|
|
||||||
|
# HylianLuck_ChanceMax: Maximum chance of Hylian Luck
|
||||||
|
# HylianLuck_MaxBonusLevel: On this level, Hylian Luck chance will be HylianLuck_ChanceMax
|
||||||
|
HylianLuck_ChanceMax: 10.0
|
||||||
|
HylianLuck_MaxBonusLevel: 1000
|
||||||
#
|
#
|
||||||
# Settings for Mining
|
# Settings for Mining
|
||||||
###
|
###
|
||||||
|
Loading…
x
Reference in New Issue
Block a user