1use serde::{Deserialize, Serialize};
2use ts_rs::TS;
3
4use crate::game::{Mana, 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}
58
59#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]
61#[serde(
62 tag = "type",
63 rename_all = "camelCase",
64 rename_all_fields = "camelCase"
65)]
66#[ts(export, export_to = "prompts/common.ts")]
67pub enum PlayCardMode {
68 Normal,
69 BackFaceLand,
70 RoomRightSplit,
71 Alternative { cost: AlternativeCostKind },
72 StaticAlternative,
73 ForetellExile,
74 UnlockDoor,
75}
76
77#[derive(Debug, Clone, Serialize, Deserialize, TS)]
78#[serde(rename_all = "camelCase")]
79#[ts(export, export_to = "prompts/common.ts")]
80pub struct ActivatableAbilityInfo {
81 pub card_id: String,
82 pub ability_index: usize,
83 pub description: String,
84 pub is_mana_ability: bool,
85 #[serde(default, skip_serializing_if = "Option::is_none")]
86 #[ts(optional)]
87 pub is_class_level_up: Option<bool>,
88 #[serde(default, skip_serializing_if = "Option::is_none")]
89 #[ts(optional)]
90 pub cost: Option<String>,
91 #[serde(default, skip_serializing_if = "Option::is_none")]
92 #[ts(optional)]
93 pub produced_mana: Option<Vec<Mana>>,
94}
95
96#[derive(Debug, Clone, Serialize, Deserialize, TS)]
97#[serde(
98 tag = "type",
99 rename_all = "camelCase",
100 rename_all_fields = "camelCase"
101)]
102#[ts(export, export_to = "prompts/common.ts")]
103pub enum AvailableActionKind {
104 Cast {
105 card_id: String,
106 mode: PlayCardMode,
107 label: String,
108 },
109 ActivateAbility(ActivatableAbilityInfo),
110 UndoMana {
111 card_id: String,
112 },
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize, TS)]
116#[ts(export, export_to = "prompts/common.ts")]
117pub struct AvailableAction {
118 pub id: String,
119 #[serde(flatten)]
120 #[ts(flatten)]
121 pub kind: AvailableActionKind,
122}
123
124#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]
125#[serde(rename_all = "camelCase")]
126#[ts(export, export_to = "prompts/common.ts")]
127pub enum PaymentResourceKind {
128 Convoke,
129 Improvise,
130 Delve,
131}
132
133#[derive(Debug, Clone, Serialize, Deserialize, TS)]
134#[serde(
135 tag = "type",
136 rename_all = "camelCase",
137 rename_all_fields = "camelCase"
138)]
139#[ts(export, export_to = "prompts/common.ts")]
140pub enum PaymentActionKind {
141 ActivateManaAbility(ActivatableAbilityInfo),
142 UndoMana {
143 card_id: String,
144 },
145 UseResource {
146 card_id: String,
147 resource: PaymentResourceKind,
148 },
149 ReleaseResource {
150 card_id: String,
151 resource: PaymentResourceKind,
152 },
153 PayLife {
154 amount: u32,
155 },
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize, TS)]
159#[ts(export, export_to = "prompts/common.ts")]
160pub struct PaymentAction {
161 pub id: String,
162 #[serde(flatten)]
163 #[ts(flatten)]
164 pub kind: PaymentActionKind,
165}
166
167#[derive(Debug, Clone, Serialize, Deserialize, TS)]
168#[serde(rename_all = "camelCase")]
169#[ts(export, export_to = "prompts/common.ts")]
170pub enum AttackTargetKind {
171 Player,
172 Planeswalker,
173 Battle,
174}
175
176#[derive(Debug, Clone, Serialize, Deserialize, TS)]
177#[serde(rename_all = "camelCase")]
178#[ts(export, export_to = "prompts/common.ts")]
179pub struct AttackTargetDto {
180 pub id: String,
181 pub label: String,
182 pub kind: AttackTargetKind,
183}
184
185#[derive(Debug, Clone, Serialize, Deserialize, TS)]
186#[serde(rename_all = "camelCase")]
187#[ts(export, export_to = "prompts/common.ts")]
188pub struct BlockAssignment {
189 pub blocker_id: String,
190 pub attacker_id: String,
191}
192
193#[derive(Debug, Clone, Serialize, Deserialize, TS)]
194#[serde(rename_all = "camelCase")]
195#[ts(export, export_to = "prompts/common.ts")]
196pub struct AttackAssignment {
197 pub attacker_id: String,
198 pub target_id: String,
199}
200
201#[derive(Debug, Clone, Serialize, Deserialize, TS)]
202#[serde(rename_all = "camelCase")]
203#[ts(export, export_to = "prompts/common.ts")]
204pub struct CombatDamageAssignmentEntry {
205 pub assignee_id: String,
206 pub damage: i32,
207}
208
209#[derive(Debug, Clone, Serialize, Deserialize, TS)]
210#[serde(
211 tag = "kind",
212 rename_all = "camelCase",
213 rename_all_fields = "camelCase"
214)]
215#[ts(export, export_to = "prompts/common.ts")]
216pub enum TargetAnyChoice {
217 Player { player_id: String },
218 Card { card_id: String },
219 None,
220}
221
222#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]
223#[serde(rename_all = "camelCase")]
224#[ts(export, export_to = "prompts/common.ts")]
225pub enum TargetKind {
226 Player,
227 Card,
228 Spell,
229}
230
231#[derive(Debug, Clone, Serialize, Deserialize, TS)]
232#[serde(rename_all = "camelCase")]
233#[ts(export, export_to = "prompts/common.ts")]
234pub struct TargetRef {
235 pub kind: TargetKind,
236 pub id: String,
237 #[serde(default, skip_serializing_if = "Option::is_none")]
238 #[ts(optional)]
239 pub intent: Option<TargetingIntent>,
240 #[serde(default, skip_serializing_if = "Option::is_none")]
241 #[ts(optional)]
242 pub oracle: Option<String>,
243}