BT22_094.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using UnityEngine;
  5. // Yuugo Kamishiro
  6. namespace DCGO.CardEffects.BT22
  7. {
  8. public class BT22_094 : 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 top 3, add 1 [CS] card to hand, bottom deck the rest", 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 [CS] 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.IsExistOnField(card);
  31. }
  32. bool CanSelectCardCondition(CardSource cardSource)
  33. {
  34. return cardSource.HasCSTraits;
  35. }
  36. IEnumerator ActivateCoroutine(Hashtable hashtable)
  37. {
  38. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  39. revealCount: 3,
  40. new SimplifiedSelectCardConditionClass[]
  41. {
  42. new SimplifiedSelectCardConditionClass(
  43. canTargetCondition: CanSelectCardCondition,
  44. message: "Select 1 [CS] Card",
  45. mode: SelectCardEffect.Mode.AddHand,
  46. maxCount: 1,
  47. selectCardCoroutine: null),
  48. },
  49. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  50. activateClass: activateClass
  51. ));
  52. }
  53. }
  54. #endregion
  55. #region Your Turn
  56. #region Before Pay Cost
  57. if (timing == EffectTiming.BeforePayCost)
  58. {
  59. ActivateClass activateClass2 = new ActivateClass();
  60. activateClass2.SetUpICardEffect("Reduce play cost", CanUseCondition2, card);
  61. activateClass2.SetUpActivateClass(CanActivateCondition2, ActivateCoroutine2, -1, true, EffectDiscription2());
  62. cardEffects.Add(activateClass2);
  63. string EffectDiscription2()
  64. {
  65. return "[Your Turn] When any of your Digimon or Tamers with the [CS] trait would be played, by returning this Tamer to the bottom of the deck, reduce the play cost by 2.";
  66. }
  67. bool PlayCardCondition(CardSource cardSource)
  68. {
  69. return (cardSource.IsDigimon
  70. || cardSource.IsTamer)
  71. && cardSource.HasCSTraits
  72. && cardSource.Owner == card.Owner;
  73. }
  74. bool CanUseCondition2(Hashtable hashtable)
  75. {
  76. return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, PlayCardCondition)
  77. && CardEffectCommons.IsExistOnBattleArea(card);
  78. }
  79. bool CanActivateCondition2(Hashtable hashtable)
  80. {
  81. return CardEffectCommons.IsExistOnBattleArea(card)
  82. && CardEffectCommons.IsOwnerTurn(card);
  83. }
  84. IEnumerator ActivateCoroutine2(Hashtable _hashtable)
  85. {
  86. Permanent bounceTargetPermanent = card.PermanentOfThisCard();
  87. if (bounceTargetPermanent != null)
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeckBouncePeremanentAndProcessAccordingToResult(
  90. targetPermanents: new List<Permanent>() { bounceTargetPermanent },
  91. activateClass: activateClass2,
  92. successProcess: SuccessProcess(),
  93. failureProcess: null));
  94. IEnumerator SuccessProcess()
  95. {
  96. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  97. ChangeCostClass changeCostClass = new ChangeCostClass();
  98. changeCostClass.SetUpICardEffect("Cost -2", CanUseChangeCostCondition, card);
  99. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  100. card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
  101. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
  102. bool CanUseChangeCostCondition(Hashtable hashtable)
  103. {
  104. return true;
  105. }
  106. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  107. {
  108. if (CardSourceCondition(cardSource)
  109. && RootCondition(root)
  110. && PermanentsCondition(targetPermanents))
  111. {
  112. Cost -= 2;
  113. }
  114. return Cost;
  115. }
  116. bool PermanentsCondition(List<Permanent> targetPermanents)
  117. {
  118. return targetPermanents != null;
  119. }
  120. bool CardSourceCondition(CardSource cardSource)
  121. {
  122. if (cardSource != null)
  123. {
  124. return cardSource.Owner == card.Owner;
  125. }
  126. return false;
  127. }
  128. bool RootCondition(SelectCardEffect.Root root) => true;
  129. bool isUpDown() => true;
  130. }
  131. }
  132. }
  133. }
  134. #endregion
  135. #region Before Pay Cost (Not Shown)
  136. if (timing == EffectTiming.None)
  137. {
  138. ChangeCostClass changeCostClass = new ChangeCostClass();
  139. changeCostClass.SetUpICardEffect("Play Cost -2", CanUseChangeCostCondition, card);
  140. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true);
  141. changeCostClass.SetNotShowUI(true);
  142. cardEffects.Add(changeCostClass);
  143. bool CanUseChangeCostCondition(Hashtable hashtable)
  144. {
  145. return true;
  146. }
  147. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  148. {
  149. if (CardSourceCondition(cardSource)
  150. && RootCondition(root)
  151. && PermanentsCondition(targetPermanents))
  152. {
  153. Cost -= 2;
  154. }
  155. return Cost;
  156. }
  157. bool PermanentsCondition(List<Permanent> targetPermanents)
  158. {
  159. return targetPermanents != null;
  160. }
  161. bool CardSourceCondition(CardSource cardSource)
  162. {
  163. if (cardSource != null)
  164. {
  165. return cardSource.Owner == card.Owner;
  166. }
  167. return false;
  168. }
  169. bool RootCondition(SelectCardEffect.Root root) => true;
  170. bool isUpDown() => true;
  171. }
  172. #endregion
  173. #endregion
  174. #region Security
  175. if (timing == EffectTiming.SecuritySkill)
  176. {
  177. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  178. }
  179. #endregion
  180. return cardEffects;
  181. }
  182. }
  183. }