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