BT24_083.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. // Hiroko Sagisaka
  6. namespace DCGO.CardEffects.BT24
  7. {
  8. public class BT24_083 : 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 5k- [TS]", 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 [Hiroko Sagisaka] or 1 [TS] trait Digimon card with 5000 DP or less from your hand 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("Hiroko Sagisaka")
  34. || (cardSource.IsDigimon
  35. && cardSource.HasDP
  36. && cardSource.CardDP <= 5000
  37. && cardSource.HasTSTraits))
  38. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable hashtable)
  41. {
  42. yield return ContinuousController.instance.StartCoroutine(
  43. CardEffectCommons.DeckBouncePeremanentAndProcessAccordingToResult(
  44. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  45. activateClass: activateClass,
  46. successProcess: SuccessProcess(),
  47. failureProcess: null));
  48. IEnumerator SuccessProcess()
  49. {
  50. int maxCount = Math.Min(1, card.Owner.HandCards.Count(CanSelectCardCondition));
  51. List<CardSource> selectedCards = new List<CardSource>();
  52. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  53. selectHandEffect.SetUp(
  54. selectPlayer: card.Owner,
  55. canTargetCondition: CanSelectCardCondition,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. maxCount: maxCount,
  59. canNoSelect: true,
  60. canEndNotMax: false,
  61. isShowOpponent: true,
  62. selectCardCoroutine: SelectCardCoroutine,
  63. afterSelectCardCoroutine: null,
  64. mode: SelectHandEffect.Mode.Custom,
  65. cardEffect: activateClass);
  66. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  67. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  68. yield return StartCoroutine(selectHandEffect.Activate());
  69. IEnumerator SelectCardCoroutine(CardSource cardSource)
  70. {
  71. selectedCards.Add(cardSource);
  72. yield return null;
  73. }
  74. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  75. cardSources: selectedCards,
  76. activateClass: activateClass,
  77. payCost: false,
  78. isTapped: false,
  79. root: SelectCardEffect.Root.Hand,
  80. activateETB: true));
  81. }
  82. }
  83. }
  84. #endregion
  85. #region On Play
  86. if (timing == EffectTiming.OnEnterFieldAnyone)
  87. {
  88. ActivateClass activateClass = new ActivateClass();
  89. activateClass.SetUpICardEffect("Reveal 3, Add 1, Bottom Deck the rest", CanUseCondition, card);
  90. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  91. cardEffects.Add(activateClass);
  92. string EffectDescription() => "[On Play] Reveal the top 3 cards of your deck. Add 1 card with the [TS] trait among them to the hand. Return the rest to the bottom of the deck.";
  93. bool CanSelectCardCondition(CardSource cardSource)
  94. {
  95. return cardSource.HasTSTraits;
  96. }
  97. bool CanUseCondition(Hashtable hashtable)
  98. {
  99. return CardEffectCommons.IsExistOnBattleArea(card)
  100. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  101. }
  102. bool CanActivateCondition(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.IsExistOnBattleArea(card);
  105. }
  106. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  107. {
  108. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  109. revealCount: 3,
  110. simplifiedSelectCardConditions:
  111. new SimplifiedSelectCardConditionClass[]
  112. {
  113. new SimplifiedSelectCardConditionClass(
  114. canTargetCondition:CanSelectCardCondition,
  115. message: "Select 1 card with the [TS] trait.",
  116. mode: SelectCardEffect.Mode.AddHand,
  117. maxCount: 1,
  118. selectCardCoroutine: null)
  119. },
  120. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  121. activateClass: activateClass
  122. ));
  123. }
  124. }
  125. #endregion
  126. #region Security
  127. if (timing == EffectTiming.SecuritySkill)
  128. {
  129. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  130. }
  131. #endregion
  132. return cardEffects;
  133. }
  134. }
  135. }