BT14_026.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT14
  6. {
  7. public class BT14_026 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OnCounterTiming)
  13. {
  14. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  15. }
  16. if (timing == EffectTiming.OnEnterFieldAnyone)
  17. {
  18. ActivateClass activateClass = new ActivateClass();
  19. activateClass.SetUpICardEffect("Trash digivolution cards and return 1 Digimon to hand", CanUseCondition, card);
  20. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  21. cardEffects.Add(activateClass);
  22. string EffectDiscription()
  23. {
  24. return "[On Play] Trash any 2 digivolution cards from your opponent's Digimon. Then, return 1 of your opponent's Digimon with no digivolution cards to the hand.";
  25. }
  26. bool CanSelectPermanentCondition(Permanent permanent)
  27. {
  28. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  29. {
  30. if (permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanSelectCardCondition(CardSource cardSource)
  38. {
  39. return !cardSource.CanNotTrashFromDigivolutionCards(activateClass);
  40. }
  41. bool CanSelectPermanentCondition1(Permanent permanent)
  42. {
  43. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  44. {
  45. if (permanent.HasNoDigivolutionCards)
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  55. }
  56. bool CanActivateCondition(Hashtable hashtable)
  57. {
  58. if (CardEffectCommons.IsExistOnBattleArea(card))
  59. {
  60. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  61. {
  62. return true;
  63. }
  64. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  65. {
  66. return true;
  67. }
  68. }
  69. return false;
  70. }
  71. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  72. {
  73. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  74. permanentCondition: CanSelectPermanentCondition,
  75. cardCondition: CanSelectCardCondition,
  76. maxCount: 2,
  77. canNoTrash: false,
  78. isFromOnly1Permanent: false,
  79. activateClass: activateClass
  80. ));
  81. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  82. {
  83. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  84. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  85. selectPermanentEffect.SetUp(
  86. selectPlayer: card.Owner,
  87. canTargetCondition: CanSelectPermanentCondition1,
  88. canTargetCondition_ByPreSelecetedList: null,
  89. canEndSelectCondition: null,
  90. maxCount: maxCount,
  91. canNoSelect: false,
  92. canEndNotMax: false,
  93. selectPermanentCoroutine: null,
  94. afterSelectPermanentCoroutine: null,
  95. mode: SelectPermanentEffect.Mode.Bounce,
  96. cardEffect: activateClass);
  97. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  98. }
  99. }
  100. }
  101. if (timing == EffectTiming.OnEnterFieldAnyone)
  102. {
  103. ActivateClass activateClass = new ActivateClass();
  104. activateClass.SetUpICardEffect("Trash digivolution cards and return 1 Digimon to hand", CanUseCondition, card);
  105. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  106. cardEffects.Add(activateClass);
  107. string EffectDiscription()
  108. {
  109. return "[When Digivolving] Trash any 2 digivolution cards from your opponent's Digimon. Then, return 1 of your opponent's Digimon with no digivolution cards to the hand.";
  110. }
  111. bool CanSelectPermanentCondition(Permanent permanent)
  112. {
  113. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  114. }
  115. bool CanSelectCardCondition(CardSource cardSource)
  116. {
  117. return !cardSource.CanNotTrashFromDigivolutionCards(activateClass);
  118. }
  119. bool CanSelectPermanentCondition1(Permanent permanent)
  120. {
  121. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  122. {
  123. if (permanent.HasNoDigivolutionCards)
  124. {
  125. return true;
  126. }
  127. }
  128. return false;
  129. }
  130. bool CanUseCondition(Hashtable hashtable)
  131. {
  132. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  133. }
  134. bool CanActivateCondition(Hashtable hashtable)
  135. {
  136. if (CardEffectCommons.IsExistOnBattleArea(card))
  137. {
  138. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  139. {
  140. return true;
  141. }
  142. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  143. {
  144. return true;
  145. }
  146. }
  147. return false;
  148. }
  149. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  150. {
  151. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  152. permanentCondition: CanSelectPermanentCondition,
  153. cardCondition: CanSelectCardCondition,
  154. maxCount: 2,
  155. canNoTrash: false,
  156. isFromOnly1Permanent: false,
  157. activateClass: activateClass
  158. ));
  159. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  160. {
  161. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  162. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  163. selectPermanentEffect.SetUp(
  164. selectPlayer: card.Owner,
  165. canTargetCondition: CanSelectPermanentCondition1,
  166. canTargetCondition_ByPreSelecetedList: null,
  167. canEndSelectCondition: null,
  168. maxCount: maxCount,
  169. canNoSelect: false,
  170. canEndNotMax: false,
  171. selectPermanentCoroutine: null,
  172. afterSelectPermanentCoroutine: null,
  173. mode: SelectPermanentEffect.Mode.Bounce,
  174. cardEffect: activateClass);
  175. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  176. }
  177. }
  178. }
  179. return cardEffects;
  180. }
  181. }
  182. }