wowlab_engine_combat/builder/spell_builder/
resources.rs1use super::{BuilderSpellEffect, ResourcePool, SpellDefinitionDraft};
2
3impl SpellDefinitionDraft {
4 pub fn cost(mut self, amount: f64) -> Self {
5 self.resource_cost = amount;
6
7 self
8 }
9
10 pub fn cost_percent_of_base(mut self, percent: f64) -> Self {
12 self.resource_cost_pct = wowlab_types::data::ResourceCostPercent::base(percent);
13
14 self
15 }
16
17 pub fn cost_percent_of_maximum(mut self, percent: f64) -> Self {
19 self.resource_cost_pct = wowlab_types::data::ResourceCostPercent::maximum(percent);
20
21 self
22 }
23
24 pub fn health_cost(mut self, amount: f64, percent_of_maximum: f64) -> Self {
26 self.health_cost = amount.max(0.0);
27 self.health_cost_pct = percent_of_maximum.max(0.0);
28
29 self
30 }
31
32 pub fn health_optional_cost(mut self, amount: f64, percent_of_maximum: f64) -> Self {
34 self.health_optional_cost = amount.max(0.0);
35 self.health_optional_cost_pct =
36 wowlab_types::data::ResourceCostPercent::maximum(percent_of_maximum.max(0.0));
37
38 self
39 }
40
41 pub fn gain(mut self, amount: f64) -> Self {
42 self.resource_gain = amount;
43
44 self
45 }
46
47 pub fn secondary_cost(mut self, amount: f64) -> Self {
48 self.secondary_resource_cost = amount;
49
50 self
51 }
52
53 pub fn secondary_gain(mut self, amount: f64) -> Self {
54 self.secondary_resource_gain = amount;
55
56 self
57 }
58
59 pub fn additional_resource_gain(mut self, amount: f64) -> Self {
60 self.followup_effects.push(BuilderSpellEffect::Energize {
61 effect: None,
62 pool: ResourcePool::Primary,
63 amount,
64 });
65
66 self
67 }
68
69 pub(super) fn optional_cost(mut self, amount: f64) -> Self {
70 self.optional_resource_cost = amount;
71
72 self
73 }
74
75 pub(super) fn secondary_optional_cost(mut self, amount: f64) -> Self {
76 self.secondary_optional_resource_cost = amount;
77
78 self
79 }
80}