Spell attack bonus and DC are now available in spell attacks.

This commit is contained in:
Jacob
2017-07-19 12:13:49 +01:00
parent 24cc4fd2b1
commit 0e53f157d2
6 changed files with 107 additions and 37 deletions

View File

@@ -1,15 +1,15 @@
<template name="attackView">
<div class="attackView layout horizontal">
<div class="paper-font-headline layout horizontal center" style="margin-right: 16px;">
{{evaluateSigned charId attackBonus}}
{{evaluateAttackBonus charId attack}}
</div>
<div class="layout vertical">
<div>
{{evaluateString charId damage}}&nbsp;{{damageType}}
{{evaluateDamage charId attack}}&nbsp;{{damageType}}
</div>
{{#if details}}
{{#if attack.details}}
<div class="paper-font-caption">
{{details}}
{{attack.details}}
</div>
{{/if}}
</div>

View File

@@ -0,0 +1,28 @@
Template.attackView.helpers ({
evaluateAttackBonus: function(charId, attack) {
if (attack.parent.collection == "Spells") {
var spell = Spells.findOne(attack.parent.id);
if (spell) {
bonus = evaluate(charId, attack.attackBonus, {"spellListId": spell.parent.id});
}
} else {
var bonus = evaluate(charId, attack.attackBonus);
}
if (_.isFinite(bonus)) {
return bonus > 0 ? "+" + bonus : "" + bonus;
} else {
return bonus;
}
},
evaluateDamage: function(charId, attack) {
if (attack.parent.collection == "Spells") {
var spell = Spells.findOne(attack.parent.id);
if (spell) {
return evaluateSpellString(charId, spell.parent.id, attack.damage);
}
} else {
return evaluateString(charId, attack.damage);
}
},
})