diff --git a/app/imports/api/properties/ClassLevels.js b/app/imports/api/properties/ClassLevels.js index 9b42c7b9..befbaf83 100644 --- a/app/imports/api/properties/ClassLevels.js +++ b/app/imports/api/properties/ClassLevels.js @@ -19,6 +19,7 @@ const ClassLevelSchema = createPropertySchema({ min: 2, regEx: VARIABLE_NAME_REGEX, max: STORAGE_LIMITS.variableName, + optional: true, }, level: { type: SimpleSchema.Integer, diff --git a/app/imports/api/properties/Classes.js b/app/imports/api/properties/Classes.js index e2b89e87..ee631246 100644 --- a/app/imports/api/properties/Classes.js +++ b/app/imports/api/properties/Classes.js @@ -1,76 +1,20 @@ import SimpleSchema from 'simpl-schema'; import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js'; import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js'; +import { SlotSchema, ComputedOnlySlotSchema } from './Slots.js'; // Classes are like slots, except they only take class levels and enforce that // lower levels are taken before higher levels let ClassSchema = createPropertySchema({ - name: { - type: String, - optional: true, - max: STORAGE_LIMITS.name, - }, - description: { - type: 'inlineCalculationFieldToCompute', - optional: true, - }, - // Only `classLevel`s with the same variable name can fill the class - variableName: { - type: String, - optional: true, - max: STORAGE_LIMITS.variableName, - }, - classType: { - type: String, - allowedValues: ['startingClass', 'multiClass'], - defaultValue: 'startingClass', - }, - // Same tag format as Slots to match library classLevels against - slotTags: { - type: Array, - defaultValue: [], - maxCount: STORAGE_LIMITS.tagCount, - }, - 'slotTags.$': { - type: String, - max: STORAGE_LIMITS.tagLength, - }, - extraTags: { - type: Array, - defaultValue: [], - maxCount: STORAGE_LIMITS.extraTagsCount, - }, - 'extraTags.$': { - type: Object, - }, - 'extraTags.$._id': { - type: String, - regEx: SimpleSchema.RegEx.Id, - autoValue(){ - if (!this.isSet) return Random.id(); - } - }, - 'extraTags.$.operation': { - type: String, - allowedValues: ['OR', 'NOT'], - defaultValue: 'OR', - }, - 'extraTags.$.tags': { - type: Array, - defaultValue: [], - maxCount: STORAGE_LIMITS.tagCount, - }, - 'extraTags.$.tags.$': { - type: String, - max: STORAGE_LIMITS.tagLength, - }, - }); + // Only `classLevel`s with the same variable name can fill the class + variableName: { + type: String, + optional: true, + max: STORAGE_LIMITS.variableName, + }, +}).extend(SlotSchema); const ComputedOnlyClassSchema = createPropertySchema({ - description: { - type: 'inlineCalculationFieldToCompute', - optional: true, - }, level: { type: SimpleSchema.Integer, optional: true, @@ -84,7 +28,7 @@ const ComputedOnlyClassSchema = createPropertySchema({ 'missingLevels.$': { type: SimpleSchema.Integer, }, - }); + }).extend(ComputedOnlySlotSchema); const ComputedClassSchema = new SimpleSchema() .extend(ClassSchema) diff --git a/app/imports/api/properties/Damages.js b/app/imports/api/properties/Damages.js index 80464696..12e55623 100644 --- a/app/imports/api/properties/Damages.js +++ b/app/imports/api/properties/Damages.js @@ -14,7 +14,7 @@ const DamageSchema = createPropertySchema({ // Who this damage applies to target: { type: String, - defaultValue: 'every', + defaultValue: 'target', allowedValues: [ 'self', 'target', diff --git a/app/imports/api/properties/Features.js b/app/imports/api/properties/Features.js index 9421c965..0abe8be9 100644 --- a/app/imports/api/properties/Features.js +++ b/app/imports/api/properties/Features.js @@ -6,6 +6,7 @@ let FeatureSchema = createPropertySchema({ name: { type: String, max: STORAGE_LIMITS.name, + optional: true, }, summary: { type: 'inlineCalculationFieldToCompute', diff --git a/app/imports/api/properties/Slots.js b/app/imports/api/properties/Slots.js index b19defd3..310ba198 100644 --- a/app/imports/api/properties/Slots.js +++ b/app/imports/api/properties/Slots.js @@ -89,7 +89,7 @@ let SlotSchema = createPropertySchema({ const ComputedOnlySlotSchema = createPropertySchema({ // Computed fields description: { - type: 'inlineCalculationFieldToCompute', + type: 'computedOnlyInlineCalculationField', optional: true, }, quantityExpected: { diff --git a/app/imports/ui/components/propertyToolbar.vue b/app/imports/ui/components/propertyToolbar.vue index 32282734..36b24414 100644 --- a/app/imports/ui/components/propertyToolbar.vue +++ b/app/imports/ui/components/propertyToolbar.vue @@ -102,6 +102,7 @@ /> diff --git a/app/imports/ui/creature/creatureProperties/CreaturePropertyDialog.vue b/app/imports/ui/creature/creatureProperties/CreaturePropertyDialog.vue index 67c647fa..df761d70 100644 --- a/app/imports/ui/creature/creatureProperties/CreaturePropertyDialog.vue +++ b/app/imports/ui/creature/creatureProperties/CreaturePropertyDialog.vue @@ -14,18 +14,6 @@ /> diff --git a/app/imports/ui/properties/viewers/ActionViewer.vue b/app/imports/ui/properties/viewers/ActionViewer.vue index 89c72e80..08f3be8f 100644 --- a/app/imports/ui/properties/viewers/ActionViewer.vue +++ b/app/imports/ui/properties/viewers/ActionViewer.vue @@ -93,20 +93,10 @@ /> - - - - - - - - - - diff --git a/app/imports/ui/properties/viewers/ClassLevelViewer.vue b/app/imports/ui/properties/viewers/ClassLevelViewer.vue index 4ef5c83b..27dca3ca 100644 --- a/app/imports/ui/properties/viewers/ClassLevelViewer.vue +++ b/app/imports/ui/properties/viewers/ClassLevelViewer.vue @@ -1,16 +1,25 @@ @@ -19,6 +28,11 @@ import propertyViewerMixin from '/imports/ui/properties/viewers/shared/propertyV export default { mixins: [propertyViewerMixin], + inject: { + context: { + default: {}, + }, + }, } diff --git a/app/imports/ui/properties/viewers/ConstantViewer.vue b/app/imports/ui/properties/viewers/ConstantViewer.vue index c6e62cb0..e38839d8 100644 --- a/app/imports/ui/properties/viewers/ConstantViewer.vue +++ b/app/imports/ui/properties/viewers/ConstantViewer.vue @@ -1,23 +1,23 @@ diff --git a/app/imports/ui/properties/viewers/ContainerViewer.vue b/app/imports/ui/properties/viewers/ContainerViewer.vue index 90138387..d66f9f08 100644 --- a/app/imports/ui/properties/viewers/ContainerViewer.vue +++ b/app/imports/ui/properties/viewers/ContainerViewer.vue @@ -1,107 +1,107 @@ diff --git a/app/imports/ui/properties/viewers/DamageMultiplierViewer.vue b/app/imports/ui/properties/viewers/DamageMultiplierViewer.vue index 9f4bafe8..70b746bf 100644 --- a/app/imports/ui/properties/viewers/DamageMultiplierViewer.vue +++ b/app/imports/ui/properties/viewers/DamageMultiplierViewer.vue @@ -1,9 +1,15 @@ diff --git a/app/imports/ui/properties/viewers/DamageViewer.vue b/app/imports/ui/properties/viewers/DamageViewer.vue index 3bb69284..524964ab 100644 --- a/app/imports/ui/properties/viewers/DamageViewer.vue +++ b/app/imports/ui/properties/viewers/DamageViewer.vue @@ -1,9 +1,22 @@ @@ -12,6 +25,12 @@ export default { mixins: [propertyViewerMixin], + computed: { + type(){ + if (this.model.damageType === 'healing') return this.model.damageType; + return `${this.model.damageType} damage` + }, + } } diff --git a/app/imports/ui/properties/viewers/EffectViewer.vue b/app/imports/ui/properties/viewers/EffectViewer.vue index 0730ca71..64159818 100644 --- a/app/imports/ui/properties/viewers/EffectViewer.vue +++ b/app/imports/ui/properties/viewers/EffectViewer.vue @@ -1,38 +1,37 @@ diff --git a/app/imports/ui/properties/viewers/shared/PropertyDescription.vue b/app/imports/ui/properties/viewers/shared/PropertyDescription.vue index 2eb5fa56..2853bbd3 100644 --- a/app/imports/ui/properties/viewers/shared/PropertyDescription.vue +++ b/app/imports/ui/properties/viewers/shared/PropertyDescription.vue @@ -2,7 +2,7 @@ @@ -22,16 +24,26 @@
- {{ value }} + +
@@ -50,7 +62,12 @@ export default { type: [String, Number, Boolean], default: undefined, }, + calculation: { + type: Object, + default: undefined, + }, center: Boolean, + end: Boolean, large: Boolean, mono: Boolean, cols: { @@ -58,6 +75,27 @@ export default { default: () => ({cols: 12, sm: 6, md: 4}), }, }, + computed: { + showCalculationInsteadOfValue(){ + if (!this.calculation) return; + return this.calculation && this.calculation.value === undefined; + }, + // large and center are only applied to calculations if we are showing their + // value, if we are showing the calculation itself, large and center are + // turned off + isLarge(){ + if (this.showCalculationInsteadOfValue) return false; + return this.large; + }, + isCenter(){ + if (this.showCalculationInsteadOfValue) return false; + return this.center; + }, + isMono(){ + if (this.showCalculationInsteadOfValue) return true; + return this.mono; + } + }, } diff --git a/app/imports/ui/properties/viewers/shared/propertyViewerIndex.js b/app/imports/ui/properties/viewers/shared/propertyViewerIndex.js index 32b260d4..c748e2ab 100644 --- a/app/imports/ui/properties/viewers/shared/propertyViewerIndex.js +++ b/app/imports/ui/properties/viewers/shared/propertyViewerIndex.js @@ -1,6 +1,5 @@ import ActionViewer from '/imports/ui/properties/viewers/ActionViewer.vue'; import AdjustmentViewer from '/imports/ui/properties/viewers/AdjustmentViewer.vue'; -import AttackViewer from '/imports/ui/properties/viewers/AttackViewer.vue'; import AttributeViewer from '/imports/ui/properties/viewers/AttributeViewer.vue'; import BuffViewer from '/imports/ui/properties/viewers/BuffViewer.vue'; import ContainerViewer from '/imports/ui/properties/viewers/ContainerViewer.vue'; @@ -27,10 +26,10 @@ import ToggleViewer from '/imports/ui/properties/viewers/ToggleViewer.vue'; export default { action: ActionViewer, adjustment: AdjustmentViewer, - attack: AttackViewer, attribute: AttributeViewer, buff: BuffViewer, container: ContainerViewer, + class: SlotViewer, classLevel: ClassLevelViewer, constant: ConstantViewer, damage: DamageViewer,