BT22_086.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Yao Qinglan
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_086 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Start of Your Main Phase
  13. if (timing == EffectTiming.OnStartMainPhase)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Bottom deck this tamer, play 1 [Yao Qinglan] from hand, Then if no digimon play 1 [Sangomon] from trash", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Start of Your Main Phase] By returning this Tamer to the bottom of the deck, you may play 1 [Yao Qinglan] from your hand without paying the cost. Then, if you don't have a Digimon, you may play 1 [Sangomon] from your trash without paying the cost.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.IsExistOnBattleArea(card)
  26. && CardEffectCommons.IsOwnerTurn(card);
  27. }
  28. bool CanActivateCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.IsExistOnBattleArea(card);
  31. }
  32. bool BottomDeckCondition(Permanent permanent)
  33. {
  34. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  35. && permanent == card.PermanentOfThisCard();
  36. }
  37. bool IsYaoQinglan(CardSource cardSource)
  38. {
  39. return CardEffectCommons.IsExistOnHand(cardSource)
  40. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass)
  41. && cardSource.EqualsCardName("Yao Qinglan");
  42. }
  43. bool IsSangomon(CardSource cardSource)
  44. {
  45. return CardEffectCommons.IsExistOnTrash(cardSource)
  46. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass)
  47. && cardSource.EqualsCardName("Sangomon");
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable hashtable)
  50. {
  51. #region Bottom Deck Yao Qinglan
  52. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, BottomDeckCondition));
  53. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  54. selectPermanentEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: BottomDeckCondition,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: maxCount,
  60. canNoSelect: false,
  61. canEndNotMax: false,
  62. selectPermanentCoroutine: null,
  63. afterSelectPermanentCoroutine: null,
  64. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  65. cardEffect: activateClass);
  66. selectPermanentEffect.SetUpCustomMessage("Select 1 tamer to bottom deck.", "The opponent is selecting a tamer to bottom deck.");
  67. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  68. #endregion
  69. if (!CardEffectCommons.IsExistOnField(card))
  70. {
  71. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsYaoQinglan))
  72. {
  73. #region Play Yao Qinglan
  74. CardSource yaoQinglan = null;
  75. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, IsYaoQinglan));
  76. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  77. selectHandEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: IsYaoQinglan,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. maxCount: maxCount1,
  83. canNoSelect: true,
  84. canEndNotMax: false,
  85. isShowOpponent: true,
  86. selectCardCoroutine: SelectCardCoroutine,
  87. afterSelectCardCoroutine: null,
  88. mode: SelectHandEffect.Mode.Custom,
  89. cardEffect: activateClass);
  90. IEnumerator SelectCardCoroutine(CardSource cardSource)
  91. {
  92. yaoQinglan = cardSource;
  93. yield return null;
  94. }
  95. selectHandEffect.SetUpCustomMessage("Select 1 [Yao Qinglan] to play.", "The opponent is selecting 1 [Yao Qinglan] to play.");
  96. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  97. yield return StartCoroutine(selectHandEffect.Activate());
  98. if (yaoQinglan != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  99. cardSources: new List<CardSource>() { yaoQinglan },
  100. activateClass: activateClass,
  101. payCost: false,
  102. isTapped: false,
  103. root: SelectCardEffect.Root.Hand,
  104. activateETB: true
  105. ));
  106. #endregion
  107. }
  108. if (card.Owner.GetBattleAreaDigimons().Count == 0 && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsSangomon))
  109. {
  110. #region Play Sangomon From Trash
  111. CardSource sangomon = null;
  112. int maxCount2 = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, IsSangomon));
  113. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  114. selectCardEffect.SetUp(
  115. canTargetCondition: IsSangomon,
  116. canTargetCondition_ByPreSelecetedList: null,
  117. canEndSelectCondition: null,
  118. canNoSelect: () => false,
  119. selectCardCoroutine: SelectCardCoroutine1,
  120. afterSelectCardCoroutine: null,
  121. message: "Select 1 [Sangomon] to play",
  122. maxCount: maxCount2,
  123. canEndNotMax: false,
  124. isShowOpponent: true,
  125. mode: SelectCardEffect.Mode.Custom,
  126. root: SelectCardEffect.Root.Trash,
  127. customRootCardList: null,
  128. canLookReverseCard: true,
  129. selectPlayer: card.Owner,
  130. cardEffect: activateClass);
  131. IEnumerator SelectCardCoroutine1(CardSource cardSource)
  132. {
  133. sangomon = cardSource;
  134. yield return null;
  135. }
  136. selectCardEffect.SetUpCustomMessage("Select 1 [Sangomon] to play", "The opponent is selecting 1 [Sangomon] to play.");
  137. yield return StartCoroutine(selectCardEffect.Activate());
  138. if (sangomon != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  139. cardSources: new List<CardSource>() { sangomon },
  140. activateClass: activateClass,
  141. payCost: false,
  142. isTapped: false,
  143. root: SelectCardEffect.Root.Trash,
  144. activateETB: true
  145. ));
  146. #endregion
  147. }
  148. }
  149. }
  150. }
  151. #endregion
  152. #region All Turns
  153. if (timing == EffectTiming.OnAddDigivolutionCards)
  154. {
  155. ActivateClass activateClass = new ActivateClass();
  156. activateClass.SetUpICardEffect("Suspend tamer, Draw 1", CanUseCondition, card);
  157. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  158. cardEffects.Add(activateClass);
  159. string EffectDiscription()
  160. {
  161. return "[All Turns] When effects add digivolution cards to any of your Digimon with [Aqua] or [Sea Animal] in any of their traits, by suspending this Tamer, <Draw 1> (Draw 1 card from your deck.)";
  162. }
  163. bool CanUseCondition(Hashtable hashtable)
  164. {
  165. return CardEffectCommons.CanTriggerOnAddDigivolutionCard(hashtable, IsAquaOrSeaAnimalTrait, null, null);
  166. }
  167. bool CanActivateCondition(Hashtable hashtable)
  168. {
  169. return CardEffectCommons.IsExistOnBattleArea(card)
  170. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  171. }
  172. bool IsAquaOrSeaAnimalTrait(Permanent permanent)
  173. {
  174. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  175. && (permanent.TopCard.HasAquaTraits || permanent.TopCard.HasSeaAnimalTraits);
  176. }
  177. IEnumerator ActivateCoroutine(Hashtable hashtable)
  178. {
  179. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, hashtable).Tap());
  180. if (card.PermanentOfThisCard().IsSuspended) yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  181. }
  182. }
  183. #endregion
  184. #region Security
  185. if (timing == EffectTiming.SecuritySkill)
  186. {
  187. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  188. }
  189. #endregion
  190. return cardEffects;
  191. }
  192. }
  193. }