BT14_049.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT14
  5. {
  6. public class BT14_049 : 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.OnCounterTiming)
  12. {
  13. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  14. }
  15. if (timing == EffectTiming.OnEnterFieldAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Suspend 1 Digimon and return 1 Digimon to the bottom of Deck", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[On Play] Suspend 1 of your opponent's Digimon. Then, you may return 1 of your opponent's suspended Digimon with 5000 DP or less to the bottom of the deck.";
  24. }
  25. bool CanSelectPermanentCondition(Permanent permanent)
  26. {
  27. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  28. }
  29. bool CanSelectPermanentCondition1(Permanent permanent)
  30. {
  31. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  32. {
  33. if (permanent.DP <= 5000)
  34. {
  35. if (permanent.IsSuspended)
  36. {
  37. return true;
  38. }
  39. }
  40. }
  41. return false;
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.IsExistOnBattleArea(card))
  50. {
  51. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  52. {
  53. return true;
  54. }
  55. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  63. {
  64. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  65. {
  66. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  67. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  68. selectPermanentEffect.SetUp(
  69. selectPlayer: card.Owner,
  70. canTargetCondition: CanSelectPermanentCondition,
  71. canTargetCondition_ByPreSelecetedList: null,
  72. canEndSelectCondition: null,
  73. maxCount: maxCount,
  74. canNoSelect: false,
  75. canEndNotMax: false,
  76. selectPermanentCoroutine: null,
  77. afterSelectPermanentCoroutine: null,
  78. mode: SelectPermanentEffect.Mode.Tap,
  79. cardEffect: activateClass);
  80. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  81. }
  82. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  83. {
  84. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  85. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  86. selectPermanentEffect.SetUp(
  87. selectPlayer: card.Owner,
  88. canTargetCondition: CanSelectPermanentCondition1,
  89. canTargetCondition_ByPreSelecetedList: null,
  90. canEndSelectCondition: null,
  91. maxCount: maxCount,
  92. canNoSelect: true,
  93. canEndNotMax: false,
  94. selectPermanentCoroutine: null,
  95. afterSelectPermanentCoroutine: null,
  96. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  97. cardEffect: activateClass);
  98. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  99. }
  100. }
  101. }
  102. if (timing == EffectTiming.OnEnterFieldAnyone)
  103. {
  104. ActivateClass activateClass = new ActivateClass();
  105. activateClass.SetUpICardEffect("Suspend 1 Digimon and return 1 Digimon to the bottom of Deck", CanUseCondition, card);
  106. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  107. cardEffects.Add(activateClass);
  108. string EffectDiscription()
  109. {
  110. return "[When Digivolving] Suspend 1 of your opponent's Digimon. Then, you may return 1 of your opponent's suspended Digimon with 5000 DP or less to the bottom of the deck.";
  111. }
  112. bool CanSelectPermanentCondition(Permanent permanent)
  113. {
  114. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  115. }
  116. bool CanSelectPermanentCondition1(Permanent permanent)
  117. {
  118. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  119. {
  120. if (permanent.DP <= 5000)
  121. {
  122. if (permanent.IsSuspended)
  123. {
  124. return true;
  125. }
  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. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  152. {
  153. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  154. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  155. selectPermanentEffect.SetUp(
  156. selectPlayer: card.Owner,
  157. canTargetCondition: CanSelectPermanentCondition,
  158. canTargetCondition_ByPreSelecetedList: null,
  159. canEndSelectCondition: null,
  160. maxCount: maxCount,
  161. canNoSelect: false,
  162. canEndNotMax: false,
  163. selectPermanentCoroutine: null,
  164. afterSelectPermanentCoroutine: null,
  165. mode: SelectPermanentEffect.Mode.Tap,
  166. cardEffect: activateClass);
  167. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  168. }
  169. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  170. {
  171. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  172. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  173. selectPermanentEffect.SetUp(
  174. selectPlayer: card.Owner,
  175. canTargetCondition: CanSelectPermanentCondition1,
  176. canTargetCondition_ByPreSelecetedList: null,
  177. canEndSelectCondition: null,
  178. maxCount: maxCount,
  179. canNoSelect: true,
  180. canEndNotMax: false,
  181. selectPermanentCoroutine: null,
  182. afterSelectPermanentCoroutine: null,
  183. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  184. cardEffect: activateClass);
  185. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  186. }
  187. }
  188. }
  189. return cardEffects;
  190. }
  191. }
  192. }