From 8b4c86c8ba0f29a4cf701ef187195d384d8232a9 Mon Sep 17 00:00:00 2001 From: GJ Date: Thu, 29 Mar 2012 15:23:12 -0400 Subject: [PATCH] Fixed some issues with calculating drop chances. --- Changelog.txt | 2 ++ src/main/java/com/gmail/nossr50/skills/Excavation.java | 2 +- src/main/java/com/gmail/nossr50/skills/Fishing.java | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 58caf44d3..8e5f32a07 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -8,9 +8,11 @@ Key: - Removal Version 1.3.05-dev + + Added ExperienceAPI and PartyAPI classes for developer use = Fixed XP bar not updating when XP was gained = Fixed bug with repairing wooden tools = Fixed bug where spawned wolves only had 8 health. + = Fixed bug where rare Treasures from Excavation were dropping too often ! Changed Tree Feller to account for ability durability loss but not leaves. ! Changed bypass node for Arcane Forging to not default to true for OPs diff --git a/src/main/java/com/gmail/nossr50/skills/Excavation.java b/src/main/java/com/gmail/nossr50/skills/Excavation.java index 2a57aa7b1..d21f9ffe4 100644 --- a/src/main/java/com/gmail/nossr50/skills/Excavation.java +++ b/src/main/java/com/gmail/nossr50/skills/Excavation.java @@ -104,7 +104,7 @@ public class Excavation { for (ExcavationTreasure treasure : treasures) { if (skillLevel >= treasure.getDropLevel()) { - if (random.nextInt(100) <= treasure.getDropChance()) { + if (random.nextDouble() * 100.0d <= treasure.getDropChance()) { xp += treasure.getXp(); is.add(treasure.getDrop()); } diff --git a/src/main/java/com/gmail/nossr50/skills/Fishing.java b/src/main/java/com/gmail/nossr50/skills/Fishing.java index 28d814d3e..c960c209f 100644 --- a/src/main/java/com/gmail/nossr50/skills/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/Fishing.java @@ -100,7 +100,7 @@ public class Fishing { if (LoadProperties.fishingDrops) { FishingTreasure treasure = rewards.get(random.nextInt(rewards.size())); - if (random.nextInt(100) <= treasure.getDropChance()) { + if (random.nextDouble() * 100.0d <= treasure.getDropChance()) { Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp()); theCatch.setItemStack(treasure.getDrop()); }