BT11_102.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_102 : 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.OptionSkill)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  15. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Main] Choose 1 of your Digimon with [Insect] in one of its traits. Suspend 2 of your opponent's Digimon with DP less than or equal to the DP of the chosen Digimon. Then, 1 of your opponent's suspended Digimon can't unsuspend during your opponent's next unsuspend phase.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  24. {
  25. if (permanent.TopCard.ContainsTraits("Insect"))
  26. {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanSelectPermanentCondition2(Permanent permanent)
  33. {
  34. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  35. {
  36. if (permanent.IsSuspended)
  37. {
  38. return true;
  39. }
  40. }
  41. return false;
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  48. {
  49. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  50. {
  51. Permanent selectedPermanent = null;
  52. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  53. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  54. selectPermanentEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: CanSelectPermanentCondition,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: maxCount,
  60. canNoSelect: false,
  61. canEndNotMax: false,
  62. selectPermanentCoroutine: SelectPermanentCoroutine,
  63. afterSelectPermanentCoroutine: null,
  64. mode: SelectPermanentEffect.Mode.Custom,
  65. cardEffect: activateClass);
  66. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon with [Insect] in one of its traits.", "The opponent is selecting 1 Digimon with [Insect] in one of its traits.");
  67. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  68. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  69. {
  70. selectedPermanent = permanent;
  71. yield return null;
  72. }
  73. if (selectedPermanent != null)
  74. {
  75. int maxDP = selectedPermanent.DP;
  76. bool CanSelectPermanentCondition1(Permanent permanent)
  77. {
  78. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  79. {
  80. if (permanent.DP <= maxDP)
  81. {
  82. if (permanent.CanSelectBySkill(activateClass))
  83. {
  84. return true;
  85. }
  86. }
  87. }
  88. return false;
  89. }
  90. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  91. {
  92. maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  93. selectPermanentEffect.SetUp(
  94. selectPlayer: card.Owner,
  95. canTargetCondition: CanSelectPermanentCondition1,
  96. canTargetCondition_ByPreSelecetedList: null,
  97. canEndSelectCondition: null,
  98. maxCount: maxCount,
  99. canNoSelect: false,
  100. canEndNotMax: false,
  101. selectPermanentCoroutine: null,
  102. afterSelectPermanentCoroutine: null,
  103. mode: SelectPermanentEffect.Mode.Tap,
  104. cardEffect: activateClass);
  105. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  106. }
  107. }
  108. }
  109. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition2))
  110. {
  111. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition2));
  112. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  113. selectPermanentEffect.SetUp(
  114. selectPlayer: card.Owner,
  115. canTargetCondition: CanSelectPermanentCondition2,
  116. canTargetCondition_ByPreSelecetedList: null,
  117. canEndSelectCondition: null,
  118. maxCount: maxCount,
  119. canNoSelect: false,
  120. canEndNotMax: false,
  121. selectPermanentCoroutine: SelectPermanentCoroutine,
  122. afterSelectPermanentCoroutine: null,
  123. mode: SelectPermanentEffect.Mode.Custom,
  124. cardEffect: activateClass);
  125. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  126. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  127. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  128. {
  129. Permanent selectedPermanent = permanent;
  130. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendNextActivePhase(
  131. targetPermanent: selectedPermanent,
  132. activateClass: activateClass
  133. ));
  134. }
  135. }
  136. }
  137. }
  138. if (timing == EffectTiming.SecuritySkill)
  139. {
  140. ActivateClass activateClass = new ActivateClass();
  141. activateClass.SetUpICardEffect($"Suspend 2 Digimon", CanUseCondition, card);
  142. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  143. activateClass.SetIsSecurityEffect(true);
  144. cardEffects.Add(activateClass);
  145. string EffectDiscription()
  146. {
  147. return "[Security] Suspend 2 of your opponent's Digimon.";
  148. }
  149. bool CanSelectPermanentCondition(Permanent permanent)
  150. {
  151. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  152. {
  153. if (permanent.CanSelectBySkill(activateClass))
  154. {
  155. return true;
  156. }
  157. }
  158. return false;
  159. }
  160. bool CanUseCondition(Hashtable hashtable)
  161. {
  162. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  163. }
  164. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  165. {
  166. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  167. {
  168. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  169. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  170. selectPermanentEffect.SetUp(
  171. selectPlayer: card.Owner,
  172. canTargetCondition: CanSelectPermanentCondition,
  173. canTargetCondition_ByPreSelecetedList: null,
  174. canEndSelectCondition: null,
  175. maxCount: maxCount,
  176. canNoSelect: false,
  177. canEndNotMax: false,
  178. selectPermanentCoroutine: null,
  179. afterSelectPermanentCoroutine: null,
  180. mode: SelectPermanentEffect.Mode.Tap,
  181. cardEffect: activateClass);
  182. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  183. }
  184. }
  185. }
  186. return cardEffects;
  187. }
  188. }
  189. }