1
+ package mage .cards .c ;
2
+
3
+ import java .util .UUID ;
4
+ import mage .MageInt ;
5
+ import mage .constants .SubType ;
6
+ import mage .constants .SuperType ;
7
+ import mage .game .Game ;
8
+ import mage .players .Player ;
9
+ import mage .abilities .Ability ;
10
+ import mage .abilities .common .DealsDamageSourceTriggeredAbility ;
11
+ import mage .abilities .dynamicvalue .common .SavedDamageValue ;
12
+ import mage .abilities .effects .OneShotEffect ;
13
+ import mage .abilities .effects .common .TransformSourceEffect ;
14
+ import mage .abilities .effects .common .UntapSourceEffect ;
15
+ import mage .abilities .keyword .DeathtouchAbility ;
16
+ import mage .abilities .keyword .TransformAbility ;
17
+ import mage .cards .CardImpl ;
18
+ import mage .cards .CardSetInfo ;
19
+ import mage .constants .CardType ;
20
+ import mage .constants .Outcome ;
21
+
22
+ /**
23
+ * @author balazskristof
24
+ */
25
+ public final class CecilDarkKnight extends CardImpl {
26
+
27
+ public CecilDarkKnight (UUID ownerId , CardSetInfo setInfo ) {
28
+ super (ownerId , setInfo , new CardType []{CardType .CREATURE }, "{B}" );
29
+
30
+ this .supertype .add (SuperType .LEGENDARY );
31
+ this .subtype .add (SubType .HUMAN );
32
+ this .subtype .add (SubType .KNIGHT );
33
+ this .power = new MageInt (2 );
34
+ this .toughness = new MageInt (3 );
35
+
36
+ this .secondSideCardClazz = mage .cards .c .CecilRedeemedPaladin .class ;
37
+
38
+ // Deathtouch
39
+ this .addAbility (DeathtouchAbility .getInstance ());
40
+
41
+ // Darkness -- Whenever Cecil deals damage, you lose that much life. Then if your life total is less than or equal to half your starting life total, untap Cecil and transform it.
42
+ this .addAbility (new TransformAbility ());
43
+ this .addAbility (new DealsDamageSourceTriggeredAbility (new CecilDarkKnightEffect ()).withFlavorWord ("Darkness" ));
44
+ }
45
+
46
+ private CecilDarkKnight (final CecilDarkKnight card ) {
47
+ super (card );
48
+ }
49
+
50
+ @ Override
51
+ public CecilDarkKnight copy () {
52
+ return new CecilDarkKnight (this );
53
+ }
54
+ }
55
+
56
+ class CecilDarkKnightEffect extends OneShotEffect {
57
+
58
+ CecilDarkKnightEffect () {
59
+ super (Outcome .LoseLife );
60
+ staticText = "you lose that much life. Then if your life total is less than or equal to half your starting life total, untap {this} and transform it." ;
61
+ }
62
+
63
+ private CecilDarkKnightEffect (final CecilDarkKnightEffect effect ) {
64
+ super (effect );
65
+ }
66
+
67
+ @ Override
68
+ public CecilDarkKnightEffect copy () {
69
+ return new CecilDarkKnightEffect (this );
70
+ }
71
+
72
+ @ Override
73
+ public boolean apply (Game game , Ability source ) {
74
+ game .processAction ();
75
+ Player player = game .getPlayer (source .getControllerId ());
76
+ if (player != null ) {
77
+ player .loseLife (SavedDamageValue .MUCH .calculate (game , source , this ), game , source , false );
78
+ game .processAction ();
79
+ if (player .getLife () <= game .getStartingLife () / 2 ) {
80
+ new UntapSourceEffect ().apply (game , source );
81
+ new TransformSourceEffect ().apply (game , source );
82
+ }
83
+ return true ;
84
+ }
85
+ return false ;
86
+ }
87
+
88
+ }
0 commit comments