feat(content): add action unlock condition schema
This commit is contained in:
@@ -20,16 +20,23 @@ export const resourceAmountSchema = z.object({
|
||||
amount: z.number().positive(),
|
||||
});
|
||||
|
||||
export const unlockDefSchema = z.object({
|
||||
minResources: z.record(z.string(), z.number().nonnegative()).optional(),
|
||||
requireStoryFlags: z.array(z.string().min(1)).optional(),
|
||||
});
|
||||
|
||||
export const actionDefSchema = z.object({
|
||||
id: z.string().min(1),
|
||||
name: z.string().min(1),
|
||||
durationMs: z.number().positive(),
|
||||
costs: z.array(resourceAmountSchema).default([]),
|
||||
yields: z.array(resourceAmountSchema).min(1),
|
||||
unlock: unlockDefSchema.optional(),
|
||||
});
|
||||
|
||||
export type ResourceDef = z.infer<typeof resourceDefSchema>;
|
||||
export type ResourceAmount = z.infer<typeof resourceAmountSchema>;
|
||||
export type UnlockDef = z.infer<typeof unlockDefSchema>;
|
||||
export type ActionDef = z.infer<typeof actionDefSchema>;
|
||||
|
||||
export interface Content {
|
||||
|
||||
Reference in New Issue
Block a user