From 79ba87041e71f2f9fc385403c1adf8e450398809 Mon Sep 17 00:00:00 2001 From: Thaum Date: Thu, 5 Feb 2015 10:03:56 +0000 Subject: [PATCH] Gave Features a use limit option --- rpg-docs/Model/Character/Features.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/rpg-docs/Model/Character/Features.js b/rpg-docs/Model/Character/Features.js index bf91f924..33b791a6 100644 --- a/rpg-docs/Model/Character/Features.js +++ b/rpg-docs/Model/Character/Features.js @@ -4,9 +4,18 @@ Schemas.Feature = new SimpleSchema({ charId: {type: String, regEx: SimpleSchema.RegEx.Id}, name: {type: String}, description:{type: String, optional: true}, - actions: {type: [Schemas.Action], defaultValue: []}, - attacks: {type: [Schemas.Attack], defaultValue: []}, - spells: {type: [Schemas.Spell] , defaultValue: []}, + uses: {type: String, optional: true, trim: false}, + used: {type: Number, defaultValue: 0}, + reset: {type: String, allowedValues: ["manual", "longRest", "shortRest"], defaultValue: "manual"}, }); Features.attachSchema(Schemas.Feature); + +Features.helpers({ + usesLeft: function(){ + return evaluate(this.charId, this.uses) - this.used; + }, + usesValue: function(){ + return evaluate(this.charId, this.uses); + } +});