mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +01:00
Added new method for calculating the ShakeChance
This commit is contained in:
parent
464d6bdd35
commit
a1a61e9d4a
@ -209,33 +209,10 @@ public class Fishing {
|
|||||||
|
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final PlayerProfile profile = Users.getProfile(player);
|
final PlayerProfile profile = Users.getProfile(player);
|
||||||
|
int lootTier = getFishingLootTier(profile);
|
||||||
|
|
||||||
int dropChance = 10;
|
int dropChance = getShakeChance(lootTier);
|
||||||
|
|
||||||
switch (getFishingLootTier(profile)) {
|
|
||||||
case 1:
|
|
||||||
dropChance = Config.getInstance().getShakeChanceRank1();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
dropChance = Config.getInstance().getShakeChanceRank2();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
dropChance = Config.getInstance().getShakeChanceRank3();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
dropChance = Config.getInstance().getShakeChanceRank4();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 5:
|
|
||||||
dropChance = Config.getInstance().getShakeChanceRank5();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (event.getPlayer().hasPermission("mcmmo.perks.lucky.fishing")) {
|
if (event.getPlayer().hasPermission("mcmmo.perks.lucky.fishing")) {
|
||||||
dropChance = (int) (dropChance * 1.25); //With lucky perk on max level tier, its 100%
|
dropChance = (int) (dropChance * 1.25); //With lucky perk on max level tier, its 100%
|
||||||
}
|
}
|
||||||
@ -447,4 +424,31 @@ public class Fishing {
|
|||||||
|
|
||||||
Combat.dealDamage(le, 1);
|
Combat.dealDamage(le, 1);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Gets chance of shake success.
|
||||||
|
*
|
||||||
|
* @param rank Treasure hunter rank
|
||||||
|
* @return The chance of a successful shake
|
||||||
|
*/
|
||||||
|
public static int getShakeChance(int lootTier) {
|
||||||
|
switch (lootTier) {
|
||||||
|
case 1:
|
||||||
|
return Config.getInstance().getShakeChanceRank1();
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
return Config.getInstance().getShakeChanceRank2();
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
return Config.getInstance().getShakeChanceRank3();
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
return Config.getInstance().getShakeChanceRank4();
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
return Config.getInstance().getShakeChanceRank5();
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user