EX9_067.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Mirai Kinosaki
  6. namespace DCGO.CardEffects.EX9
  7. {
  8. public class EX9_067 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region On Play
  14. if (timing == EffectTiming.OnEnterFieldAnyone)
  15. {
  16. ActivateClass activateClass = new ActivateClass();
  17. activateClass.SetUpICardEffect("Reveal 3 top, Add 1 card with [Puppet] or [LIBERATOR] to hand", CanUseCondition, card);
  18. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[On Play] Reveal the top 3 cards of your deck. Add 1 card with the [Puppet] or [LIBERATOR] trait among them to the hand. Return the rest to the bottom of the deck.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  27. }
  28. bool CanActivateCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.IsExistOnBattleArea(card);
  31. }
  32. bool CanSelectCardCondition(CardSource cardSource)
  33. {
  34. return cardSource.EqualsTraits("Puppet") || cardSource.EqualsTraits("LIBERATOR");
  35. }
  36. IEnumerator ActivateCoroutine(Hashtable hashtable)
  37. {
  38. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  39. revealCount: 3,
  40. simplifiedSelectCardConditions:
  41. new SimplifiedSelectCardConditionClass[]
  42. {
  43. new SimplifiedSelectCardConditionClass(
  44. canTargetCondition: CanSelectCardCondition,
  45. message: "Select 1 [Puppet] or [LIBERATOR] card.",
  46. mode: SelectCardEffect.Mode.AddHand,
  47. maxCount: 1,
  48. selectCardCoroutine: null)
  49. },
  50. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  51. activateClass: activateClass
  52. ));
  53. }
  54. }
  55. #endregion
  56. #region Your Turn
  57. if (timing == EffectTiming.OnEnterFieldAnyone)
  58. {
  59. ActivateClass activateClass = new ActivateClass();
  60. activateClass.SetUpICardEffect("Play 1 Arisa Kinosaki or [Puppet] digimon from hand for -3 cost", CanUseCondition, card);
  61. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  62. cardEffects.Add(activateClass);
  63. string EffectDiscription()
  64. {
  65. return "[Your Turn] When any of your Digimon digivolve into a [Puppet] trait Digimon, by returning this Tamer to the bottom of the deck, you may play 1 [Arisa Kinosaki] or 1 [Puppet] trait Digimon card from your hand with the play cost reduced by 3.";
  66. }
  67. bool CanUseCondition(Hashtable hashtable)
  68. {
  69. return CardEffectCommons.IsExistOnBattleArea(card)
  70. && CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, permanent =>
  71. {
  72. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  73. {
  74. if (permanent.TopCard.EqualsTraits("Puppet"))
  75. {
  76. return true;
  77. }
  78. }
  79. return false;
  80. });
  81. }
  82. bool CanActivateCondition(Hashtable hashtable)
  83. {
  84. return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.IsOwnerTurn(card);
  85. }
  86. bool CanSelectCardCondition(CardSource cardSource)
  87. {
  88. if (cardSource.IsTamer && cardSource.CardNames.Contains("Arisa Kinosaki"))
  89. {
  90. return true;
  91. }
  92. if (cardSource.IsDigimon && cardSource.EqualsTraits("Puppet"))
  93. {
  94. return true;
  95. }
  96. return false;
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable hashtable)
  99. {
  100. yield return ContinuousController.instance.StartCoroutine(new DeckBottomBounceClass(new List<Permanent> { card.PermanentOfThisCard() }, hashtable).DeckBounce());
  101. List<CardSource> selectedCards = new List<CardSource>();
  102. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  103. {
  104. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  105. selectHandEffect.SetUp(
  106. selectPlayer: card.Owner,
  107. canTargetCondition: CanSelectCardCondition,
  108. canTargetCondition_ByPreSelecetedList: null,
  109. canEndSelectCondition: null,
  110. maxCount: 1,
  111. canNoSelect: true,
  112. canEndNotMax: true,
  113. isShowOpponent: true,
  114. selectCardCoroutine: SelectCardCoroutine,
  115. afterSelectCardCoroutine: null,
  116. mode: SelectHandEffect.Mode.Custom,
  117. cardEffect: activateClass);
  118. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  119. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  120. yield return StartCoroutine(selectHandEffect.Activate());
  121. IEnumerator SelectCardCoroutine(CardSource cardSource)
  122. {
  123. selectedCards.Add(cardSource);
  124. yield return null;
  125. }
  126. if(selectedCards.Count > 0)
  127. {
  128. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  129. cardSources: selectedCards,
  130. activateClass: activateClass,
  131. payCost: true,
  132. isTapped: false,
  133. root: SelectCardEffect.Root.Hand,
  134. activateETB: true,
  135. fixedCost: selectedCards[0].BasePlayCostFromEntity - 3));
  136. }
  137. }
  138. }
  139. }
  140. #endregion
  141. #region Security
  142. if (timing == EffectTiming.SecuritySkill)
  143. {
  144. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  145. }
  146. #endregion
  147. return cardEffects;
  148. }
  149. }
  150. }