Fixed a bug which caused advanced.yml not to respect every MaxChance node

This commit is contained in:
TfT_02
2013-01-02 01:27:50 +01:00
parent 3aee334fbd
commit 4f8337c11a
11 changed files with 61 additions and 43 deletions

View File

@ -12,6 +12,7 @@ public class Taming {
public static final int FAST_FOOD_SERVICE_ACTIVATION_CHANCE = advancedConfig.getFastFoodChance();
public static final int FAST_FOOD_SERVICE_ACTIVATION_LEVEL = advancedConfig.getFastFoodUnlock();
public static final int GORE_CHANCE_MAX = AdvancedConfig.getInstance().getGoreChanceMax();
public static final int GORE_BLEED_TICKS = advancedConfig.getGoreBleedTicks();
public static final int GORE_MAX_BONUS_LEVEL = advancedConfig.getGoreMaxBonusLevel();
public static final int GORE_MULTIPLIER = advancedConfig.getGoreModifier();

View File

@ -8,7 +8,6 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
@ -103,15 +102,15 @@ public class TamingManager {
GoreEventHandler eventHandler = new GoreEventHandler(this, event);
int goreChanceMax = AdvancedConfig.getInstance().getGoreChanceMax();
int goreMaxLevel = AdvancedConfig.getInstance().getGoreMaxBonusLevel();
int randomChance = 100;
if (player.hasPermission("mcmmo.perks.lucky.taming")) {
randomChance = (int) (randomChance * 0.75);
}
final float chance = (float) (((double) goreChanceMax / (double) goreMaxLevel) * skillLevel);
float chance = (float) (((double) Taming.GORE_CHANCE_MAX / (double) Taming.GORE_MAX_BONUS_LEVEL) * skillLevel);
if (chance > Taming.GORE_CHANCE_MAX) chance = Taming.GORE_CHANCE_MAX;
if (chance > Taming.getRandom().nextInt(randomChance)) {
eventHandler.modifyEventDamage();
eventHandler.applyBleed();