BT13_057.cs 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT13
  6. {
  7. public class BT13_057 : 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.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Suspend opponent's 1 Digimon to unsuspend this Digimon", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[When Digivolving] By suspending 1 of your opponent's Digimon or Tamers, unsuspend this Digimon.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  25. {
  26. if (permanent.IsDigimon || permanent.IsTamer)
  27. {
  28. if (!permanent.IsSuspended)
  29. {
  30. return true;
  31. }
  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 (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  52. {
  53. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  54. {
  55. Permanent selectedPermanent = null;
  56. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  57. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  58. selectPermanentEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: CanSelectPermanentCondition,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: maxCount,
  64. canNoSelect: true,
  65. canEndNotMax: false,
  66. selectPermanentCoroutine: SelectPermanentCoroutine,
  67. afterSelectPermanentCoroutine: null,
  68. mode: SelectPermanentEffect.Mode.Custom,
  69. cardEffect: activateClass);
  70. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer to suspend.", "The opponent is selecting 1 Digimon or Tamer to suspend.");
  71. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  72. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  73. {
  74. selectedPermanent = permanent;
  75. yield return null;
  76. }
  77. if (selectedPermanent != null)
  78. {
  79. if (selectedPermanent.TopCard != null)
  80. {
  81. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  82. {
  83. if (!selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  84. {
  85. Permanent tapPermanent = selectedPermanent;
  86. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { tapPermanent }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  87. if (tapPermanent.TopCard != null)
  88. {
  89. if (tapPermanent.IsSuspended)
  90. {
  91. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  92. }
  93. }
  94. }
  95. }
  96. }
  97. }
  98. }
  99. }
  100. }
  101. if (timing == EffectTiming.OnTappedAnyone)
  102. {
  103. ActivateClass activateClass = new ActivateClass();
  104. activateClass.SetUpICardEffect("Suspend 1 Digimon or Tamer", CanUseCondition, card);
  105. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  106. activateClass.SetHashString("Suspend_BT13_056");
  107. cardEffects.Add(activateClass);
  108. string EffectDiscription()
  109. {
  110. return "[All Turns][Once Per Turn] When an opponent's Digimon or Tamer becomes suspended, suspend 1 of your opponent's Digimon or Tamers.";
  111. }
  112. bool PermanentCondition(Permanent permanent)
  113. {
  114. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  115. {
  116. if (permanent.IsDigimon || permanent.IsTamer)
  117. {
  118. return true;
  119. }
  120. }
  121. return false;
  122. }
  123. bool CanSelectPermanentCondition(Permanent permanent)
  124. {
  125. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  126. {
  127. if (permanent.IsDigimon || permanent.IsTamer)
  128. {
  129. return true;
  130. }
  131. }
  132. return false;
  133. }
  134. bool CanUseCondition(Hashtable hashtable)
  135. {
  136. if (CardEffectCommons.IsExistOnBattleArea(card))
  137. {
  138. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition))
  139. {
  140. return true;
  141. }
  142. }
  143. return false;
  144. }
  145. bool CanActivateCondition(Hashtable hashtable)
  146. {
  147. if (CardEffectCommons.IsExistOnBattleArea(card))
  148. {
  149. return true;
  150. }
  151. return false;
  152. }
  153. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  154. {
  155. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  156. {
  157. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  158. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  159. selectPermanentEffect.SetUp(
  160. selectPlayer: card.Owner,
  161. canTargetCondition: CanSelectPermanentCondition,
  162. canTargetCondition_ByPreSelecetedList: null,
  163. canEndSelectCondition: null,
  164. maxCount: maxCount,
  165. canNoSelect: false,
  166. canEndNotMax: false,
  167. selectPermanentCoroutine: null,
  168. afterSelectPermanentCoroutine: null,
  169. mode: SelectPermanentEffect.Mode.Tap,
  170. cardEffect: activateClass);
  171. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  172. }
  173. }
  174. }
  175. return cardEffects;
  176. }
  177. }
  178. }