EX4_034.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.EX4
  5. {
  6. public class EX4_034 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Reveal the top 4 cards of deck", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] Reveal the top 4 cards of your deck. Add 1 2-color green card and 1 Tamer card with [Shu-Chong Wong] in its name among them to your hand. Place the rest at the bottom of your deck in any order.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource.CardColors.Count == 2)
  24. {
  25. if (cardSource.CardColors.Contains(CardColor.Green))
  26. {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanSelectCardCondition1(CardSource cardSource)
  33. {
  34. if (cardSource.IsTamer)
  35. {
  36. if (cardSource.ContainsCardName("Shu-Chong Wong"))
  37. {
  38. return true;
  39. }
  40. }
  41. return false;
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.IsExistOnBattleArea(card))
  50. {
  51. if (card.Owner.LibraryCards.Count >= 1)
  52. {
  53. return true;
  54. }
  55. }
  56. return false;
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  61. revealCount: 4,
  62. simplifiedSelectCardConditions:
  63. new SimplifiedSelectCardConditionClass[]
  64. {
  65. new SimplifiedSelectCardConditionClass(
  66. canTargetCondition:CanSelectCardCondition,
  67. message: "Select 1 2-color green card.",
  68. mode: SelectCardEffect.Mode.AddHand,
  69. maxCount: 1,
  70. selectCardCoroutine: null),
  71. new SimplifiedSelectCardConditionClass(
  72. canTargetCondition:CanSelectCardCondition1,
  73. message: "Select 1 Tamer card with [Shu-Chong Wong] in its name.",
  74. mode: SelectCardEffect.Mode.AddHand,
  75. maxCount: 1,
  76. selectCardCoroutine: null),
  77. },
  78. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  79. activateClass: activateClass
  80. ));
  81. }
  82. }
  83. if (timing == EffectTiming.OnTappedAnyone)
  84. {
  85. ActivateClass activateClass = new ActivateClass();
  86. activateClass.SetUpICardEffect("This Digimon digivolves", CanUseCondition, card);
  87. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  88. activateClass.SetIsInheritedEffect(true);
  89. cardEffects.Add(activateClass);
  90. string EffectDiscription()
  91. {
  92. return "[Your Turn] When <Alliance> suspends one of your Digimon, this Digimon may digivolve into a 2-color green Digimon card in your hand for the cost. When this Digimon would digivolve by this effect, reduce the cost by 2.";
  93. }
  94. bool CanSelectCardCondition(CardSource cardSource)
  95. {
  96. if (cardSource.CardColors.Count == 2)
  97. {
  98. if (cardSource.CardColors.Contains(CardColor.Green))
  99. {
  100. if (cardSource.IsDigimon)
  101. {
  102. return true;
  103. }
  104. }
  105. }
  106. return false;
  107. }
  108. bool CanUseCondition(Hashtable hashtable)
  109. {
  110. if (CardEffectCommons.IsExistOnBattleArea(card))
  111. {
  112. if (CardEffectCommons.IsOwnerTurn(card))
  113. {
  114. if (CardEffectCommons.IsAlliance(hashtable))
  115. {
  116. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, (permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)))
  117. {
  118. return true;
  119. }
  120. }
  121. }
  122. }
  123. return false;
  124. }
  125. bool CanActivateCondition(Hashtable hashtable)
  126. {
  127. if (CardEffectCommons.IsExistOnBattleArea(card))
  128. {
  129. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  130. {
  131. return true;
  132. }
  133. }
  134. return false;
  135. }
  136. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  137. {
  138. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  139. targetPermanent: card.PermanentOfThisCard(),
  140. cardCondition: CanSelectCardCondition,
  141. payCost: true,
  142. reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
  143. fixedCostTuple: null,
  144. ignoreDigivolutionRequirementFixedCost: -1,
  145. isHand: true,
  146. activateClass: activateClass,
  147. successProcess: null));
  148. }
  149. }
  150. return cardEffects;
  151. }
  152. }
  153. }