Files
DiceCloud/app/imports/api/properties/Proficiencies.ts
2025-01-12 19:29:26 +02:00

38 lines
1.3 KiB
TypeScript

import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
import TagTargetingSchema from '/imports/api/properties/subSchemas/TagTargetingSchema';
import type { Expand, InferType } from '/imports/api/utility/TypedSimpleSchema';
const ProficiencySchema = createPropertySchema({
name: {
type: String,
optional: true,
max: STORAGE_LIMITS.name,
},
// The variableNames of the skills, tags, or attributes to apply proficiency to
stats: {
type: Array,
defaultValue: [],
maxCount: STORAGE_LIMITS.statsToTarget,
},
'stats.$': {
type: String,
max: STORAGE_LIMITS.variableName,
},
// A number representing how proficient the character is
// where 0.49 is half rounded down and 0.5 is half rounded up
value: {
type: Number,
allowedValues: [0.49, 0.5, 1, 2],
defaultValue: 1,
},
}).extend(TagTargetingSchema);
const ComputedOnlyProficiencySchema = createPropertySchema({});
export type Proficiency = InferType<typeof ProficiencySchema>;
export type ComputedOnlyProficiency = InferType<typeof ComputedOnlyProficiencySchema>;
export type ComputedProficiency = Expand<InferType<typeof ProficiencySchema> & InferType<typeof ComputedOnlyProficiencySchema>>;
export { ProficiencySchema, ComputedOnlyProficiencySchema };