BT15_011.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT15
  5. {
  6. public class BT15_011 : 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. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. if (targetPermanent.TopCard.CardTraits.Contains("SoC"))
  16. {
  17. if (targetPermanent.TopCard.HasLevel)
  18. {
  19. if (targetPermanent.Level == 3)
  20. {
  21. return true;
  22. }
  23. }
  24. }
  25. return false;
  26. }
  27. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  28. }
  29. if (timing == EffectTiming.None)
  30. {
  31. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  32. }
  33. if (timing == EffectTiming.OnEnterFieldAnyone)
  34. {
  35. ActivateClass activateClass = new ActivateClass();
  36. activateClass.SetUpICardEffect("Reveal the top 4 cards of deck", CanUseCondition, card);
  37. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  38. cardEffects.Add(activateClass);
  39. string EffectDiscription()
  40. {
  41. return "[On Play] Reveal the top 4 cards of your deck. Add 1 Digimon card and 1 Tamer card both with the [SoC] trait among them to the hand. Return the rest to the bottom of the deck. If you added, trash 1 card in your hand.";
  42. }
  43. bool CanSelectCardCondition(CardSource cardSource)
  44. {
  45. if (cardSource.IsDigimon)
  46. {
  47. if (cardSource.CardTraits.Contains("SoC"))
  48. {
  49. return true;
  50. }
  51. }
  52. return false;
  53. }
  54. bool CanSelectCardCondition1(CardSource cardSource)
  55. {
  56. if (cardSource.IsTamer)
  57. {
  58. if (cardSource.CardTraits.Contains("SoC"))
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. bool CanUseCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  68. }
  69. bool CanActivateCondition(Hashtable hashtable)
  70. {
  71. if (CardEffectCommons.IsExistOnBattleArea(card))
  72. {
  73. if (card.Owner.LibraryCards.Count >= 1)
  74. {
  75. return true;
  76. }
  77. }
  78. return false;
  79. }
  80. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  81. {
  82. bool added = false;
  83. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  84. revealCount: 4,
  85. simplifiedSelectCardConditions:
  86. new SimplifiedSelectCardConditionClass[]
  87. {
  88. new SimplifiedSelectCardConditionClass(
  89. canTargetCondition:CanSelectCardCondition,
  90. message: "Select 1 Digimon card with the [SoC] trait.",
  91. mode: SelectCardEffect.Mode.AddHand,
  92. maxCount: 1,
  93. selectCardCoroutine: null),
  94. new SimplifiedSelectCardConditionClass(
  95. canTargetCondition:CanSelectCardCondition1,
  96. message: "Select 1 Tamer card with the [SoC] trait.",
  97. mode: SelectCardEffect.Mode.AddHand,
  98. maxCount: 1,
  99. selectCardCoroutine: null),
  100. },
  101. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  102. activateClass: activateClass,
  103. revealedCardsCoroutine: RevealedCardsCoroutine
  104. ));
  105. IEnumerator RevealedCardsCoroutine(List<CardSource> revealedCards)
  106. {
  107. added = revealedCards.Count(CardSource => CanSelectCardCondition(CardSource) || CanSelectCardCondition1(CardSource)) >= 1;
  108. yield return null;
  109. }
  110. if (added)
  111. {
  112. if (card.Owner.HandCards.Count >= 1)
  113. {
  114. int discardCount = 1;
  115. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  116. selectHandEffect.SetUp(
  117. selectPlayer: card.Owner,
  118. canTargetCondition: (cardSource) => true,
  119. canTargetCondition_ByPreSelecetedList: null,
  120. canEndSelectCondition: null,
  121. maxCount: discardCount,
  122. canNoSelect: false,
  123. canEndNotMax: false,
  124. isShowOpponent: true,
  125. selectCardCoroutine: null,
  126. afterSelectCardCoroutine: null,
  127. mode: SelectHandEffect.Mode.Discard,
  128. cardEffect: activateClass);
  129. yield return StartCoroutine(selectHandEffect.Activate());
  130. }
  131. }
  132. }
  133. }
  134. return cardEffects;
  135. }
  136. }
  137. }