ST23_06.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Gekkomon
  5. namespace DCGO.CardEffects.ST23
  6. {
  7. public class ST23_06 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsTraits("Glowing Dawn");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 2, permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Shared WM/OP
  23. string SharedEffectName() => "Reveal 3, add 1 [Glowing Dawn], place 1 such under tamer face-down.";
  24. string SharedEffectDescription(string tag) => $"[{tag}] Reveal the top 3 cards of your deck. Among them, add 1 [Glowing Dawn] trait card to the hand and place 1 such card face down under any of your [Glowing Dawn] trait Tamers. Return the rest to the bottom of the deck.";
  25. bool SharedCanActivateCondition(Hashtable hashtable)
  26. {
  27. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  28. && card.Owner.LibraryCards.Count >= 1;
  29. }
  30. bool CanSelectCardCondition(CardSource cardSource)
  31. {
  32. return cardSource.EqualsTraits("Glowing Dawn");
  33. }
  34. bool CanSelectPermanentCondition(Permanent permanent)
  35. {
  36. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaTamer(permanent, card)
  37. && permanent.TopCard.EqualsTraits("Glowing Dawn");
  38. }
  39. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  40. {
  41. int tamerCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, CanSelectPermanentCondition));
  42. CardSource tuckedCard = null;
  43. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition))
  44. {
  45. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  46. revealCount: 3,
  47. simplifiedSelectCardConditions:
  48. new SimplifiedSelectCardConditionClass[]
  49. {
  50. new SimplifiedSelectCardConditionClass(
  51. canTargetCondition:CanSelectCardCondition,
  52. message: "Select 1 card with [Glowing Dawn] trait to add to hand.",
  53. mode: SelectCardEffect.Mode.AddHand,
  54. maxCount: 1,
  55. selectCardCoroutine: null),
  56. new SimplifiedSelectCardConditionClass(
  57. canTargetCondition:CanSelectCardCondition,
  58. message: "Select 1 card with [Glowing Dawn] trait to place under a [Glowing Dawn] tamer.",
  59. mode: SelectCardEffect.Mode.Custom,
  60. maxCount: 1,
  61. selectCardCoroutine: PlaceUnderTamer),
  62. },
  63. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  64. activateClass: activateClass));
  65. }
  66. else
  67. {
  68. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  69. revealCount: 3,
  70. simplifiedSelectCardConditions:
  71. new SimplifiedSelectCardConditionClass[]
  72. {
  73. new SimplifiedSelectCardConditionClass(
  74. canTargetCondition:CanSelectCardCondition,
  75. message: "Select 1 card with [Glowing Dawn] trait to add to hand.",
  76. mode: SelectCardEffect.Mode.AddHand,
  77. maxCount: 1,
  78. selectCardCoroutine: null),
  79. },
  80. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  81. activateClass: activateClass));
  82. }
  83. IEnumerator PlaceUnderTamer(CardSource source)
  84. {
  85. tuckedCard = source;
  86. yield return null;
  87. }
  88. if (tuckedCard != null)
  89. {
  90. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition))
  91. {
  92. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  93. selectPermanentEffect.SetUp(
  94. selectPlayer: card.Owner,
  95. canTargetCondition: CanSelectPermanentCondition,
  96. canTargetCondition_ByPreSelecetedList: null,
  97. canEndSelectCondition: null,
  98. maxCount: 1,
  99. canNoSelect: false,
  100. canEndNotMax: false,
  101. selectPermanentCoroutine: SelectTamerCoroutine,
  102. afterSelectPermanentCoroutine: null,
  103. mode: SelectPermanentEffect.Mode.Custom,
  104. cardEffect: activateClass);
  105. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer that will add card to sources.", "The opponent is selecting 1 Tamer that will add card to sources.");
  106. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  107. IEnumerator SelectTamerCoroutine(Permanent permanent)
  108. {
  109. Permanent selectedPermanent = permanent;
  110. if (selectedPermanent != null)
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { tuckedCard }, activateClass, isFacedown: true));
  113. }
  114. }
  115. }
  116. }
  117. }
  118. #endregion
  119. #region When Moving
  120. if (timing == EffectTiming.OnMove)
  121. {
  122. ActivateClass activateClass = new ActivateClass();
  123. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  124. activateClass.SetUpActivateClass(SharedCanActivateCondition, (hashTable) => SharedActivateCoroutine(hashTable, activateClass), -1, false, SharedEffectDescription("When Moving"));
  125. cardEffects.Add(activateClass);
  126. bool PermanentCondition(Permanent permanent)
  127. {
  128. return permanent == card.PermanentOfThisCard();
  129. }
  130. bool CanUseCondition(Hashtable hashtable)
  131. {
  132. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  133. && CardEffectCommons.CanTriggerOnMove(hashtable, PermanentCondition);
  134. }
  135. }
  136. #endregion
  137. #region On Play
  138. if (timing == EffectTiming.OnEnterFieldAnyone)
  139. {
  140. ActivateClass activateClass = new ActivateClass();
  141. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  142. activateClass.SetUpActivateClass(SharedCanActivateCondition, (hashTable) => SharedActivateCoroutine(hashTable, activateClass), -1, false, SharedEffectDescription("On Play"));
  143. cardEffects.Add(activateClass);
  144. bool CanUseCondition(Hashtable hashtable)
  145. {
  146. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  147. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  148. }
  149. }
  150. #endregion
  151. #region ESS - Piercing
  152. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  153. {
  154. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: true, card: card, condition: null));
  155. }
  156. #endregion
  157. return cardEffects;
  158. }
  159. }
  160. }