EX2_039.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX2
  4. {
  5. public class EX2_039 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnDiscardLibrary)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Trash up to 3 cards from deck top", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "When this card is trashed from your deck, if it wasn't trashed by [EX2-039 Impmon]'s effect, you may trash up to 3 cards from the top of your deck.";
  19. }
  20. bool CardEffectCondition(ICardEffect cardEffect)
  21. {
  22. if (cardEffect != null)
  23. {
  24. if (cardEffect.EffectSourceCard != null)
  25. {
  26. if (cardEffect.EffectSourceCard != null)
  27. {
  28. if (cardEffect.EffectSourceCard.CardID == "EX2-039")
  29. {
  30. return false;
  31. }
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.CanTriggerWhenSelfDiscardLibrary(hashtable, card))
  40. {
  41. if (!CardEffectCommons.IsByEffect(hashtable, CardEffectCondition))
  42. {
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.IsExistOnTrash(card))
  51. {
  52. if (card.Owner.LibraryCards.Count >= 1)
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. int maxCount = 3;
  62. SelectCountEffect selectCountEffect = GManager.instance.GetComponent<SelectCountEffect>();
  63. if (selectCountEffect != null)
  64. {
  65. selectCountEffect.SetUp(
  66. SelectPlayer: card.Owner,
  67. targetPermanent: null,
  68. MaxCount: maxCount,
  69. CanNoSelect: true,
  70. Message: "How many cards do you trash?",
  71. Message_Enemy: "The opponent is choosing how many cards to trash.",
  72. SelectCountCoroutine: SelectCountCoroutine);
  73. yield return ContinuousController.instance.StartCoroutine(selectCountEffect.Activate());
  74. IEnumerator SelectCountCoroutine(int count)
  75. {
  76. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(count, card.Owner, activateClass).AddTrashCardsFromLibraryTop());
  77. }
  78. }
  79. }
  80. }
  81. if (timing == EffectTiming.OnEnterFieldAnyone)
  82. {
  83. ActivateClass activateClass = new ActivateClass();
  84. activateClass.SetUpICardEffect("Reveal the top 4 cards of deck", CanUseCondition, card);
  85. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  86. cardEffects.Add(activateClass);
  87. string EffectDiscription()
  88. {
  89. return "[On Play] Reveal the top 4 cards of your deck. Add 1 Digimon card with [Beelzemon] in its name and 1 [Ai & Mako] among them to your hand. Place the remaining cards at the bottom of your deck in any order.";
  90. }
  91. bool CanSelectCardCondition(CardSource cardSource)
  92. {
  93. if (cardSource.ContainsCardName("Beelzemon"))
  94. {
  95. if (cardSource.IsDigimon)
  96. {
  97. return true;
  98. }
  99. }
  100. return false;
  101. }
  102. bool CanSelectCardCondition1(CardSource cardSource)
  103. {
  104. if (cardSource.CardNames.Contains("Ai & Mako"))
  105. {
  106. return true;
  107. }
  108. if (cardSource.CardNames.Contains("Ai&Mako"))
  109. {
  110. return true;
  111. }
  112. return false;
  113. }
  114. bool CanUseCondition(Hashtable hashtable)
  115. {
  116. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  117. }
  118. bool CanActivateCondition(Hashtable hashtable)
  119. {
  120. if (CardEffectCommons.IsExistOnBattleArea(card))
  121. {
  122. if (card.Owner.LibraryCards.Count >= 1)
  123. {
  124. return true;
  125. }
  126. }
  127. return false;
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  130. {
  131. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  132. revealCount: 4,
  133. simplifiedSelectCardConditions:
  134. new SimplifiedSelectCardConditionClass[]
  135. {
  136. new SimplifiedSelectCardConditionClass(
  137. canTargetCondition:CanSelectCardCondition,
  138. message: "Select 1 Digimon card with [Beelzemon] in its name.",
  139. mode: SelectCardEffect.Mode.AddHand,
  140. maxCount: 1,
  141. selectCardCoroutine: null),
  142. new SimplifiedSelectCardConditionClass(
  143. canTargetCondition:CanSelectCardCondition1,
  144. message: "Select 1 [Ai & Mako].",
  145. mode: SelectCardEffect.Mode.AddHand,
  146. maxCount: 1,
  147. selectCardCoroutine: null),
  148. },
  149. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  150. activateClass: activateClass,
  151. mutualConditions: true
  152. ));
  153. }
  154. }
  155. if (timing == EffectTiming.None)
  156. {
  157. bool Condition()
  158. {
  159. if (CardEffectCommons.IsExistOnBattleArea(card))
  160. {
  161. if (CardEffectCommons.IsOwnerTurn(card))
  162. {
  163. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Beelzemon"))
  164. {
  165. return true;
  166. }
  167. }
  168. }
  169. return false;
  170. }
  171. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 3000, isInheritedEffect: true, card: card, condition: Condition));
  172. }
  173. return cardEffects;
  174. }
  175. }
  176. }