Files
DiceCloud/app/imports/api/properties/Damages.js
Stefan Zermatten 1b5bb981e9 Updated viewers
Action, classlevel, constant, container, damage multiplier, damage, 
effect, feature, folder, item
2021-10-19 17:19:35 +02:00

43 lines
1.1 KiB
JavaScript

import SimpleSchema from 'simpl-schema';
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
const DamageSchema = createPropertySchema({
// The roll that determines how much to damage the attribute
// This can be simplified, but only computed when applied
amount: {
type: 'fieldToCompute',
optional: true,
defaultValue: '1d8 + strength.modifier',
parseLevel: 'compile',
},
// Who this damage applies to
target: {
type: String,
defaultValue: 'target',
allowedValues: [
'self',
'target',
],
},
damageType: {
type: String,
max: STORAGE_LIMITS.calculation,
defaultValue: 'slashing',
},
});
const ComputedOnlyDamageSchema = createPropertySchema({
amount: {
type: 'computedOnlyField',
optional: true,
parseLevel: 'compile',
},
});
const ComputedDamageSchema = new SimpleSchema()
.extend(DamageSchema)
.extend(ComputedOnlyDamageSchema);
export { DamageSchema, ComputedDamageSchema, ComputedOnlyDamageSchema };