BT14_053.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT14
  5. {
  6. public class BT14_053 : 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("Suspend 1 Digimon or Tamer", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[When Digivolving] Suspend 1 of your opponent's Digimon or Tamers.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  24. {
  25. if (permanent.IsDigimon)
  26. {
  27. return true;
  28. }
  29. if (permanent.IsTamer)
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  52. {
  53. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  54. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  55. selectPermanentEffect.SetUp(
  56. selectPlayer: card.Owner,
  57. canTargetCondition: CanSelectPermanentCondition,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. maxCount: maxCount,
  61. canNoSelect: false,
  62. canEndNotMax: false,
  63. selectPermanentCoroutine: null,
  64. afterSelectPermanentCoroutine: null,
  65. mode: SelectPermanentEffect.Mode.Tap,
  66. cardEffect: activateClass);
  67. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  68. }
  69. }
  70. if (timing == EffectTiming.OnAllyAttack)
  71. {
  72. ActivateClass activateClass = new ActivateClass();
  73. activateClass.SetUpICardEffect("Suspend 1 Digimon or Tamer", CanUseCondition, card);
  74. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  75. cardEffects.Add(activateClass);
  76. string EffectDiscription()
  77. {
  78. return "[When Attacking] Suspend 1 of your opponent's Digimon or Tamers.";
  79. }
  80. bool CanSelectPermanentCondition(Permanent permanent)
  81. {
  82. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  83. {
  84. if (permanent.IsDigimon)
  85. {
  86. return true;
  87. }
  88. if (permanent.IsTamer)
  89. {
  90. return true;
  91. }
  92. }
  93. return false;
  94. }
  95. bool CanUseCondition(Hashtable hashtable)
  96. {
  97. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  98. }
  99. bool CanActivateCondition(Hashtable hashtable)
  100. {
  101. if (CardEffectCommons.IsExistOnBattleArea(card))
  102. {
  103. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  104. {
  105. return true;
  106. }
  107. }
  108. return false;
  109. }
  110. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  111. {
  112. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  113. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  114. selectPermanentEffect.SetUp(
  115. selectPlayer: card.Owner,
  116. canTargetCondition: CanSelectPermanentCondition,
  117. canTargetCondition_ByPreSelecetedList: null,
  118. canEndSelectCondition: null,
  119. maxCount: maxCount,
  120. canNoSelect: false,
  121. canEndNotMax: false,
  122. selectPermanentCoroutine: null,
  123. afterSelectPermanentCoroutine: null,
  124. mode: SelectPermanentEffect.Mode.Tap,
  125. cardEffect: activateClass);
  126. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  127. }
  128. }
  129. if (timing == EffectTiming.OnTappedAnyone)
  130. {
  131. ActivateClass activateClass = new ActivateClass();
  132. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  133. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  134. activateClass.SetHashString("Unsuspend_BT14_053");
  135. cardEffects.Add(activateClass);
  136. string EffectDiscription()
  137. {
  138. return "[Your Turn][Once Per Turn] When an effect suspends a Digimon or Tamer, you may unsuspend this Digimon.";
  139. }
  140. bool PermanentCondition(Permanent permanent)
  141. {
  142. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  143. {
  144. if (permanent.IsDigimon)
  145. {
  146. return true;
  147. }
  148. if (permanent.IsTamer)
  149. {
  150. return true;
  151. }
  152. }
  153. return false;
  154. }
  155. bool CanUseCondition(Hashtable hashtable)
  156. {
  157. if (CardEffectCommons.IsExistOnBattleArea(card))
  158. {
  159. if (CardEffectCommons.IsOwnerTurn(card))
  160. {
  161. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition))
  162. {
  163. if (CardEffectCommons.IsByEffect(hashtable, null))
  164. {
  165. return true;
  166. }
  167. }
  168. }
  169. }
  170. return false;
  171. }
  172. bool CanActivateCondition(Hashtable hashtable)
  173. {
  174. if (CardEffectCommons.IsExistOnBattleArea(card))
  175. {
  176. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  177. {
  178. return true;
  179. }
  180. }
  181. return false;
  182. }
  183. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  184. {
  185. Permanent selectedPermanent = card.PermanentOfThisCard();
  186. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  187. }
  188. }
  189. return cardEffects;
  190. }
  191. }
  192. }