BT12_071.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_071 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnAllyAttack)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  16. activateClass.SetHashString("Reveal_BT12_070");
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Opponent's Turn][Once Per Turn] When an opponent's Digimon attacks, you may reveal the top 3 cards of your deck. Play 1 black card with a play cost of 6 or less among them without paying its cost. Trash the rest.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  25. {
  26. if (cardSource.GetCostItself <= 6)
  27. {
  28. if (cardSource.HasPlayCost)
  29. {
  30. if (cardSource.HasCardColor(CardColor.Black))
  31. {
  32. return true;
  33. }
  34. }
  35. }
  36. }
  37. return false;
  38. }
  39. bool PermanentCondition(Permanent permanent)
  40. {
  41. return CardEffectCommons.IsOpponentPermanent(permanent, card);
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. if (CardEffectCommons.IsExistOnBattleArea(card))
  46. {
  47. if (CardEffectCommons.IsOpponentTurn(card))
  48. {
  49. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
  50. {
  51. return true;
  52. }
  53. }
  54. }
  55. return false;
  56. }
  57. bool CanActivateCondition(Hashtable hashtable)
  58. {
  59. if (CardEffectCommons.IsExistOnBattleArea(card))
  60. {
  61. if (card.Owner.LibraryCards.Count >= 1)
  62. {
  63. return true;
  64. }
  65. }
  66. return false;
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  69. {
  70. List<CardSource> selectedCards = new List<CardSource>();
  71. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  72. revealCount: 3,
  73. simplifiedSelectCardConditions:
  74. new SimplifiedSelectCardConditionClass[]
  75. {
  76. new SimplifiedSelectCardConditionClass(
  77. canTargetCondition:CanSelectCardCondition,
  78. message: "Select 1 black card with a play cost of 6 or less.",
  79. mode: SelectCardEffect.Mode.Custom,
  80. maxCount: 1,
  81. selectCardCoroutine: SelectCardCoroutine),
  82. },
  83. remainingCardsPlace: RemainingCardsPlace.Trash,
  84. activateClass: activateClass
  85. ));
  86. IEnumerator SelectCardCoroutine(CardSource cardSource)
  87. {
  88. selectedCards.Add(cardSource);
  89. yield return null;
  90. }
  91. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  92. cardSources: selectedCards,
  93. activateClass: activateClass,
  94. payCost: false,
  95. isTapped: false,
  96. root: SelectCardEffect.Root.Library,
  97. activateETB: true));
  98. }
  99. }
  100. if (timing == EffectTiming.OnDestroyedAnyone)
  101. {
  102. ActivateClass activateClass = new ActivateClass();
  103. activateClass.SetUpICardEffect("Play 1 Digimon from hand", CanUseCondition, card);
  104. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  105. cardEffects.Add(activateClass);
  106. string EffectDiscription()
  107. {
  108. return "[On Deletion] You may play 1 black level 4 or lower card with a [Hybrid] trait from your hand without paying its cost.";
  109. }
  110. bool CanSelectCardCondition(CardSource cardSource)
  111. {
  112. if (cardSource.IsDigimon)
  113. {
  114. if (cardSource.HasCardColor(CardColor.Black))
  115. {
  116. if (cardSource.Level <= 4)
  117. {
  118. if (cardSource.CardTraits.Contains("Hybrid"))
  119. {
  120. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  121. {
  122. if (cardSource.HasLevel)
  123. {
  124. return true;
  125. }
  126. }
  127. }
  128. }
  129. }
  130. }
  131. return false;
  132. }
  133. bool CanUseCondition(Hashtable hashtable)
  134. {
  135. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  136. }
  137. bool CanActivateCondition(Hashtable hashtable)
  138. {
  139. if (CardEffectCommons.IsExistOnTrash(card))
  140. {
  141. if (card.Owner.HandCards.Count >= 1)
  142. {
  143. return true;
  144. }
  145. }
  146. return false;
  147. }
  148. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  149. {
  150. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  151. {
  152. List<CardSource> selectedCards = new List<CardSource>();
  153. int maxCount = 1;
  154. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  155. selectHandEffect.SetUp(
  156. selectPlayer: card.Owner,
  157. canTargetCondition: CanSelectCardCondition,
  158. canTargetCondition_ByPreSelecetedList: null,
  159. canEndSelectCondition: null,
  160. maxCount: maxCount,
  161. canNoSelect: true,
  162. canEndNotMax: false,
  163. isShowOpponent: true,
  164. selectCardCoroutine: SelectCardCoroutine,
  165. afterSelectCardCoroutine: null,
  166. mode: SelectHandEffect.Mode.Custom,
  167. cardEffect: activateClass);
  168. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  169. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  170. yield return StartCoroutine(selectHandEffect.Activate());
  171. IEnumerator SelectCardCoroutine(CardSource cardSource)
  172. {
  173. selectedCards.Add(cardSource);
  174. yield return null;
  175. }
  176. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  177. }
  178. }
  179. }
  180. return cardEffects;
  181. }
  182. }
  183. }