Fixed issue with some skill activations not activating enough or

activating too much.

Fixes #785
This commit is contained in:
GJ 2013-03-04 22:45:37 -05:00
parent 4210920c5f
commit df53e2fd4f
5 changed files with 7 additions and 5 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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()) {

View File

@ -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();