From 02cb6903258e3ab062cd92193d1066fb13936f2e Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Thu, 25 Jul 2019 15:44:45 +0200 Subject: [PATCH] Spells now reference their spell lists directly --- .../api/creature/properties/SpellLists.js | 18 ++++++++---------- app/imports/api/creature/properties/Spells.js | 12 +++++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/imports/api/creature/properties/SpellLists.js b/app/imports/api/creature/properties/SpellLists.js index d99d587e..c6246335 100644 --- a/app/imports/api/creature/properties/SpellLists.js +++ b/app/imports/api/creature/properties/SpellLists.js @@ -10,6 +10,7 @@ import { setDocAncestryMixin, ensureAncestryContainsCharIdMixin } from '/imports import simpleSchemaMixin from '/imports/api/creature/mixins/simpleSchemaMixin.js'; import propagateInheritanceUpdateMixin from '/imports/api/creature/mixins/propagateInheritanceUpdateMixin.js'; import updateSchemaMixin from '/imports/api/creature/mixins/updateSchemaMixin.js'; +import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js'; let SpellLists = new Mongo.Collection("spellLists"); @@ -18,20 +19,17 @@ let SpellListSchema = schema({ type: String, optional: true, }, + // The technical, lowercase, single-word name used in formulae + variableName: { + type: String, + regEx: VARIABLE_NAME_REGEX, + min: 3, + defaultValue: 'newAttribute', + }, description: { type: String, optional: true, }, - // Calculation of save DC used for all spells in this list - saveDC: { - type: String, - optional: true, - }, - // Calculation of attack bonus used for all spells in this list - attackBonus: { - type: String, - optional: true, - }, // Calculation of how many spells in this list can be prepared maxPrepared: { type: String, diff --git a/app/imports/api/creature/properties/Spells.js b/app/imports/api/creature/properties/Spells.js index e49befc4..553e1d4d 100644 --- a/app/imports/api/creature/properties/Spells.js +++ b/app/imports/api/creature/properties/Spells.js @@ -35,11 +35,13 @@ let SpellSchema = schema({ type: Boolean, defaultValue: false, }, - // Spells are enabled when they are prepared, so that unprepared spells don't - // show their actions - enabled: { - type: Boolean, - defaultValue: true, + // Spell lists that this spell appears on + spellLists: { + type: Array, + defaultValue: [], + }, + 'spellLists.$': { + type: String, }, description: { type: String,