EX2_053.cs 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX2
  4. {
  5. public class EX2_053 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnEnterFieldAnyone)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  15. activateClass.SetHashString("Reveal_EX2_053");
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play][Once Per Turn] If one of your [Mother D-Reaper]s has 5 or more digivolution cards, reveal the top 3 cards of your deck. You may play 1 card with [D-Reaper] in its traits and a play cost of 10 or less among them without paying its memory cost. Place the remaining cards at the top of your deck in any order.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  24. {
  25. if (cardSource.CardTraits.Contains("D-Reaper"))
  26. {
  27. if (cardSource.GetCostItself <= 10)
  28. {
  29. return true;
  30. }
  31. }
  32. }
  33. return false;
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.IsExistOnBattleArea(card))
  42. {
  43. foreach (Permanent permanent in card.Owner.GetBattleAreaPermanents())
  44. {
  45. if (permanent.DigivolutionCards.Count >= 5)
  46. {
  47. if (permanent.TopCard.CardNames.Contains("Mother D-Reaper"))
  48. {
  49. return true;
  50. }
  51. if (permanent.TopCard.CardNames.Contains("MotherD-Reaper"))
  52. {
  53. return true;
  54. }
  55. }
  56. }
  57. }
  58. return false;
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  61. {
  62. List<CardSource> selectedCards = new List<CardSource>();
  63. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  64. revealCount: 3,
  65. simplifiedSelectCardConditions:
  66. new SimplifiedSelectCardConditionClass[]
  67. {
  68. new SimplifiedSelectCardConditionClass(
  69. canTargetCondition:CanSelectCardCondition,
  70. message: "Select 1 card with [D-Reaper] in its traits and a play cost of 10 or less.",
  71. mode: SelectCardEffect.Mode.Custom,
  72. maxCount: 1,
  73. selectCardCoroutine: SelectCardCoroutine),
  74. },
  75. remainingCardsPlace: RemainingCardsPlace.DeckTop,
  76. activateClass: activateClass,
  77. canNoSelect: true
  78. ));
  79. IEnumerator SelectCardCoroutine(CardSource cardSource)
  80. {
  81. selectedCards.Add(cardSource);
  82. yield return null;
  83. }
  84. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  85. cardSources: selectedCards,
  86. activateClass: activateClass,
  87. payCost: false,
  88. isTapped: false,
  89. root: SelectCardEffect.Root.Library,
  90. activateETB: true));
  91. }
  92. }
  93. if (timing == EffectTiming.OnAllyAttack)
  94. {
  95. ActivateClass activateClass = new ActivateClass();
  96. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  97. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  98. activateClass.SetHashString("Reveal_EX2_053");
  99. cardEffects.Add(activateClass);
  100. string EffectDiscription()
  101. {
  102. return "[When Attacking][Once Per Turn] If one of your [Mother D-Reaper]s has 5 or more digivolution cards, reveal the top 3 cards of your deck. You may play 1 card with [D-Reaper] in its traits and a play cost of 10 or less among them without paying its memory cost. Place the remaining cards at the top of your deck in any order.";
  103. }
  104. bool CanSelectCardCondition(CardSource cardSource)
  105. {
  106. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  107. {
  108. if (cardSource.CardTraits.Contains("D-Reaper"))
  109. {
  110. if (cardSource.GetCostItself <= 10)
  111. {
  112. return true;
  113. }
  114. }
  115. }
  116. return false;
  117. }
  118. bool CanUseCondition(Hashtable hashtable)
  119. {
  120. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  121. }
  122. bool CanActivateCondition(Hashtable hashtable)
  123. {
  124. if (CardEffectCommons.IsExistOnBattleArea(card))
  125. {
  126. foreach (Permanent permanent in card.Owner.GetBattleAreaPermanents())
  127. {
  128. if (permanent.DigivolutionCards.Count >= 5)
  129. {
  130. if (permanent.TopCard.CardNames.Contains("Mother D-Reaper"))
  131. {
  132. return true;
  133. }
  134. if (permanent.TopCard.CardNames.Contains("MotherD-Reaper"))
  135. {
  136. return true;
  137. }
  138. }
  139. }
  140. }
  141. return false;
  142. }
  143. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  144. {
  145. List<CardSource> selectedCards = new List<CardSource>();
  146. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  147. revealCount: 3,
  148. simplifiedSelectCardConditions:
  149. new SimplifiedSelectCardConditionClass[]
  150. {
  151. new SimplifiedSelectCardConditionClass(
  152. canTargetCondition:CanSelectCardCondition,
  153. message: "Select 1 card with [D-Reaper] in its traits and a play cost of 10 or less.",
  154. mode: SelectCardEffect.Mode.Custom,
  155. maxCount: 1,
  156. selectCardCoroutine: SelectCardCoroutine),
  157. },
  158. remainingCardsPlace: RemainingCardsPlace.DeckTop,
  159. activateClass: activateClass,
  160. canNoSelect: true
  161. ));
  162. IEnumerator SelectCardCoroutine(CardSource cardSource)
  163. {
  164. selectedCards.Add(cardSource);
  165. yield return null;
  166. }
  167. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  168. cardSources: selectedCards,
  169. activateClass: activateClass,
  170. payCost: false,
  171. isTapped: false,
  172. root: SelectCardEffect.Root.Library,
  173. activateETB: true));
  174. }
  175. }
  176. return cardEffects;
  177. }
  178. }
  179. }