manabrew_engine/spellability/alternative_cost.rs
1//! Alternative casting costs for spells and abilities.
2//!
3//! Mirrors Java's `AlternativeCost` — tracks how a spell was cast so resolution
4//! can apply the correct behaviour (e.g. Evoke -> sacrifice on ETB, Dash -> haste + bounce).
5
6use serde::{Deserialize, Serialize};
7
8/// Alternative casting costs — mirrors Java's `AlternativeCost`.
9/// Tracks how a spell was cast so resolution can apply the correct behaviour.
10#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
11pub enum AlternativeCost {
12 Flashback,
13 Spectacle,
14 Evoke,
15 Dash,
16 Blitz,
17 Escape,
18 Overload,
19 Madness,
20 Foretell,
21 Emerge,
22 Suspend,
23 /// Cast face-down as a 2/2 creature for {3} (Morph).
24 Morph,
25 /// Cast face-down as a 2/2 creature for {3}, +1/+1 counter on turn face-up (Megamorph).
26 Megamorph,
27 /// Cast as an Aura with enchant creature for the bestow cost.
28 Bestow,
29 /// Cast for warp cost; exile at beginning of next end step.
30 Warp,
31 /// Sacrifice-based alternative cost (e.g. Fireblast: sacrifice two Mountains).
32 SacrificeAlt,
33 /// Cast a plotted card from exile for free.
34 Plot,
35 /// Awaken — cast with awaken cost to animate a land.
36 Awaken,
37 /// Disturb — cast from graveyard transformed.
38 Disturb,
39 /// Harmonize — alternative cost for harmony effects.
40 Harmonize,
41 /// Freerunning — reduced cost when dealing combat damage.
42 Freerunning,
43 /// Impending — cast as a non-creature with time counters.
44 Impending,
45 /// Mayhem — alternative cost for mayhem effects.
46 Mayhem,
47 /// MTMtE — More Than Meets the Eye (Transformers) alternative cost.
48 MTMtE,
49 /// Mutate — cast on top of or under another creature.
50 Mutate,
51 /// Prowl — reduced cost when a creature of the same type dealt combat damage.
52 Prowl,
53 /// Sneak — alternative cost for sneaking into play.
54 Sneak,
55 /// Surge — reduced cost when you or a teammate cast another spell this turn.
56 Surge,
57 /// WebSlinging — alternative cost for web-slinging effects.
58 WebSlinging,
59 /// Plotted — the card was previously plotted and is now being cast.
60 Plotted,
61}
62
63impl AlternativeCost {
64 /// True if this is a morph-style face-down cast (Morph or Megamorph).
65 pub fn is_morph(self) -> bool {
66 matches!(self, AlternativeCost::Morph | AlternativeCost::Megamorph)
67 }
68}
69
70/// Generic mana cost for casting a card face-down via Morph/Megamorph ({3}).
71pub const MORPH_GENERIC_COST: i32 = 3;
72
73/// Power and toughness of a face-down morph creature.
74pub const MORPH_PT: i32 = 2;