1use serde::{Deserialize, Serialize};
2use ts_rs::TS;
3
4use crate::game::{Mana, RoomDoor, TargetingIntent};
5
6#[derive(Debug, Clone, Serialize, Deserialize, TS)]
7#[serde(rename_all = "camelCase")]
8#[ts(export, export_to = "prompts/common.ts")]
9pub struct PromptPresentation {
10 pub title: String,
11 #[serde(default, skip_serializing_if = "Option::is_none")]
12 #[ts(optional)]
13 pub description: Option<String>,
14 #[serde(default, skip_serializing_if = "Option::is_none")]
15 #[ts(optional)]
16 pub text: Option<String>,
17 #[serde(default)]
18 pub targets: Vec<TargetRef>,
19}
20
21#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]
23#[serde(rename_all = "camelCase")]
24#[ts(export, export_to = "prompts/common.ts")]
25pub enum AlternativeCostKind {
26 Flashback,
27 Spectacle,
28 Evoke,
29 Dash,
30 Blitz,
31 Escape,
32 Overload,
33 Madness,
34 Foretell,
35 Emerge,
36 Suspend,
37 Morph,
38 Megamorph,
39 Bestow,
40 Warp,
41 SacrificeAlt,
42 Plot,
43 Awaken,
44 Disturb,
45 Harmonize,
46 Freerunning,
47 Impending,
48 Mayhem,
49 #[serde(rename = "moreThanMeetsTheEye")]
50 MTMtE,
51 Mutate,
52 Prowl,
53 Sneak,
54 Surge,
55 WebSlinging,
56 Plotted,
57 Prototype,
58}
59
60#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]
62#[serde(
63 tag = "type",
64 rename_all = "camelCase",
65 rename_all_fields = "camelCase"
66)]
67#[ts(export, export_to = "prompts/common.ts")]
68pub enum PlayCardMode {
69 Normal,
70 BackFaceLand,
71 RoomRightSplit,
72 Adventure,
73 Alternative { cost: AlternativeCostKind },
74 StaticAlternative,
75 ForetellExile,
76 UnlockDoor { door: RoomDoor },
77}
78
79#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]
80#[serde(rename_all = "camelCase")]
81#[ts(export, export_to = "prompts/common.ts")]
82pub enum LevelUpKind {
83 Class,
84 Creature,
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize, TS)]
88#[serde(rename_all = "camelCase")]
89#[ts(export, export_to = "prompts/common.ts")]
90pub struct ActivatableAbilityInfo {
91 pub card_id: String,
92 pub ability_index: usize,
93 pub description: String,
94 pub is_mana_ability: bool,
95 #[serde(default, skip_serializing_if = "Option::is_none")]
96 #[ts(optional)]
97 pub level_up: Option<LevelUpKind>,
98 #[serde(default, skip_serializing_if = "Option::is_none")]
99 #[ts(optional)]
100 pub cost: Option<String>,
101 #[serde(default, skip_serializing_if = "Option::is_none")]
102 #[ts(optional)]
103 pub produced_mana: Option<Vec<Mana>>,
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize, TS)]
107#[serde(
108 tag = "type",
109 rename_all = "camelCase",
110 rename_all_fields = "camelCase"
111)]
112#[ts(export, export_to = "prompts/common.ts")]
113pub enum AvailableActionKind {
114 Cast {
115 card_id: String,
116 mode: PlayCardMode,
117 label: String,
118 #[serde(default, skip_serializing_if = "Option::is_none")]
119 #[ts(optional)]
120 face_index: Option<u8>,
121 },
122 ActivateAbility(ActivatableAbilityInfo),
123 UndoMana {
124 card_id: String,
125 },
126}
127
128#[derive(Debug, Clone, Serialize, Deserialize, TS)]
129#[ts(export, export_to = "prompts/common.ts")]
130pub struct AvailableAction {
131 pub id: String,
132 #[serde(flatten)]
133 #[ts(flatten)]
134 pub kind: AvailableActionKind,
135}
136
137#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]
138#[serde(rename_all = "camelCase")]
139#[ts(export, export_to = "prompts/common.ts")]
140pub enum PaymentResourceKind {
141 Convoke,
142 Improvise,
143 Delve,
144 Waterbend,
145}
146
147#[derive(Debug, Clone, Serialize, Deserialize, TS)]
148#[serde(
149 tag = "type",
150 rename_all = "camelCase",
151 rename_all_fields = "camelCase"
152)]
153#[ts(export, export_to = "prompts/common.ts")]
154pub enum PaymentActionKind {
155 ActivateManaAbility(ActivatableAbilityInfo),
156 UndoMana {
157 card_id: String,
158 },
159 UseResource {
160 card_id: String,
161 resource: PaymentResourceKind,
162 },
163 ReleaseResource {
164 card_id: String,
165 resource: PaymentResourceKind,
166 },
167 PayLife {
168 amount: u32,
169 },
170}
171
172#[derive(Debug, Clone, Serialize, Deserialize, TS)]
173#[ts(export, export_to = "prompts/common.ts")]
174pub struct PaymentAction {
175 pub id: String,
176 #[serde(flatten)]
177 #[ts(flatten)]
178 pub kind: PaymentActionKind,
179}
180
181#[derive(Debug, Clone, Serialize, Deserialize, TS)]
182#[serde(rename_all = "camelCase")]
183#[ts(export, export_to = "prompts/common.ts")]
184pub enum AttackTargetKind {
185 Player,
186 Planeswalker,
187 Battle,
188}
189
190#[derive(Debug, Clone, Serialize, Deserialize, TS)]
191#[serde(rename_all = "camelCase")]
192#[ts(export, export_to = "prompts/common.ts")]
193pub struct AttackTargetDto {
194 pub id: String,
195 pub label: String,
196 pub kind: AttackTargetKind,
197}
198
199#[derive(Debug, Clone, Serialize, Deserialize, TS)]
200#[serde(rename_all = "camelCase")]
201#[ts(export, export_to = "prompts/common.ts")]
202pub struct BlockAssignment {
203 pub blocker_id: String,
204 pub attacker_id: String,
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize, TS)]
208#[serde(rename_all = "camelCase")]
209#[ts(export, export_to = "prompts/common.ts")]
210pub struct AttackAssignment {
211 pub attacker_id: String,
212 pub target_id: String,
213}
214
215#[derive(Debug, Clone, Serialize, Deserialize, TS)]
216#[serde(rename_all = "camelCase")]
217#[ts(export, export_to = "prompts/common.ts")]
218pub struct CombatDamageAssignmentEntry {
219 pub assignee_id: String,
220 pub damage: i32,
221}
222
223#[derive(Debug, Clone, Serialize, Deserialize, TS)]
224#[serde(
225 tag = "kind",
226 rename_all = "camelCase",
227 rename_all_fields = "camelCase"
228)]
229#[ts(export, export_to = "prompts/common.ts")]
230pub enum TargetAnyChoice {
231 Player { player_id: String },
232 Card { card_id: String },
233 None,
234}
235
236#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]
237#[serde(rename_all = "camelCase")]
238#[ts(export, export_to = "prompts/common.ts")]
239pub enum TargetKind {
240 Player,
241 Card,
242 Spell,
243}
244
245#[derive(Debug, Clone, Serialize, Deserialize, TS)]
246#[serde(rename_all = "camelCase")]
247#[ts(export, export_to = "prompts/common.ts")]
248pub struct TargetRef {
249 pub kind: TargetKind,
250 pub id: String,
251 #[serde(default, skip_serializing_if = "Option::is_none")]
252 #[ts(optional)]
253 pub intent: Option<TargetingIntent>,
254 #[serde(default, skip_serializing_if = "Option::is_none")]
255 #[ts(optional)]
256 pub oracle: Option<String>,
257}