BT12_101.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT12
  6. {
  7. public class BT12_101 : 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] Trash the top 3 digivolution cards of 1 of your opponent's Digimon. Then, if you have a green Digimon in play, you may play 1 level 4 or lower blue Digimon card with a [Free] trait from your hand without paying the cost.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  25. {
  26. return true;
  27. }
  28. return false;
  29. }
  30. bool CanSelectPermanentCondition1(Permanent permanent)
  31. {
  32. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  33. {
  34. if (permanent.TopCard.CardColors.Contains(CardColor.Green))
  35. {
  36. return true;
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanSelectCardCondition(CardSource cardSource)
  42. {
  43. if (cardSource.IsDigimon)
  44. {
  45. if (cardSource.HasCardColor(CardColor.Blue))
  46. {
  47. if (cardSource.Level <= 4)
  48. {
  49. if (cardSource.CardTraits.Contains("Free"))
  50. {
  51. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  52. {
  53. if (cardSource.HasLevel)
  54. {
  55. return true;
  56. }
  57. }
  58. }
  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. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  73. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  74. selectPermanentEffect.SetUp(
  75. selectPlayer: card.Owner,
  76. canTargetCondition: CanSelectPermanentCondition,
  77. canTargetCondition_ByPreSelecetedList: null,
  78. canEndSelectCondition: null,
  79. maxCount: maxCount,
  80. canNoSelect: false,
  81. canEndNotMax: false,
  82. selectPermanentCoroutine: SelectPermanentCoroutine,
  83. afterSelectPermanentCoroutine: null,
  84. mode: SelectPermanentEffect.Mode.Custom,
  85. cardEffect: activateClass);
  86. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  87. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  88. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  89. {
  90. Permanent selectedPermanent = permanent;
  91. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: 3, isFromTop: true, activateClass: activateClass));
  92. }
  93. }
  94. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  95. {
  96. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  97. {
  98. List<CardSource> selectedCards = new List<CardSource>();
  99. int maxCount = 1;
  100. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  101. selectHandEffect.SetUp(
  102. selectPlayer: card.Owner,
  103. canTargetCondition: CanSelectCardCondition,
  104. canTargetCondition_ByPreSelecetedList: null,
  105. canEndSelectCondition: null,
  106. maxCount: maxCount,
  107. canNoSelect: true,
  108. canEndNotMax: false,
  109. isShowOpponent: true,
  110. selectCardCoroutine: SelectCardCoroutine,
  111. afterSelectCardCoroutine: null,
  112. mode: SelectHandEffect.Mode.Custom,
  113. cardEffect: activateClass);
  114. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  115. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  116. yield return StartCoroutine(selectHandEffect.Activate());
  117. IEnumerator SelectCardCoroutine(CardSource cardSource)
  118. {
  119. selectedCards.Add(cardSource);
  120. yield return null;
  121. }
  122. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  123. cardSources: selectedCards,
  124. activateClass: activateClass,
  125. payCost: false,
  126. isTapped: false,
  127. root: SelectCardEffect.Root.Hand,
  128. activateETB: true));
  129. }
  130. }
  131. }
  132. }
  133. if (timing == EffectTiming.SecuritySkill)
  134. {
  135. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  136. card: card,
  137. cardEffects: ref cardEffects,
  138. effectName: $"Trash digivolution cards and play 1 Digimon from hand");
  139. }
  140. return cardEffects;
  141. }
  142. }
  143. }