EX8_057.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX8
  4. {
  5. public class EX8_057 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.IsLevel2 && targetPermanent.TopCard.EqualsTraits("NSo");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  18. permanentCondition: PermanentCondition,
  19. digivolutionCost: 0,
  20. ignoreDigivolutionRequirement: false,
  21. card: card,
  22. condition: null)
  23. );
  24. }
  25. #endregion
  26. #region On Play
  27. if (timing == EffectTiming.OnEnterFieldAnyone)
  28. {
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  32. EffectDescription());
  33. cardEffects.Add(activateClass);
  34. string EffectDescription()
  35. {
  36. return
  37. "[On Play] Reveal the top 3 cards of your deck. Add 1 card with the [NSo] trait and 1 card with the [Fallen Angel] trait among them to the hand. Return the rest to the bottom of the deck.";
  38. }
  39. bool CanSelectNightmareSoldierCardCondition(CardSource cardSource)
  40. {
  41. return cardSource.EqualsTraits("NSo");
  42. }
  43. bool CanSelectFallenAngelCardCondition(CardSource cardSource)
  44. {
  45. return cardSource.EqualsTraits("Fallen Angel");
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  50. }
  51. bool CanActivateCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  54. card.Owner.LibraryCards.Count >= 1;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable hashtable)
  57. {
  58. yield return ContinuousController.instance.StartCoroutine(
  59. CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  60. revealCount: 3,
  61. simplifiedSelectCardConditions:
  62. new SimplifiedSelectCardConditionClass[]
  63. {
  64. new(
  65. canTargetCondition: CanSelectNightmareSoldierCardCondition,
  66. message: "Select 1 card with the [NSo] trait.",
  67. mode: SelectCardEffect.Mode.AddHand,
  68. maxCount: 1,
  69. selectCardCoroutine: null),
  70. new(
  71. canTargetCondition: CanSelectFallenAngelCardCondition,
  72. message: "Select 1 card with the [Fallen Angel] trait.",
  73. mode: SelectCardEffect.Mode.AddHand,
  74. maxCount: 1,
  75. selectCardCoroutine: null),
  76. },
  77. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  78. activateClass: activateClass
  79. ));
  80. }
  81. }
  82. #endregion
  83. #region ESS - When Attacking
  84. if (timing == EffectTiming.OnAllyAttack)
  85. {
  86. ActivateClass activateClass = new ActivateClass();
  87. activateClass.SetUpICardEffect("Draw 1 and trash 1 card from hand", CanUseCondition, card);
  88. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  89. activateClass.SetIsInheritedEffect(true);
  90. activateClass.SetHashString("Draw_EX8_057");
  91. cardEffects.Add(activateClass);
  92. string EffectDiscription()
  93. {
  94. return "[When Attacking] [Once Per Turn] <Draw 1> and trash 1 card in your hand.";
  95. }
  96. bool CanUseCondition(Hashtable hashtable)
  97. {
  98. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  99. }
  100. bool CanActivateCondition(Hashtable hashtable)
  101. {
  102. if (CardEffectCommons.IsExistOnBattleArea(card))
  103. {
  104. return true;
  105. }
  106. return false;
  107. }
  108. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  109. {
  110. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  111. if (card.Owner.HandCards.Count >= 1)
  112. {
  113. int discardCount = 1;
  114. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  115. selectHandEffect.SetUp(
  116. selectPlayer: card.Owner,
  117. canTargetCondition: (cardSource) => true,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canEndSelectCondition: null,
  120. maxCount: discardCount,
  121. canNoSelect: false,
  122. canEndNotMax: false,
  123. isShowOpponent: true,
  124. selectCardCoroutine: null,
  125. afterSelectCardCoroutine: null,
  126. mode: SelectHandEffect.Mode.Discard,
  127. cardEffect: activateClass);
  128. yield return StartCoroutine(selectHandEffect.Activate());
  129. }
  130. }
  131. }
  132. #endregion
  133. return cardEffects;
  134. }
  135. }
  136. }