Adding an attack to a spell now has attack bonus set by the spell list

Default damage is also changed to 1d10 fire for spells
This commit is contained in:
Jacob
2017-07-18 19:52:12 +01:00
parent 2a332a2965
commit aadc83391f
2 changed files with 23 additions and 2 deletions

View File

@@ -7,12 +7,32 @@ Template.attackEditList.helpers({
Template.attackEditList.events({
"tap #addAttackButton": function() {
if (typeof this.isSpell !== 'undefined' && this.isSpell) {
var parentSpell = Spells.findOne({"_id": this.parentId})
if (parentSpell && parentSpell.parent.collection == "SpellLists") {
var spellList = SpellLists.findOne({"_id":parentSpell.parent.id});
if (spellList && spellList.attackBonus) {
Attacks.insert({
charId: this.charId,
parent: {
id: this.parentId,
collection: this.parentCollection
},
attackBonus: spellList.attackBonus,
damage: "1d10",
damageType: "fire",
});
return;
}
}
}
Attacks.insert({
charId: this.charId,
parent: {
id: this.parentId,
collection: this.parentCollection
}
},
});
},
});

View File

@@ -38,6 +38,7 @@
</div>
<div>{{#markdown}}{{evaluateSpellString charId parent.id description}}{{/markdown}}</div>
{{> attacksViewList charId=charId parentId=_id}}
{{> buffViewList charId=charId parentId=_id}}
</template>
<template name="spellEdit">
@@ -114,5 +115,5 @@
<!--Description-->
<paper-textarea id="descriptionInput" label="Description" value="{{description}}">
</paper-textarea>
{{> attackEditList parentId=_id parentCollection="Spells" charId=charId enabled=true name=name}}
{{> attackEditList parentId=_id parentCollection="Spells" charId=charId enabled=true name=name isSpell=true}}
</template>