BT13_107.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT13
  5. {
  6. public class BT13_107 : 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. Return 1 of your opponent's suspended Digimon with DP less than or equal to that Digimon to the hand. Then, by returning the top card of one of your [Leopardmon: Leopard Mode] to the hand, unsuspend all of your Digimon.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  24. }
  25. bool CanSelectPermanentCondition2(Permanent permanent)
  26. {
  27. if (permanent != null)
  28. {
  29. if (permanent.TopCard != null)
  30. {
  31. if (permanent.TopCard.Owner == card.Owner)
  32. {
  33. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  34. {
  35. if (permanent.DigivolutionCards.Count >= 1)
  36. {
  37. if (permanent.TopCard.CardNames.Contains("Leopardmon: Leopard Mode"))
  38. {
  39. return true;
  40. }
  41. if (permanent.TopCard.CardNames.Contains("Leopardmon:LeopardMode"))
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  59. {
  60. Permanent selectedPermanent = null;
  61. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  62. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  63. selectPermanentEffect.SetUp(
  64. selectPlayer: card.Owner,
  65. canTargetCondition: CanSelectPermanentCondition,
  66. canTargetCondition_ByPreSelecetedList: null,
  67. canEndSelectCondition: null,
  68. maxCount: maxCount,
  69. canNoSelect: false,
  70. canEndNotMax: false,
  71. selectPermanentCoroutine: SelectPermanentCoroutine,
  72. afterSelectPermanentCoroutine: null,
  73. mode: SelectPermanentEffect.Mode.Custom,
  74. cardEffect: activateClass);
  75. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon.", "The opponent is selecting 1 Digimon.");
  76. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  77. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  78. {
  79. selectedPermanent = permanent;
  80. yield return null;
  81. }
  82. if (selectedPermanent != null)
  83. {
  84. int maxDP = selectedPermanent.DP;
  85. bool CanSelectPermanentCondition1(Permanent permanent)
  86. {
  87. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  88. {
  89. if (permanent.DP <= maxDP)
  90. {
  91. if (permanent.IsSuspended)
  92. {
  93. return true;
  94. }
  95. }
  96. }
  97. return false;
  98. }
  99. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  100. {
  101. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  102. selectPermanentEffect.SetUp(
  103. selectPlayer: card.Owner,
  104. canTargetCondition: CanSelectPermanentCondition1,
  105. canTargetCondition_ByPreSelecetedList: null,
  106. canEndSelectCondition: null,
  107. maxCount: maxCount,
  108. canNoSelect: false,
  109. canEndNotMax: false,
  110. selectPermanentCoroutine: null,
  111. afterSelectPermanentCoroutine: null,
  112. mode: SelectPermanentEffect.Mode.Bounce,
  113. cardEffect: activateClass);
  114. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  115. }
  116. }
  117. }
  118. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition2))
  119. {
  120. Permanent selectedPermanent = null;
  121. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition2));
  122. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  123. selectPermanentEffect.SetUp(
  124. selectPlayer: card.Owner,
  125. canTargetCondition: CanSelectPermanentCondition2,
  126. canTargetCondition_ByPreSelecetedList: null,
  127. canEndSelectCondition: null,
  128. maxCount: maxCount,
  129. canNoSelect: true,
  130. canEndNotMax: false,
  131. selectPermanentCoroutine: SelectPermanentCoroutine,
  132. afterSelectPermanentCoroutine: null,
  133. mode: SelectPermanentEffect.Mode.Custom,
  134. cardEffect: activateClass);
  135. selectPermanentEffect.SetUpCustomMessage("Select 1 [Leopardmon: Leopard Mode].", "The opponent is selecting 1 [Leopardmon: Leopard Mode].");
  136. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  137. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  138. {
  139. selectedPermanent = permanent;
  140. yield return null;
  141. }
  142. if (selectedPermanent != null)
  143. {
  144. if (selectedPermanent.DigivolutionCards.Count >= 1)
  145. {
  146. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  147. CardSource cardSource = selectedPermanent.TopCard;
  148. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(cardSource));
  149. selectedPermanent.ShowingPermanentCard.ShowPermanentData(true);
  150. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(cardSource, selectedPermanent));
  151. if (!cardSource.IsToken)
  152. {
  153. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { cardSource }, false, activateClass));
  154. }
  155. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.IsSuspended && permanent.CanUnsuspend))
  156. {
  157. List<Permanent> untappedPermanents = new List<Permanent>();
  158. foreach (Permanent permanent in card.Owner.GetBattleAreaDigimons())
  159. {
  160. if (permanent.IsSuspended && permanent.CanUnsuspend)
  161. {
  162. untappedPermanents.Add(permanent);
  163. }
  164. }
  165. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(untappedPermanents, activateClass).Unsuspend());
  166. }
  167. }
  168. }
  169. }
  170. }
  171. }
  172. if (timing == EffectTiming.SecuritySkill)
  173. {
  174. ActivateClass activateClass = new ActivateClass();
  175. activateClass.SetUpICardEffect($"Suspend 1 Digimon and add this card to hand", CanUseCondition, card);
  176. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  177. activateClass.SetIsSecurityEffect(true);
  178. cardEffects.Add(activateClass);
  179. string EffectDiscription()
  180. {
  181. return "[Security] Suspend 1 of your opponent's Digimon. Then, add this card to the hand.";
  182. }
  183. bool CanSelectPermanentCondition(Permanent permanent)
  184. {
  185. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  186. }
  187. bool CanUseCondition(Hashtable hashtable)
  188. {
  189. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  190. }
  191. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  192. {
  193. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  194. {
  195. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  196. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  197. selectPermanentEffect.SetUp(
  198. selectPlayer: card.Owner,
  199. canTargetCondition: CanSelectPermanentCondition,
  200. canTargetCondition_ByPreSelecetedList: null,
  201. canEndSelectCondition: null,
  202. maxCount: maxCount,
  203. canNoSelect: false,
  204. canEndNotMax: false,
  205. selectPermanentCoroutine: null,
  206. afterSelectPermanentCoroutine: null,
  207. mode: SelectPermanentEffect.Mode.Tap,
  208. cardEffect: activateClass);
  209. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  210. }
  211. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  212. }
  213. }
  214. return cardEffects;
  215. }
  216. }
  217. }