Skip to main content

wowlab_manifest_schema/
combat.rs

1use serde::Deserialize;
2
3use crate::{EventEffectDef, ScalarRef};
4
5/// Structured empower behavior for a spell definition.
6#[derive(Debug, Deserialize)]
7#[serde(deny_unknown_fields)]
8pub struct EmpowerDef {
9    /// Aura that makes the empower instant and releases it at the DBC maximum rank.
10    #[serde(default)]
11    pub max_when_aura: Option<String>,
12    /// Rank-aware content driver for mechanics not represented by empower-stage data.
13    #[serde(default)]
14    pub driver: Option<String>,
15}
16
17/// Channel behavior on a [`crate::ManifestSpellDef`].
18#[derive(Debug, Default, Deserialize)]
19pub struct ChannelDef {
20    #[serde(default)]
21    pub tick_count: Option<ScalarRef>,
22    #[serde(default)]
23    pub tick_interval_ms: Option<ScalarRef>,
24    #[serde(default)]
25    pub tick_zero: bool,
26    #[serde(default)]
27    pub damage_type: ChannelDamageType,
28    #[serde(default)]
29    pub tick_damage: Option<ManifestDamageDef>,
30    #[serde(default)]
31    pub tick_damage_alt: Option<TickDamageAltDef>,
32    #[serde(default)]
33    pub tick_cost: Option<TickCostDef>,
34    #[serde(default)]
35    pub tick_cost_alt: Option<TickCostAltDef>,
36    #[serde(default)]
37    pub gcd_on_start: Option<bool>,
38    #[serde(default)]
39    pub tick_hook: Option<String>,
40    #[serde(default)]
41    pub tick_effects: Vec<EventEffectDef>,
42    /// Effects executed once after the channel's final scheduled tick.
43    #[serde(default)]
44    pub complete_effects: Vec<EventEffectDef>,
45}
46
47/// Combat result classification for a channel's child tick action.
48#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq)]
49#[serde(rename_all = "snake_case")]
50// #t(rust_non_exhaustive_on_public) fixed direct/periodic manifest vocabulary
51pub enum ChannelDamageType {
52    Direct,
53    #[default]
54    Periodic,
55}
56
57/// Aura-conditional alternative damage payload for a channel tick.
58#[derive(Debug, Deserialize)]
59pub struct TickDamageAltDef {
60    pub aura: String,
61    pub damage: ManifestDamageDef,
62}
63
64/// Per-tick resource cost for a [`ChannelDef`].
65#[derive(Debug, Default, Deserialize)]
66// #t(rust_newtype_pub_field) manifest DTO intentionally mirrors the one-field tick-cost table
67pub struct TickCostDef {
68    pub spell_id: u32,
69}
70
71/// Aura-conditional alternative tick cost for a [`ChannelDef`].
72#[derive(Debug, Default, Deserialize)]
73pub struct TickCostAltDef {
74    pub spell_id: u32,
75    pub aura: String,
76}
77
78/// `AoE` shape on a [`crate::ManifestSpellDef`].
79#[derive(Debug, Default, Deserialize)]
80pub struct AoeDef {
81    #[serde(default)]
82    pub max_targets: Option<u8>,
83    #[serde(default)]
84    pub reduced_aoe_targets: Option<u8>,
85    #[serde(default)]
86    pub full_amount_targets: Option<u8>,
87    #[serde(default)]
88    pub base_aoe_multiplier: Option<f64>,
89    #[serde(default)]
90    pub chain_multiplier: Option<f64>,
91    #[serde(default)]
92    pub split: Option<bool>,
93}
94
95/// Damage payload on a [`crate::ManifestSpellDef`] or [`ChannelDef::tick_damage`].
96#[derive(Debug, Deserialize)]
97#[serde(untagged)]
98// #t(rust_non_exhaustive_on_public) fixed serde untagged variants for manifest damage definitions
99pub enum ManifestDamageDef {
100    EffectRef {
101        spell_id: u32,
102        effect: u8,
103        kind: String,
104        #[serde(default)]
105        school: Option<DamageSchoolKind>,
106        /// Weapon-AP composite: "mainhand" (default), "both", "offhand", or "none".
107        #[serde(default)]
108        ap_type: Option<String>,
109    },
110    Ap {
111        ap_coef: f64,
112        school: DamageSchoolKind,
113    },
114    Sp {
115        sp_coef: f64,
116        school: DamageSchoolKind,
117    },
118    Flat {
119        flat: f64,
120    },
121}
122
123/// Armor-relevant damage school category used by manifest-authored payloads.
124#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq)]
125#[serde(rename_all = "snake_case")]
126// #t(rust_non_exhaustive_on_public) fixed physical/magic categories
127pub enum DamageSchoolKind {
128    Physical,
129    Magic,
130}