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.
This commit is contained in:
Jacob
2017-07-17 02:41:51 +01:00
parent b3ef43eb70
commit 17a390a8aa

View File

@@ -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);