From face6387a0790cfecc0eb4b9c8883205b3efef17 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 1 Nov 2017 15:55:07 +0200 Subject: [PATCH] Fixed attacks not being added to spells added with multi-add Fixes #145 --- rpg-docs/client/views/character/spells/spells.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rpg-docs/client/views/character/spells/spells.js b/rpg-docs/client/views/character/spells/spells.js index e2b4da76..df7a68af 100644 --- a/rpg-docs/client/views/character/spells/spells.js +++ b/rpg-docs/client/views/character/spells/spells.js @@ -279,23 +279,23 @@ Template.spells.events({ collection: "SpellLists", }; spell.prepared = "prepared"; - Spells.insert(spell); + let insertedSpellId = Spells.insert(spell); // Copy over attacks and effects _.each(rawSpell.attacks, (attack) => { if (!("attackBonus" in attack)) {attack.attackBonus = "attackBonus"} //if no attack bonus provided, use spell list's attack.charId = charId; - attack.parent = {id: spellId, collection: "Spells"}; + attack.parent = {id: insertedSpellId, collection: "Spells"}; Attacks.insert(attack); }); _.each(rawSpell.effects, (effect) => { effect.charId = charId; - effect.parent = {id: spellId, collection: "Spells"}; + effect.parent = {id: insertedSpellId, collection: "Spells"}; Effects.insert(effect); }); _.each(rawSpell.buffs, (buff) => { buff.charId = charId; - buff.parent = {id: spellId, collection: "Spells"}; + buff.parent = {id: insertedSpellId, collection: "Spells"}; buffId = Buffs.insert(buff); _.each(buff.attacks, (attack) => {