EX7_047.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // Eldradimon
  5. namespace DCGO.CardEffects.EX7
  6. {
  7. public class EX7_047 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsTraits("NSp");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 3,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null,
  25. level: 5)
  26. );
  27. }
  28. #endregion
  29. #region Blocker
  30. if (timing == EffectTiming.None)
  31. {
  32. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  33. isInheritedEffect: false,
  34. card: card,
  35. condition: null));
  36. }
  37. #endregion
  38. #region OP/WD Shared
  39. string SharedEffectName = "Reveal the top 4 cards of your deck and play Digimon from them";
  40. CardEffectFactory.ActivateClassesForSharedEffects
  41. (ref cardEffects, timing, card,
  42. SharedEffectName,
  43. SharedActivateCoroutine,
  44. SharedEffectDescription,
  45. optional: false,
  46. onPlay: true,
  47. whenDigivolving: true);
  48. string SharedEffectDescription(string tag) => $"[{tag}] Reveal the top 4 cards of your deck. You may play up to 7 play cost's total worth of Digimon cards with the [NSp] trait among them without paying the costs. Return the rest to the bottom of the deck.";
  49. IEnumerator SharedActivateCoroutine(Hashtable _hashtable, ActivateClass activateClass)
  50. {
  51. bool CanSelectCardCondition(CardSource cardSource)
  52. {
  53. return cardSource.IsDigimon
  54. && cardSource.HasPlayCost
  55. && cardSource.GetCostItself <= 7
  56. && cardSource.EqualsTraits("NSp")
  57. && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  58. }
  59. int maxCount = card.Owner.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame());
  60. List<CardSource> selectedCards = new List<CardSource>();
  61. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  62. revealCount: 4,
  63. simplifiedSelectCardConditions:
  64. new SimplifiedSelectCardConditionClass[]
  65. {
  66. new(
  67. canTargetCondition: CanSelectCardCondition,
  68. message: "Select cards with the [NSp] whose play costs add up to 7 or less.",
  69. mode: SelectCardEffect.Mode.Custom,
  70. maxCount: maxCount,
  71. selectCardCoroutine: SelectCardCoroutine),
  72. },
  73. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  74. activateClass: activateClass,
  75. canTargetCondition_ByPreSelecetedList: CanTargetConditionByPreSelectedList,
  76. canEndSelectCondition: CanEndSelectCondition,
  77. canNoSelect: true,
  78. canEndNotMax: true
  79. ));
  80. IEnumerator SelectCardCoroutine(CardSource cardSource)
  81. {
  82. selectedCards.Add(cardSource);
  83. yield return null;
  84. }
  85. bool CanTargetConditionByPreSelectedList(List<CardSource> cardSources, CardSource cardSource)
  86. {
  87. return cardSources.Sum(source => source.GetCostItself) + cardSource.GetCostItself <= 7;
  88. }
  89. bool CanEndSelectCondition(List<CardSource> cardSources)
  90. {
  91. return cardSources.Count > 0 &&
  92. cardSources.Sum(source => source.GetCostItself) <= 7;
  93. }
  94. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  95. cardSources: selectedCards,
  96. activateClass: activateClass,
  97. payCost: false,
  98. isTapped: false,
  99. root: SelectCardEffect.Root.Library,
  100. activateETB: true));
  101. }
  102. #endregion
  103. #region End of Your Turn
  104. if (timing == EffectTiming.OnEndTurn)
  105. {
  106. ActivateClass activateClass = new ActivateClass();
  107. activateClass.SetUpICardEffect("DNA digivolve into a Digimon card with the [NSp] trait", CanUseCondition, card);
  108. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  109. activateClass.SetHashString("DNA_EX7_047");
  110. cardEffects.Add(activateClass);
  111. string EffectDescription()
  112. {
  113. return "[End of Your Turn] (Once Per Turn) 2 of your Digimon may DNA digivolve into a Digimon card with the [NSp] trait in your hand.";
  114. }
  115. bool CanUseCondition(Hashtable hashtable)
  116. {
  117. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  118. && CardEffectCommons.IsOwnerTurn(card);
  119. }
  120. bool CanSelectDNACardCondition(CardSource cardSource)
  121. {
  122. return cardSource.IsDigimon &&
  123. cardSource.CanPlayJogress(true) &&
  124. cardSource.EqualsTraits("NSp");
  125. }
  126. bool CanActivateCondition(Hashtable hashtable)
  127. {
  128. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
  129. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectDNACardCondition)
  130. && card.Owner.GetBattleAreaDigimons().Count >= 2;
  131. }
  132. IEnumerator ActivateCoroutine(Hashtable hashtable)
  133. {
  134. yield return ContinuousController.instance.StartCoroutine(
  135. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  136. CanSelectDNACardCondition,
  137. payCost: true,
  138. isHand: true,
  139. activateClass
  140. ));
  141. }
  142. }
  143. #endregion
  144. return cardEffects;
  145. }
  146. }
  147. }