diff --git a/app/imports/api/properties/Actions.js b/app/imports/api/properties/Actions.js index cc6eedbf..f563c19c 100644 --- a/app/imports/api/properties/Actions.js +++ b/app/imports/api/properties/Actions.js @@ -1,4 +1,5 @@ import SimpleSchema from 'simpl-schema'; +import ResourceSchema from '/imports/api/properties/subSchemas/ResourceSchema.js' import ResultsSchema from '/imports/api/properties/subSchemas/ResultsSchema.js'; /* @@ -7,7 +8,9 @@ import ResultsSchema from '/imports/api/properties/subSchemas/ResultsSchema.js'; * Any actions that are children of this action will be considered alternatives * to this action */ -let ActionSchema = new SimpleSchema({ +let ActionSchema = new SimpleSchema({}) +.extend(ResourceSchema) +.extend({ name: { type: String, optional: true, @@ -59,7 +62,7 @@ let ActionSchema = new SimpleSchema({ // How this action's uses are reset automatically reset: { type: String, - allowedValues: ["longRest", "shortRest"], + allowedValues: ['longRest', 'shortRest'], optional: true, }, }); diff --git a/app/imports/api/properties/Attacks.js b/app/imports/api/properties/Attacks.js index 1d484ba6..5d69b74e 100644 --- a/app/imports/api/properties/Attacks.js +++ b/app/imports/api/properties/Attacks.js @@ -11,19 +11,13 @@ let AttackSchema = new SimpleSchema() defaultValue: 'strength.modifier + proficiencyBonus', optional: true, }, - // 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 actionType: { + type: String, defaultValue: 'attack', }, tags: { - type: Array, + type: Array, defaultValue: ['attack'], }, 'tags.$': { diff --git a/app/imports/api/properties/Spells.js b/app/imports/api/properties/Spells.js index 90df03bf..54f720a2 100644 --- a/app/imports/api/properties/Spells.js +++ b/app/imports/api/properties/Spells.js @@ -1,3 +1,4 @@ +import { AttackSchema } from '/imports/api/properties/Attacks.js'; import SimpleSchema from 'simpl-schema'; const magicSchools = [ @@ -11,7 +12,9 @@ const magicSchools = [ 'transmutation', ]; -let SpellSchema = new SimpleSchema({ +let SpellSchema = new SimpleSchema({}) +.extend(AttackSchema) +.extend({ name: { type: String, optional: true, @@ -22,6 +25,11 @@ let SpellSchema = new SimpleSchema({ type: Boolean, optional: true, }, + // This spell ignores spell slot rules + castWithoutSpellSlots: { + type: Boolean, + optional: true, + }, // Spell lists that this spell appears on spellLists: { type: Array, diff --git a/app/imports/api/properties/subSchemas/ResourceSchema.js b/app/imports/api/properties/subSchemas/ResourceSchema.js new file mode 100644 index 00000000..9e406a3d --- /dev/null +++ b/app/imports/api/properties/subSchemas/ResourceSchema.js @@ -0,0 +1,34 @@ +import SimpleSchema from 'simpl-schema'; + +const ResourceSchema = new SimpleSchema({ + itemsConsumed: { + type: Array, + defaultValue: [], + }, + 'itemsConsumed.$': { + type: Object, + }, + 'itemsConsumed.$.variableName': { + type: String, + }, + 'itemsConsumed.$.quantity': { + type: Number, + defaultValue: 1, + }, + attributesConsumed: { + type: Array, + defaultValue: [], + }, + 'attributesConsumed.$': { + type: Object, + }, + 'attributesConsumed.$.variableName': { + type: String, + }, + 'attributesConsumed.$.quantity': { + type: Number, + defaultValue: 1, + }, +}); + +export default ResourceSchema; diff --git a/app/package.json b/app/package.json index 43369166..0ccd3939 100644 --- a/app/package.json +++ b/app/package.json @@ -59,7 +59,12 @@ "files": [ "*.vue" ], - "parser": "vue-eslint-parser" + "parser": "vue-eslint-parser", + "rules": { + "vue/component-tags-order": ["error", { + "order": ["template", "script", "style"] + }] + } } ], "parserOptions": {