Skills now correctly denormalise their passive bonus, conditional benefits, advantage, and fail effects

This commit is contained in:
Thaum Rystra
2020-05-15 16:23:57 +02:00
parent 41b05064c8
commit 891fd00b5f
3 changed files with 34 additions and 9 deletions

View File

@@ -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){

View File

@@ -15,9 +15,6 @@
>
{{ displayedModifier }}
</span>
{{ model.name }}<template v-if="model.conditionalBenefits">
*
</template>
<v-icon
v-if="model.advantage > 0"
size="20px"
@@ -30,6 +27,13 @@
>
arrow_downward
</v-icon>
{{ model.name }}
<template v-if="model.conditionalBenefits.length">
*
</template>
<template v-if="model.passiveBonus">
({{ passiveScore }})
</template>
</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>
@@ -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){

View File

@@ -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;
}
},