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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! Optional additional costs for spells.
//!
//! Mirrors Java's `OptionalCost.java` enum — represents additional costs
//! that may be paid when casting a spell.
use serde::{Deserialize, Serialize};
/// Optional additional costs for spells.
/// Mirrors Java's `OptionalCost.java` enum.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum OptionalCost {
/// First kicker cost was paid.
Kicker1,
/// Second kicker cost was paid (for cards with two kicker costs).
Kicker2,
/// Buyback cost was paid (return spell to hand on resolution).
Buyback,
/// Entwine cost was paid (choose all modes).
Entwine,
/// Bargain — sacrifice an artifact, enchantment, or token.
Bargain,
/// Promise of a gift — offer a card to an opponent.
PromiseGift,
/// Retrace — cast from graveyard by discarding a land.
Retrace,
/// Jumpstart — cast from graveyard by discarding a card.
Jumpstart,
/// Offering — sacrifice a creature of the specified type.
Offering,
/// Reduce white mana in cost.
ReduceW,
/// Reduce blue mana in cost.
ReduceU,
/// Reduce black mana in cost.
ReduceB,
/// Reduce red mana in cost.
ReduceR,
/// Reduce green mana in cost.
ReduceG,
/// Generic alternative cost.
AltCost,
/// Flash — cast at instant speed.
Flash,
/// Generic optional cost.
Generic,
}
impl OptionalCost {
/// Human-readable name for this optional cost.
/// Mirrors Java's `OptionalCost.getName()`.
pub fn name(&self) -> &str {
match self {
OptionalCost::Kicker1 => "Kicker",
OptionalCost::Kicker2 => "Kicker 2",
OptionalCost::Buyback => "Buyback",
OptionalCost::Entwine => "Entwine",
OptionalCost::Bargain => "Bargain",
OptionalCost::PromiseGift => "Promise of a Gift",
OptionalCost::Retrace => "Retrace",
OptionalCost::Jumpstart => "Jumpstart",
OptionalCost::Offering => "Offering",
OptionalCost::ReduceW => "Reduce W",
OptionalCost::ReduceU => "Reduce U",
OptionalCost::ReduceB => "Reduce B",
OptionalCost::ReduceR => "Reduce R",
OptionalCost::ReduceG => "Reduce G",
OptionalCost::AltCost => "Alternative Cost",
OptionalCost::Flash => "Flash",
OptionalCost::Generic => "Generic",
}
}
/// Mana pip abbreviation for this cost (used for display).
/// Mirrors Java's `OptionalCost.getPip()`.
pub fn pip(&self) -> &str {
match self {
OptionalCost::Kicker1 => "K",
OptionalCost::Kicker2 => "K2",
OptionalCost::Buyback => "BB",
OptionalCost::Entwine => "EN",
OptionalCost::Bargain => "BG",
OptionalCost::PromiseGift => "PG",
OptionalCost::Retrace => "RT",
OptionalCost::Jumpstart => "JS",
OptionalCost::Offering => "OF",
OptionalCost::ReduceW => "W",
OptionalCost::ReduceU => "U",
OptionalCost::ReduceB => "B",
OptionalCost::ReduceR => "R",
OptionalCost::ReduceG => "G",
OptionalCost::AltCost => "AC",
OptionalCost::Flash => "FL",
OptionalCost::Generic => "GN",
}
}
}