Started restructuring the library with attacks, saves, and limited parenting

This commit is contained in:
Stefan Zermatten
2019-08-12 16:42:30 +02:00
parent 6f4710bee3
commit a8b3fc3f2f
14 changed files with 204 additions and 91 deletions

View File

@@ -0,0 +1,38 @@
import SimpleSchema from 'simpl-schema';
import AdjustmentSchema from '/imports/api/creature/subSchemas/AdjustmentSchema.js';
import { ActionSchema } from '/imports/api/properties/Actions.js';
// Attacks are special instances of actions
let AttackSchema = new SimpleSchema()
.extend(ActionSchema)
.extend({
// What gets added to the d20 roll
rollBonus: {
type: String,
optional: true,
},
// What damage does it do to the targets
adjustments: {
type: Array,
defaultValue: [],
},
'adjustments.$': {
type: AdjustmentSchema,
},
// If set reference an item whose quantity is reduced by 1 every time this
// attack is rolled
ammunition: {
type: String,
regEx: SimpleSchema.RegEx.Id,
optional: true,
},
// Set better defaults for the action
type: {
defaultValue: 'attack',
},
tags: {
defaultValue: ['attack'],
},
});
export { AttackSchema };