Changed data structure around attacks and their consumed resources
This commit is contained in:
@@ -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,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -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.$': {
|
||||
|
||||
@@ -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,
|
||||
|
||||
34
app/imports/api/properties/subSchemas/ResourceSchema.js
Normal file
34
app/imports/api/properties/subSchemas/ResourceSchema.js
Normal file
@@ -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;
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user