BT12_086.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_086 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  14. }
  15. if (timing == EffectTiming.OnEnterFieldAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[On Play] Reveal the top 3 cards of your deck. Add up to 2 differently colored Digimon cards with <Save> in their text among them to your hand. Place the remaining cards at the bottom of your deck in any order.";
  24. }
  25. bool CanSelectCardCondition(CardSource cardSource)
  26. {
  27. if (cardSource.IsDigimon)
  28. {
  29. if (cardSource.HasSaveText)
  30. {
  31. if (cardSource.CardColors.Count >= 1)
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  42. }
  43. bool CanActivateCondition(Hashtable hashtable)
  44. {
  45. if (CardEffectCommons.IsExistOnBattleArea(card))
  46. {
  47. if (card.Owner.LibraryCards.Count >= 1)
  48. {
  49. return true;
  50. }
  51. }
  52. return false;
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  55. {
  56. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  57. revealCount: 3,
  58. simplifiedSelectCardConditions:
  59. new SimplifiedSelectCardConditionClass[]
  60. {
  61. new SimplifiedSelectCardConditionClass(
  62. canTargetCondition:CanSelectCardCondition,
  63. message: "Select up to 2 differently colored Digimon cards with <Save> in their text.",
  64. mode: SelectCardEffect.Mode.AddHand,
  65. maxCount: 2,
  66. selectCardCoroutine: null),
  67. },
  68. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  69. activateClass: activateClass,
  70. canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
  71. canEndSelectCondition: CanEndSelectCondition,
  72. canEndNotMax: true
  73. ));
  74. bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource cardSource)
  75. {
  76. List<CardSource> concat = cardSources.Concat(new List<CardSource>() { cardSource }).ToList();
  77. if (Combinations.GetDifferenetColorCardCount(concat) < concat.Count)
  78. {
  79. return false;
  80. }
  81. return true;
  82. }
  83. bool CanEndSelectCondition(List<CardSource> cardSources)
  84. {
  85. if (cardSources.Count <= 0)
  86. {
  87. return false;
  88. }
  89. if (Combinations.GetDifferenetColorCardCount(cardSources) < cardSources.Count)
  90. {
  91. return false;
  92. }
  93. return true;
  94. }
  95. }
  96. }
  97. if (timing == EffectTiming.OnDestroyedAnyone)
  98. {
  99. cardEffects.Add(CardEffectFactory.SaveEffect(card: card));
  100. }
  101. if (timing == EffectTiming.None)
  102. {
  103. bool Condition()
  104. {
  105. if (CardEffectCommons.IsExistOnBattleArea(card))
  106. {
  107. if (CardEffectCommons.IsOwnerTurn(card))
  108. {
  109. if (card.PermanentOfThisCard().TopCard.HasSaveText)
  110. {
  111. return true;
  112. }
  113. }
  114. }
  115. return false;
  116. }
  117. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(isInheritedEffect: true, card: card, condition: Condition));
  118. }
  119. return cardEffects;
  120. }
  121. }
  122. }