BT24_088.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. // Asuna Shiroki
  6. namespace DCGO.CardEffects.BT24
  7. {
  8. public class BT24_088 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Start of Your Turn
  14. if (timing == EffectTiming.OnStartTurn)
  15. {
  16. ActivateClass activateClass = new ActivateClass();
  17. activateClass.SetUpICardEffect("Return to deck to play another or a lvl 4 or lower [TS] or [Three Musketeers]", CanUseCondition, card);
  18. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  19. cardEffects.Add(activateClass);
  20. string EffectDescription() => "[Start of Your Turn] If you have 4 or less memory, by returning this Tamer to the bottom of the deck, you may play 1 [Asuna Shiroki] or 1 level 4 or lower Digimon card with the [TS] trait or [Three Musketeers] in its text from your trash without paying the cost.";
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.IsExistOnBattleArea(card)
  24. && CardEffectCommons.IsOwnerTurn(card);
  25. }
  26. bool CanActivateCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.IsExistOnBattleArea(card)
  29. && card.Owner.MemoryForPlayer <= 4;
  30. }
  31. bool CanSelectCardCondition(CardSource cardSource)
  32. {
  33. return (cardSource.EqualsCardName("Asuna Shiroki")
  34. || (cardSource.IsDigimon
  35. && cardSource.HasLevel
  36. && cardSource.Level <= 4
  37. && (cardSource.HasTSTraits
  38. || cardSource.HasText("Three Musketeers"))))
  39. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  40. }
  41. IEnumerator ActivateCoroutine(Hashtable hashtable)
  42. {
  43. yield return ContinuousController.instance.StartCoroutine(
  44. CardEffectCommons.DeckBouncePeremanentAndProcessAccordingToResult(
  45. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  46. activateClass: activateClass,
  47. successProcess: SuccessProcess(),
  48. failureProcess: null));
  49. IEnumerator SuccessProcess()
  50. {
  51. int maxCount = Math.Min(1, card.Owner.TrashCards.Count((cardSource) => CanSelectCardCondition(cardSource)));
  52. List<CardSource> selectedCards = new List<CardSource>();
  53. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  54. selectCardEffect.SetUp(
  55. canTargetCondition: CanSelectCardCondition,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. canNoSelect: () => true,
  59. selectCardCoroutine: SelectCardCoroutine,
  60. afterSelectCardCoroutine: null,
  61. message: "Select 1 card to play.",
  62. maxCount: maxCount,
  63. canEndNotMax: false,
  64. isShowOpponent: true,
  65. mode: SelectCardEffect.Mode.Custom,
  66. root: SelectCardEffect.Root.Trash,
  67. customRootCardList: null,
  68. canLookReverseCard: true,
  69. selectPlayer: card.Owner,
  70. cardEffect: activateClass);
  71. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  72. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  73. yield return StartCoroutine(selectCardEffect.Activate());
  74. IEnumerator SelectCardCoroutine(CardSource cardSource)
  75. {
  76. selectedCards.Add(cardSource);
  77. yield return null;
  78. }
  79. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  80. cardSources: selectedCards,
  81. activateClass: activateClass,
  82. payCost: false,
  83. isTapped: false,
  84. root: SelectCardEffect.Root.Trash,
  85. activateETB: true));
  86. }
  87. }
  88. }
  89. #endregion
  90. #region On Play
  91. if (timing == EffectTiming.OnEnterFieldAnyone)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("Trash 1 card from hand to Draw 2", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  96. cardEffects.Add(activateClass);
  97. string EffectDescription() => "[On Play] By trashing 1 card with [Three Musketeers] in its text or the [TS] trait from your hand, <Draw 2>.";
  98. bool CanSelectCardCondition(CardSource cardSource)
  99. {
  100. return cardSource.HasText("Three Musketeers")
  101. || cardSource.HasTSTraits;
  102. }
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. return CardEffectCommons.IsExistOnBattleArea(card)
  106. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  107. }
  108. bool CanActivateCondition(Hashtable hashtable)
  109. {
  110. return CardEffectCommons.IsExistOnBattleArea(card)
  111. && card.Owner.HandCards.Count >= 1;
  112. }
  113. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  114. {
  115. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  116. {
  117. bool discarded = false;
  118. int discardCount = 1;
  119. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  120. selectHandEffect.SetUp(
  121. selectPlayer: card.Owner,
  122. canTargetCondition: CanSelectCardCondition,
  123. canTargetCondition_ByPreSelecetedList: null,
  124. canEndSelectCondition: null,
  125. maxCount: discardCount,
  126. canNoSelect: true,
  127. canEndNotMax: false,
  128. isShowOpponent: true,
  129. selectCardCoroutine: null,
  130. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  131. mode: SelectHandEffect.Mode.Discard,
  132. cardEffect: activateClass);
  133. yield return StartCoroutine(selectHandEffect.Activate());
  134. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  135. {
  136. if (cardSources.Count >= 1)
  137. {
  138. discarded = true;
  139. yield return null;
  140. }
  141. }
  142. if (discarded)
  143. {
  144. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
  145. }
  146. }
  147. }
  148. }
  149. #endregion
  150. #region Security
  151. if (timing == EffectTiming.SecuritySkill)
  152. {
  153. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  154. }
  155. #endregion
  156. return cardEffects;
  157. }
  158. }
  159. }