From 891fd00b5f7d7112c82f1271397c21d69099f2dd Mon Sep 17 00:00:00 2001 From: Thaum Rystra Date: Fri, 15 May 2020 16:23:57 +0200 Subject: [PATCH] Skills now correctly denormalise their passive bonus, conditional benefits, advantage, and fail effects --- .../api/creature/computation/combineStat.js | 27 +++++++++++++++---- .../components/skills/SkillListTile.vue | 13 ++++++--- .../ui/properties/forms/EffectForm.vue | 3 ++- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/app/imports/api/creature/computation/combineStat.js b/app/imports/api/creature/computation/combineStat.js index 2592aa45..2ca20994 100644 --- a/app/imports/api/creature/computation/combineStat.js +++ b/app/imports/api/creature/computation/combineStat.js @@ -43,11 +43,10 @@ function combineSkill(stat, aggregator, memo){ let profBonusStat = memo.statsByVariableName['proficiencyBonus']; let profBonus = profBonusStat && profBonusStat.value; - /** TODO level needs to be on the memo somewhere - if (typeof profBonus !== "number"){ - profBonus = Math.floor(char.level / 4 + 1.75); + if (typeof profBonus !== 'number' && memo.statsByVariableName['level']){ + let level = memo.statsByVariableName['level'].value; + profBonus = Math.floor(level / 4 + 1.75); } - */ // Multiply the proficiency bonus by the actual proficiency profBonus *= stat.proficiency; // Combine everything to get the final result @@ -55,8 +54,26 @@ function combineSkill(stat, aggregator, memo){ if (result < aggregator.min) result = aggregator.min; if (result > aggregator.max) result = aggregator.max; result = Math.floor(result); - if (stat.base > result) result = stat.base; + if (aggregator.base > result) result = aggregator.base; stat.value = result; + // Advantage/disadvantage + if (aggregator.advantage && !aggregator.disadvantage){ + stat.advantage = 1; + } else if (aggregator.disadvantage && !aggregator.advantage){ + stat.advantage = -1; + } else { + stat.advantage = 0; + } + // Passive bonus + stat.passiveBonus = aggregator.passiveAdd; + // conditional benefits + stat.conditionalBenefits = aggregator.conditional; + // Roll bonuses + stat.rollBonus = aggregator.rollBonus; + // Forced to fail + stat.fail = aggregator.fail; + // Rollbonus + stat.rollBonuses = aggregator.rollBonus; } function combineDamageMultiplier(stat){ diff --git a/app/imports/ui/properties/components/skills/SkillListTile.vue b/app/imports/ui/properties/components/skills/SkillListTile.vue index 7fb8ffd5..da3be2ae 100644 --- a/app/imports/ui/properties/components/skills/SkillListTile.vue +++ b/app/imports/ui/properties/components/skills/SkillListTile.vue @@ -15,9 +15,6 @@ > {{ displayedModifier }} - {{ model.name }} arrow_downward + {{ model.name }} + + @@ -69,6 +73,9 @@ export default { hasClickListener(){ return this.$listeners && this.$listeners.click }, + passiveScore(){ + return 10 + this.model.value + this.model.passiveBonus; + } }, methods: { click(e){ diff --git a/app/imports/ui/properties/forms/EffectForm.vue b/app/imports/ui/properties/forms/EffectForm.vue index f1a18ccf..abe75dc1 100644 --- a/app/imports/ui/properties/forms/EffectForm.vue +++ b/app/imports/ui/properties/forms/EffectForm.vue @@ -114,7 +114,8 @@ case 'disadvantage': return false; case 'passiveAdd': return true; case 'fail': return false; - case 'conditional': return true; + case 'conditional': return false; + case 'rollBonus': return true; default: return true; } },