BT13_087.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT13
  4. {
  5. public class BT13_087 : 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.OnEnterFieldAnyone)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Reveal the top 4 cards of deck", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[On Play] Reveal the top 4 cards of your deck. Add 2 cards with [Lucemon] in their names or the [Royal Knight] trait among them to the hand. Trash the rest.";
  19. }
  20. bool CanSelectCardCondition(CardSource cardSource)
  21. {
  22. if (cardSource.ContainsCardName("Lucemon"))
  23. {
  24. return true;
  25. }
  26. if (cardSource.HasRoyalKnightTraits)
  27. {
  28. return true;
  29. }
  30. return false;
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.IsExistOnBattleArea(card))
  39. {
  40. if (card.Owner.LibraryCards.Count >= 1)
  41. {
  42. return true;
  43. }
  44. }
  45. return false;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  48. {
  49. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  50. revealCount: 4,
  51. simplifiedSelectCardConditions:
  52. new SimplifiedSelectCardConditionClass[]
  53. {
  54. new SimplifiedSelectCardConditionClass(
  55. canTargetCondition:CanSelectCardCondition,
  56. message: "Select 2 cards with [Lucemon] in their names or the [Royal Knight] trait.",
  57. mode: SelectCardEffect.Mode.AddHand,
  58. maxCount: 2,
  59. selectCardCoroutine: null),
  60. },
  61. remainingCardsPlace: RemainingCardsPlace.Trash,
  62. activateClass: activateClass
  63. ));
  64. }
  65. }
  66. if (timing == EffectTiming.OnEnterFieldAnyone)
  67. {
  68. ActivateClass activateClass = new ActivateClass();
  69. activateClass.SetUpICardEffect("Reveal the top 4 cards of deck", CanUseCondition, card);
  70. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  71. cardEffects.Add(activateClass);
  72. string EffectDiscription()
  73. {
  74. return "[When Digivolving] Reveal the top 4 cards of your deck. Add 2 cards with [Lucemon] in their names or the [Royal Knight] trait among them to the hand. Trash the rest.";
  75. }
  76. bool CanSelectCardCondition(CardSource cardSource)
  77. {
  78. if (cardSource.ContainsCardName("Lucemon"))
  79. {
  80. return true;
  81. }
  82. if (cardSource.HasRoyalKnightTraits)
  83. {
  84. return true;
  85. }
  86. return false;
  87. }
  88. bool CanUseCondition(Hashtable hashtable)
  89. {
  90. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  91. }
  92. bool CanActivateCondition(Hashtable hashtable)
  93. {
  94. if (CardEffectCommons.IsExistOnBattleArea(card))
  95. {
  96. if (card.Owner.LibraryCards.Count >= 1)
  97. {
  98. return true;
  99. }
  100. }
  101. return false;
  102. }
  103. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  104. {
  105. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  106. revealCount: 4,
  107. simplifiedSelectCardConditions:
  108. new SimplifiedSelectCardConditionClass[]
  109. {
  110. new SimplifiedSelectCardConditionClass(
  111. canTargetCondition:CanSelectCardCondition,
  112. message: "Select 2 cards with [Lucemon] in their names or the [Royal Knight] trait.",
  113. mode: SelectCardEffect.Mode.AddHand,
  114. maxCount: 2,
  115. selectCardCoroutine: null),
  116. },
  117. remainingCardsPlace: RemainingCardsPlace.Trash,
  118. activateClass: activateClass
  119. ));
  120. }
  121. }
  122. if (timing == EffectTiming.OnEnterFieldAnyone)
  123. {
  124. ActivateClass activateClass = new ActivateClass();
  125. activateClass.SetUpICardEffect("Delete opponent's all level 4 or lower Digimon", CanUseCondition, card);
  126. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  127. cardEffects.Add(activateClass);
  128. string EffectDiscription()
  129. {
  130. return "[Your Turn] When you play another Digimon with [Lucemon] in its name or the [Royal Knight] trait, delete all of your opponent's level 4 or lower Digimon.";
  131. }
  132. bool CanSelectPermanentCondition(Permanent permanent)
  133. {
  134. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  135. {
  136. if (permanent.Level <= 4)
  137. {
  138. if (permanent.TopCard.HasLevel)
  139. {
  140. if (permanent.CanBeDestroyedBySkill(activateClass))
  141. {
  142. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  143. {
  144. return true;
  145. }
  146. }
  147. }
  148. }
  149. }
  150. return false;
  151. }
  152. bool PermanentCondition(Permanent permanent)
  153. {
  154. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  155. {
  156. if (permanent != card.PermanentOfThisCard())
  157. {
  158. if (permanent.TopCard.ContainsCardName("Lucemon"))
  159. {
  160. return true;
  161. }
  162. if (permanent.TopCard.HasRoyalKnightTraits)
  163. {
  164. return true;
  165. }
  166. }
  167. }
  168. return false;
  169. }
  170. bool CanUseCondition(Hashtable hashtable)
  171. {
  172. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  173. {
  174. if (CardEffectCommons.IsOwnerTurn(card))
  175. {
  176. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  177. {
  178. return true;
  179. }
  180. }
  181. }
  182. return false;
  183. }
  184. bool CanActivateCondition(Hashtable hashtable)
  185. {
  186. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  187. }
  188. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  189. {
  190. List<Permanent> destroyTargetPermanents = card.Owner.Enemy.GetBattleAreaDigimons().Filter(CanSelectPermanentCondition);
  191. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(destroyTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  192. }
  193. }
  194. return cardEffects;
  195. }
  196. }
  197. }