Skill commands now show the perk effect, if any are active

This commit is contained in:
TfT_02 2013-01-06 12:16:08 +01:00
parent 99c6c46d54
commit 00020a9cbb
31 changed files with 229 additions and 66 deletions

View File

@ -13,8 +13,11 @@ public class AcrobaticsCommand extends SkillCommand {
AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private String dodgeChance;
private String dodgeChanceLucky;
private String rollChance;
private String rollChanceLucky;
private String gracefulRollChance;
private String gracefulRollChanceLucky;
private float dodgeChanceMax = advancedConfig.getDodgeChanceMax();
private float dodgeMaxBonusLevel = advancedConfig.getDodgeMaxBonusLevel();
@ -34,15 +37,30 @@ public class AcrobaticsCommand extends SkillCommand {
@Override
protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("0.0");
float dodgeChanceF;
float rollChanceF;
float gracefulRollChanceF;
// DODGE
if(skillValue >= dodgeMaxBonusLevel) dodgeChance = df.format(dodgeChanceMax);
else dodgeChance = df.format(((double) dodgeChanceMax / (double) dodgeMaxBonusLevel) * skillValue);
if(skillValue >= dodgeMaxBonusLevel) dodgeChanceF = dodgeChanceMax;
else dodgeChanceF = (float) (((double) dodgeChanceMax / (double) dodgeMaxBonusLevel) * skillValue);
dodgeChance = df.format(dodgeChanceF);
if(dodgeChanceF + dodgeChanceF * 0.3333D >= 100D) dodgeChanceLucky = df.format(100D);
else dodgeChanceLucky = df.format(dodgeChanceF + dodgeChanceF * 0.3333D);
// ROLL
if(skillValue >= rollMaxBonusLevel) rollChance = df.format(rollChanceMax);
else rollChance = df.format(((double) rollChanceMax / (double) rollMaxBonusLevel) * skillValue);
if(skillValue >= rollMaxBonusLevel) rollChanceF = rollChanceMax;
else rollChanceF = (float) (((double) rollChanceMax / (double) rollMaxBonusLevel) * skillValue);
rollChance = df.format(rollChanceF);
if(rollChanceF + rollChanceF * 0.3333D >= 100D) rollChanceLucky = df.format(100D);
else rollChanceLucky = df.format(rollChanceF + rollChanceF * 0.3333D);
// GRACEFULROLL
if(skillValue >= gracefulRollMaxBonusLevel) gracefulRollChance = df.format(gracefulRollChanceMax);
else gracefulRollChance = df.format(((double) gracefulRollChanceMax / (double) gracefulRollMaxBonusLevel) * skillValue);
if(skillValue >= gracefulRollMaxBonusLevel) gracefulRollChanceF = gracefulRollChanceMax;
else gracefulRollChanceF = (float) (((double) gracefulRollChanceMax / (double) gracefulRollMaxBonusLevel) * skillValue);
gracefulRollChance = df.format(gracefulRollChanceF);
if(gracefulRollChanceF + gracefulRollChanceF * 0.3333D >= 100D) gracefulRollChanceLucky = df.format(100D);
else gracefulRollChanceLucky = df.format(gracefulRollChanceF + gracefulRollChanceF * 0.3333D);
}
@Override
@ -85,15 +103,24 @@ public class AcrobaticsCommand extends SkillCommand {
@Override
protected void statsDisplay() {
if (canRoll) {
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Chance", new Object[] { rollChance }));
if (player.hasPermission("mcmmo.perks.lucky.acrobatics"))
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Chance", new Object[] { rollChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { rollChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Chance", new Object[] { rollChance }));
}
if (canGracefulRoll) {
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance }));
if (player.hasPermission("mcmmo.perks.lucky.acrobatics"))
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { gracefulRollChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance }));
}
if (canDodge) {
player.sendMessage(LocaleLoader.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance }));
if (player.hasPermission("mcmmo.perks.lucky.acrobatics"))
player.sendMessage(LocaleLoader.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { dodgeChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance }));
}
}
}

View File

@ -14,7 +14,9 @@ public class ArcheryCommand extends SkillCommand {
private String skillShotBonus;
private String dazeChance;
private String dazeChanceLucky;
private String retrieveChance;
private String retrieveChanceLucky;
private int skillShotIncreaseLevel = advancedConfig.getSkillShotIncreaseLevel();
private double skillShotIncreasePercentage = advancedConfig.getSkillShotIncreasePercentage();
@ -26,7 +28,6 @@ public class ArcheryCommand extends SkillCommand {
private float retrieveBonusMax = advancedConfig.getRetrieveBonusMax();
private float retrieveMaxBonusLevel = advancedConfig.getRetrieveMaxBonusLevel();
private boolean canSkillShot;
private boolean canDaze;
private boolean canRetrieve;
@ -38,18 +39,27 @@ public class ArcheryCommand extends SkillCommand {
@Override
protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("0.0");
float dazeChanceF;
float retrieveChanceF;
// SkillShot
double bonus = (int)((double) skillValue / (double) skillShotIncreaseLevel) * skillShotIncreasePercentage;
if (bonus > skillShotBonusMax) skillShotBonus = percent.format(skillShotBonusMax);
else skillShotBonus = percent.format(bonus);
// Daze
if(skillValue >= dazeMaxBonusLevel) dazeChance = df.format(dazeBonusMax);
else dazeChance = df.format(((double) dazeBonusMax / (double) dazeMaxBonusLevel) * skillValue);
if(skillValue >= dazeMaxBonusLevel) dazeChanceF = dazeBonusMax;
else dazeChanceF = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * skillValue);
dazeChance = df.format(dazeChanceF);
if(dazeChanceF + dazeChanceF * 0.3333D >= 100D) dazeChanceLucky = df.format(100D);
else dazeChanceLucky = df.format(dazeChanceF + dazeChanceF * 0.3333D);
// Retrieve
if(skillValue >= retrieveMaxBonusLevel) retrieveChance = df.format(retrieveBonusMax);
else retrieveChance = df.format(((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * skillValue);
if(skillValue >= retrieveMaxBonusLevel) retrieveChanceF = retrieveBonusMax;
else retrieveChanceF = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * skillValue);
retrieveChance = df.format(retrieveChanceF);
if(retrieveChanceF + retrieveChanceF * 0.3333D >= 100D) retrieveChanceLucky = df.format(100D);
else retrieveChanceLucky = df.format(retrieveChanceF + retrieveChanceF * 0.3333D);
}
@Override
@ -92,15 +102,21 @@ public class ArcheryCommand extends SkillCommand {
@Override
protected void statsDisplay() {
if (canSkillShot) {
player.sendMessage(LocaleLoader.getString("Archery.Combat.SkillshotBonus", new Object[] { skillShotBonus }));
player.sendMessage(LocaleLoader.getString("Archery.Combat.SkillshotBonus", new Object[] { skillShotBonus }));
}
if (canDaze) {
player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", new Object[] { dazeChance }));
if (player.hasPermission("mcmmo.perks.lucky.archery"))
player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", new Object[] { dazeChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { dazeChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", new Object[] { dazeChance }));
}
if (canRetrieve) {
player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance }));
if (player.hasPermission("mcmmo.perks.lucky.archery"))
player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { retrieveChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance }));
}
}
}

View File

@ -14,6 +14,7 @@ public class AxesCommand extends SkillCommand {
AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private String critChance;
private String critChanceLucky;
private String bonusDamage;
private String impactDamage;
private String greaterImpactDamage;
@ -24,7 +25,7 @@ public class AxesCommand extends SkillCommand {
private double critMaxChance = advancedConfig.getAxesCriticalChance();
private int critMaxBonusLevel = advancedConfig.getAxesCriticalMaxBonusLevel();
private int greaterImpactIncreaseLevel = advancedConfig.getArmorImpactIncreaseLevel();
// private double greaterImpactModifier = advancedConfig.getGreaterImpactModifier();
private double greaterImpactBonusDamage = advancedConfig.getGreaterImpactBonusDamage();
private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength();
private boolean canSkullSplitter;
@ -40,14 +41,22 @@ public class AxesCommand extends SkillCommand {
@Override
protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("0.0");
float critChanceF;
int skillCheck = Misc.skillCheck((int)skillValue, critMaxBonusLevel);
//Armor Impact
impactDamage = String.valueOf(1 + ((double) skillValue / (double) greaterImpactIncreaseLevel));
//Skull Splitter
skullSplitterLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
greaterImpactDamage = "2";
if (skillValue >= critMaxBonusLevel) critChance = df.format(critMaxChance);
else critChance = String.valueOf((critMaxChance / critMaxBonusLevel) * skillCheck);
//Greater Impact
greaterImpactDamage = String.valueOf(greaterImpactBonusDamage);
//Critical Strikes
if (skillValue >= critMaxBonusLevel) critChanceF = (float) critMaxChance;
else critChanceF = (float) ((critMaxChance / critMaxBonusLevel) * skillCheck);
critChance = df.format(critChanceF);
if(critChanceF + critChanceF * 0.3333D >= 100D) critChanceLucky = df.format(100D);
else critChanceLucky = df.format(critChanceF + critChanceF * 0.3333D);
//Axe Mastery
if (skillValue >= bonusDamageAxesMaxBonusLevel) bonusDamage = String.valueOf(bonusDamageAxesBonusMax);
else bonusDamage = String.valueOf(skillValue / ((double) bonusDamageAxesMaxBonusLevel / (double) bonusDamageAxesBonusMax));
}
@ -113,8 +122,11 @@ public class AxesCommand extends SkillCommand {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.4"), LocaleLoader.getString("Axes.Ability.Bonus.5", new Object[] {greaterImpactDamage}) }));
}
if (canCritical) {
player.sendMessage(LocaleLoader.getString("Axes.Combat.CritChance", new Object[] { critChance }));
if (canCritical){
if (player.hasPermission("mcmmo.perks.lucky.axes"))
player.sendMessage(LocaleLoader.getString("Axes.Combat.CritChance", new Object[] { critChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { critChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Axes.Combat.CritChance", new Object[] { critChance }));
}
if (canSkullSplitter) {

View File

@ -1,5 +1,7 @@
package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import org.bukkit.ChatColor;
import com.gmail.nossr50.commands.SkillCommand;
@ -16,6 +18,7 @@ public class FishingCommand extends SkillCommand {
private String magicChance;
private int shakeUnlockLevel;
private String shakeChance;
private String shakeChanceLucky;
private String fishermansDietRank;
private int fishermansDietRankChange = advancedConfig.getFarmerDietRankChange();
@ -32,18 +35,20 @@ public class FishingCommand extends SkillCommand {
@Override
protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("0.0");
//Treasure Hunter
lootTier = Fishing.getFishingLootTier(profile);
magicChance = percent.format(lootTier / 15D);
magicChance = percent.format(lootTier / 15D);
//Shake
int dropChance = Fishing.getShakeChance(lootTier);
if (player.hasPermission("mcmmo.perks.lucky.fishing")) {
dropChance = (int) (dropChance * 1.25D);
}
shakeChance = String.valueOf(dropChance);
shakeChance = df.format(dropChance);
if(dropChance + dropChance * 0.3333D >= 100D) shakeChanceLucky = df.format(100D);
else shakeChanceLucky = df.format(dropChance + dropChance * 0.3333D);
shakeUnlockLevel = advancedConfig.getShakeUnlockLevel();
//Fishermans Diet
if(skillValue >= fishermansDietRankMaxLevel) fishermansDietRank = "5";
else fishermansDietRank = String.valueOf((int) ((double) skillValue / (double) fishermansDietRankChange));
shakeUnlockLevel = advancedConfig.getShakeUnlockLevel();
else fishermansDietRank = String.valueOf((int) ((double) skillValue / (double) fishermansDietRankChange));
}
@Override
@ -103,7 +108,10 @@ public class FishingCommand extends SkillCommand {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Fishing.Ability.Locked.0", new Object[] { shakeUnlockLevel }) }));
}
else {
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Shake", new Object[] { shakeChance }));
if (player.hasPermission("mcmmo.perks.lucky.fishing"))
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Shake", new Object[] { shakeChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { shakeChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Shake", new Object[] { shakeChance }));
}
}

View File

@ -15,9 +15,11 @@ public class HerbalismCommand extends SkillCommand {
private String greenTerraLength;
private String greenThumbChance;
private String greenThumbChanceLucky;
private String greenThumbStage;
private String farmersDietRank;
private String doubleDropChance;
private String doubleDropChanceLucky;
private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength();
private int farmersDietRankChange = advancedConfig.getFarmerDietRankChange();
@ -43,6 +45,8 @@ public class HerbalismCommand extends SkillCommand {
@Override
protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("0.0");
float greenThumbChanceF;
float doubleDropChanceF;
greenTerraLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
//FARMERS DIET
if(skillValue >= farmersDietMaxLevel) farmersDietRank = "5";
@ -51,12 +55,17 @@ public class HerbalismCommand extends SkillCommand {
if(skillValue >= greenThumbStageMaxLevel) greenThumbStage = "4";
else greenThumbStage = String.valueOf((int) ((double) skillValue / (double) greenThumbStageChange));
if(skillValue >= greenThumbMaxLevel) greenThumbChance = String.valueOf(greenThumbMaxBonus);
else greenThumbChance = df.format((greenThumbMaxBonus / greenThumbMaxLevel) * skillValue);
if(skillValue >= greenThumbMaxLevel) greenThumbChanceF = (float) (greenThumbMaxBonus);
else greenThumbChanceF = (float) ((greenThumbMaxBonus / greenThumbMaxLevel) * skillValue);
greenThumbChance = df.format(greenThumbChanceF);
if(greenThumbChanceF + greenThumbChanceF * 0.3333D >= 100D) greenThumbChanceLucky = df.format(100D);
else greenThumbChanceLucky = df.format(greenThumbChanceF + greenThumbChanceF * 0.3333D);
//DOUBLE DROPS
if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus);
else doubleDropChance = df.format((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
if(skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
doubleDropChance = df.format(doubleDropChanceF);
if(doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D);
else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D);
}
@Override
@ -116,7 +125,10 @@ public class HerbalismCommand extends SkillCommand {
}
if (canGreenThumbBlocks || canGreenThumbWheat) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", new Object[] { greenThumbChance }));
if (player.hasPermission("mcmmo.perks.lucky.herbalism"))
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", new Object[] { greenThumbChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { greenThumbChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", new Object[] { greenThumbChance }));
}
if (canGreenThumbWheat) {
@ -128,7 +140,10 @@ public class HerbalismCommand extends SkillCommand {
}
if (canDoubleDrop && !doubleDropsDisabled) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", new Object[] { doubleDropChance }));
if (player.hasPermission("mcmmo.perks.lucky.herbalism"))
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", new Object[] { doubleDropChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { doubleDropChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", new Object[] { doubleDropChance }));
}
}
}

View File

@ -14,6 +14,7 @@ import com.gmail.nossr50.util.Misc;
public class MiningCommand extends SkillCommand {
AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private String doubleDropChance;
private String doubleDropChanceLucky;
private String superBreakerLength;
private String blastMiningRank;
private String blastRadiusIncrease;
@ -46,10 +47,17 @@ public class MiningCommand extends SkillCommand {
@Override
protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("0.0");
float doubleDropChanceF;
//Super Breaker
superBreakerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus);
else doubleDropChance = df.format((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
//Double Drops
if(skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
doubleDropChance = df.format(doubleDropChanceF);
if(doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D);
else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D);
//Blast Mining
if (skillValue >= blastMiningRank8) {
blastMiningRank = "8";
blastDamageDecrease = "100.00%";
@ -150,7 +158,10 @@ public class MiningCommand extends SkillCommand {
@Override
protected void statsDisplay() {
if (canDoubleDrop && !doubleDropsDisabled) {
player.sendMessage(LocaleLoader.getString("Mining.Effect.DropChance", new Object[] { doubleDropChance }));
if (player.hasPermission("mcmmo.perks.lucky.mining"))
player.sendMessage(LocaleLoader.getString("Mining.Effect.DropChance", new Object[] { doubleDropChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { doubleDropChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Mining.Effect.DropChance", new Object[] { doubleDropChance }));
}
if (canSuperBreaker) {

View File

@ -18,6 +18,7 @@ public class RepairCommand extends SkillCommand {
private int arcaneForgingRank;
private String repairMasteryBonus;
private String superRepairChance;
private String superRepairChanceLucky;
private float repairMasteryChanceMax = advancedConfig.getRepairMasteryChanceMax();
private float repairMasteryMaxBonusLevel = advancedConfig.getRepairMasteryMaxLevel();
@ -50,6 +51,7 @@ public class RepairCommand extends SkillCommand {
@Override
protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("0.0");
float superRepairChanceF;
// We're using pickaxes here, not the best but it works
Repairable diamondRepairable = mcMMO.repairManager.getRepairable(278);
Repairable goldRepairable = mcMMO.repairManager.getRepairable(285);
@ -66,8 +68,11 @@ public class RepairCommand extends SkillCommand {
if(skillValue >= repairMasteryMaxBonusLevel) repairMasteryBonus = df.format(repairMasteryChanceMax);
else repairMasteryBonus = df.format(((double) repairMasteryChanceMax / (double) repairMasteryMaxBonusLevel) * skillValue);
if(skillValue >= superRepairMaxBonusLevel) superRepairChance = df.format(superRepairChanceMax);
else superRepairChance = df.format(((double) superRepairChanceMax / (double) superRepairMaxBonusLevel) * skillValue);
if(skillValue >= superRepairMaxBonusLevel) superRepairChanceF = superRepairChanceMax;
else superRepairChanceF = (float) (((double) superRepairChanceMax / (double) superRepairMaxBonusLevel) * skillValue);
superRepairChance = df.format(superRepairChanceF);
if(superRepairChanceF + superRepairChanceF * 0.3333D >= 100D) superRepairChanceLucky = df.format(100D);
else superRepairChanceLucky = df.format(superRepairChanceF + superRepairChanceF * 0.3333D);
arcaneForgingRank = Repair.getArcaneForgingRank(profile);
}
@ -149,7 +154,10 @@ public class RepairCommand extends SkillCommand {
}
if (canSuperRepair) {
player.sendMessage(LocaleLoader.getString("Repair.Skills.Super.Chance", new Object[] { superRepairChance }));
if (player.hasPermission("mcmmo.perks.lucky.repair"))
player.sendMessage(LocaleLoader.getString("Repair.Skills.Super.Chance", new Object[] { superRepairChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { superRepairChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Repair.Skills.Super.Chance", new Object[] { superRepairChance }));
}
if (canArcaneForge) {

View File

@ -13,8 +13,10 @@ public class SwordsCommand extends SkillCommand {
AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private String counterAttackChance;
private String counterAttackChanceLucky;
private String bleedLength;
private String bleedChance;
private String bleedChanceLucky;
private String serratedStrikesLength;
private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength();
@ -37,16 +39,24 @@ public class SwordsCommand extends SkillCommand {
@Override
protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("0.0");
float bleedChanceF;
float counterAttackChanceF;
serratedStrikesLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
if (skillValue >= bleedMaxLevel) bleedLength = String.valueOf(bleedMaxTicks);
else bleedLength = String.valueOf(bleedBaseTicks);
if(skillValue >= bleedMaxLevel) bleedChance = df.format(bleedChanceMax);
else bleedChance = df.format(((double) bleedChanceMax / (double) bleedMaxLevel) * skillValue);
if(skillValue >= bleedMaxLevel) bleedChanceF = bleedChanceMax;
else bleedChanceF = (float) (((double) bleedChanceMax / (double) bleedMaxLevel) * skillValue);
bleedChance = df.format(bleedChanceF);
if(bleedChanceF + bleedChanceF * 0.3333D >= 100D) bleedChanceLucky = df.format(100D);
else bleedChanceLucky = df.format(bleedChanceF + bleedChanceF * 0.3333D);
if(skillValue >= counterMaxLevel) counterAttackChance = df.format(counterChanceMax);
else counterAttackChance = df.format(((double) counterChanceMax / (double) counterMaxLevel) * skillValue);
if(skillValue >= counterMaxLevel) counterAttackChanceF = counterChanceMax;
else counterAttackChanceF = (float) (((double) counterChanceMax / (double) counterMaxLevel) * skillValue);
counterAttackChance = df.format(counterAttackChanceF);
if(counterAttackChanceF + counterAttackChanceF * 0.3333D >= 100D) counterAttackChanceLucky = df.format(100D);
else counterAttackChanceLucky = df.format(counterAttackChanceF + counterAttackChanceF * 0.3333D);
serratedStrikesLength = String.valueOf(serratedBleedTicks);
}
@ -92,13 +102,19 @@ public class SwordsCommand extends SkillCommand {
@Override
protected void statsDisplay() {
if (canCounter) {
player.sendMessage(LocaleLoader.getString("Swords.Combat.Counter.Chance", new Object[] { counterAttackChance }));
if (player.hasPermission("mcmmo.perks.lucky.swords"))
player.sendMessage(LocaleLoader.getString("Swords.Combat.Counter.Chance", new Object[] { counterAttackChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { counterAttackChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Swords.Combat.Counter.Chance", new Object[] { counterAttackChance }));
}
if (canBleed) {
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Length", new Object[] { bleedLength }));
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Note"));
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Chance", new Object[] { bleedChance }));
if (player.hasPermission("mcmmo.perks.lucky.swords"))
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Chance", new Object[] { bleedChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { bleedChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Chance", new Object[] { bleedChance }));
}
if (canSerratedStrike) {

View File

@ -13,6 +13,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
public class TamingCommand extends SkillCommand {
AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private String goreChance;
private String goreChanceLucky;
private float goreChanceMax = advancedConfig.getGoreChanceMax();
private float goreMaxLevel = advancedConfig.getGoreMaxBonusLevel();
@ -39,8 +40,12 @@ public class TamingCommand extends SkillCommand {
@Override
protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("0.0");
if(skillValue >= goreMaxLevel) goreChance = df.format(goreChanceMax);
else goreChance = df.format(((double) goreChanceMax / (double) goreMaxLevel) * skillValue);
float goreChanceF;
if(skillValue >= goreMaxLevel) goreChanceF = (goreChanceMax);
else goreChanceF = (float) (((double) goreChanceMax / (double) goreMaxLevel) * skillValue);
goreChance = df.format(goreChanceF);
if(goreChanceF + goreChanceF * 0.3333D >= 100D) goreChanceLucky = df.format(100D);
else goreChanceLucky = df.format(goreChanceF + goreChanceF * 0.3333D);
}
@Override
@ -157,7 +162,10 @@ public class TamingCommand extends SkillCommand {
}
if (canGore) {
player.sendMessage(LocaleLoader.getString("Taming.Combat.Chance.Gore", new Object[] { goreChance }));
if (player.hasPermission("mcmmo.perks.lucky.taming"))
player.sendMessage(LocaleLoader.getString("Taming.Combat.Chance.Gore", new Object[] { goreChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { goreChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Taming.Combat.Chance.Gore", new Object[] { goreChance }));
}
}
}

View File

@ -13,7 +13,9 @@ public class UnarmedCommand extends SkillCommand {
AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private String berserkLength;
private String deflectChance;
private String deflectChanceLucky;
private String disarmChance;
private String disarmChanceLucky;
private String ironArmBonus;
private float disarmChanceMax = advancedConfig.getDisarmChanceMax();
@ -36,13 +38,21 @@ public class UnarmedCommand extends SkillCommand {
@Override
protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("0.0");
float disarmChanceF;
float deflectChanceF;
berserkLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
if(skillValue >= disarmMaxLevel) disarmChance = df.format(disarmChanceMax);
else disarmChance = df.format(((double) disarmChanceMax / (double) disarmMaxLevel) * skillValue);
if(skillValue >= disarmMaxLevel) disarmChanceF = disarmChanceMax;
else disarmChanceF = (float) (((double) disarmChanceMax / (double) disarmMaxLevel) * skillValue);
disarmChance = df.format(disarmChanceF);
if(disarmChanceF + disarmChanceF * 0.3333D >= 100D) disarmChanceLucky = df.format(100D);
else disarmChanceLucky = df.format(disarmChanceF + disarmChanceF * 0.3333D);
if(skillValue >= deflectMaxLevel) deflectChance = df.format(deflectChanceMax);
else deflectChance = df.format(((double) deflectChanceMax / (double) deflectMaxLevel) * skillValue);
if(skillValue >= deflectMaxLevel) deflectChanceF = deflectChanceMax;
else deflectChanceF = (float) (((double) deflectChanceMax / (double) deflectMaxLevel) * skillValue);
deflectChance = df.format(deflectChanceF);
if(deflectChanceF + deflectChanceF * 0.3333D >= 100D) deflectChanceLucky = df.format(100D);
else deflectChanceLucky = df.format(deflectChanceF + deflectChanceF * 0.3333D);
if (skillValue >= 250) ironArmBonus = String.valueOf(ironArmMaxBonus);
else ironArmBonus = String.valueOf(3 + ((double) skillValue / (double) ironArmIncreaseLevel));
@ -97,11 +107,17 @@ public class UnarmedCommand extends SkillCommand {
}
if (canDeflect) {
player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Chance.ArrowDeflect", new Object[] { deflectChance }));
if (player.hasPermission("mcmmo.perks.lucky.unarmed"))
player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Chance.ArrowDeflect", new Object[] { deflectChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { deflectChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Chance.ArrowDeflect", new Object[] { deflectChance }));
}
if (canDisarm) {
player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Chance.Disarm", new Object[] { disarmChance }));
if (player.hasPermission("mcmmo.perks.lucky.unarmed"))
player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Chance.Disarm", new Object[] { disarmChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { disarmChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Chance.Disarm", new Object[] { disarmChance }));
}
if (canBerserk) {

View File

@ -14,6 +14,7 @@ public class WoodcuttingCommand extends SkillCommand {
AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private String treeFellerLength;
private String doubleDropChance;
private String doubleDropChanceLucky;
private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength();
private double doubleDropsMaxBonus = advancedConfig.getWoodcuttingDoubleDropChance();
@ -32,10 +33,14 @@ public class WoodcuttingCommand extends SkillCommand {
@Override
protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("0.0");
float doubleDropChanceF;
treeFellerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus);
else doubleDropChance = df.format((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
if(skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
doubleDropChance = df.format(doubleDropChanceF);
if(doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D);
else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D);
}
@Override
@ -91,7 +96,10 @@ public class WoodcuttingCommand extends SkillCommand {
}
if (canDoubleDrop && !doubleDropsDisabled) {
player.sendMessage(LocaleLoader.getString("Woodcutting.Ability.Chance.DDrop", new Object[] { doubleDropChance }));
if (player.hasPermission("mcmmo.perks.lucky.woodcutting"))
player.sendMessage(LocaleLoader.getString("Woodcutting.Ability.Chance.DDrop", new Object[] { doubleDropChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { doubleDropChanceLucky }));
else
player.sendMessage(LocaleLoader.getString("Woodcutting.Ability.Chance.DDrop", new Object[] { doubleDropChance }));
}
if (canTreeFell) {

View File

@ -96,7 +96,6 @@ public class Axes {
}
if (chance > random.nextInt(randomChance) && !entity.isDead()){
// if (random.nextInt(randomChance) <= skillCheck && !entity.isDead()){
int damage = event.getDamage();
if (entity instanceof Player){

View File

@ -514,6 +514,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -513,6 +513,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -514,6 +514,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -515,6 +515,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -112,7 +112,7 @@ Fishing.Effect.4=Shake (vs. Entities)
Fishing.Effect.5=Shake items off of mobs w/ fishing pole
Fishing.Effect.6=Fisherman's Diet
Fishing.Effect.7=Improves hunger restored from fished foods
Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0}%
Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0}
Fishing.ItemFound=[[GRAY]]Treasure found!
Fishing.Listener=Fishing:
Fishing.MagicFound=[[GRAY]]You feel a touch of magic with this catch...
@ -535,6 +535,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -515,6 +515,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -515,6 +515,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -515,6 +515,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -515,6 +515,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -515,6 +515,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -515,6 +515,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -515,6 +515,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -515,6 +515,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -515,6 +515,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -515,6 +515,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -515,6 +515,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -515,6 +515,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -515,6 +515,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance

View File

@ -515,6 +515,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance