File size: 2,805 Bytes
d87d4e5
3a7a84c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d87d4e5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
79
80
import { Type } from "@google/genai";
import { z } from "zod";

export const heroFormSchema = z.object({
  _id: z.string(),
  heroName: z.string().min(2, "Name must be at least 2 characters."),
  heroGender: z.enum(["Male", "Female"]),
  heroDescription: z.string().min(10, "Description is too short."),
  heroColor: z.string().regex(/^#[0-9a-fA-F]{6}$/, "Must be a valid hex color."),
  heroHealth: z.number().int().min(50),
  heroSpeed: z.number().min(0.5),
  basicAttack: z.object({
    type: z.enum(['RANGED', 'MELEE', 'CONTACT']),
    damage: z.number().min(1),
    cooldown: z.number().min(0.5),
    range: z.number().min(0),
  }),
  powerName: z.string().min(3, "Power name is too short."),
  powerDescription: z.string().min(10, "Power description is too short."),
  powerLogicDescription: z.string().min(10, "Power logic description is too short."),
  powerLogic: z.string().min(20, "Power logic code seems too short."),
  introLine: z.string().min(5, "Intro line is too short."),
  superpowerActivationLine: z.string().min(5, "Activation line is too short."),
  avatarPrompt: z.string().min(10),
  iconPrompt: z.string().min(10),
  avatarUrl: z.string().url("Must be a valid URL."),
  iconUrl: z.string().url("Must be a valid URL."),
  introLineAudioUrl: z.string().url().optional().nullable(),
  superpowerActivationLineAudioUrl: z.string().url().optional().nullable(),
  tags: z.array(z.string()).optional(),
});


export const heroDataSchema = {
  type: Type.OBJECT,
  properties: {
    heroName: { type: Type.STRING },
    heroGender: { type: Type.STRING },
    heroDescription: { type: Type.STRING },
    heroColor: { type: Type.STRING },
    heroHealth: { type: Type.NUMBER },
    heroSpeed: { type: Type.NUMBER },
    basicAttack: {
      type: Type.OBJECT,
      properties: {
        type: { type: Type.STRING }, // e.g., "RANGED", "MELEE", "CONTACT"
        damage: { type: Type.NUMBER },
        cooldown: { type: Type.NUMBER },
        range: { type: Type.NUMBER },
        knockback: { type: Type.NUMBER },
      },
      required: ["type", "damage", "cooldown", "range", "knockback"],
    },
    powerName: { type: Type.STRING },
    powerDescription: { type: Type.STRING },
    powerLogicDescription: { type: Type.STRING },
    introLine: { type: Type.STRING },
    superpowerActivationLine: { type: Type.STRING },
    avatarPrompt: { type: Type.STRING },
    iconPrompt: { type: Type.STRING },
    tags: { type: Type.ARRAY, items: { type: Type.STRING } },
  },
  required: [
    "heroName",
    "heroGender",
    "heroDescription",
    "heroColor",
    "heroHealth",
    "heroSpeed",
    "basicAttack",
    "powerName",
    "powerDescription",
    "powerLogicDescription",
    "introLine",
    "superpowerActivationLine",
    "avatarPrompt",
    "iconPrompt",
    "tags",
  ],
};