Skip to content

Commit

Permalink
fix monster saves that have explicit bonuses
Browse files Browse the repository at this point in the history
closes #307
  • Loading branch information
eepMoody committed Oct 25, 2019
1 parent ff294c2 commit 8a1fee0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion components/StatBonus.vue
Expand Up @@ -10,11 +10,18 @@
export default {
computed: {
statBonus: function () {
return (Math.floor((this.stat - 10)/2));
if (this.type === 'score') {
return Math.floor((this.stat -10)/2);
}
else return this.stat;
}
},
props: {
stat: Number,
type: {
type: String,
default: "score"
}
},
}
</script>
Expand Down
6 changes: 3 additions & 3 deletions pages/monsters/_id.vue
Expand Up @@ -52,7 +52,7 @@
<b>Saving Throws</b>
<span v-for="(save, index) in getSaves" :key="save.name">
{{save.name}}
<stat-bonus :stat="save.val"></stat-bonus><span v-if="index < getSaves.length -1">, </span>
<stat-bonus :stat="save.val" :type="save.type"></stat-bonus><span v-if="index < getSaves.length -1">, </span>
</span>
</p>
<p v-if="monster.skills">
Expand Down Expand Up @@ -124,9 +124,9 @@ export default {
const statValue = this.monster[savesArray[i].name];
console.log(`${saveValue} vs ${statValue}`);
if (saveValue !== null) {
saves.push({name: savesArray[i].display, val: saveValue})
saves.push({name: savesArray[i].display, val: saveValue, type: 'bonus'})
} else {
saves.push({name: savesArray[i].display, val: statValue})
saves.push({name: savesArray[i].display, val: statValue, type: 'score'})
}
}
Expand Down

0 comments on commit 8a1fee0

Please sign in to comment.