ST24_04.cs 9.3 KB

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