mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 14:16:45 +01:00
RandomChanceUtil Refactor part 2
This commit is contained in:
parent
f7640938df
commit
fe889cf1c5
@ -29,7 +29,7 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
// ACROBATICS_DODGE
|
// ACROBATICS_DODGE
|
||||||
if (canDodge) {
|
if (canDodge) {
|
||||||
String[] dodgeStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.ACROBATICS_DODGE);
|
String[] dodgeStrings = getAbilityDisplayValues(player, SubSkillType.ACROBATICS_DODGE);
|
||||||
dodgeChance = dodgeStrings[0];
|
dodgeChance = dodgeStrings[0];
|
||||||
dodgeChanceLucky = dodgeStrings[1];
|
dodgeChanceLucky = dodgeStrings[1];
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
|
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
|
||||||
//damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
|
//damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
|
||||||
|
|
||||||
String[] rollStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.ACROBATICS_ROLL);
|
String[] rollStrings = getAbilityDisplayValues(player, SubSkillType.ACROBATICS_ROLL);
|
||||||
|
|
||||||
//Format
|
//Format
|
||||||
double rollChanceLucky = rollChance * 1.333D;
|
double rollChanceLucky = rollChance * 1.333D;
|
||||||
|
@ -32,14 +32,14 @@ public class ArcheryCommand extends SkillCommand {
|
|||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
// ARCHERY_ARROW_RETRIEVAL
|
// ARCHERY_ARROW_RETRIEVAL
|
||||||
if (canRetrieve) {
|
if (canRetrieve) {
|
||||||
String[] retrieveStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
String[] retrieveStrings = getAbilityDisplayValues(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
||||||
retrieveChance = retrieveStrings[0];
|
retrieveChance = retrieveStrings[0];
|
||||||
retrieveChanceLucky = retrieveStrings[1];
|
retrieveChanceLucky = retrieveStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ARCHERY_DAZE
|
// ARCHERY_DAZE
|
||||||
if (canDaze) {
|
if (canDaze) {
|
||||||
String[] dazeStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.ARCHERY_DAZE);
|
String[] dazeStrings = getAbilityDisplayValues(player, SubSkillType.ARCHERY_DAZE);
|
||||||
dazeChance = dazeStrings[0];
|
dazeChance = dazeStrings[0];
|
||||||
dazeChanceLucky = dazeStrings[1];
|
dazeChanceLucky = dazeStrings[1];
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class AxesCommand extends SkillCommand {
|
|||||||
|
|
||||||
// CRITICAL HIT
|
// CRITICAL HIT
|
||||||
if (canCritical) {
|
if (canCritical) {
|
||||||
String[] criticalHitStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.AXES_CRITICAL_STRIKES);
|
String[] criticalHitStrings = getAbilityDisplayValues(player, SubSkillType.AXES_CRITICAL_STRIKES);
|
||||||
critChance = criticalHitStrings[0];
|
critChance = criticalHitStrings[0];
|
||||||
critChanceLucky = criticalHitStrings[1];
|
critChanceLucky = criticalHitStrings[1];
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
|
|
||||||
// DOUBLE DROPS
|
// DOUBLE DROPS
|
||||||
if (canDoubleDrop) {
|
if (canDoubleDrop) {
|
||||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.HERBALISM_DOUBLE_DROPS);
|
String[] doubleDropStrings = getAbilityDisplayValues(player, SubSkillType.HERBALISM_DOUBLE_DROPS);
|
||||||
doubleDropChance = doubleDropStrings[0];
|
doubleDropChance = doubleDropStrings[0];
|
||||||
doubleDropChanceLucky = doubleDropStrings[1];
|
doubleDropChanceLucky = doubleDropStrings[1];
|
||||||
}
|
}
|
||||||
@ -65,21 +65,21 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
||||||
greenThumbStage = RankUtils.getRank(player, SubSkillType.HERBALISM_GREEN_THUMB);
|
greenThumbStage = RankUtils.getRank(player, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||||
|
|
||||||
String[] greenThumbStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.HERBALISM_GREEN_THUMB);
|
String[] greenThumbStrings = getAbilityDisplayValues(player, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||||
greenThumbChance = greenThumbStrings[0];
|
greenThumbChance = greenThumbStrings[0];
|
||||||
greenThumbChanceLucky = greenThumbStrings[1];
|
greenThumbChanceLucky = greenThumbStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// HYLIAN LUCK
|
// HYLIAN LUCK
|
||||||
if (hasHylianLuck) {
|
if (hasHylianLuck) {
|
||||||
String[] hylianLuckStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.HERBALISM_HYLIAN_LUCK);
|
String[] hylianLuckStrings = getAbilityDisplayValues(player, SubSkillType.HERBALISM_HYLIAN_LUCK);
|
||||||
hylianLuckChance = hylianLuckStrings[0];
|
hylianLuckChance = hylianLuckStrings[0];
|
||||||
hylianLuckChanceLucky = hylianLuckStrings[1];
|
hylianLuckChanceLucky = hylianLuckStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// SHROOM THUMB
|
// SHROOM THUMB
|
||||||
if (canShroomThumb) {
|
if (canShroomThumb) {
|
||||||
String[] shroomThumbStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
String[] shroomThumbStrings = getAbilityDisplayValues(player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||||
shroomThumbChance = shroomThumbStrings[0];
|
shroomThumbChance = shroomThumbStrings[0];
|
||||||
shroomThumbChanceLucky = shroomThumbStrings[1];
|
shroomThumbChanceLucky = shroomThumbStrings[1];
|
||||||
}
|
}
|
||||||
|
@ -56,14 +56,14 @@ public class MiningCommand extends SkillCommand {
|
|||||||
|
|
||||||
// Mastery TRIPLE DROPS
|
// Mastery TRIPLE DROPS
|
||||||
if (canMotherLode) {
|
if (canMotherLode) {
|
||||||
String[] masteryTripleDropStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.MINING_MOTHER_LODE);
|
String[] masteryTripleDropStrings = getAbilityDisplayValues(player, SubSkillType.MINING_MOTHER_LODE);
|
||||||
tripleDropChance = masteryTripleDropStrings[0];
|
tripleDropChance = masteryTripleDropStrings[0];
|
||||||
tripleDropChanceLucky = masteryTripleDropStrings[1];
|
tripleDropChanceLucky = masteryTripleDropStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// DOUBLE DROPS
|
// DOUBLE DROPS
|
||||||
if (canDoubleDrop) {
|
if (canDoubleDrop) {
|
||||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.MINING_DOUBLE_DROPS);
|
String[] doubleDropStrings = getAbilityDisplayValues(player, SubSkillType.MINING_DOUBLE_DROPS);
|
||||||
doubleDropChance = doubleDropStrings[0];
|
doubleDropChance = doubleDropStrings[0];
|
||||||
doubleDropChanceLucky = doubleDropStrings[1];
|
doubleDropChanceLucky = doubleDropStrings[1];
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public class RepairCommand extends SkillCommand {
|
|||||||
|
|
||||||
// SUPER REPAIR
|
// SUPER REPAIR
|
||||||
if (canSuperRepair) {
|
if (canSuperRepair) {
|
||||||
String[] superRepairStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.REPAIR_SUPER_REPAIR);
|
String[] superRepairStrings = getAbilityDisplayValues(player, SubSkillType.REPAIR_SUPER_REPAIR);
|
||||||
superRepairChance = superRepairStrings[0];
|
superRepairChance = superRepairStrings[0];
|
||||||
superRepairChanceLucky = superRepairStrings[1];
|
superRepairChanceLucky = superRepairStrings[1];
|
||||||
}
|
}
|
||||||
|
@ -38,14 +38,14 @@ public class SmeltingCommand extends SkillCommand {
|
|||||||
|
|
||||||
// FLUX MINING
|
// FLUX MINING
|
||||||
/*if (canFluxMine) {
|
/*if (canFluxMine) {
|
||||||
String[] fluxMiningStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.SMELTING_FLUX_MINING);
|
String[] fluxMiningStrings = getAbilityDisplayValues(player, SubSkillType.SMELTING_FLUX_MINING);
|
||||||
str_fluxMiningChance = fluxMiningStrings[0];
|
str_fluxMiningChance = fluxMiningStrings[0];
|
||||||
str_fluxMiningChanceLucky = fluxMiningStrings[1];
|
str_fluxMiningChanceLucky = fluxMiningStrings[1];
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// SECOND SMELT
|
// SECOND SMELT
|
||||||
if (canSecondSmelt) {
|
if (canSecondSmelt) {
|
||||||
String[] secondSmeltStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.SMELTING_SECOND_SMELT);
|
String[] secondSmeltStrings = getAbilityDisplayValues(player, SubSkillType.SMELTING_SECOND_SMELT);
|
||||||
str_secondSmeltChance = secondSmeltStrings[0];
|
str_secondSmeltChance = secondSmeltStrings[0];
|
||||||
str_secondSmeltChanceLucky = secondSmeltStrings[1];
|
str_secondSmeltChanceLucky = secondSmeltStrings[1];
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
// SWORDS_COUNTER_ATTACK
|
// SWORDS_COUNTER_ATTACK
|
||||||
if (canCounter) {
|
if (canCounter) {
|
||||||
String[] counterStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.SWORDS_COUNTER_ATTACK);
|
String[] counterStrings = getAbilityDisplayValues(player, SubSkillType.SWORDS_COUNTER_ATTACK);
|
||||||
counterChance = counterStrings[0];
|
counterChance = counterStrings[0];
|
||||||
counterChanceLucky = counterStrings[1];
|
counterChanceLucky = counterStrings[1];
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
if (canBleed) {
|
if (canBleed) {
|
||||||
bleedLength = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks();
|
bleedLength = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks();
|
||||||
|
|
||||||
String[] bleedStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.SWORDS_RUPTURE);
|
String[] bleedStrings = getAbilityDisplayValues(player, SubSkillType.SWORDS_RUPTURE);
|
||||||
bleedChance = bleedStrings[0];
|
bleedChance = bleedStrings[0];
|
||||||
bleedChanceLucky = bleedStrings[1];
|
bleedChanceLucky = bleedStrings[1];
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public class TamingCommand extends SkillCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
if (canGore) {
|
if (canGore) {
|
||||||
String[] goreStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.TAMING_GORE);
|
String[] goreStrings = getAbilityDisplayValues(player, SubSkillType.TAMING_GORE);
|
||||||
goreChance = goreStrings[0];
|
goreChance = goreStrings[0];
|
||||||
goreChanceLucky = goreStrings[1];
|
goreChanceLucky = goreStrings[1];
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
// UNARMED_ARROW_DEFLECT
|
// UNARMED_ARROW_DEFLECT
|
||||||
if (canDeflect) {
|
if (canDeflect) {
|
||||||
String[] deflectStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.UNARMED_ARROW_DEFLECT);
|
String[] deflectStrings = getAbilityDisplayValues(player, SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||||
deflectChance = deflectStrings[0];
|
deflectChance = deflectStrings[0];
|
||||||
deflectChanceLucky = deflectStrings[1];
|
deflectChanceLucky = deflectStrings[1];
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
|
|
||||||
// UNARMED_DISARM
|
// UNARMED_DISARM
|
||||||
if (canDisarm) {
|
if (canDisarm) {
|
||||||
String[] disarmStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.UNARMED_DISARM);
|
String[] disarmStrings = getAbilityDisplayValues(player, SubSkillType.UNARMED_DISARM);
|
||||||
disarmChance = disarmStrings[0];
|
disarmChance = disarmStrings[0];
|
||||||
disarmChanceLucky = disarmStrings[1];
|
disarmChanceLucky = disarmStrings[1];
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
|
|
||||||
// IRON GRIP
|
// IRON GRIP
|
||||||
if (canIronGrip) {
|
if (canIronGrip) {
|
||||||
String[] ironGripStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.UNARMED_IRON_GRIP);
|
String[] ironGripStrings = getAbilityDisplayValues(player, SubSkillType.UNARMED_IRON_GRIP);
|
||||||
ironGripChance = ironGripStrings[0];
|
ironGripChance = ironGripStrings[0];
|
||||||
ironGripChanceLucky = ironGripStrings[1];
|
ironGripChanceLucky = ironGripStrings[1];
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
|
|
||||||
//Clean Cuts
|
//Clean Cuts
|
||||||
if(canTripleDrop) {
|
if(canTripleDrop) {
|
||||||
String[] tripleDropStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.WOODCUTTING_CLEAN_CUTS);
|
String[] tripleDropStrings = getAbilityDisplayValues(player, SubSkillType.WOODCUTTING_CLEAN_CUTS);
|
||||||
tripleDropChance = tripleDropStrings[0];
|
tripleDropChance = tripleDropStrings[0];
|
||||||
tripleDropChanceLucky = tripleDropStrings[1];
|
tripleDropChanceLucky = tripleDropStrings[1];
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setDoubleDropClassicChanceStrings(Player player) {
|
private void setDoubleDropClassicChanceStrings(Player player) {
|
||||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.WOODCUTTING_HARVEST_LUMBER);
|
String[] doubleDropStrings = getAbilityDisplayValues(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER);
|
||||||
doubleDropChance = doubleDropStrings[0];
|
doubleDropChance = doubleDropStrings[0];
|
||||||
doubleDropChanceLucky = doubleDropStrings[1];
|
doubleDropChanceLucky = doubleDropStrings[1];
|
||||||
}
|
}
|
||||||
|
@ -124,14 +124,14 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
float skillValue = playerProfile.getSkillLevel(getPrimarySkill());
|
float skillValue = playerProfile.getSkillLevel(getPrimarySkill());
|
||||||
boolean isLucky = Permissions.lucky(player, getPrimarySkill());
|
boolean isLucky = Permissions.lucky(player, getPrimarySkill());
|
||||||
|
|
||||||
String[] rollStrings = RandomChanceUtil.calculateAbilityDisplayValues(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.ACROBATICS_ROLL);
|
String[] rollStrings = RandomChanceUtil.calculateAbilityDisplayValues(player, SubSkillType.ACROBATICS_ROLL);
|
||||||
rollChance = rollStrings[0];
|
rollChance = rollStrings[0];
|
||||||
rollChanceLucky = rollStrings[1];
|
rollChanceLucky = rollStrings[1];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Graceful is double the odds of a normal roll
|
* Graceful is double the odds of a normal roll
|
||||||
*/
|
*/
|
||||||
String[] gracefulRollStrings = RandomChanceUtil.calculateAbilityDisplayValuesCustom(SkillProbabilityType.DYNAMIC_CONFIGURABLE, player, SubSkillType.ACROBATICS_ROLL, 2.0D);
|
String[] gracefulRollStrings = RandomChanceUtil.calculateAbilityDisplayValuesCustom(player, SubSkillType.ACROBATICS_ROLL, 2.0D);
|
||||||
gracefulRollChance = gracefulRollStrings[0];
|
gracefulRollChance = gracefulRollStrings[0];
|
||||||
gracefulRollChanceLucky = gracefulRollStrings[1];
|
gracefulRollChanceLucky = gracefulRollStrings[1];
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
double modifiedDamage = calculateModifiedRollDamage(damage, AdvancedConfig.getInstance().getRollDamageThreshold());
|
double modifiedDamage = calculateModifiedRollDamage(damage, AdvancedConfig.getInstance().getRollDamageThreshold());
|
||||||
|
|
||||||
if (!isFatal(player, modifiedDamage)
|
if (!isFatal(player, modifiedDamage)
|
||||||
&& SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.ACROBATICS_ROLL, player)) {
|
&& SkillUtils.isSkillRNGSuccessful(SubSkillType.ACROBATICS_ROLL, player)) {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Acrobatics.Roll.Text");
|
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Acrobatics.Roll.Text");
|
||||||
SoundManager.sendCategorizedSound(player, player.getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS);
|
SoundManager.sendCategorizedSound(player, player.getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS);
|
||||||
//player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
|
//player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
|
||||||
|
@ -179,7 +179,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.ARCHERY_ARROW_RETRIEVAL, player)) {
|
if (SkillUtils.isSkillRNGSuccessful(SubSkillType.ARCHERY_ARROW_RETRIEVAL, player)) {
|
||||||
projectile.setMetadata(mcMMO.trackedArrow, mcMMO.metadataValue);
|
projectile.setMetadata(mcMMO.trackedArrow, mcMMO.metadataValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,8 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
double modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage, Acrobatics.dodgeDamageModifier);
|
double modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage, Acrobatics.dodgeDamageModifier);
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
if (!isFatal(modifiedDamage) && SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.ACROBATICS_DODGE, player)) {
|
if (!isFatal(modifiedDamage)
|
||||||
|
&& SkillUtils.isSkillRNGSuccessful(SubSkillType.ACROBATICS_DODGE, player)) {
|
||||||
ParticleEffectUtils.playDodgeEffect(player);
|
ParticleEffectUtils.playDodgeEffect(player);
|
||||||
|
|
||||||
if (mmoPlayer.useChatNotifications()) {
|
if (mmoPlayer.useChatNotifications()) {
|
||||||
|
@ -88,7 +88,7 @@ public class ArcheryManager extends SkillManager {
|
|||||||
* @param defender The {@link Player} being affected by the ability
|
* @param defender The {@link Player} being affected by the ability
|
||||||
*/
|
*/
|
||||||
public double daze(Player defender) {
|
public double daze(Player defender) {
|
||||||
if (!SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.ARCHERY_DAZE, getPlayer())) {
|
if (!SkillUtils.isSkillRNGSuccessful(SubSkillType.ARCHERY_DAZE, getPlayer())) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public class AxesManager extends SkillManager {
|
|||||||
* @param damage The amount of damage initially dealt by the event
|
* @param damage The amount of damage initially dealt by the event
|
||||||
*/
|
*/
|
||||||
public double criticalHit(LivingEntity target, double damage) {
|
public double criticalHit(LivingEntity target, double damage) {
|
||||||
if (!SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.AXES_CRITICAL_STRIKES, getPlayer())) {
|
if (!SkillUtils.isSkillRNGSuccessful(SubSkillType.AXES_CRITICAL_STRIKES, getPlayer())) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ public class AxesManager extends SkillManager {
|
|||||||
|
|
||||||
for (ItemStack armor : target.getEquipment().getArmorContents()) {
|
for (ItemStack armor : target.getEquipment().getArmorContents()) {
|
||||||
if (armor != null && ItemUtils.isArmor(armor)) {
|
if (armor != null && ItemUtils.isArmor(armor)) {
|
||||||
if (SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.AXES_ARMOR_IMPACT, getPlayer())) {
|
if (SkillUtils.isSkillRNGSuccessful(SubSkillType.AXES_ARMOR_IMPACT, getPlayer())) {
|
||||||
SkillUtils.handleDurabilityChange(armor, durabilityDamage, 1);
|
SkillUtils.handleDurabilityChange(armor, durabilityDamage, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ public class AxesManager extends SkillManager {
|
|||||||
*/
|
*/
|
||||||
public double greaterImpact(@NotNull LivingEntity target) {
|
public double greaterImpact(@NotNull LivingEntity target) {
|
||||||
//static chance (3rd param)
|
//static chance (3rd param)
|
||||||
if (!SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.AXES_GREATER_IMPACT, getPlayer())) {
|
if (!SkillUtils.isSkillRNGSuccessful(SubSkillType.AXES_GREATER_IMPACT, getPlayer())) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,7 +587,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
* @return true if the ability was successful, false otherwise
|
* @return true if the ability was successful, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean processGreenThumbBlocks(BlockState blockState) {
|
public boolean processGreenThumbBlocks(BlockState blockState) {
|
||||||
if (!SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.HERBALISM_GREEN_THUMB, getPlayer())) {
|
if (!SkillUtils.isSkillRNGSuccessful(SubSkillType.HERBALISM_GREEN_THUMB, getPlayer())) {
|
||||||
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE_FAILED, "Herbalism.Ability.GTh.Fail");
|
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE_FAILED, "Herbalism.Ability.GTh.Fail");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -602,7 +602,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
* @return true if the ability was successful, false otherwise
|
* @return true if the ability was successful, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean processHylianLuck(BlockState blockState) {
|
public boolean processHylianLuck(BlockState blockState) {
|
||||||
if (!SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.HERBALISM_HYLIAN_LUCK, getPlayer())) {
|
if (!SkillUtils.isSkillRNGSuccessful(SubSkillType.HERBALISM_HYLIAN_LUCK, getPlayer())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -658,7 +658,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
playerInventory.removeItem(new ItemStack(Material.RED_MUSHROOM));
|
playerInventory.removeItem(new ItemStack(Material.RED_MUSHROOM));
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
|
|
||||||
if (!SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.HERBALISM_SHROOM_THUMB, player)) {
|
if (!SkillUtils.isSkillRNGSuccessful(SubSkillType.HERBALISM_SHROOM_THUMB, player)) {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Herbalism.Ability.ShroomThumb.Fail");
|
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Herbalism.Ability.ShroomThumb.Fail");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ public class RepairManager extends SkillManager {
|
|||||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.REPAIR_SUPER_REPAIR))
|
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.REPAIR_SUPER_REPAIR))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.REPAIR_SUPER_REPAIR, getPlayer())) {
|
if (SkillUtils.isSkillRNGSuccessful(SubSkillType.REPAIR_SUPER_REPAIR, getPlayer())) {
|
||||||
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Repair.Skills.FeltEasy");
|
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Repair.Skills.FeltEasy");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ public class SmeltingManager extends SkillManager {
|
|||||||
|
|
||||||
public boolean isSecondSmeltSuccessful() {
|
public boolean isSecondSmeltSuccessful() {
|
||||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.SMELTING_SECOND_SMELT)
|
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.SMELTING_SECOND_SMELT)
|
||||||
&& SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.SMELTING_SECOND_SMELT, getPlayer());
|
&& SkillUtils.isSkillRNGSuccessful(SubSkillType.SMELTING_SECOND_SMELT, getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -61,7 +61,7 @@ public class SwordsManager extends SkillManager {
|
|||||||
*/
|
*/
|
||||||
public void ruptureCheck(@NotNull LivingEntity target) throws IllegalStateException {
|
public void ruptureCheck(@NotNull LivingEntity target) throws IllegalStateException {
|
||||||
if(BleedTimerTask.isBleedOperationAllowed()) {
|
if(BleedTimerTask.isBleedOperationAllowed()) {
|
||||||
if (SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.SWORDS_RUPTURE, getPlayer())) {
|
if (SkillUtils.isSkillRNGSuccessful(SubSkillType.SWORDS_RUPTURE, getPlayer())) {
|
||||||
|
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player) {
|
||||||
Player defender = (Player) target;
|
Player defender = (Player) target;
|
||||||
@ -128,7 +128,7 @@ public class SwordsManager extends SkillManager {
|
|||||||
* @param damage The amount of damage initially dealt by the event
|
* @param damage The amount of damage initially dealt by the event
|
||||||
*/
|
*/
|
||||||
public void counterAttackChecks(@NotNull LivingEntity attacker, double damage) {
|
public void counterAttackChecks(@NotNull LivingEntity attacker, double damage) {
|
||||||
if (SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.SWORDS_COUNTER_ATTACK, getPlayer())) {
|
if (SkillUtils.isSkillRNGSuccessful(SubSkillType.SWORDS_COUNTER_ATTACK, getPlayer())) {
|
||||||
CombatUtils.dealDamage(attacker, damage / Swords.counterAttackModifier, getPlayer());
|
CombatUtils.dealDamage(attacker, damage / Swords.counterAttackModifier, getPlayer());
|
||||||
|
|
||||||
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Countered");
|
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Countered");
|
||||||
|
@ -146,7 +146,7 @@ public class TamingManager extends SkillManager {
|
|||||||
* @param damage The damage being absorbed by the wolf
|
* @param damage The damage being absorbed by the wolf
|
||||||
*/
|
*/
|
||||||
public void fastFoodService(@NotNull Wolf wolf, double damage) {
|
public void fastFoodService(@NotNull Wolf wolf, double damage) {
|
||||||
if (!SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.TAMING_FAST_FOOD_SERVICE, getPlayer())) {
|
if (!SkillUtils.isSkillRNGSuccessful(SubSkillType.TAMING_FAST_FOOD_SERVICE, getPlayer())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ public class TamingManager extends SkillManager {
|
|||||||
*/
|
*/
|
||||||
public double gore(@NotNull LivingEntity target, double damage) {
|
public double gore(@NotNull LivingEntity target, double damage) {
|
||||||
if(BleedTimerTask.isBleedOperationAllowed()) {
|
if(BleedTimerTask.isBleedOperationAllowed()) {
|
||||||
if (!SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.TAMING_GORE, getPlayer())) {
|
if (!SkillUtils.isSkillRNGSuccessful(SubSkillType.TAMING_GORE, getPlayer())) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ public class UnarmedManager extends SkillManager {
|
|||||||
* @param defender The defending player
|
* @param defender The defending player
|
||||||
*/
|
*/
|
||||||
public void disarmCheck(@NotNull Player defender) {
|
public void disarmCheck(@NotNull Player defender) {
|
||||||
if (SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.UNARMED_DISARM, getPlayer()) && !hasIronGrip(defender)) {
|
if (SkillUtils.isSkillRNGSuccessful(SubSkillType.UNARMED_DISARM, getPlayer()) && !hasIronGrip(defender)) {
|
||||||
if (EventUtils.callDisarmEvent(defender).isCancelled()) {
|
if (EventUtils.callDisarmEvent(defender).isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ public class UnarmedManager extends SkillManager {
|
|||||||
* Check for arrow deflection.
|
* Check for arrow deflection.
|
||||||
*/
|
*/
|
||||||
public boolean deflectCheck() {
|
public boolean deflectCheck() {
|
||||||
if (SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.UNARMED_ARROW_DEFLECT, getPlayer())) {
|
if (SkillUtils.isSkillRNGSuccessful(SubSkillType.UNARMED_ARROW_DEFLECT, getPlayer())) {
|
||||||
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Combat.ArrowDeflect");
|
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Combat.ArrowDeflect");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ public class UnarmedManager extends SkillManager {
|
|||||||
private boolean hasIronGrip(@NotNull Player defender) {
|
private boolean hasIronGrip(@NotNull Player defender) {
|
||||||
if (!Misc.isNPCEntityExcludingVillagers(defender)
|
if (!Misc.isNPCEntityExcludingVillagers(defender)
|
||||||
&& Permissions.isSubSkillEnabled(defender, SubSkillType.UNARMED_IRON_GRIP)
|
&& Permissions.isSubSkillEnabled(defender, SubSkillType.UNARMED_IRON_GRIP)
|
||||||
&& SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.UNARMED_IRON_GRIP, defender)) {
|
&& SkillUtils.isSkillRNGSuccessful(SubSkillType.UNARMED_IRON_GRIP, defender)) {
|
||||||
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Unarmed.Ability.IronGrip.Defender");
|
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Unarmed.Ability.IronGrip.Defender");
|
||||||
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Unarmed.Ability.IronGrip.Attacker");
|
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Unarmed.Ability.IronGrip.Attacker");
|
||||||
|
|
||||||
|
@ -69,11 +69,11 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkHarvestLumberActivation() {
|
private boolean checkHarvestLumberActivation() {
|
||||||
return SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.WOODCUTTING_HARVEST_LUMBER, getPlayer());
|
return SkillUtils.isSkillRNGSuccessful(SubSkillType.WOODCUTTING_HARVEST_LUMBER, getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkCleanCutsActivation() {
|
private boolean checkCleanCutsActivation() {
|
||||||
return SkillUtils.isSkillRNGSuccessful(SkillProbabilityType.DYNAMIC_CONFIGURABLE, SubSkillType.WOODCUTTING_CLEAN_CUTS, getPlayer());
|
return SkillUtils.isSkillRNGSuccessful(SubSkillType.WOODCUTTING_CLEAN_CUTS, getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -327,7 +327,8 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
|
|
||||||
if(RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
|
if(RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
|
||||||
if(AdvancedConfig.getInstance().isKnockOnWoodXPOrbEnabled()) {
|
if(AdvancedConfig.getInstance().isKnockOnWoodXPOrbEnabled()) {
|
||||||
if(RandomChanceUtil.rollDiceSimple(10, 100)) {
|
//TODO: Test the results of this RNG, should be 10%
|
||||||
|
if(SkillUtils.isStaticSkillRNGSuccessful(PrimarySkillType.WOODCUTTING, player, 10)) {
|
||||||
int randOrbCount = Math.max(1, Misc.getRandom().nextInt(100));
|
int randOrbCount = Math.max(1, Misc.getRandom().nextInt(100));
|
||||||
Misc.spawnExperienceOrb(blockState.getLocation(), randOrbCount);
|
Misc.spawnExperienceOrb(blockState.getLocation(), randOrbCount);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user