- Actions/spells now display their summary, not their description - All save branches and attack branches run when there are no targets - Improved action logging - Index branch lets you customise a choice of children to run
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
import SimpleSchema from 'simpl-schema';
|
|
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
|
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
|
|
|
let BranchSchema = createPropertySchema({
|
|
branchType: {
|
|
type: String,
|
|
allowedValues: [
|
|
// Uses the condition field to determine whether to apply children
|
|
'if',
|
|
// Attack
|
|
'hit',
|
|
'miss',
|
|
// Save
|
|
'failedSave',
|
|
'successfulSave',
|
|
// Iterate through targets
|
|
'eachTarget',
|
|
// Pick one child at random
|
|
'random',
|
|
// Pick one child based on a given index
|
|
'index',
|
|
// if it has option children, asks to select one
|
|
// Otherwise presents its own text with yes/no
|
|
//'choice',
|
|
//'option',
|
|
],
|
|
defaultValue: 'if',
|
|
},
|
|
text: {
|
|
type: String,
|
|
optional: true,
|
|
max: STORAGE_LIMITS.name,
|
|
},
|
|
condition: {
|
|
type: 'fieldToCompute',
|
|
optional: true,
|
|
parseLevel: 'compile',
|
|
},
|
|
});
|
|
|
|
let ComputedOnlyBranchSchema = createPropertySchema({
|
|
condition: {
|
|
type: 'computedOnlyField',
|
|
optional: true,
|
|
parseLevel: 'compile',
|
|
},
|
|
});
|
|
|
|
const ComputedBranchSchema = new SimpleSchema()
|
|
.extend(BranchSchema)
|
|
.extend(ComputedOnlyBranchSchema);
|
|
|
|
export { BranchSchema, ComputedBranchSchema, ComputedOnlyBranchSchema }
|