From f9ce70e310ee16e1e3f5a9655ba8f16f874fe907 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 21 Jan 2019 08:46:08 -0800 Subject: [PATCH] Fixing styling on Acrobatics, Archery --- .../commands/skills/AcrobaticsCommand.java | 15 ++++++++------- .../nossr50/commands/skills/ArcheryCommand.java | 8 +++++--- .../nossr50/commands/skills/SkillCommand.java | 10 ++++++++++ .../nossr50/datatypes/skills/SubSkillType.java | 16 ++++++++++++++-- .../resources/locale/locale_en_US.properties | 11 +++++++---- 5 files changed, 44 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java index af41db57d..247f1c5bc 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java @@ -58,19 +58,20 @@ public class AcrobaticsCommand extends SkillCommand { protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList(); - /* - if (canRoll) { + /*if (canRoll) { + messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, dazeChance) + + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", dazeChanceLucky) : "")); messages.add(LocaleLoader.getString("Acrobatics.Roll.Chance", rollChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", rollChanceLucky) : "")); } - if (canGracefulRoll) { + if (canRoll) { messages.add(LocaleLoader.getString("Acrobatics.Roll.GraceChance", gracefulRollChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", gracefulRollChanceLucky) : "")); - } - */ + }*/ + if (canDodge) { - messages.add(LocaleLoader.getString("Acrobatics.DodgeChance", dodgeChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", dodgeChanceLucky) : "")); - + messages.add(getStatMessage(SubSkillType.ACROBATICS_DODGE, dodgeChance) + + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", dodgeChanceLucky) : "")); } return messages; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java index 5a99d1028..dcd1a3e11 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java @@ -80,15 +80,17 @@ public class ArcheryCommand extends SkillCommand { List messages = new ArrayList(); if (canSkillShot) { - messages.add(LocaleLoader.getString("Archery.Combat.SkillshotBonus", skillShotBonus)); + messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, skillShotBonus)); } if (canDaze) { - messages.add(LocaleLoader.getString("Archery.Combat.DazeChance", dazeChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", dazeChanceLucky) : "")); + messages.add(getStatMessage(SubSkillType.ARCHERY_DAZE, dazeChance) + + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", dazeChanceLucky) : "")); } if (canRetrieve) { - messages.add(LocaleLoader.getString("Archery.Combat.RetrieveChance", retrieveChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", retrieveChanceLucky) : "")); + messages.add(getStatMessage(SubSkillType.ARCHERY_ARROW_RETRIEVAL, retrieveChance) + + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", retrieveChanceLucky) : "")); } return messages; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java index 461c9bab0..89fc25da6 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java @@ -235,6 +235,16 @@ public abstract class SkillCommand implements TabExecutor { return new String[] { String.valueOf(length), String.valueOf(enduranceLength) }; } + /** + * Grab the stat string for a given subskill + * @param subSkillType target subskill + */ + protected String getStatMessage(SubSkillType subSkillType, String stat) + { + String statDescription = subSkillType.getLocaleStatDescription(); + return subSkillType.getLocaleStat(statDescription, stat); + } + protected abstract void dataCalculations(Player player, float skillValue, boolean isLucky); protected abstract void permissionsCheck(Player player); diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java index 8b8a73e22..bfa5298af 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java @@ -242,11 +242,23 @@ public enum SubSkillType { public String getLocaleName() { - return LocaleLoader.getString(getLocaleKeyRoot()+".Name"); + return getFromLocaleSubAddress(".Name"); } public String getLocaleDescription() { - return LocaleLoader.getString(getLocaleKeyRoot()+".Description"); + return getFromLocaleSubAddress(".Description"); + } + + public String getLocaleStatDescription() { return getFromLocaleSubAddress(".Stat"); } + + public String getLocaleStat(String... vars) + { + String statMsg = LocaleLoader.getString("Ability.Generic.Template", (Object[]) vars); + return statMsg; + } + + private String getFromLocaleSubAddress(String s) { + return LocaleLoader.getString(getLocaleKeyRoot() + s); } } diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 01c17c351..925e2f471 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -135,8 +135,9 @@ Acrobatics.SubSkill.GracefulRoll.Name=Graceful Roll Acrobatics.SubSkill.GracefulRoll.Description=Twice as effective as a normal Roll Acrobatics.SubSkill.Dodge.Name=Dodge Acrobatics.SubSkill.Dodge.Description=Reduce attack damage by half +Acrobatics.SubSkill.Dodge.Stat=Dodge Chance Acrobatics.Listener=Acrobatics: -Acrobatics.Roll.Text=[[ITALIC]][[BOLD]]**Rolled** +Acrobatics.Roll.Text=[[ITALIC]]**Rolled** Acrobatics.SkillName=ACROBATICS #ALCHEMY Alchemy.SubSkill.Catalysis.Name=Catalysis @@ -150,15 +151,17 @@ Alchemy.Concoctions.Rank=Concoctions Rank: [[YELLOW]]{0}/{1} Alchemy.Concoctions.Ingredients=Ingredients [[[YELLOW]]{0}[[RED]]]: [[YELLOW]]{1} Alchemy.SkillName=ALCHEMY #ARCHERY -Archery.Combat.DazeChance=Chance to Daze: [[YELLOW]]{0} -Archery.Combat.RetrieveChance=Chance to Retrieve Arrows: [[YELLOW]]{0} -Archery.Combat.SkillshotBonus=Skill Shot Bonus Damage: [[YELLOW]]{0} + + Archery.SubSkill.SkillShot.Name=Skill Shot Archery.SubSkill.SkillShot.Description=Increases damage done with bows +Archery.SubSkill.SkillShot.Stat=Skill Shot Bonus Damage Archery.SubSkill.Daze.Name=Daze Archery.SubSkill.Daze.Description=Disorients foes and deals {0} DMG +Archery.SubSkill.Daze.Stat=Daze Chance Archery.SubSkill.ArrowRetrieval.Name=Arrow Retrieval Archery.SubSkill.ArrowRetrieval.Description=Chance to retrieve arrows from corpses +Archery.SubSkill.ArrowRetrieval.Stat=Arrow Recovery Chance Archery.Listener=Archery: Archery.SkillName=ARCHERY #AXES