Added point buy to computation engine

This commit is contained in:
Stefan Zermatten
2022-08-19 14:03:12 +02:00
parent 28307e26c3
commit c6ca8c1fa4
14 changed files with 443 additions and 209 deletions

View File

@@ -176,6 +176,7 @@ let ComputedOnlyAttributeSchema = createPropertySchema({
effects: {
type: Array,
optional: true,
removeBeforeCompute: true,
},
'effects.$': {
type: Object,

View File

@@ -13,13 +13,6 @@ let PointBuySchema = createPropertySchema({
optional: true,
max: STORAGE_LIMITS.name,
},
variableName: {
type: String,
optional: true,
regEx: VARIABLE_NAME_REGEX,
min: 2,
max: STORAGE_LIMITS.variableName,
},
ignored: {
type: Boolean,
optional: true,
@@ -82,6 +75,7 @@ let PointBuySchema = createPropertySchema({
cost: {
type: 'fieldToCompute',
optional: true,
parseLevel: 'compile',
},
});
@@ -97,6 +91,7 @@ const ComputedOnlyPointBuySchema = createPropertySchema({
cost: {
type: 'computedOnlyField',
optional: true,
parseLevel: 'compile',
},
'values': {
type: Array,
@@ -117,6 +112,20 @@ const ComputedOnlyPointBuySchema = createPropertySchema({
'values.$.cost': {
type: 'computedOnlyField',
optional: true,
parseLevel: 'compile',
},
'values.$.spent': {
type: Number,
optional: true,
removeBeforeCompute: true,
},
'values.$.errors': {
type: Array,
optional: true,
removeBeforeCompute: true,
},
'values.$.errors.$': {
type: String,
},
total: {
type: 'computedOnlyField',
@@ -127,11 +136,14 @@ const ComputedOnlyPointBuySchema = createPropertySchema({
optional: true,
removeBeforeCompute: true,
},
error: {
type: String,
errors: {
type: Array,
optional: true,
removeBeforeCompute: true,
},
'errors.$': {
type: String,
},
});
const ComputedPointBuySchema = new SimpleSchema()