-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.config.ts
More file actions
78 lines (75 loc) · 2.56 KB
/
content.config.ts
File metadata and controls
78 lines (75 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { defineContentConfig, defineCollection, z } from '@nuxt/content'
const amountType = z.union([
z.number().gte(0),
z.object({
min: z.number().gte(0),
max: z.number().gte(1),
}),
])
const actionsType = z.array(z.object({
type: z.string(),
card: z.string().optional(),
amount: amountType.optional(),
sound: z.string().optional(),
instantSound: z.boolean().optional(),
soundVolume: z.number().gte(0).lte(1).optional(),
actions: z.array(z.object({
type: z.string(),
card: z.string().optional(),
amount: amountType.optional(),
})).optional(),
}))
export default defineContentConfig({
collections: {
cards: defineCollection({
type: 'data',
source: 'cards/**/*.json',
schema: z.object({
identifier: z.string(),
extend: z.string().optional(),
label: z.string(),
description: z.string(),
icon: z.string().default('material-symbols:man-rounded'),
iconColor: z.string().optional().default('#000000'),
health: z.number().gte(0).lte(20).optional(),
amount: z.number().gte(0).optional(),
type: z.enum(['person', 'resource', 'building', 'merchant', 'enemy', 'event', 'limitedUsage', 'static']),
strength: z.number().gte(0).optional(),
buyable: z.boolean().default(false),
buyableMaxAmount: z.number().gte(1).default(1),
price: z.number().gt(0).optional(),
container: z.string().optional(),
containerMax: z.number().gt(1).optional(),
cooldown: z.number().gte(0).optional(),
interactions: z.array(z.object({
card: z.string(),
consume: z.boolean().default(false),
amount: z.number().gte(0).optional(),
actions: actionsType,
time: z.number().positive().default(0),
infinite: z.boolean().default(false),
showHealthInsteadOfTime: z.boolean().default(false),
consumeContainer: z.boolean().default(false),
})),
onDeath: actionsType,
onSpawn: actionsType,
timer: z.object({
time: z.number().positive().default(0),
resetWhenCardIsStacked: z.boolean().default(false),
actions: actionsType,
}).optional(),
}),
}),
events: defineCollection({
type: 'data',
source: 'events/**/*.json',
schema: z.object({
identifier: z.string(),
icon: z.string().default('material-symbols:man-rounded'),
type: z.enum(['positive', 'negative', 'neutral']),
hidden: z.boolean().default(false),
actions: actionsType,
}),
}),
},
})