EX10_046.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Devimon
  5. namespace DCGO.CardEffects.EX10
  6. {
  7. public class EX10_046 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region SOYMP/WD Shared
  13. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  14. {
  15. #region Check Opponent Trash & Trash 2 if true
  16. bool trashDeck = card.Owner.Enemy.TrashCards.Count <= 10;
  17. if (trashDeck)
  18. {
  19. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(
  20. addTrashCount: 2,
  21. player: card.Owner,
  22. cardEffect: activateClass).AddTrashCardsFromLibraryTop());
  23. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(
  24. addTrashCount: 2,
  25. player: card.Owner.Enemy,
  26. cardEffect: activateClass).AddTrashCardsFromLibraryTop());
  27. }
  28. #endregion
  29. bool CardCondition(CardSource cardSource)
  30. {
  31. return cardSource.HasFallenAngelTraits || cardSource.HasUndeadTraits;
  32. }
  33. if (card.Owner.Enemy.TrashCards.Count >= 10 && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CardCondition))
  34. {
  35. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, CardCondition));
  36. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  37. selectCardEffect.SetUp(
  38. canTargetCondition: CardCondition,
  39. canTargetCondition_ByPreSelecetedList: null,
  40. canEndSelectCondition: null,
  41. canNoSelect: () => true,
  42. selectCardCoroutine: null,
  43. afterSelectCardCoroutine: null,
  44. message: "Select 1 [Fallen Angel]/[Undead] to add to your hand.",
  45. maxCount: maxCount,
  46. canEndNotMax: false,
  47. isShowOpponent: true,
  48. mode: SelectCardEffect.Mode.AddHand,
  49. root: SelectCardEffect.Root.Trash,
  50. customRootCardList: null,
  51. canLookReverseCard: true,
  52. selectPlayer: card.Owner,
  53. cardEffect: activateClass);
  54. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  55. }
  56. }
  57. #endregion
  58. #region Start of Your Main Phase
  59. if (timing == EffectTiming.OnStartMainPhase)
  60. {
  61. ActivateClass activateClass = new ActivateClass();
  62. activateClass.SetUpICardEffect("If opponent has 10 or less in trash, trash top 2 from both players deck, then if 10 or more, add 1 [Fallen Angel]/[Undead] from trash to hand", CanUseCondition, card);
  63. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  64. cardEffects.Add(activateClass);
  65. string EffectDiscription()
  66. {
  67. return "[Start of Your Main Phase] If your opponent has 10 or fewer cards in their trash, trash the top 2 cards of both players' decks. Then, if they have 10 or more cards in their trash, you may return 1 card with the [Fallen Angel] or [Undead] trait from your trash to the hand.";
  68. }
  69. bool CanUseCondition(Hashtable hashtable)
  70. {
  71. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  72. }
  73. bool CanActivateCondition(Hashtable hashtable)
  74. {
  75. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  76. && CardEffectCommons.IsOwnerTurn(card);
  77. }
  78. }
  79. #endregion
  80. #region When Digivolving
  81. if (timing == EffectTiming.OnEnterFieldAnyone)
  82. {
  83. ActivateClass activateClass = new ActivateClass();
  84. activateClass.SetUpICardEffect("If opponent has 10 or less in trash, trash top 2 from both players deck, then if 10 or more, add 1 [Fallen Angel]/[Undead] from trash to hand", CanUseCondition, card);
  85. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  86. cardEffects.Add(activateClass);
  87. string EffectDiscription()
  88. {
  89. return "[When Digivolving] If your opponent has 10 or fewer cards in their trash, trash the top 2 cards of both players' decks. Then, if they have 10 or more cards in their trash, you may return 1 card with the [Fallen Angel] or [Undead] trait from your trash to the hand.";
  90. }
  91. bool CanUseCondition(Hashtable hashtable)
  92. {
  93. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  94. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  95. }
  96. bool CanActivateCondition(Hashtable hashtable)
  97. {
  98. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  99. }
  100. }
  101. #endregion
  102. #region ESS
  103. if (timing == EffectTiming.OnAllyAttack)
  104. {
  105. ActivateClass activateClass = new ActivateClass();
  106. activateClass.SetUpICardEffect("Trash top card from both players deck", CanUseCondition, card);
  107. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  108. activateClass.SetHashString("EX10_046_TrashTopDeck");
  109. activateClass.SetIsInheritedEffect(true);
  110. cardEffects.Add(activateClass);
  111. string EffectDiscription()
  112. {
  113. return "[When Attacking] [Once Per Turn] Trash the top card of both players' decks.";
  114. }
  115. bool CanUseCondition(Hashtable hashtable)
  116. {
  117. return CardEffectCommons.IsExistOnField(card)
  118. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  119. }
  120. bool CanActivateCondition(Hashtable hashtable)
  121. {
  122. return CardEffectCommons.IsExistOnField(card);
  123. }
  124. IEnumerator ActivateCoroutine(Hashtable hashtable)
  125. {
  126. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(
  127. addTrashCount: 1,
  128. player: card.Owner,
  129. cardEffect: activateClass).AddTrashCardsFromLibraryTop());
  130. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(
  131. addTrashCount: 1,
  132. player: card.Owner.Enemy,
  133. cardEffect: activateClass).AddTrashCardsFromLibraryTop());
  134. }
  135. }
  136. #endregion
  137. return cardEffects;
  138. }
  139. }
  140. }