BT19_071.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT19
  6. {
  7. public class BT19_071 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region On Play
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Trash 2 cards from deck top and gain Blocker", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] Trash the top 2 cards of your deck. Then, this Digimon gains <Blocker> until the end of your opponent's turn.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  26. }
  27. bool CanActivateCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  30. }
  31. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  32. {
  33. if (card.Owner.LibraryCards.Count >= 1)
  34. {
  35. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(2, card.Owner, activateClass).AddTrashCardsFromLibraryTop());
  36. }
  37. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  38. targetPermanent: card.PermanentOfThisCard(), effectDuration: EffectDuration.UntilOpponentTurnEnd,
  39. activateClass: activateClass));
  40. }
  41. }
  42. #endregion
  43. #region When Digivolving
  44. if (timing == EffectTiming.OnEnterFieldAnyone)
  45. {
  46. ActivateClass activateClass = new ActivateClass();
  47. activateClass.SetUpICardEffect("Trash 2 cards from deck top and gain Blocker", CanUseCondition, card);
  48. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  49. cardEffects.Add(activateClass);
  50. string EffectDiscription()
  51. {
  52. return "[When Digivolving] Trash the top 2 cards of your deck. Then, this Digimon gains <Blocker> until the end of your opponent's turn.";
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  57. {
  58. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. bool CanActivateCondition(Hashtable hashtable)
  66. {
  67. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  68. {
  69. return true;
  70. }
  71. return false;
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  74. {
  75. if (card.Owner.LibraryCards.Count >= 1)
  76. {
  77. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(2, card.Owner, activateClass).AddTrashCardsFromLibraryTop());
  78. }
  79. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  80. targetPermanent: card.PermanentOfThisCard(), effectDuration: EffectDuration.UntilOpponentTurnEnd,
  81. activateClass: activateClass));
  82. }
  83. }
  84. #endregion
  85. #region All Turns
  86. if (timing == EffectTiming.OnDiscardLibrary)
  87. {
  88. ActivateClass activateClass = new ActivateClass();
  89. activateClass.SetUpICardEffect("Delete 1 of your opponent's level 5 or lower Digimon", CanUseCondition, card);
  90. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  91. activateClass.SetHashString("DeleteDigimon_BT19_071");
  92. cardEffects.Add(activateClass);
  93. string EffectDiscription()
  94. {
  95. return "[All Turns][Once Per Turn] When effects trashes cards from your deck, delete 1 of your opponent's level 5 or lower Digimon.";
  96. }
  97. bool CanUseCondition(Hashtable hashtable)
  98. {
  99. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  100. {
  101. if (CardEffectCommons.CanTriggerWhenDiscardLibrary(hashtable, cardSource => cardSource.Owner == card.Owner))
  102. {
  103. return true;
  104. }
  105. }
  106. return false;
  107. }
  108. bool CanSelectPermanentCondition(Permanent permanent)
  109. {
  110. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  111. {
  112. if (permanent.TopCard.HasLevel && permanent.Level <= 5)
  113. {
  114. return true;
  115. }
  116. }
  117. return false;
  118. }
  119. bool CanActivateCondition(Hashtable hashtable)
  120. {
  121. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  122. }
  123. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  124. {
  125. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  126. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  127. selectPermanentEffect.SetUp(
  128. selectPlayer: card.Owner,
  129. canTargetCondition: CanSelectPermanentCondition,
  130. canTargetCondition_ByPreSelecetedList: null,
  131. canEndSelectCondition: null,
  132. maxCount: maxCount,
  133. canNoSelect: false,
  134. canEndNotMax: false,
  135. selectPermanentCoroutine: null,
  136. afterSelectPermanentCoroutine: null,
  137. mode: SelectPermanentEffect.Mode.Destroy,
  138. cardEffect: activateClass);
  139. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  140. }
  141. }
  142. #endregion
  143. return cardEffects;
  144. }
  145. }
  146. }