BT13_058.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT13
  5. {
  6. public class BT13_058 : 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.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardNames.Contains("Leopardmon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Suspend 1 Digimon and opponent's 1 Digimon can't unsuspend", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[When Digivolving] Suspend 1 of your opponent's Digimon. Until the end of your opponent's turn, 1 of your opponent's Digimon doesn't unsuspend.";
  28. }
  29. bool CanSelectPermanentCondition(Permanent permanent)
  30. {
  31. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleArea(card))
  40. {
  41. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  42. {
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  49. {
  50. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  51. {
  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: null,
  63. afterSelectPermanentCoroutine: null,
  64. mode: SelectPermanentEffect.Mode.Tap,
  65. cardEffect: activateClass);
  66. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  67. }
  68. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  69. {
  70. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: CanSelectPermanentCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: maxCount,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: SelectPermanentCoroutine,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Custom,
  83. cardEffect: activateClass);
  84. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get unable to unsuspend.", "The opponent is selecting 1 Digimon that will get unable to unsuspend.");
  85. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  86. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  87. {
  88. Permanent selectedPermanent = permanent;
  89. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd(
  90. targetPermanent: selectedPermanent,
  91. activateClass: activateClass
  92. ));
  93. }
  94. }
  95. }
  96. }
  97. if (timing == EffectTiming.OnAllyAttack)
  98. {
  99. ActivateClass activateClass = new ActivateClass();
  100. activateClass.SetUpICardEffect("Suspend your 1 Digimon to unsuspend this Digimon", CanUseCondition, card);
  101. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  102. cardEffects.Add(activateClass);
  103. string EffectDiscription()
  104. {
  105. return "[When Attacking] By suspending 1 of your other Digimon, unsuspend this Digimon.";
  106. }
  107. bool CanSelectPermanentCondition(Permanent permanent)
  108. {
  109. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  110. {
  111. if (permanent != card.PermanentOfThisCard())
  112. {
  113. if (!permanent.IsSuspended && permanent.CanSuspend)
  114. {
  115. return true;
  116. }
  117. }
  118. }
  119. return false;
  120. }
  121. bool CanUseCondition(Hashtable hashtable)
  122. {
  123. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  124. }
  125. bool CanActivateCondition(Hashtable hashtable)
  126. {
  127. if (CardEffectCommons.IsExistOnBattleArea(card))
  128. {
  129. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  130. {
  131. return true;
  132. }
  133. }
  134. return false;
  135. }
  136. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  137. {
  138. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  139. {
  140. Permanent selectedPermanent = null;
  141. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  142. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  143. selectPermanentEffect.SetUp(
  144. selectPlayer: card.Owner,
  145. canTargetCondition: CanSelectPermanentCondition,
  146. canTargetCondition_ByPreSelecetedList: null,
  147. canEndSelectCondition: null,
  148. maxCount: maxCount,
  149. canNoSelect: true,
  150. canEndNotMax: false,
  151. selectPermanentCoroutine: SelectPermanentCoroutine,
  152. afterSelectPermanentCoroutine: null,
  153. mode: SelectPermanentEffect.Mode.Custom,
  154. cardEffect: activateClass);
  155. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  156. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  157. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  158. {
  159. selectedPermanent = permanent;
  160. yield return null;
  161. }
  162. if (selectedPermanent != null)
  163. {
  164. if (selectedPermanent.TopCard != null)
  165. {
  166. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  167. {
  168. if (!selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  169. {
  170. Permanent tapPermanent = selectedPermanent;
  171. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { tapPermanent }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  172. if (tapPermanent.TopCard != null)
  173. {
  174. if (tapPermanent.IsSuspended)
  175. {
  176. if (CardEffectCommons.IsExistOnBattleArea(card))
  177. {
  178. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  179. }
  180. }
  181. }
  182. }
  183. }
  184. }
  185. }
  186. }
  187. }
  188. }
  189. if (timing == EffectTiming.OnEndTurn)
  190. {
  191. ActivateClass activateClass = new ActivateClass();
  192. activateClass.SetUpICardEffect("Trash the top card of this Digimon and unsuspend all your Digimon", CanUseCondition, card);
  193. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  194. cardEffects.Add(activateClass);
  195. string EffectDiscription()
  196. {
  197. return "[End of Your Turn] Trash the top card of this Digimon and unsuspend all of your Digimon.";
  198. }
  199. bool CanUseCondition(Hashtable hashtable)
  200. {
  201. if (CardEffectCommons.IsExistOnBattleArea(card))
  202. {
  203. if (CardEffectCommons.IsOwnerTurn(card))
  204. {
  205. return true;
  206. }
  207. }
  208. return false;
  209. }
  210. bool CanActivateCondition(Hashtable hashtable)
  211. {
  212. if (CardEffectCommons.IsExistOnBattleArea(card))
  213. {
  214. if (card.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  215. {
  216. return true;
  217. }
  218. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.IsSuspended && permanent.CanUnsuspend))
  219. {
  220. return true;
  221. }
  222. }
  223. return false;
  224. }
  225. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  226. {
  227. if (CardEffectCommons.IsExistOnBattleArea(card))
  228. {
  229. Permanent selectedPermanent = card.PermanentOfThisCard();
  230. if (selectedPermanent.DigivolutionCards.Count >= 1)
  231. {
  232. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  233. CardSource cardSource = selectedPermanent.TopCard;
  234. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(cardSource));
  235. if (!cardSource.IsToken)
  236. {
  237. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(cardSource));
  238. }
  239. selectedPermanent.ShowingPermanentCard.ShowPermanentData(true);
  240. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(cardSource, selectedPermanent));
  241. }
  242. }
  243. bool PermanentCondition(Permanent permanent)
  244. {
  245. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  246. {
  247. if (CardEffectCommons.CanUnsuspend(permanent))
  248. {
  249. return true;
  250. }
  251. }
  252. return false;
  253. }
  254. List<Permanent> unsuspendTargetPermanents = card.Owner.GetBattleAreaDigimons().Filter(PermanentCondition);
  255. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(unsuspendTargetPermanents, activateClass).Unsuspend());
  256. }
  257. }
  258. return cardEffects;
  259. }
  260. }
  261. }