Changed Fishing to always give a fish on a successful catch

This commit is contained in:
bm01 2013-01-26 00:37:43 +01:00
parent d601496173
commit 188ad359fe
2 changed files with 18 additions and 14 deletions

View File

@ -25,9 +25,13 @@ Version 1.4.00-dev
= Fixed Leaf Blower not respecting the unlock level set in advanced.yml = Fixed Leaf Blower not respecting the unlock level set in advanced.yml
= Fixed abilities activating with the wrong tool in hand = Fixed abilities activating with the wrong tool in hand
= Fixed Experience.Gains.Mobspawners.Enabled not being used correctly (the check was inverted) = Fixed Experience.Gains.Mobspawners.Enabled not being used correctly (the check was inverted)
<<<<<<< Upstream, based on origin/master
= Fixed bug where Iron Grip was using the attacker's skill values rather than the defender's. = Fixed bug where Iron Grip was using the attacker's skill values rather than the defender's.
= Fixed a bug where /party kick would trigger the PartyChangeEvent for the wrong player = Fixed a bug where /party kick would trigger the PartyChangeEvent for the wrong player
= Fixed a bug where party join messages weren't displayed = Fixed a bug where party join messages weren't displayed
=======
! A Fishing catch will now always contains a fish even if a treasure is found
>>>>>>> 1f7a94a Changed Fishing to always give a fish on a successful catch
! Changed how Berserk handles not picking up items to avoid listening to PlayerPickupItemEvent ! Changed how Berserk handles not picking up items to avoid listening to PlayerPickupItemEvent
! Moved Hylian Luck into a separate listener since it actually cancels the event and shouldn't just be on MONITOR. ! Moved Hylian Luck into a separate listener since it actually cancels the event and shouldn't just be on MONITOR.
! Changed how Tree Feller is handled, it should now put less stress on the CPU ! Changed how Tree Feller is handled, it should now put less stress on the CPU

View File

@ -116,28 +116,28 @@ public class Fishing {
} }
} }
if (rewards.size() <= 0) { if (rewards.isEmpty()) {
return; return;
} }
FishingTreasure foundTreasure = rewards.get(Misc.getRandom().nextInt(rewards.size())); FishingTreasure treasure = rewards.get(Misc.getRandom().nextInt(rewards.size()));
ItemStack treasureDrop = treasure.getDrop();
int activationChance = Misc.calculateActivationChance(Permissions.luckyFishing(player)); int activationChance = Misc.calculateActivationChance(Permissions.luckyFishing(player));
if (Misc.getRandom().nextDouble() * activationChance <= foundTreasure.getDropChance()) { if (Misc.getRandom().nextDouble() * activationChance <= treasure.getDropChance()) {
Users.getPlayer(player).addXP(SkillType.FISHING, foundTreasure.getXp()); player.getWorld().dropItem(player.getEyeLocation(), theCatch.getItemStack()); // Drop the original item
theCatch.setItemStack(foundTreasure.getDrop());
short maxDurability = treasureDrop.getType().getMaxDurability();
if (maxDurability > 0) {
treasureDrop.setDurability((short) (Misc.getRandom().nextInt(maxDurability))); // Change durability to random value
}
theCatch.setItemStack(treasureDrop);
Users.getPlayer(player).addXP(SkillType.FISHING, treasure.getXp());
} }
} }
else {
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
}
short maxDurability = theCatch.getItemStack().getType().getMaxDurability();
if (maxDurability > 0) {
theCatch.getItemStack().setDurability((short) (Misc.getRandom().nextInt(maxDurability))); // Change durability to random value
}
Skills.xpProcessing(player, profile, SkillType.FISHING, Config.getInstance().getFishingBaseXP()); Skills.xpProcessing(player, profile, SkillType.FISHING, Config.getInstance().getFishingBaseXP());
} }