EX4_034.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. mutualConditions: true
  81. ));
  82. }
  83. }
  84. if (timing == EffectTiming.OnTappedAnyone)
  85. {
  86. ActivateClass activateClass = new ActivateClass();
  87. activateClass.SetUpICardEffect("This Digimon digivolves", CanUseCondition, card);
  88. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  89. activateClass.SetIsInheritedEffect(true);
  90. cardEffects.Add(activateClass);
  91. string EffectDiscription()
  92. {
  93. 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.";
  94. }
  95. bool CanSelectCardCondition(CardSource cardSource)
  96. {
  97. if (cardSource.CardColors.Count == 2)
  98. {
  99. if (cardSource.CardColors.Contains(CardColor.Green))
  100. {
  101. if (cardSource.IsDigimon)
  102. {
  103. return true;
  104. }
  105. }
  106. }
  107. return false;
  108. }
  109. bool CanUseCondition(Hashtable hashtable)
  110. {
  111. if (CardEffectCommons.IsExistOnBattleArea(card))
  112. {
  113. if (CardEffectCommons.IsOwnerTurn(card))
  114. {
  115. if (CardEffectCommons.IsAlliance(hashtable))
  116. {
  117. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, (permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)))
  118. {
  119. return true;
  120. }
  121. }
  122. }
  123. }
  124. return false;
  125. }
  126. bool CanActivateCondition(Hashtable hashtable)
  127. {
  128. if (CardEffectCommons.IsExistOnBattleArea(card))
  129. {
  130. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  131. {
  132. return true;
  133. }
  134. }
  135. return false;
  136. }
  137. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  138. {
  139. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  140. targetPermanent: card.PermanentOfThisCard(),
  141. cardCondition: CanSelectCardCondition,
  142. payCost: true,
  143. reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
  144. fixedCostTuple: null,
  145. ignoreDigivolutionRequirementFixedCost: -1,
  146. isHand: true,
  147. activateClass: activateClass,
  148. successProcess: null));
  149. }
  150. }
  151. return cardEffects;
  152. }
  153. }
  154. }