66 lines
1.3 KiB
JavaScript
66 lines
1.3 KiB
JavaScript
import SimpleSchema from 'simpl-schema';
|
|
import InlineComputationSchema from '/imports/api/properties/subSchemas/InlineComputationSchema.js';
|
|
|
|
let BuffSchema = new SimpleSchema({
|
|
name: {
|
|
type: String,
|
|
optional: true,
|
|
},
|
|
description: {
|
|
type: String,
|
|
optional: true,
|
|
},
|
|
duration: {
|
|
type: String,
|
|
optional: true,
|
|
},
|
|
applied: {
|
|
type: Boolean,
|
|
defaultValue: false,
|
|
index: 1,
|
|
},
|
|
target: {
|
|
type: String,
|
|
allowedValues: [
|
|
'self', // the character who took the buff
|
|
'each', // rolled once for `each` target
|
|
'every', // rolled once and applied to `every` target
|
|
],
|
|
defaultValue: 'every',
|
|
},
|
|
});
|
|
|
|
let ComputedOnlyBuffSchema = new SimpleSchema({
|
|
descriptionCalculations: {
|
|
type: Array,
|
|
defaultValue: [],
|
|
maxCount: 32,
|
|
},
|
|
'descriptionCalculations.$': InlineComputationSchema,
|
|
durationSpent: {
|
|
type: Number,
|
|
optional: true,
|
|
min: 0,
|
|
},
|
|
appliedBy: {
|
|
type: Object,
|
|
optional: true,
|
|
},
|
|
'appliedBy.name': {
|
|
type: String,
|
|
},
|
|
'appliedBy.id': {
|
|
type: String,
|
|
regEx: SimpleSchema.RegEx.Id,
|
|
},
|
|
'appliedBy.collection': {
|
|
type: String,
|
|
},
|
|
})
|
|
|
|
const ComputedBuffSchema = new SimpleSchema()
|
|
.extend(BuffSchema)
|
|
.extend(ComputedOnlyBuffSchema);
|
|
|
|
export { BuffSchema, ComputedOnlyBuffSchema, ComputedBuffSchema };
|