From 437fe29112a06d928028bad76d208c510b3dd063 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 9 Mar 2019 16:22:20 -0800 Subject: [PATCH] Fuel Efficiency now uses a rank system, also fixed some bugs with it --- Changelog.txt | 3 +++ .../commands/skills/SmeltingCommand.java | 3 ++- .../gmail/nossr50/config/AdvancedConfig.java | 12 ++++++------ .../nossr50/datatypes/skills/SubSkillType.java | 1 + .../skills/smelting/SmeltingManager.java | 17 +++++++++++++++-- src/main/resources/advanced.yml | 8 -------- src/main/resources/skillranks.yml | 14 ++++++++++---- 7 files changed, 37 insertions(+), 21 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 2bc1dc8d4..bbeb4c480 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -8,6 +8,9 @@ Key: - Removal Version 2.1.14 + Fixed a bug where Fuel Efficiency was way too good + Fuel Efficiency now uses the rank system + Removed Fuel Efficiency config options in advanced.yml Added Tropical Fish, Raw Cod, Raw Salmon to the list of foods that benefit from Fisherman's Diet Fixed a display issue with Fisherman's Diet diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java index e4028df22..83fb1bf47 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java @@ -4,6 +4,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.smelting.Smelting; +import com.gmail.nossr50.skills.smelting.SmeltingManager; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; @@ -35,7 +36,7 @@ public class SmeltingCommand extends SkillCommand { protected void dataCalculations(Player player, float skillValue) { // FUEL EFFICIENCY if (canFuelEfficiency) { - burnTimeModifier = decimal.format(1 + ((skillValue / Smelting.burnModifierMaxLevel) * Smelting.burnTimeMultiplier)); + burnTimeModifier = String.valueOf(UserManager.getPlayer(player).getSmeltingManager().getFuelEfficiencyMultiplier()); } // FLUX MINING diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index cfbc7f7a6..da1271854 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -438,10 +438,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { reason.add("Skills.Smelting.FuelEfficiency.MaxBonusLevel should be at least 1!"); } - if (getBurnTimeMultiplier() < 1) { - reason.add("Skills.Smelting.FuelEfficiency.Multiplier should be at least 1!"); - } - if (getMaxBonusLevel(SubSkillType.SMELTING_SECOND_SMELT) < 1) { reason.add("Skills.Smelting.SecondSmelt.MaxBonusLevel should be at least 1!"); } @@ -939,8 +935,12 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public double getArcaneSalvageExtractPartialEnchantsChance(int rank) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank); } /* SMELTING */ - public int getBurnModifierMaxLevel() { return config.getInt("Skills.Smelting.FuelEfficiency.MaxBonusLevel", 100); } - public double getBurnTimeMultiplier() { return config.getDouble("Skills.Smelting.FuelEfficiency.Multiplier", 3.0D); } + public int getBurnModifierMaxLevel() { + if(mcMMO.isRetroModeEnabled()) + return config.getInt("Skills.Smelting.FuelEfficiency.RetroMode.MaxBonusLevel", 1000); + else + return config.getInt("Skills.Smelting.FuelEfficiency.Standard.MaxBonusLevel", 100); + } /*public int getFluxMiningUnlockLevel() { return config.getInt("Skills.Smelting.FluxMining.UnlockLevel", 250); }*/ public double getFluxMiningChance() { return config.getDouble("Skills.Smelting.FluxMining.Chance", 33.0D); } diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java index c6a88be82..c11cd797e 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java @@ -52,6 +52,7 @@ public enum SubSkillType { MINING_DEMOLITIONS_EXPERTISE(1), MINING_DOUBLE_DROPS, MINING_SUPER_BREAKER(1), + MINING_FUEL_EFFICIENCY(4), /* Repair */ REPAIR_ARCANE_FORGING(8), diff --git a/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java b/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java index 6cc041e02..24c463edb 100644 --- a/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java @@ -102,9 +102,22 @@ public class SmeltingManager extends SkillManager { * @param burnTime The initial burn time from the {@link FurnaceBurnEvent} */ public int fuelEfficiency(int burnTime) { - double burnModifier = 1 + (((double) getSkillLevel() / Smelting.burnModifierMaxLevel) * Smelting.burnTimeMultiplier); + return burnTime * getFuelEfficiencyMultiplier(); + } - return (int) (burnTime * burnModifier); + public int getFuelEfficiencyMultiplier() + { + switch(RankUtils.getRank(getPlayer(), SubSkillType.SMELTING_FUEL_EFFICIENCY)) + { + case 1: + return 2; + case 2: + return 3; + case 3: + return 4; + default: + return 1; + } } public ItemStack smeltProcessing(ItemStack smelting, ItemStack result) { diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index f684719bc..547ba0eb9 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -409,14 +409,6 @@ Skills: # Settings for Smelting ### Smelting: - FuelEfficiency: - # Multiplier: The furnace burn time will be multiplied by this value. - # MaxBonusLevel: On this level, the efficiency multiplier will stop increasing - Multiplier: 3.0 - MaxBonusLevel: - Standard: 100 - RetroMode: 1000 - SecondSmelt: # ChanceMax: Maximum chance of triggering Second Smelt # MaxBonusLevel: On this level, the chance to cause Second Smelt will be diff --git a/src/main/resources/skillranks.yml b/src/main/resources/skillranks.yml index 9482bb7b5..33c89bfd6 100644 --- a/src/main/resources/skillranks.yml +++ b/src/main/resources/skillranks.yml @@ -207,11 +207,17 @@ Taming: RetroMode: Rank_1: 750 Smelting: - FluxMining: + FuelEfficiency: Standard: - Rank_1: 25 - Retro: - Rank_1: 250 + Rank_1: 10 + Rank_2: 50 + Rank_3: 75 + Rank_4: 100 + RetroMode: + Rank_1: 100 + Rank_2: 500 + Rank_3: 750 + Rank_4: 1000 UnderstandingTheArt: Standard: Rank_1: 10