BT11_055.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT11
  6. {
  7. public class BT11_055 : 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 Digimon and 1 opponent's Digimon can't unsuspend", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] For each green or black Tamer you have in play, suspend 1 of your opponent's Digimon. Then, 1 of your opponent's suspended Digimon can't unsuspend during your opponent's next unsuspend phase.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  25. {
  26. if (permanent.CanSelectBySkill(activateClass))
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanSelectPermanentCondition1(Permanent permanent)
  34. {
  35. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  36. {
  37. if (permanent.CanSelectBySkill(activateClass))
  38. {
  39. if (permanent.IsSuspended)
  40. {
  41. return true;
  42. }
  43. }
  44. }
  45. return false;
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  50. }
  51. bool CanActivateCondition(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.IsExistOnBattleArea(card))
  54. {
  55. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  56. {
  57. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => (permanent.TopCard.CardColors.Contains(CardColor.Green) || permanent.TopCard.CardColors.Contains(CardColor.Black)) && permanent.IsTamer))
  58. {
  59. return true;
  60. }
  61. }
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  63. {
  64. return true;
  65. }
  66. }
  67. return false;
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  72. {
  73. int maxCount = Math.Min(card.Owner.GetBattleAreaPermanents().Count((permanent) => (permanent.TopCard.CardColors.Contains(CardColor.Green) || permanent.TopCard.CardColors.Contains(CardColor.Black)) && permanent.IsTamer), CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  74. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  75. selectPermanentEffect.SetUp(
  76. selectPlayer: card.Owner,
  77. canTargetCondition: CanSelectPermanentCondition,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. maxCount: maxCount,
  81. canNoSelect: false,
  82. canEndNotMax: false,
  83. selectPermanentCoroutine: null,
  84. afterSelectPermanentCoroutine: null,
  85. mode: SelectPermanentEffect.Mode.Tap,
  86. cardEffect: activateClass);
  87. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  88. }
  89. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  90. {
  91. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  92. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  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: SelectPermanentCoroutine,
  102. afterSelectPermanentCoroutine: null,
  103. mode: SelectPermanentEffect.Mode.Custom,
  104. cardEffect: activateClass);
  105. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will not unsuspend.", "The opponent is selecting 1 Digimon that will not unsuspend.");
  106. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  107. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  108. {
  109. Permanent selectedPermanent = permanent;
  110. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendNextActivePhase(
  111. targetPermanent: selectedPermanent,
  112. activateClass: activateClass
  113. ));
  114. }
  115. }
  116. }
  117. }
  118. if (timing == EffectTiming.OnEnterFieldAnyone)
  119. {
  120. ActivateClass activateClass = new ActivateClass();
  121. activateClass.SetUpICardEffect("Suspend Digimon and 1 opponent's Digimon can't unsuspend", CanUseCondition, card);
  122. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  123. cardEffects.Add(activateClass);
  124. string EffectDiscription()
  125. {
  126. return "[When Digivolving] For each green or black Tamer you have in play, suspend 1 of your opponent's Digimon. Then, 1 of your opponent's suspended Digimon can't unsuspend during your opponent's next unsuspend phase.";
  127. }
  128. bool CanSelectPermanentCondition(Permanent permanent)
  129. {
  130. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  131. {
  132. if (permanent.CanSelectBySkill(activateClass))
  133. {
  134. return true;
  135. }
  136. }
  137. return false;
  138. }
  139. bool CanSelectPermanentCondition1(Permanent permanent)
  140. {
  141. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  142. {
  143. if (permanent.CanSelectBySkill(activateClass))
  144. {
  145. if (permanent.IsSuspended)
  146. {
  147. return true;
  148. }
  149. }
  150. }
  151. return false;
  152. }
  153. bool CanUseCondition(Hashtable hashtable)
  154. {
  155. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  156. }
  157. bool CanActivateCondition(Hashtable hashtable)
  158. {
  159. if (CardEffectCommons.IsExistOnBattleArea(card))
  160. {
  161. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  162. {
  163. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => (permanent.TopCard.CardColors.Contains(CardColor.Green) || permanent.TopCard.CardColors.Contains(CardColor.Black)) && permanent.IsTamer))
  164. {
  165. return true;
  166. }
  167. }
  168. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  169. {
  170. return true;
  171. }
  172. }
  173. return false;
  174. }
  175. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  176. {
  177. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  178. {
  179. int maxCount = Math.Min(card.Owner.GetBattleAreaPermanents().Count((permanent) => (permanent.TopCard.CardColors.Contains(CardColor.Green) || permanent.TopCard.CardColors.Contains(CardColor.Black)) && permanent.IsTamer), CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  180. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  181. selectPermanentEffect.SetUp(
  182. selectPlayer: card.Owner,
  183. canTargetCondition: CanSelectPermanentCondition,
  184. canTargetCondition_ByPreSelecetedList: null,
  185. canEndSelectCondition: null,
  186. maxCount: maxCount,
  187. canNoSelect: false,
  188. canEndNotMax: false,
  189. selectPermanentCoroutine: null,
  190. afterSelectPermanentCoroutine: null,
  191. mode: SelectPermanentEffect.Mode.Tap,
  192. cardEffect: activateClass);
  193. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  194. }
  195. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  196. {
  197. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  198. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  199. selectPermanentEffect.SetUp(
  200. selectPlayer: card.Owner,
  201. canTargetCondition: CanSelectPermanentCondition1,
  202. canTargetCondition_ByPreSelecetedList: null,
  203. canEndSelectCondition: null,
  204. maxCount: maxCount,
  205. canNoSelect: false,
  206. canEndNotMax: false,
  207. selectPermanentCoroutine: SelectPermanentCoroutine,
  208. afterSelectPermanentCoroutine: null,
  209. mode: SelectPermanentEffect.Mode.Custom,
  210. cardEffect: activateClass);
  211. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will not unsuspend.", "The opponent is selecting 1 Digimon that will not unsuspend.");
  212. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  213. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  214. {
  215. Permanent selectedPermanent = permanent;
  216. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendNextActivePhase(
  217. targetPermanent: selectedPermanent,
  218. activateClass: activateClass
  219. ));
  220. }
  221. }
  222. }
  223. }
  224. if (timing == EffectTiming.OnEndBattle)
  225. {
  226. ActivateClass activateClass = new ActivateClass();
  227. activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
  228. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  229. activateClass.SetIsInheritedEffect(true);
  230. activateClass.SetHashString("TrashSecurity_BT11_055");
  231. cardEffects.Add(activateClass);
  232. string EffectDiscription()
  233. {
  234. return "[All Turns][Once Per Turn] When this Digimon deletes an opponent's Digimon in battle, trash the top card of your opponent's security stack.";
  235. }
  236. bool CanUseCondition(Hashtable hashtable)
  237. {
  238. if (CardEffectCommons.IsExistOnBattleArea(card))
  239. {
  240. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  241. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  242. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false))
  243. {
  244. return true;
  245. }
  246. }
  247. return false;
  248. }
  249. bool CanActivateCondition(Hashtable hashtable)
  250. {
  251. if (CardEffectCommons.IsExistOnBattleArea(card))
  252. {
  253. return true;
  254. }
  255. return false;
  256. }
  257. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  258. {
  259. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  260. player: card.Owner.Enemy,
  261. destroySecurityCount: 1,
  262. cardEffect: activateClass,
  263. fromTop: true).DestroySecurity());
  264. }
  265. }
  266. return cardEffects;
  267. }
  268. }
  269. }