BT17_009.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT17
  5. {
  6. public class BT17_009 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On Play
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  17. EffectDescription());
  18. cardEffects.Add(activateClass);
  19. string EffectDescription()
  20. {
  21. return
  22. "[On Play] Reveal the top 3 cards of your deck. Add 1 card with the [Hybrid]/[Ten Warriors] trait and 1 Tamer card with an inherited effect among them to the hand. Return the rest to the bottom of the deck.";
  23. }
  24. bool CanSelectCardCondition(CardSource cardSource)
  25. {
  26. return cardSource.HasHybridTenWarriorsTraits;
  27. }
  28. bool CanSelectTamerCardCondition(CardSource cardSource)
  29. {
  30. if (cardSource.IsTamer)
  31. {
  32. if (cardSource.HasInheritedEffect)
  33. {
  34. return true;
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  42. }
  43. bool CanActivateCondition(Hashtable hashtable)
  44. {
  45. if (CardEffectCommons.IsExistOnBattleArea(card))
  46. {
  47. if (card.Owner.LibraryCards.Count >= 1)
  48. {
  49. return true;
  50. }
  51. }
  52. return false;
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable hashtable)
  55. {
  56. yield return ContinuousController.instance.StartCoroutine(
  57. CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  58. revealCount: 3,
  59. simplifiedSelectCardConditions:
  60. new SimplifiedSelectCardConditionClass[]
  61. {
  62. new(
  63. canTargetCondition: CanSelectCardCondition,
  64. message: "Select 1 card with the [Hybrid]/[Ten Warriors] trait.",
  65. mode: SelectCardEffect.Mode.AddHand,
  66. maxCount: 1,
  67. selectCardCoroutine: null),
  68. new(
  69. canTargetCondition: CanSelectTamerCardCondition,
  70. message: "Select 1 Tamer card with an inherited effect.",
  71. mode: SelectCardEffect.Mode.AddHand,
  72. maxCount: 1,
  73. selectCardCoroutine: null),
  74. },
  75. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  76. activateClass: activateClass
  77. ));
  78. }
  79. }
  80. #endregion
  81. #region On Deletion - ESS
  82. if (timing == EffectTiming.OnDestroyedAnyone)
  83. {
  84. ActivateClass activateClass = new ActivateClass();
  85. activateClass.SetUpICardEffect("Play 1 Tamer card from hand", CanUseCondition, card);
  86. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true,
  87. EffectDescription());
  88. activateClass.SetIsInheritedEffect(true);
  89. cardEffects.Add(activateClass);
  90. string EffectDescription()
  91. {
  92. return
  93. "[On Deletion] You may play 1 Tamer card with inherited effects from your hand without paying the cost.";
  94. }
  95. bool CanUseCondition(Hashtable hashtable)
  96. {
  97. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  98. }
  99. bool CanSelectCardCondition(CardSource cardSource)
  100. {
  101. if (cardSource.IsTamer)
  102. {
  103. if (cardSource.HasInheritedEffect)
  104. {
  105. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false,
  106. cardEffect: activateClass))
  107. {
  108. return true;
  109. }
  110. }
  111. }
  112. return false;
  113. }
  114. bool CanActivateCondition(Hashtable hashtable)
  115. {
  116. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  117. {
  118. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  119. {
  120. return true;
  121. }
  122. }
  123. return false;
  124. }
  125. IEnumerator ActivateCoroutine(Hashtable hashtable)
  126. {
  127. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  128. {
  129. List<CardSource> selectedCards = new List<CardSource>();
  130. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  131. selectHandEffect.SetUp(
  132. selectPlayer: card.Owner,
  133. canTargetCondition: CanSelectCardCondition,
  134. canTargetCondition_ByPreSelecetedList: null,
  135. canEndSelectCondition: null,
  136. maxCount: 1,
  137. canNoSelect: true,
  138. canEndNotMax: false,
  139. isShowOpponent: true,
  140. selectCardCoroutine: SelectCardCoroutine,
  141. afterSelectCardCoroutine: null,
  142. mode: SelectHandEffect.Mode.Custom,
  143. cardEffect: activateClass);
  144. selectHandEffect.SetUpCustomMessage("Select 1 Tamer card to play.",
  145. "The opponent is selecting 1 Tamer card to play.");
  146. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  147. yield return StartCoroutine(selectHandEffect.Activate());
  148. IEnumerator SelectCardCoroutine(CardSource cardSource)
  149. {
  150. selectedCards.Add(cardSource);
  151. yield return null;
  152. }
  153. yield return ContinuousController.instance.StartCoroutine(
  154. CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass,
  155. payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  156. }
  157. }
  158. }
  159. #endregion
  160. return cardEffects;
  161. }
  162. }
  163. }