Files
DiceCloud/rpg-docs/Model/Character/Features.js

30 lines
1.0 KiB
JavaScript

Features = new Mongo.Collection("features");
Schemas.Feature = new SimpleSchema({
charId: {type: String, regEx: SimpleSchema.RegEx.Id},
name: {type: String, trim: false},
description:{type: String, optional: true, trim: false},
uses: {type: String, optional: true, trim: false},
used: {type: Number, defaultValue: 0},
reset: {type: String, allowedValues: ["manual", "longRest", "shortRest"], defaultValue: "manual"},
enabled: {type: String, allowedValues: ["enabled", "disabled", "alwaysEnabled"], defaultValue: "alwaysEnabled"},
color: {type: String, allowedValues: _.pluck(colorOptions, "key"), defaultValue: "q"}
});
Features.attachSchema(Schemas.Feature);
Features.helpers({
usesLeft: function(){
return evaluate(this.charId, this.uses) - this.used;
},
usesValue: function(){
return evaluate(this.charId, this.uses);
}
});
Features.attachBehaviour('softRemovable');
makeParent(Features); //parents of effects and attacks
Features.allow(CHARACTER_SUBSCHEMA_ALLOW);
Features.deny(CHARACTER_SUBSCHEMA_DENY);