Changed data structure around attacks and their consumed resources

This commit is contained in:
Thaum Rystra
2020-04-04 18:18:38 +02:00
parent 97111741bf
commit 1856e90d12
5 changed files with 56 additions and 12 deletions

View File

@@ -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,
},
});

View File

@@ -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.$': {

View File

@@ -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,

View 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;

View File

@@ -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": {