BT11_098.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT11
  6. {
  7. public class BT11_098 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OptionSkill)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  16. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Main] You may play 1 blue Digimon card from one of your blue Digimon's digivolution cards without paying the cost. Then, if you have a Digimon with [Seadramon] in its name in play, return 1 of your opponent's level 4 or lower Digimon to the bottom of its owner's deck.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  25. {
  26. if (permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  27. {
  28. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  29. {
  30. return true;
  31. }
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanSelectCardCondition(CardSource cardSource)
  37. {
  38. if (cardSource.IsDigimon)
  39. {
  40. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  41. {
  42. if (cardSource.HasCardColor(CardColor.Blue))
  43. {
  44. return true;
  45. }
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanSelectPermanentCondition1(Permanent permanent)
  51. {
  52. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  53. {
  54. if (permanent.Level <= 4)
  55. {
  56. if (permanent.TopCard.HasLevel)
  57. {
  58. return true;
  59. }
  60. }
  61. }
  62. return false;
  63. }
  64. bool CanUseCondition(Hashtable hashtable)
  65. {
  66. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  69. {
  70. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  71. {
  72. Permanent selectedPermanent = null;
  73. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  74. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  75. selectPermanentEffect.SetUp(
  76. selectPlayer: card.Owner,
  77. canTargetCondition: CanSelectPermanentCondition,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. maxCount: maxCount,
  81. canNoSelect: true,
  82. canEndNotMax: false,
  83. selectPermanentCoroutine: SelectPermanentCoroutine,
  84. afterSelectPermanentCoroutine: null,
  85. mode: SelectPermanentEffect.Mode.Custom,
  86. cardEffect: activateClass);
  87. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that has digivolution cards.", "The opponent is selecting 1 Digimon that has digivolution cards.");
  88. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  89. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  90. {
  91. selectedPermanent = permanent;
  92. yield return null;
  93. }
  94. if (selectedPermanent != null)
  95. {
  96. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  97. {
  98. maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  99. List<CardSource> selectedCards = new List<CardSource>();
  100. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  101. selectCardEffect.SetUp(
  102. canTargetCondition: CanSelectCardCondition,
  103. canTargetCondition_ByPreSelecetedList: null,
  104. canEndSelectCondition: null,
  105. canNoSelect: () => true,
  106. selectCardCoroutine: SelectCardCoroutine,
  107. afterSelectCardCoroutine: null,
  108. message: "Select 1 digivolution card to play.",
  109. maxCount: maxCount,
  110. canEndNotMax: false,
  111. isShowOpponent: true,
  112. mode: SelectCardEffect.Mode.Custom,
  113. root: SelectCardEffect.Root.Custom,
  114. customRootCardList: selectedPermanent.DigivolutionCards,
  115. canLookReverseCard: true,
  116. selectPlayer: card.Owner,
  117. cardEffect: activateClass);
  118. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.", "The opponent is selecting 1 digivolution card to play.");
  119. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  120. yield return StartCoroutine(selectCardEffect.Activate());
  121. IEnumerator SelectCardCoroutine(CardSource cardSource)
  122. {
  123. selectedCards.Add(cardSource);
  124. yield return null;
  125. }
  126. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  127. cardSources: selectedCards,
  128. activateClass: activateClass,
  129. payCost: false,
  130. isTapped: false,
  131. root: SelectCardEffect.Root.DigivolutionCards,
  132. activateETB: true));
  133. }
  134. }
  135. }
  136. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon &&
  137. permanent.TopCard.ContainsCardName("Seadramon")))
  138. {
  139. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  140. {
  141. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  142. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  143. selectPermanentEffect.SetUp(
  144. selectPlayer: card.Owner,
  145. canTargetCondition: CanSelectPermanentCondition1,
  146. canTargetCondition_ByPreSelecetedList: null,
  147. canEndSelectCondition: null,
  148. maxCount: maxCount,
  149. canNoSelect: false,
  150. canEndNotMax: false,
  151. selectPermanentCoroutine: null,
  152. afterSelectPermanentCoroutine: null,
  153. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  154. cardEffect: activateClass);
  155. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  156. }
  157. }
  158. }
  159. }
  160. if (timing == EffectTiming.SecuritySkill)
  161. {
  162. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  163. card: card,
  164. cardEffects: ref cardEffects,
  165. effectName: $"Play 1 digivolution card and return 1 Digimon to the bottom of deck");
  166. }
  167. return cardEffects;
  168. }
  169. }
  170. }