浏览代码

Fixed issue with some skill activations not activating enough or
activating too much.

Fixes #785

GJ 12 年之前
父节点
当前提交
df53e2fd4f

+ 1 - 0
Changelog.txt

@@ -14,6 +14,7 @@ Version 1.4.02-dev
  = Fixed bug where the PTP cooldown was being read improperly
  = Fixed bug where /ptp <accept|toggle|acceptall> where broken
  = Fixed ClassCastException relating to counter-attack with Swords
+ = Fixed issue with some skill activations not activating enough or activating too much
 
 Version 1.4.01
  = Fixed bug where trying to use /mctop or /xplock with the Smelting child skill caused NPEs

+ 3 - 2
src/main/java/com/gmail/nossr50/skills/axes/AxesManager.java

@@ -12,6 +12,7 @@ import com.gmail.nossr50.datatypes.skills.ToolType;
 import com.gmail.nossr50.locale.LocaleLoader;
 import com.gmail.nossr50.skills.SkillManager;
 import com.gmail.nossr50.util.ItemUtils;
+import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.ModUtils;
 import com.gmail.nossr50.util.Permissions;
 import com.gmail.nossr50.util.player.UserManager;
@@ -92,7 +93,7 @@ public class AxesManager extends SkillManager {
         int durabilityDamage = 1 + (getSkillLevel() / Axes.impactIncreaseLevel);
 
         for (ItemStack armor : target.getEquipment().getArmorContents()) {
-            if (ItemUtils.isArmor(armor) && Axes.impactChance > getActivationChance()) {
+            if (ItemUtils.isArmor(armor) && Axes.impactChance > Misc.getRandom().nextInt(getActivationChance())) {
                 double durabilityModifier = 1 / (armor.getEnchantmentLevel(Enchantment.DURABILITY) + 1); // Modifier to simulate the durability enchantment behavior
                 double modifiedDurabilityDamage = durabilityDamage * durabilityModifier;
                 short maxDurability = ModUtils.isCustomArmor(armor) ? ModUtils.getArmorFromItemStack(armor).getDurability() : armor.getType().getMaxDurability();
@@ -111,7 +112,7 @@ public class AxesManager extends SkillManager {
      * @return the modified event damage if the ability was successful, the original event damage otherwise
      */
     public int greaterImpactCheck(LivingEntity target, int damage) {
-        if (Axes.greaterImpactChance > getActivationChance()) {
+        if (Axes.greaterImpactChance > Misc.getRandom().nextInt(getActivationChance())) {
             Player player = getPlayer();
 
             ParticleEffectUtils.playGreaterImpactEffect(target);

+ 1 - 1
src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java

@@ -134,7 +134,7 @@ public class FishingManager extends SkillManager {
      * @param mob The {@link LivingEntity} affected by the ability
      */
     public void shakeCheck(LivingEntity target) {
-        if (getActivationChance() > getShakeProbability()) {
+        if (getShakeProbability() > Misc.getRandom().nextInt(getActivationChance())) {
             Map<ItemStack, Integer> possibleDrops = new HashMap<ItemStack, Integer>();
 
             Fishing.findPossibleDrops(target, possibleDrops);

+ 1 - 1
src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java

@@ -41,7 +41,7 @@ public class SmeltingManager extends SkillManager {
     public boolean processFluxMining(BlockState blockState) {
         Player player = getPlayer();
 
-        if (getActivationChance() > Smelting.fluxMiningChance) {
+        if (Smelting.fluxMiningChance > Misc.getRandom().nextInt(getActivationChance())) {
             ItemStack item = null;
 
             switch (blockState.getType()) {

+ 1 - 1
src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java

@@ -85,7 +85,7 @@ public class TamingManager extends SkillManager {
      * @param damage The damage being absorbed by the wolf
      */
     public void fastFoodService(Wolf wolf, int damage) {
-        if (getActivationChance() > Taming.fastFoodServiceActivationChance) {
+        if (Taming.fastFoodServiceActivationChance > Misc.getRandom().nextInt(getActivationChance())) {
 
             int health = wolf.getHealth();
             int maxHealth = wolf.getMaxHealth();