mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Fixing a lot of bugs involving calculating the success of skills
This commit is contained in:
parent
be9aeacd70
commit
e969598f58
@ -9,6 +9,10 @@ Key:
|
|||||||
|
|
||||||
Version 2.1.2
|
Version 2.1.2
|
||||||
(Perks) Fixed a bug where the Lucky perk wasn't adding to success
|
(Perks) Fixed a bug where the Lucky perk wasn't adding to success
|
||||||
|
(Skills) Fixing a bug where Shake didn't calculate success correctly
|
||||||
|
(Skills) Fixed a bug where Arcane Forging didn't calculate success and failure correctly
|
||||||
|
(Skills) Fixed a bug where Salvage didn't calculate success and failure correctly
|
||||||
|
(Skills) Fixed a bug where Flux Mining didn't calculate success correctly
|
||||||
(Skills) Tree Feller now works on Mushroom Stems
|
(Skills) Tree Feller now works on Mushroom Stems
|
||||||
(Experience) Wood blocks now give XP and are affected by Tree Feller (6 sided bark blocks)
|
(Experience) Wood blocks now give XP and are affected by Tree Feller (6 sided bark blocks)
|
||||||
(API) Moved XPGainReason from skills to experience package
|
(API) Moved XPGainReason from skills to experience package
|
||||||
@ -17,6 +21,7 @@ Version 2.1.2
|
|||||||
(Config) The Extra Stats option for XP bars now overrides the setting for updating XP bars every time XP is gained
|
(Config) The Extra Stats option for XP bars now overrides the setting for updating XP bars every time XP is gained
|
||||||
(Config) Added an option for Party XP gains to not update XP bars
|
(Config) Added an option for Party XP gains to not update XP bars
|
||||||
(Config) Added an option for Passive XP gains to not update XP bars (smelting/brewing)
|
(Config) Added an option for Passive XP gains to not update XP bars (smelting/brewing)
|
||||||
|
(Config) Added warnings if mcMMO finds a MaxBonusLevel of 0 for any skill that incorporates RNG
|
||||||
|
|
||||||
Version 2.1.1
|
Version 2.1.1
|
||||||
= Fixed an issue where excavation wasn't using the correct permission node
|
= Fixed an issue where excavation wasn't using the correct permission node
|
||||||
|
@ -705,6 +705,9 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
if(mcMMO.isRetroModeEnabled())
|
if(mcMMO.isRetroModeEnabled())
|
||||||
maxBonusLevel *= 10;
|
maxBonusLevel *= 10;
|
||||||
|
|
||||||
|
if(maxBonusLevel == 0)
|
||||||
|
mcMMO.p.getLogger().severe("Warning Max Bonus Level for "+subSkillType.getAdvConfigAddress() + ".MaxBonusLevel"+" is set to 0! Typically this value should be 100.");
|
||||||
|
|
||||||
return maxBonusLevel;
|
return maxBonusLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,19 +4,16 @@ import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
|||||||
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public abstract class SkillManager {
|
public abstract class SkillManager {
|
||||||
protected McMMOPlayer mcMMOPlayer;
|
protected McMMOPlayer mcMMOPlayer;
|
||||||
protected int activationChance;
|
|
||||||
protected PrimarySkillType skill;
|
protected PrimarySkillType skill;
|
||||||
|
|
||||||
public SkillManager(McMMOPlayer mcMMOPlayer, PrimarySkillType skill) {
|
public SkillManager(McMMOPlayer mcMMOPlayer, PrimarySkillType skill) {
|
||||||
this.mcMMOPlayer = mcMMOPlayer;
|
this.mcMMOPlayer = mcMMOPlayer;
|
||||||
this.activationChance = PerksUtils.handleLuckyPerks(mcMMOPlayer.getPlayer(), skill);
|
|
||||||
this.skill = skill;
|
this.skill = skill;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,11 +15,10 @@ import com.gmail.nossr50.datatypes.treasure.Rarity;
|
|||||||
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
||||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
||||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
|
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
|
||||||
import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillRandomCheckEvent;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.*;
|
import com.gmail.nossr50.util.*;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
|
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
@ -261,9 +260,7 @@ public class FishingManager extends SkillManager {
|
|||||||
public void shakeCheck(LivingEntity target) {
|
public void shakeCheck(LivingEntity target) {
|
||||||
fishingTries--; // Because autoclicking to shake is OK.
|
fishingTries--; // Because autoclicking to shake is OK.
|
||||||
|
|
||||||
SubSkillRandomCheckEvent activationEvent = new SubSkillRandomCheckEvent(getPlayer(), SubSkillType.FISHING_SHAKE, getShakeProbability() / activationChance);
|
if (RandomChanceUtil.checkRandomChanceExecutionSuccess(getPlayer(), SubSkillType.FISHING_SHAKE, true)) {
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(activationEvent);
|
|
||||||
if ((activationEvent.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
|
|
||||||
List<ShakeTreasure> possibleDrops = Fishing.findPossibleDrops(target);
|
List<ShakeTreasure> possibleDrops = Fishing.findPossibleDrops(target);
|
||||||
|
|
||||||
if (possibleDrops == null || possibleDrops.isEmpty()) {
|
if (possibleDrops == null || possibleDrops.isEmpty()) {
|
||||||
|
@ -17,6 +17,7 @@ import com.gmail.nossr50.util.Misc;
|
|||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
|
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
||||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||||
@ -324,10 +325,11 @@ public class RepairManager extends SkillManager {
|
|||||||
for (Entry<Enchantment, Integer> enchant : enchants.entrySet()) {
|
for (Entry<Enchantment, Integer> enchant : enchants.entrySet()) {
|
||||||
Enchantment enchantment = enchant.getKey();
|
Enchantment enchantment = enchant.getKey();
|
||||||
|
|
||||||
if (getKeepEnchantChance() > Misc.getRandom().nextInt(activationChance)) {
|
if (RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(getKeepEnchantChance(), getPlayer(), SubSkillType.REPAIR_ARCANE_FORGING))) {
|
||||||
int enchantLevel = enchant.getValue();
|
int enchantLevel = enchant.getValue();
|
||||||
|
|
||||||
if (ArcaneForging.arcaneForgingDowngrades && enchantLevel > 1 && (100 - getDowngradeEnchantChance()) <= Misc.getRandom().nextInt(activationChance)) {
|
if (ArcaneForging.arcaneForgingDowngrades && enchantLevel > 1
|
||||||
|
&& (!RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(100 - getDowngradeEnchantChance(), getPlayer(), SubSkillType.REPAIR_ARCANE_FORGING)))) {
|
||||||
item.addUnsafeEnchantment(enchantment, enchantLevel - 1);
|
item.addUnsafeEnchantment(enchantment, enchantLevel - 1);
|
||||||
downgraded = true;
|
downgraded = true;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ import com.gmail.nossr50.util.Misc;
|
|||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
|
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
||||||
|
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||||
@ -196,12 +198,14 @@ public class SalvageManager extends SkillManager {
|
|||||||
boolean downgraded = false;
|
boolean downgraded = false;
|
||||||
|
|
||||||
for (Entry<Enchantment, Integer> enchant : enchants.entrySet()) {
|
for (Entry<Enchantment, Integer> enchant : enchants.entrySet()) {
|
||||||
int successChance = Misc.getRandom().nextInt(activationChance);
|
|
||||||
|
|
||||||
if (!Salvage.arcaneSalvageEnchantLoss || getExtractFullEnchantChance() > successChance) {
|
if (!Salvage.arcaneSalvageEnchantLoss
|
||||||
|
|| RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(getExtractFullEnchantChance(), getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE))) {
|
||||||
enchantMeta.addStoredEnchant(enchant.getKey(), enchant.getValue(), true);
|
enchantMeta.addStoredEnchant(enchant.getKey(), enchant.getValue(), true);
|
||||||
}
|
}
|
||||||
else if (enchant.getValue() > 1 && Salvage.arcaneSalvageDowngrades && getExtractPartialEnchantChance() > successChance) {
|
else if (enchant.getValue() > 1
|
||||||
|
&& Salvage.arcaneSalvageDowngrades
|
||||||
|
&& !RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(getExtractPartialEnchantChance(), getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE))) {
|
||||||
enchantMeta.addStoredEnchant(enchant.getKey(), enchant.getValue() - 1, true);
|
enchantMeta.addStoredEnchant(enchant.getKey(), enchant.getValue() - 1, true);
|
||||||
downgraded = true;
|
downgraded = true;
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,7 @@ public class SmeltingManager extends SkillManager {
|
|||||||
public boolean processFluxMining(BlockState blockState) {
|
public boolean processFluxMining(BlockState blockState) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
SubSkillRandomCheckEvent event = new SubSkillRandomCheckEvent(getPlayer(), SubSkillType.SMELTING_FLUX_MINING, Smelting.fluxMiningChance / activationChance);
|
if (RandomChanceUtil.checkRandomChanceExecutionSuccess(getPlayer(), SubSkillType.SMELTING_FLUX_MINING, true)) {
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
|
||||||
if ((event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
|
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
|
|
||||||
switch (blockState.getType()) {
|
switch (blockState.getType()) {
|
||||||
|
@ -9,7 +9,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
|
||||||
import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillRandomCheckEvent;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||||
@ -210,12 +209,8 @@ public class TamingManager extends SkillManager {
|
|||||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_PUMMEL))
|
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_PUMMEL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double chance = 10 / activationChance;
|
if(!RandomChanceUtil.checkRandomChanceExecutionSuccess(getPlayer(), SubSkillType.TAMING_PUMMEL, true))
|
||||||
SubSkillRandomCheckEvent event = new SubSkillRandomCheckEvent(getPlayer(), SubSkillType.TAMING_PUMMEL, chance);
|
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
|
||||||
if ((event.getChance() * activationChance) <= Misc.getRandom().nextInt(activationChance)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
ParticleEffectUtils.playGreaterImpactEffect(target);
|
ParticleEffectUtils.playGreaterImpactEffect(target);
|
||||||
target.setVelocity(wolf.getLocation().getDirection().normalize().multiply(1.5D));
|
target.setVelocity(wolf.getLocation().getDirection().normalize().multiply(1.5D));
|
||||||
|
@ -420,6 +420,7 @@ Skills:
|
|||||||
# Chance: Chance for Flux Mining to activate
|
# Chance: Chance for Flux Mining to activate
|
||||||
UnlockLevel: 25
|
UnlockLevel: 25
|
||||||
Chance: 33.0
|
Chance: 33.0
|
||||||
|
MaxBonusLevel: 100
|
||||||
|
|
||||||
# VanillaXPMultiplier: Vanilla XP gained from smelting ores is multiplied by these values.
|
# VanillaXPMultiplier: Vanilla XP gained from smelting ores is multiplied by these values.
|
||||||
VanillaXPMultiplier:
|
VanillaXPMultiplier:
|
||||||
|
Loading…
Reference in New Issue
Block a user