From 17a390a8aa87fd0b998ce8f48c05fe17b7f0ba5b Mon Sep 17 00:00:00 2001 From: Jacob Date: Mon, 17 Jul 2017 02:41:51 +0100 Subject: [PATCH] Changed Model of Buffs for forwards compatibility Added a parent attribute and made Buffs a child, so that buffs can be added to items, spells and features. --- rpg-docs/Model/Character/Buffs.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rpg-docs/Model/Character/Buffs.js b/rpg-docs/Model/Character/Buffs.js index 3d8c41c5..596679cd 100644 --- a/rpg-docs/Model/Character/Buffs.js +++ b/rpg-docs/Model/Character/Buffs.js @@ -22,7 +22,7 @@ Schemas.Buff = new SimpleSchema({ type: { type: String, allowedValues: [ - "inate", + "inate", //this should be "innate", but changing it could be problematic "custom", ], }, @@ -41,12 +41,18 @@ Schemas.Buff = new SimpleSchema({ allowedValues: _.pluck(colorOptions, "key"), defaultValue: "q", }, + //the id of the feature, buff or item that created this buff + parent: { + type: Schemas.Parent, + optional: true, + }, }); Buffs.attachSchema(Schemas.Buff); Buffs.attachBehaviour("softRemovable"); -makeParent(Buffs, ["name", "enabled"]); //parents of effects +makeParent(Buffs, ["name", "enabled"]); //parents of effects, attacks, proficiencies +makeChild(Buffs, ["enabled"]); //children of lots of things Buffs.allow(CHARACTER_SUBSCHEMA_ALLOW); Buffs.deny(CHARACTER_SUBSCHEMA_DENY);