BT23_087.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //Violet Inboots
  4. namespace DCGO.CardEffects.BT23
  5. {
  6. public class BT23_087 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Start of Your Main Phase
  12. if (timing == EffectTiming.OnStartMainPhase)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("By returning this card, Play [Violet Inboots], Then 1 [Ghostmon]", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Start of Your Main Phase] By returning this Tamer to the bottom of the deck, you may play 1 [Violet Inboots] from your hand without paying the cost. Then, if you don't have a Digimon, you may play 1 [Ghostmon] from your trash without paying the cost.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. return CardEffectCommons.IsExistOnField(card) &&
  25. CardEffectCommons.IsOwnerTurn(card);
  26. }
  27. bool CanActivateCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.IsExistOnField(card);
  30. }
  31. bool IsVioletInboots(CardSource source)
  32. {
  33. return source.EqualsCardName("Violet Inboots") &&
  34. CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass);
  35. }
  36. bool IsGhostmon(CardSource source)
  37. {
  38. return source.EqualsCardName("Ghostmon") &&
  39. CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass, SelectCardEffect.Root.Trash);
  40. }
  41. IEnumerator ActivateCoroutine(Hashtable hashtable)
  42. {
  43. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeckBouncePeremanentAndProcessAccordingToResult(
  44. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  45. activateClass: activateClass,
  46. successProcess: SuccessProcess(),
  47. failureProcess: null));
  48. IEnumerator SuccessProcess()
  49. {
  50. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsVioletInboots))
  51. {
  52. List<CardSource> selectedTamerCards = new List<CardSource>();
  53. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  54. selectHandEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: IsVioletInboots,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: 1,
  60. canNoSelect: true,
  61. canEndNotMax: false,
  62. isShowOpponent: true,
  63. selectCardCoroutine: SelectCardCoroutine,
  64. afterSelectCardCoroutine: null,
  65. mode: SelectHandEffect.Mode.Custom,
  66. cardEffect: activateClass);
  67. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  68. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  69. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  70. IEnumerator SelectCardCoroutine(CardSource cardSource)
  71. {
  72. selectedTamerCards.Add(cardSource);
  73. yield return null;
  74. }
  75. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedTamerCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.DigivolutionCards, activateETB: true));
  76. }
  77. if (card.Owner.GetBattleAreaDigimons().Count == 0)
  78. {
  79. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsGhostmon))
  80. {
  81. List<CardSource> selectedDigimonCards = new List<CardSource>();
  82. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  83. selectCardEffect.SetUp(
  84. canTargetCondition: IsGhostmon,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canEndSelectCondition: null,
  87. canNoSelect: () => true,
  88. selectCardCoroutine: SelectCardCoroutine,
  89. afterSelectCardCoroutine: null,
  90. message: "Select 1 Digimon card.",
  91. maxCount: 1,
  92. canEndNotMax: false,
  93. isShowOpponent: true,
  94. mode: SelectCardEffect.Mode.Custom,
  95. root: SelectCardEffect.Root.Trash,
  96. customRootCardList: null,
  97. canLookReverseCard: true,
  98. selectPlayer: card.Owner,
  99. cardEffect: activateClass);
  100. selectCardEffect.SetUpCustomMessage("Select 1 Digimon to play.", "The opponent is selecting 1 Digimon to play.");
  101. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  102. IEnumerator SelectCardCoroutine(CardSource cardSource)
  103. {
  104. selectedDigimonCards.Add(cardSource);
  105. yield return null;
  106. }
  107. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedDigimonCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.DigivolutionCards, activateETB: true));
  108. }
  109. }
  110. }
  111. }
  112. }
  113. #endregion
  114. #region Your Turn
  115. if (timing == EffectTiming.OnEnterFieldAnyone)
  116. {
  117. ActivateClass activateClass = new ActivateClass();
  118. activateClass.SetUpICardEffect("By suspending this tamer, gain <Rush>", CanUseCondition, card);
  119. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  120. cardEffects.Add(activateClass);
  121. string EffectDiscription()
  122. {
  123. return "[Your Turn] When any of your Digimon digivolve into a Digimon with the [Ghost] trait, by suspending this Tamer, that Digimon gains <Rush> for the turn.";
  124. }
  125. bool CanUseCondition(Hashtable hashtable)
  126. {
  127. return CardEffectCommons.IsExistOnField(card) &&
  128. CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, DigivolvingCondition);
  129. }
  130. bool CanActivateCondition(Hashtable hashtable)
  131. {
  132. return CardEffectCommons.IsExistOnField(card)
  133. && CardEffectCommons.IsOwnerTurn(card)
  134. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  135. }
  136. bool DigivolvingCondition(Permanent permanent)
  137. {
  138. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  139. permanent.TopCard.HasGhostTraits;
  140. }
  141. IEnumerator ActivateCoroutine(Hashtable hashtable)
  142. {
  143. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  144. new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  145. List<Permanent> digivolvedPermanent = CardEffectCommons.GetPlayedPermanentsFromEnterFieldHashtable(hashtable, null);
  146. if(digivolvedPermanent.Count > 0)
  147. {
  148. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(digivolvedPermanent[0], card))
  149. {
  150. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  151. targetPermanent: digivolvedPermanent[0],
  152. effectDuration: EffectDuration.UntilEachTurnEnd,
  153. activateClass: activateClass));
  154. }
  155. }
  156. }
  157. }
  158. #endregion
  159. #region Security Effect
  160. if (timing == EffectTiming.SecuritySkill)
  161. {
  162. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  163. }
  164. #endregion
  165. return cardEffects;
  166. }
  167. }
  168. }