EX2_008.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX2
  5. {
  6. public class EX2_008 : 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.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Reveal the top 4 cards of deck", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] Reveal the top 4 cards of your deck. Add 1 card with [Growlmon] or [Gallantmon] in its name and 1 [Takato Matsuki] among them to your hand. Place the remaining cards at the bottom of your deck in any order.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource.ContainsCardName("Growlmon"))
  24. {
  25. return true;
  26. }
  27. if (cardSource.ContainsCardName("Gallantmon"))
  28. {
  29. return true;
  30. }
  31. return false;
  32. }
  33. bool CanSelectCardCondition1(CardSource cardSource)
  34. {
  35. if (cardSource.CardNames.Contains("Takato Matsuki"))
  36. {
  37. return true;
  38. }
  39. if (cardSource.CardNames.Contains("TakatoMatsuki"))
  40. {
  41. return true;
  42. }
  43. return false;
  44. }
  45. bool CanUseCondition(Hashtable hashtable)
  46. {
  47. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  48. }
  49. bool CanActivateCondition(Hashtable hashtable)
  50. {
  51. if (CardEffectCommons.IsExistOnBattleArea(card))
  52. {
  53. if (card.Owner.LibraryCards.Count >= 1)
  54. {
  55. return true;
  56. }
  57. }
  58. return false;
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  61. {
  62. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  63. revealCount: 4,
  64. simplifiedSelectCardConditions:
  65. new SimplifiedSelectCardConditionClass[]
  66. {
  67. new SimplifiedSelectCardConditionClass(
  68. canTargetCondition:CanSelectCardCondition,
  69. message: "Select 1 card with [Growlmon] or [Gallantmon] in its name.",
  70. mode: SelectCardEffect.Mode.AddHand,
  71. maxCount: 1,
  72. selectCardCoroutine: null),
  73. new SimplifiedSelectCardConditionClass(
  74. canTargetCondition:CanSelectCardCondition1,
  75. message: "Select 1 [Takato Matsuki].",
  76. mode: SelectCardEffect.Mode.AddHand,
  77. maxCount: 1,
  78. selectCardCoroutine: null),
  79. },
  80. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  81. activateClass: activateClass,
  82. mutualConditions: true
  83. ));
  84. }
  85. }
  86. if (timing == EffectTiming.OnAllyAttack)
  87. {
  88. ActivateClass activateClass = new ActivateClass();
  89. activateClass.SetUpICardEffect("Delete 1 Digimon with 3000 DP or less", CanUseCondition, card);
  90. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  91. activateClass.SetIsInheritedEffect(true);
  92. activateClass.SetHashString("Delete_EX2_008");
  93. cardEffects.Add(activateClass);
  94. string EffectDiscription()
  95. {
  96. return "[When Attacking][Once Per Turn] If this Digimon has [Growlmon] or [Gallantmon] in its name, delete 1 of your opponent's Digimon with 3000 DP or less.";
  97. }
  98. bool CanSelectPermanentCondition(Permanent permanent)
  99. {
  100. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  101. {
  102. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(3000, activateClass))
  103. {
  104. return true;
  105. }
  106. }
  107. return false;
  108. }
  109. bool CanUseCondition(Hashtable hashtable)
  110. {
  111. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  112. }
  113. bool CanActivateCondition(Hashtable hashtable)
  114. {
  115. if (CardEffectCommons.IsExistOnBattleArea(card))
  116. {
  117. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Growlmon"))
  118. {
  119. return true;
  120. }
  121. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Gallantmon"))
  122. {
  123. return true;
  124. }
  125. }
  126. return false;
  127. }
  128. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  129. {
  130. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  131. {
  132. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  133. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  134. selectPermanentEffect.SetUp(
  135. selectPlayer: card.Owner,
  136. canTargetCondition: CanSelectPermanentCondition,
  137. canTargetCondition_ByPreSelecetedList: null,
  138. canEndSelectCondition: null,
  139. maxCount: maxCount,
  140. canNoSelect: false,
  141. canEndNotMax: false,
  142. selectPermanentCoroutine: null,
  143. afterSelectPermanentCoroutine: null,
  144. mode: SelectPermanentEffect.Mode.Destroy,
  145. cardEffect: activateClass);
  146. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  147. }
  148. }
  149. }
  150. return cardEffects;
  151. }
  152. }
  153. }