From aadc83391f3e3ef890b6806a1df75579e0f2ee38 Mon Sep 17 00:00:00 2001 From: Jacob Date: Tue, 18 Jul 2017 19:52:12 +0100 Subject: [PATCH] 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 --- .../attacks/attackEditList/attackEditList.js | 22 ++++++++++++++++++- .../spells/spellDialog/spellDialog.html | 3 ++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/rpg-docs/client/views/character/attacks/attackEditList/attackEditList.js b/rpg-docs/client/views/character/attacks/attackEditList/attackEditList.js index 207f8777..dce97c32 100644 --- a/rpg-docs/client/views/character/attacks/attackEditList/attackEditList.js +++ b/rpg-docs/client/views/character/attacks/attackEditList/attackEditList.js @@ -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 - } + }, }); }, }); diff --git a/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html b/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html index 7de0fdd8..d2d77854 100644 --- a/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html +++ b/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html @@ -38,6 +38,7 @@
{{#markdown}}{{evaluateSpellString charId parent.id description}}{{/markdown}}
{{> attacksViewList charId=charId parentId=_id}} + {{> buffViewList charId=charId parentId=_id}}