From bff72486d047bd60d55f767cb863f5af598272cb Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 31 Jan 2019 14:07:03 -0800 Subject: [PATCH] Fixed a bug where static chance skills uses incorrect calculations for success Cleaned up some leftover code from the old skill unlock system --- Changelog.txt | 13 ++++++ .../commands/skills/SalvageCommand.java | 7 +--- .../commands/skills/TamingCommand.java | 42 +++---------------- .../gmail/nossr50/config/AdvancedConfig.java | 20 ++++----- .../datatypes/skills/SubSkillType.java | 2 +- .../gmail/nossr50/skills/salvage/Salvage.java | 4 +- .../skills/salvage/SalvageManager.java | 26 ++++++++---- .../gmail/nossr50/skills/taming/Taming.java | 4 -- .../nossr50/skills/taming/TamingManager.java | 15 ++++--- .../nossr50/util/random/RandomChanceUtil.java | 12 ++++++ src/main/resources/advanced.yml | 36 +--------------- .../resources/locale/locale_en_US.properties | 2 +- src/main/resources/skillranks.yml | 5 +++ 13 files changed, 79 insertions(+), 109 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index cc8744ca1..1c2011d35 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -7,6 +7,19 @@ Key: ! Change - Removal +Version 2.1.4 + Fixed a bug where static chance skills like Arcane Salvage were using incorrect calculations for success + Advanced Salvage now uses a rank system + Arcane Salvage now goes by your rank to determine the maximum amount of materials salvaged and is no longer percentage based + Fixed a bug where Iron Arm was checking for Iron Grip to be unlocked instead of itself + (Plugin Compatibility) mcMMO now ignores cancelled events relating to the player left or right clicking + (Locale) Changed the string for "Salvage.Ability.Bonus.1" to fit the new material recovery mechanics of Salvage + (Config) Cleaned up some leftover 'unlocklevel' settings, this stuff is now handled in skillranks.yml + (Config) Removed Salvage.MaxPercentage + (Config) Removed Salvage.MaxPercentageChance + (Config) Added Salvage.ArcaneSalvage.MaxBonusLevel + (Config) Added Salvage.ArcaneSalvage.MaxChance + Version 2.1.3 Temporarily removed the unarmed no-item pickup feature until its fixed diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java index 2013302d4..99ebb1f8c 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java @@ -40,12 +40,7 @@ public class SalvageCommand extends SkillCommand { SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager(); if (canAdvancedSalvage) { - if (skillValue < Salvage.advancedSalvageUnlockLevel) { - messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Salvage.Ability.Locked.0", Salvage.advancedSalvageUnlockLevel))); - } - else { - messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Salvage.Ability.Bonus.0"), LocaleLoader.getString("Salvage.Ability.Bonus.1", percent.format(salvageManager.getMaxSalvagePercentage())))); - } + messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Salvage.Ability.Bonus.0"), LocaleLoader.getString("Salvage.Ability.Bonus.1", salvageManager.getSalvageableAmount()))); } if (canArcaneSalvage) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java index 504f6720c..fb613544e 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java @@ -59,21 +59,11 @@ public class TamingCommand extends SkillCommand { List messages = new ArrayList(); if (canEnvironmentallyAware) { - if (skillValue < Taming.environmentallyAwareUnlockLevel) { - messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Taming.Ability.Locked.0", Taming.environmentallyAwareUnlockLevel))); - } - else { - messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.0"), LocaleLoader.getString("Taming.Ability.Bonus.1"))); - } + messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.0"), LocaleLoader.getString("Taming.Ability.Bonus.1"))); } if (canFastFood) { - if (skillValue < Taming.fastFoodServiceUnlockLevel) { - messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Taming.Ability.Locked.4", Taming.fastFoodServiceUnlockLevel))); - } - else { - messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.8"), LocaleLoader.getString("Taming.Ability.Bonus.9", percent.format(Taming.fastFoodServiceActivationChance / 100D)))); - } + messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.8"), LocaleLoader.getString("Taming.Ability.Bonus.9", percent.format(Taming.fastFoodServiceActivationChance / 100D)))); } if (canGore) { @@ -83,39 +73,19 @@ public class TamingCommand extends SkillCommand { } if (canHolyHound) { - if (skillValue < Taming.holyHoundUnlockLevel) { - messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Taming.Ability.Locked.5", Taming.holyHoundUnlockLevel))); - } - else { - messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.10"), LocaleLoader.getString("Taming.Ability.Bonus.11"))); - } + messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.10"), LocaleLoader.getString("Taming.Ability.Bonus.11"))); } if (canSharpenedClaws) { - if (skillValue < Taming.sharpenedClawsUnlockLevel) { - messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Taming.Ability.Locked.3", Taming.sharpenedClawsUnlockLevel))); - } - else { - messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.6"), LocaleLoader.getString("Taming.Ability.Bonus.7", Taming.sharpenedClawsBonusDamage))); - } + messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.6"), LocaleLoader.getString("Taming.Ability.Bonus.7", Taming.sharpenedClawsBonusDamage))); } if (canShockProof) { - if (skillValue < Taming.shockProofUnlockLevel) { - messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Taming.Ability.Locked.2", Taming.shockProofUnlockLevel))); - } - else { - messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.4"), LocaleLoader.getString("Taming.Ability.Bonus.5", Taming.shockProofModifier))); - } + messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.4"), LocaleLoader.getString("Taming.Ability.Bonus.5", Taming.shockProofModifier))); } if (canThickFur) { - if (skillValue < Taming.thickFurUnlockLevel) { - messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Taming.Ability.Locked.1", Taming.thickFurUnlockLevel))); - } - else { - messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.2"), LocaleLoader.getString("Taming.Ability.Bonus.3", Taming.thickFurModifier))); - } + messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.2"), LocaleLoader.getString("Taming.Ability.Bonus.3", Taming.thickFurModifier))); } return messages; diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index ee608c813..40f9e949a 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -389,13 +389,13 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { }*/ /* SALVAGE */ - if (getSalvageMaxPercentage() < 1) { + /*if (getSalvageMaxPercentage() < 1) { reason.add("Skills.Salvage.MaxPercentage should be at least 1!"); } if (getSalvageMaxPercentageLevel() < 1) { reason.add("Skills.Salvage.MaxPercentageLevel should be at least 1!"); - } + }*/ /*if (getAdvancedSalvageUnlockLevel() < 0) { reason.add("Skills.Salvage.AdvancedSalvage.UnlockLevel should be at least 0!"); @@ -684,7 +684,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { * @return the level at which this skills max benefits will be reached on the curve */ public int getMaxBonusLevel(SubSkillType subSkillType) { - int maxBonusLevel = config.getInt(subSkillType.getAdvConfigAddress() + ".MaxBonusLevel"); + int maxBonusLevel = config.getInt(subSkillType.getAdvConfigAddress() + ".MaxBonusLevel", 100); if(mcMMO.isRetroModeEnabled()) maxBonusLevel *= 10; @@ -696,7 +696,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { } public int getMaxBonusLevel(AbstractSubSkill abstractSubSkill) { - int maxBonusLevel = config.getInt("Skills."+abstractSubSkill.getPrimaryKeyName()+"."+abstractSubSkill.getConfigKeyName()+".MaxBonusLevel"); + int maxBonusLevel = config.getInt("Skills."+abstractSubSkill.getPrimaryKeyName()+"."+abstractSubSkill.getConfigKeyName()+".MaxBonusLevel", 100); if(mcMMO.isRetroModeEnabled()) maxBonusLevel *= 10; @@ -939,7 +939,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 100); } /* Arcane Forging */ - public int getArcaneForgingRankLevel(int rank) { return config.getInt("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + rank); } + //public int getArcaneForgingRankLevel(int rank) { return config.getInt("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + rank); } public boolean getArcaneForgingEnchantLossEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.May_Lose_Enchants", true); } public double getArcaneForgingKeepEnchantsChance(int rank) { return config.getDouble("Skills.Repair.ArcaneForging.Keep_Enchants_Chance.Rank_" + rank); } @@ -948,10 +948,8 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public double getArcaneForgingDowngradeChance(int rank) { return config.getDouble("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + rank); } /* SALVAGE */ - public double getSalvageMaxPercentage() { return config.getDouble("Skills.Salvage.MaxPercentage", 100.0D); } - public int getSalvageMaxPercentageLevel() { return config.getInt("Skills.Salvage.MaxPercentageLevel", 1000); } - - /*public int getAdvancedSalvageUnlockLevel() { return config.getInt("Skills.Salvage.AdvancedSalvage.UnlockLevel", 350); }*/ + //public double getSalvageMaxPercentage() { return config.getDouble("Skills.Salvage.MaxPercentage", 100.0D); } + //public int getSalvageMaxPercentageLevel() { return config.getInt("Skills.Salvage.MaxPercentageLevel", 1000); } public boolean getArcaneSalvageEnchantDowngradeEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantDowngradeEnabled", true); } public boolean getArcaneSalvageEnchantLossEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantLossEnabled", true); } @@ -988,10 +986,10 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public double getGoreModifier() { return config.getDouble("Skills.Taming.Gore.Modifier", 2.0D); } /*public int getFastFoodUnlock() { return config.getInt("Skills.Taming.FastFood.UnlockLevel", 50); }*/ - public double getFastFoodChance() { return config.getDouble("Skills.Taming.FastFood.Chance", 50.0D); } + public double getFastFoodChance() { return config.getDouble("Skills.Taming.FastFoodService.Chance", 50.0D); } public double getPummelChance() { return config.getDouble("Skills.Taming.Pummel.Chance", 10.0D); } - public int getEnviromentallyAwareUnlock() { return config.getInt("Skills.Taming.EnvironmentallyAware.UnlockLevel", 100); } + //public int getEnviromentallyAwareUnlock() { return config.getInt("Skills.Taming.EnvironmentallyAware.UnlockLevel", 100); } /*public int getThickFurUnlock() { return config.getInt("Skills.Taming.ThickFur.UnlockLevel", 250); }*/ public double getThickFurModifier() { return config.getDouble("Skills.Taming.ThickFur.Modifier", 2.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 7ce5823b6..e0ce71cb0 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java @@ -59,7 +59,7 @@ public enum SubSkillType { REPAIR_SUPER_REPAIR, /* Salvage */ - SALVAGE_ADVANCED_SALVAGE, + SALVAGE_ADVANCED_SALVAGE(1), SALVAGE_ARCANE_SALVAGE(8), /* Smelting */ diff --git a/src/main/java/com/gmail/nossr50/skills/salvage/Salvage.java b/src/main/java/com/gmail/nossr50/skills/salvage/Salvage.java index d7b54ac06..0e8661c93 100644 --- a/src/main/java/com/gmail/nossr50/skills/salvage/Salvage.java +++ b/src/main/java/com/gmail/nossr50/skills/salvage/Salvage.java @@ -9,10 +9,10 @@ import org.bukkit.Material; public class Salvage { public static Material anvilMaterial = Config.getInstance().getSalvageAnvilMaterial(); - public static int salvageMaxPercentageLevel = AdvancedConfig.getInstance().getSalvageMaxPercentageLevel(); + /*public static int salvageMaxPercentageLevel = AdvancedConfig.getInstance().getSalvageMaxPercentageLevel(); public static double salvageMaxPercentage = AdvancedConfig.getInstance().getSalvageMaxPercentage(); - public static int advancedSalvageUnlockLevel = RankUtils.getRankUnlockLevel(SubSkillType.SALVAGE_ADVANCED_SALVAGE, 1); + public static int advancedSalvageUnlockLevel = RankUtils.getRankUnlockLevel(SubSkillType.SALVAGE_ADVANCED_SALVAGE, 1);*/ public static boolean arcaneSalvageDowngrades = AdvancedConfig.getInstance().getArcaneSalvageEnchantDowngradeEnabled(); public static boolean arcaneSalvageEnchantLoss = AdvancedConfig.getInstance().getArcaneSalvageEnchantLossEnabled(); diff --git a/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java b/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java index 08b9005e1..745efaaac 100644 --- a/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java +++ b/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java @@ -81,16 +81,16 @@ public class SalvageManager extends SkillManager { return; } - int skillLevel = getSkillLevel(); - int minimumSalvageableLevel = salvageable.getMinimumLevel(); + /*int skillLevel = getSkillLevel(); + int minimumSalvageableLevel = salvageable.getMinimumLevel();*/ // Level check - if (skillLevel < minimumSalvageableLevel) { - NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Salvage.Skills.Adept.Level", String.valueOf(minimumSalvageableLevel), StringUtils.getPrettyItemString(item.getType())); + if (!RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE)) { + NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Salvage.Skills.Adept.Level", String.valueOf(RankUtils.getUnlockLevel(SubSkillType.SALVAGE_ARCANE_SALVAGE)), StringUtils.getPrettyItemString(item.getType())); return; } - if (item.getDurability() != 0 && (getSkillLevel() < Salvage.advancedSalvageUnlockLevel || !Permissions.advancedSalvage(player))) { + if (item.getDurability() != 0 && (!RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_ADVANCED_SALVAGE) || !Permissions.advancedSalvage(player))) { NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILURE, "Salvage.Skills.Adept.Damaged"); return; } @@ -103,7 +103,8 @@ public class SalvageManager extends SkillManager { return; } - salvageableAmount = Math.max((int) (salvageableAmount * getMaxSalvagePercentage()), 1); // Always get at least something back, if you're capable of salvaging it. + //Amount of materials to salvage based on rank + salvageableAmount = getSalvageableAmount(); player.getInventory().setItemInMainHand(new ItemStack(Material.AIR)); location.add(0.5, 1, 0.5); @@ -139,8 +140,12 @@ public class SalvageManager extends SkillManager { NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Salvage.Skills.Success"); } - public double getMaxSalvagePercentage() { + /*public double getMaxSalvagePercentage() { return Math.min((((Salvage.salvageMaxPercentage / Salvage.salvageMaxPercentageLevel) * getSkillLevel()) / 100.0D), Salvage.salvageMaxPercentage / 100.0D); + }*/ + + public int getSalvageableAmount() { + return (RankUtils.getRank(getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE) * 1); } /** @@ -187,7 +192,7 @@ public class SalvageManager extends SkillManager { private ItemStack arcaneSalvageCheck(Map enchants) { Player player = getPlayer(); - if (getArcaneSalvageRank() == 0 || !Permissions.arcaneSalvage(player)) { + if (!RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE) || !Permissions.arcaneSalvage(player)) { NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILURE, "Salvage.Skills.ArcaneFailed"); return null; } @@ -199,9 +204,14 @@ public class SalvageManager extends SkillManager { for (Entry enchant : enchants.entrySet()) { + + getPlayer().sendMessage("DEBUG SALVAGE CHANCE: "+RandomChanceUtil.getRandomChanceExecutionChance(new RandomChanceSkillStatic(getExtractFullEnchantChance(), getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE))); + if (!Salvage.arcaneSalvageEnchantLoss || RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(getExtractFullEnchantChance(), getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE))) { enchantMeta.addStoredEnchant(enchant.getKey(), enchant.getValue(), true); + + getPlayer().sendMessage("DEBUG: FULL ENCHANT RECOVERY SUCCESS"); } else if (enchant.getValue() > 1 && Salvage.arcaneSalvageDowngrades diff --git a/src/main/java/com/gmail/nossr50/skills/taming/Taming.java b/src/main/java/com/gmail/nossr50/skills/taming/Taming.java index 9ceb69c71..dee6f36a3 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/Taming.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/Taming.java @@ -7,10 +7,6 @@ import org.bukkit.EntityEffect; import org.bukkit.entity.*; public class Taming { - public static int environmentallyAwareUnlockLevel = AdvancedConfig.getInstance().getEnviromentallyAwareUnlock(); - public static int holyHoundUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.TAMING_HOLY_HOUND); - - public static int fastFoodServiceUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.TAMING_FAST_FOOD_SERVICE); public static double fastFoodServiceActivationChance = AdvancedConfig.getInstance().getFastFoodChance(); public static int goreBleedTicks = 2; //Equivalent to rank 1 in Rupture diff --git a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java index d125252b7..9607e2a1b 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -40,23 +40,28 @@ public class TamingManager extends SkillManager { private static HashMap> summonedEntities = new HashMap>(); public boolean canUseThickFur() { - return getSkillLevel() >= Taming.thickFurUnlockLevel && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_THICK_FUR); + return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_THICK_FUR) + && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_THICK_FUR); } public boolean canUseEnvironmentallyAware() { - return getSkillLevel() >= Taming.environmentallyAwareUnlockLevel && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_ENVIRONMENTALLY_AWARE); + return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_ENVIRONMENTALLY_AWARE) + && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_ENVIRONMENTALLY_AWARE); } public boolean canUseShockProof() { - return getSkillLevel() >= Taming.shockProofUnlockLevel && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_SHOCK_PROOF); + return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_SHOCK_PROOF) + && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_SHOCK_PROOF); } public boolean canUseHolyHound() { - return getSkillLevel() >= Taming.holyHoundUnlockLevel && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_HOLY_HOUND); + return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_ENVIRONMENTALLY_AWARE) + && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_HOLY_HOUND); } public boolean canUseFastFoodService() { - return getSkillLevel() >= Taming.fastFoodServiceUnlockLevel && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_FAST_FOOD_SERVICE); + return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_FAST_FOOD_SERVICE) + && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_FAST_FOOD_SERVICE); } public boolean canUseSharpenedClaws() { diff --git a/src/main/java/com/gmail/nossr50/util/random/RandomChanceUtil.java b/src/main/java/com/gmail/nossr50/util/random/RandomChanceUtil.java index 9c1d76c8b..545478c25 100644 --- a/src/main/java/com/gmail/nossr50/util/random/RandomChanceUtil.java +++ b/src/main/java/com/gmail/nossr50/util/random/RandomChanceUtil.java @@ -6,6 +6,7 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillEvent; import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillRandomCheckEvent; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.skills.SkillActivationType; @@ -161,6 +162,17 @@ public class RandomChanceUtil return chanceOfSuccess; } + private static double calculateChanceOfSuccess(RandomChanceSkillStatic randomChance) { + mcMMO.p.getServer().broadcastMessage("DEBUG: USING CORRECT STATIC CALCULATION METHOD"); + + double chanceOfSuccess = getChanceOfSuccess(randomChance.getXPos(), 100, 100); + + //Add Luck + chanceOfSuccess = addLuck(randomChance.isLucky(), chanceOfSuccess); + + return chanceOfSuccess; + } + /** * The formula for RNG success is determined like this * maximum probability * ( x / maxlevel ) diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index c193cb861..89ddeb239 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -114,11 +114,9 @@ Skills: ### Alchemy: Catalysis: - # UnlockLevel: Alchemy level when the Catalysis ability unlocks # MaxBonusLevel: Maximum bonus level of Catalysis, when a player reaches this level his brewing speed will be # MinSpeed: Minimum brewing speed allowed when at or lower # MaxSpeed: Maximum brewing speed allowed when at or higher - UnlockLevel: 10 MaxBonusLevel: 100 MinSpeed: 1.0 MaxSpeed: 4.0 @@ -215,15 +213,9 @@ Skills: # This determines when Fisherman's Diet adds extra hunger recovery to food RankChange: 20 - IceFishing: - # UnlockLevel: Fishing level when the Ice Fishing ability unlocks - UnlockLevel: 5 - MasterAngler: - # UnlockLevel: Fishing level when the Master Angler ability unlocks # BoatMultiplier: Catch rate is multiplied by this modifier # BiomeModifier: Catch rate is multiplied by this modifier - UnlockLevel: 12 BoatModifier: 2.0 BiomeModifier: 2.0 # @@ -265,9 +257,7 @@ Skills: ChanceMax: 100.0 MaxBonusLevel: 100 - # BlastMining_Rank: BlastMining rank unlocks BlastMining: - # BlastDamageDecrease Ranks: % of damage reduced from TNT explosions BlastDamageDecrease: Rank_1: 0.0 @@ -363,15 +353,6 @@ Skills: # Settings for Salvage ### Salvage: - # MaxPercentage: Maximum percentage of materials to be returned when Salvaging - # MaxPercentageLevel: On this level, the Salvage percentage will be - MaxPercentage: 100.0 - MaxPercentageLevel: 100 - - # AdvancedSalvage_UnlockLevel: The level at which Advance Salvage become available - AdvancedSalvage: - UnlockLevel: 35 - ArcaneSalvage: # EnchantLossEnabled: When salvaging enchanted items, the enchants may be lost # EnchantDowngradeEnabled: When salvaging enchanted items, the enchants may be downgraded @@ -416,9 +397,7 @@ Skills: MaxBonusLevel: 100 FluxMining: - # UnlockLevel: Level when Flux Mining becomes available # Chance: Chance for Flux Mining to activate - UnlockLevel: 25 Chance: 33.0 MaxBonusLevel: 100 @@ -479,31 +458,18 @@ Skills: # BleedTicks: Determines the length of the bleeding effect # Modifier: Damage will get multiplied by this modifier Modifier: 2.0 - FastFood: - # UnlockLevel: Level when FastFood unlocks + FastFoodService: # Chance: The chance for wolves to heal hp when inflicting damage - UnlockLevel: 5 Chance: 50.0 EnvironmentallyAware: - # UnlockLevel: Level when EnvironmentallyAware unlocks - UnlockLevel: 10 ThickFur: - # UnlockLevel: Level when ThickFur unlocks # Modifier: Damage will get divided by this modifier - UnlockLevel: 25 Modifier: 2.0 - HolyHound: - # UnlockLevel: Level when HolyHound unlocks - UnlockLevel: 37 ShockProof: - # UnlockLevel: Level when ShockProof unlocks # Modifier: Damage will get divided by this modifier - UnlockLevel: 50 Modifier: 6.0 SharpenedClaws: - # UnlockLevel: Level when SharpenedClaws unlocks # Bonus: This bonus will get added to the damage caused - UnlockLevel: 75 Bonus: 2.0 CallOfTheWild: # MinHorseJumpStrength: The minimum jump strength a summoned horse must have diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 5c7b7c83e..a49f5053f 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -366,7 +366,7 @@ Salvage.SubSkill.ArcaneSalvage.Name=Arcane Salvaging Salvage.SubSkill.ArcaneSalvage.Description=Extract enchantments from items Salvage.Ability.Locked.0=LOCKED UNTIL {0}+ SKILL (ADVANCED SALVAGE) Salvage.Ability.Bonus.0=Advanced Salvage -Salvage.Ability.Bonus.1=Max yield {0} item destroyed +Salvage.Ability.Bonus.1={0} Max Materials Recovered from Salvaging Salvage.Arcane.Rank=Arcane Salvaging: [[YELLOW]]Rank {0}/{1} Salvage.Arcane.ExtractFull=[[GRAY]]AS Full-Enchant Chance Salvage.Arcane.ExtractPartial=[[GRAY]]AS Partial-Enchant Chance diff --git a/src/main/resources/skillranks.yml b/src/main/resources/skillranks.yml index 29a184cb2..2b9b3902c 100644 --- a/src/main/resources/skillranks.yml +++ b/src/main/resources/skillranks.yml @@ -232,6 +232,11 @@ Smelting: Rank_7: 850 Rank_8: 1000 Salvage: + AdvancedSalvage: + Standard: + Rank_1: 35 + RetroMode: + Rank_1: 350 ArcaneSalvage: Standard: Rank_1: 10