ST19_13.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.ST19
  4. {
  5. public class ST19_13 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.IsLevel5 &&
  16. (targetPermanent.TopCard.ContainsCardName("Monzaemon") || targetPermanent.TopCard.ContainsCardName("Numemon"));
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 3,
  21. ignoreDigivolutionRequirement: false,
  22. card: card,
  23. condition: null)
  24. );
  25. }
  26. #endregion
  27. #region Armor Purge
  28. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  29. {
  30. cardEffects.Add(CardEffectFactory.ArmorPurgeEffect(card: card));
  31. }
  32. #endregion
  33. #region On Play/ When Digivolving Shared
  34. bool CanSelectCardSharedCondition(CardSource cardSource)
  35. {
  36. return cardSource.IsDigimon &&
  37. cardSource.HasLevel && cardSource.Level <= 5 &&
  38. (cardSource.ContainsTraits("Puppet") || cardSource.ContainsCardName("Numemon"));
  39. }
  40. bool CanActivateSharedCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  43. CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardSharedCondition);
  44. }
  45. #endregion
  46. #region On Play
  47. if (timing == EffectTiming.OnEnterFieldAnyone)
  48. {
  49. ActivateClass activateClass = new ActivateClass();
  50. activateClass.SetUpICardEffect("Place a card under this Digimon to <Recovery +1 (Deck)>.", CanUseCondition, card);
  51. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, true, EffectDescription());
  52. cardEffects.Add(activateClass);
  53. string EffectDescription()
  54. {
  55. return
  56. "[On Play] By placing 1 level 5 or lower card with [Puppet] trait or with [Numemon] in its name from your trash as this Digimon's bottom digivolution card, <Recovery +1 (Deck)>.";
  57. }
  58. bool CanUseCondition(Hashtable hashtable)
  59. {
  60. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  61. }
  62. IEnumerator ActivateCoroutine(Hashtable hashtable)
  63. {
  64. bool added = false;
  65. List<CardSource> selectedCards = new List<CardSource>();
  66. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  67. selectCardEffect.SetUp(
  68. canTargetCondition: CanSelectCardSharedCondition,
  69. canTargetCondition_ByPreSelecetedList: null,
  70. canEndSelectCondition: null,
  71. canNoSelect: () => true,
  72. selectCardCoroutine: SelectCardCoroutine,
  73. afterSelectCardCoroutine: null,
  74. message: "Select 1 card to place on bottom of digivolution cards.",
  75. maxCount: 1,
  76. canEndNotMax: false,
  77. isShowOpponent: true,
  78. mode: SelectCardEffect.Mode.Custom,
  79. root: SelectCardEffect.Root.Trash,
  80. customRootCardList: null,
  81. canLookReverseCard: true,
  82. selectPlayer: card.Owner,
  83. cardEffect: activateClass);
  84. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  85. selectCardEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.",
  86. "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  87. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  88. IEnumerator SelectCardCoroutine(CardSource cardSource)
  89. {
  90. selectedCards.Add(cardSource);
  91. yield return null;
  92. }
  93. if (selectedCards.Count >= 1)
  94. {
  95. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard()
  96. .AddDigivolutionCardsBottom(selectedCards, activateClass));
  97. added = true;
  98. }
  99. if (added)
  100. {
  101. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  102. }
  103. }
  104. }
  105. #endregion
  106. #region When Digivolving
  107. if (timing == EffectTiming.OnEnterFieldAnyone)
  108. {
  109. ActivateClass activateClass = new ActivateClass();
  110. activateClass.SetUpICardEffect("Place a card under this Digimon to <Recovery +1 (Deck)>.", CanUseCondition, card);
  111. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, true, EffectDescription());
  112. cardEffects.Add(activateClass);
  113. string EffectDescription()
  114. {
  115. return
  116. "[When Digivolving] By placing 1 level 5 or lower card with [Puppet] trait or with [Numemon] in its name from your trash as this Digimon's bottom digivolution card, <Recovery +1 (Deck)>.";
  117. }
  118. bool CanUseCondition(Hashtable hashtable)
  119. {
  120. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  121. }
  122. IEnumerator ActivateCoroutine(Hashtable hashtable)
  123. {
  124. bool added = false;
  125. List<CardSource> selectedCards = new List<CardSource>();
  126. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  127. selectCardEffect.SetUp(
  128. canTargetCondition: CanSelectCardSharedCondition,
  129. canTargetCondition_ByPreSelecetedList: null,
  130. canEndSelectCondition: null,
  131. canNoSelect: () => true,
  132. selectCardCoroutine: SelectCardCoroutine,
  133. afterSelectCardCoroutine: null,
  134. message: "Select 1 card to place on bottom of digivolution cards.",
  135. maxCount: 1,
  136. canEndNotMax: false,
  137. isShowOpponent: true,
  138. mode: SelectCardEffect.Mode.Custom,
  139. root: SelectCardEffect.Root.Trash,
  140. customRootCardList: null,
  141. canLookReverseCard: true,
  142. selectPlayer: card.Owner,
  143. cardEffect: activateClass);
  144. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  145. selectCardEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.",
  146. "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  147. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  148. IEnumerator SelectCardCoroutine(CardSource cardSource)
  149. {
  150. selectedCards.Add(cardSource);
  151. yield return null;
  152. }
  153. if (selectedCards.Count >= 1)
  154. {
  155. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard()
  156. .AddDigivolutionCardsBottom(selectedCards, activateClass));
  157. added = true;
  158. }
  159. if (added)
  160. {
  161. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  162. }
  163. }
  164. }
  165. #endregion
  166. return cardEffects;
  167. }
  168. }
  169. }