Changed shake drops from guaranteed to based upon fishing level and perks.

This commit is contained in:
TfT_02 2012-11-07 13:30:20 +01:00
parent b8d37cb223
commit 2bdeeb2d6e

View File

@ -207,12 +207,48 @@ public class Fishing {
randomChance = (int) (randomChance * 0.75);
}
final Player player = event.getPlayer();
final PlayerProfile profile = Users.getProfile(player);
int dropChance = 10;
switch (getFishingLootTier(profile)) {
case 1:
dropChance = 10;
break;
case 2:
dropChance = 30;
break;
case 3:
dropChance = 50;
break;
case 4:
dropChance = 60;
break;
case 5:
dropChance = 75;
break;
default:
break;
}
if (event.getPlayer().hasPermission("mcmmo.perks.lucky.fishing")) {
dropChance = (int) (dropChance * 1.25); //With lucky perk on max level tier, its 100%
}
final int DROP_CHANCE = random.nextInt(100);
final int DROP_NUMBER = random.nextInt(randomChance) + 1;
LivingEntity le = (LivingEntity) event.getCaught();
EntityType type = le.getType();
Location location = le.getLocation();
if (DROP_CHANCE < dropChance) {
switch (type) {
case BLAZE:
Misc.dropItem(location, new ItemStack(Material.BLAZE_ROD));
@ -221,8 +257,7 @@ public class Fishing {
case CAVE_SPIDER:
if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.STRING));
}
break;
@ -230,11 +265,9 @@ public class Fishing {
case CHICKEN:
if (DROP_NUMBER > 66) {
Misc.dropItem(location, new ItemStack(Material.FEATHER));
}
else if (DROP_NUMBER > 33) {
} else if (DROP_NUMBER > 33) {
Misc.dropItem(location, new ItemStack(Material.RAW_CHICKEN));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.EGG));
}
break;
@ -242,11 +275,9 @@ public class Fishing {
case COW:
if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET));
}
else if (DROP_NUMBER > 50) {
} else if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.LEATHER));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
}
break;
@ -254,8 +285,7 @@ public class Fishing {
case CREEPER:
if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
}
break;
@ -267,8 +297,7 @@ public class Fishing {
case GHAST:
if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.GHAST_TEAR));
}
break;
@ -276,11 +305,9 @@ public class Fishing {
case IRON_GOLEM:
if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
}
else if (DROP_NUMBER > 90) {
} else if (DROP_NUMBER > 90) {
Misc.dropItem(location, new ItemStack(Material.IRON_INGOT));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.RED_ROSE));
}
break;
@ -292,17 +319,13 @@ public class Fishing {
case MUSHROOM_COW:
if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET));
}
else if (DROP_NUMBER > 98) {
} else if (DROP_NUMBER > 98) {
Misc.dropItem(location, new ItemStack(Material.MUSHROOM_SOUP));
}
else if (DROP_NUMBER > 66) {
} else if (DROP_NUMBER > 66) {
Misc.dropItem(location, new ItemStack(Material.LEATHER));
}
else if (DROP_NUMBER > 33) {
} else if (DROP_NUMBER > 33) {
Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
}
else {
} else {
Misc.dropItems(location, new ItemStack(Material.RED_MUSHROOM), 3);
}
break;
@ -314,20 +337,19 @@ public class Fishing {
case PIG_ZOMBIE:
if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET));
}
break;
case SHEEP:
Sheep sheep = (Sheep) le;
final Sheep sheep = (Sheep) le;
if (!sheep.isSheared()) {
Wool wool = new Wool();
final Wool wool = new Wool();
wool.setColor(sheep.getColor());
ItemStack theWool = wool.toItemStack();
final ItemStack theWool = wool.toItemStack();
theWool.setAmount(1 + random.nextInt(6));
Misc.dropItem(location, theWool);
@ -339,22 +361,17 @@ public class Fishing {
if (((CraftSkeleton) le).getHandle().getSkeletonType() == 1) {
if (DROP_NUMBER > 97) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1));
}
else if (DROP_NUMBER > 50) {
} else if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.BONE));
}
else {
} else {
Misc.dropItems(location, new ItemStack(Material.COAL), 3);
}
}
else {
} else {
if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM));
}
else if (DROP_NUMBER > 50) {
} else if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.BONE));
}
else {
} else {
Misc.dropItems(location, new ItemStack(Material.ARROW), 3);
}
}
@ -367,8 +384,7 @@ public class Fishing {
case SNOWMAN:
if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
}
else {
} else {
Misc.dropItems(location, new ItemStack(Material.SNOW_BALL), 5);
}
break;
@ -376,8 +392,7 @@ public class Fishing {
case SPIDER:
if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.STRING));
}
break;
@ -391,37 +406,27 @@ public class Fishing {
if (DROP_NUMBER > 97) {
if (DROP_NUMBER_2 > 66) {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8197));
}
else if(DROP_NUMBER_2 > 33) {
} else if (DROP_NUMBER_2 > 33) {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8195));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8194));
}
}
else {
} else {
if (DROP_NUMBER_2 > 88) {
Misc.dropItem(location, new ItemStack(Material.GLASS_BOTTLE));
}
else if(DROP_NUMBER_2 > 75) {
} else if (DROP_NUMBER_2 > 75) {
Misc.dropItem(location, new ItemStack(Material.GLOWSTONE_DUST));
}
else if(DROP_NUMBER_2 > 63) {
} else if (DROP_NUMBER_2 > 63) {
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
}
else if(DROP_NUMBER_2 > 50) {
} else if (DROP_NUMBER_2 > 50) {
Misc.dropItem(location, new ItemStack(Material.REDSTONE));
}
else if(DROP_NUMBER_2 > 38) {
} else if (DROP_NUMBER_2 > 38) {
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
}
else if(DROP_NUMBER_2 > 25) {
} else if (DROP_NUMBER_2 > 25) {
Misc.dropItem(location, new ItemStack(Material.STICK));
}
else if(DROP_NUMBER_2 > 13) {
} else if (DROP_NUMBER_2 > 13) {
Misc.dropItem(location, new ItemStack(Material.SUGAR));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.POTION));
}
}
@ -430,8 +435,7 @@ public class Fishing {
case ZOMBIE:
if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
}
break;
@ -439,6 +443,7 @@ public class Fishing {
default:
break;
}
}
Combat.dealDamage(le, 1);
}