Changed aggregation schema of computed fields

This commit is contained in:
ThaumRystra
2023-11-01 11:12:18 +02:00
parent 243684d206
commit 6ce7542c4b
7 changed files with 176 additions and 58 deletions

View File

@@ -25,28 +25,24 @@ function computedOnlyField(field) {
optional: true,
blackbox: true,
},
/*
// toString(.baseValue)
[`${field}.baseValueString`]: {
// toString(.unaffected)
[`${field}.displayUnaffected`]: {
type: SimpleSchema.oneOf(String, Number),
optional: true,
removeBeforeCompute: true,
},
*/
// The compiled parseNode after applying all effects
[`${field}.value`]: {
type: Object,
optional: true,
blackbox: true,
},
/*
// toString(.value)
[`${field}.valueString`]: {
// The displayed value of the calculation: toString(.value)
[`${field}.displayValue`]: {
type: SimpleSchema.oneOf(String, Number),
optional: true,
removeBeforeCompute: true,
},
*/
// A list of effect Ids targeting this calculation
[`${field}.effectIds`]: {
type: Array,
@@ -89,6 +85,30 @@ function computedOnlyField(field) {
[`${field}.errors.$`]: {
type: ErrorSchema,
},
// Effect aggregations
[`${field}.advantage`]: {
type: Number,
optional: true,
removeBeforeCompute: true,
},
[`${field}.disadvantage`]: {
type: Number,
optional: true,
removeBeforeCompute: true,
},
[`${field}.fail`]: {
type: Number,
optional: true,
removeBeforeCompute: true,
},
[`${field}.conditional`]: {
type: Array,
optional: true,
removeBeforeCompute: true,
},
[`${field}.conditional.$`]: {
type: String,
},
}
includeParentFields(field, schemaObj);
return new SimpleSchema(schemaObj);