EX2_049.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX2
  5. {
  6. public class EX2_049 : 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.OnDeclaration)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Reveal the top 5 cards of deck", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Main] You may suspend this Digimon to reveal the top 5 cards of your deck. Place 1 [ADR-02 Searcher] among them under 1 of your [Mother D-Reaper]s as its bottom digivolution card. Place the remaining cards at the bottom of your deck in any order.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  24. {
  25. if (cardSource.CardNames.Contains("ADR-02 Searcher"))
  26. {
  27. return true;
  28. }
  29. if (cardSource.CardNames.Contains("ADR-02Searcher"))
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanSelectPermanentCondition(Permanent permanent)
  37. {
  38. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  39. {
  40. if (!permanent.IsToken)
  41. {
  42. if (permanent.TopCard.CardNames.Contains("Mother D-Reaper"))
  43. {
  44. return true;
  45. }
  46. if (permanent.TopCard.CardNames.Contains("MotherD-Reaper"))
  47. {
  48. return true;
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleArea(card))
  57. {
  58. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  66. {
  67. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  68. List<CardSource> selectedCards = new List<CardSource>();
  69. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  70. revealCount: 5,
  71. simplifiedSelectCardConditions:
  72. new SimplifiedSelectCardConditionClass[]
  73. {
  74. new SimplifiedSelectCardConditionClass(
  75. canTargetCondition:CanSelectCardCondition,
  76. message: "Select 1 [ADR-02 Searcher].",
  77. mode: SelectCardEffect.Mode.Custom,
  78. maxCount: 1,
  79. selectCardCoroutine: SelectCardCoroutine),
  80. },
  81. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  82. activateClass: activateClass,
  83. canNoSelect: false
  84. ));
  85. IEnumerator SelectCardCoroutine(CardSource cardSource)
  86. {
  87. selectedCards.Add(cardSource);
  88. yield return null;
  89. }
  90. if (selectedCards.Count >= 1)
  91. {
  92. Permanent getDigivolutiuonDigimon = null;
  93. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  94. {
  95. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  96. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  97. selectPermanentEffect.SetUp(
  98. selectPlayer: card.Owner,
  99. canTargetCondition: CanSelectPermanentCondition,
  100. canTargetCondition_ByPreSelecetedList: null,
  101. canEndSelectCondition: null,
  102. maxCount: maxCount,
  103. canNoSelect: false,
  104. canEndNotMax: false,
  105. selectPermanentCoroutine: SelectPermanentCoroutine,
  106. afterSelectPermanentCoroutine: null,
  107. mode: SelectPermanentEffect.Mode.Custom,
  108. cardEffect: activateClass);
  109. selectPermanentEffect.SetUpCustomMessage("Select 1 [Mother D-Reaper] that will get a digivolution card.", "The opponent is selecting 1 [Mother D-Reaper] that will get a digivolution card.");
  110. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  111. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  112. {
  113. getDigivolutiuonDigimon = permanent;
  114. yield return null;
  115. }
  116. }
  117. if (getDigivolutiuonDigimon != null)
  118. {
  119. yield return ContinuousController.instance.StartCoroutine(getDigivolutiuonDigimon.AddDigivolutionCardsBottom(selectedCards, activateClass));
  120. }
  121. }
  122. }
  123. }
  124. return cardEffects;
  125. }
  126. }
  127. }