EX5_067.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX5
  6. {
  7. public class EX5_067 : 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.OptionSkill)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  16. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Main] Until the end of your opponent's turn, 1 of your opponent's Digimon and 1 of their Tamers can't suspend. Then, you may play 1 Tamer card with the [Night Claw]/[Light Fang] trait from your hand without paying the cost.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  25. {
  26. return true;
  27. }
  28. return false;
  29. }
  30. bool CanSelectPermanentCondition1(Permanent permanent)
  31. {
  32. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  33. {
  34. if (permanent.IsTamer)
  35. {
  36. return true;
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanSelectCardCondition(CardSource cardSource)
  42. {
  43. if (cardSource.IsTamer)
  44. {
  45. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  46. {
  47. if (cardSource.CardTraits.Contains("Light Fang"))
  48. {
  49. return true;
  50. }
  51. if (cardSource.CardTraits.Contains("LightFung"))
  52. {
  53. return true;
  54. }
  55. if (cardSource.CardTraits.Contains("Night Claw"))
  56. {
  57. return true;
  58. }
  59. if (cardSource.CardTraits.Contains("NightClaw"))
  60. {
  61. return true;
  62. }
  63. }
  64. }
  65. return false;
  66. }
  67. bool CanUseCondition(Hashtable hashtable)
  68. {
  69. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  70. }
  71. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  72. {
  73. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  74. {
  75. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  76. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  77. selectPermanentEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: CanSelectPermanentCondition,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. maxCount: maxCount,
  83. canNoSelect: false,
  84. canEndNotMax: false,
  85. selectPermanentCoroutine: SelectPermanentCoroutine,
  86. afterSelectPermanentCoroutine: null,
  87. mode: SelectPermanentEffect.Mode.Custom,
  88. cardEffect: activateClass);
  89. selectPermanentEffect.SetUpCustomMessage(
  90. "Select 1 Digimon that will get unable to suspend.",
  91. "The opponent is selecting 1 Digimon that will get unable to suspend.");
  92. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  93. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  94. {
  95. Permanent selectedPermanent = permanent;
  96. if (selectedPermanent != null)
  97. {
  98. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  99. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  100. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  101. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  102. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  103. {
  104. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  105. }
  106. bool CanUseCondition1(Hashtable hashtable)
  107. {
  108. if (selectedPermanent.TopCard != null)
  109. {
  110. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  111. {
  112. return true;
  113. }
  114. }
  115. return false;
  116. }
  117. bool PermanentCondition(Permanent permanent)
  118. {
  119. if (permanent == selectedPermanent)
  120. {
  121. return true;
  122. }
  123. return false;
  124. }
  125. }
  126. }
  127. }
  128. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition1) >= 1)
  129. {
  130. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition1));
  131. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  132. selectPermanentEffect.SetUp(
  133. selectPlayer: card.Owner,
  134. canTargetCondition: CanSelectPermanentCondition1,
  135. canTargetCondition_ByPreSelecetedList: null,
  136. canEndSelectCondition: null,
  137. maxCount: maxCount,
  138. canNoSelect: false,
  139. canEndNotMax: false,
  140. selectPermanentCoroutine: SelectPermanentCoroutine,
  141. afterSelectPermanentCoroutine: null,
  142. mode: SelectPermanentEffect.Mode.Custom,
  143. cardEffect: activateClass);
  144. selectPermanentEffect.SetUpCustomMessage(
  145. "Select 1 Tamer that will get unable to suspend.",
  146. "The opponent is selecting 1 Tamer that will get unable to suspend.");
  147. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  148. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  149. {
  150. Permanent selectedPermanent = permanent;
  151. if (selectedPermanent != null)
  152. {
  153. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  154. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  155. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  156. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  157. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  158. {
  159. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  160. }
  161. bool CanUseCondition1(Hashtable hashtable)
  162. {
  163. if (selectedPermanent.TopCard != null)
  164. {
  165. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  166. {
  167. return true;
  168. }
  169. }
  170. return false;
  171. }
  172. bool PermanentCondition(Permanent permanent)
  173. {
  174. if (permanent == selectedPermanent)
  175. {
  176. return true;
  177. }
  178. return false;
  179. }
  180. }
  181. }
  182. }
  183. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  184. {
  185. List<CardSource> selectedCards = new List<CardSource>();
  186. int maxCount = 1;
  187. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  188. selectHandEffect.SetUp(
  189. selectPlayer: card.Owner,
  190. canTargetCondition: CanSelectCardCondition,
  191. canTargetCondition_ByPreSelecetedList: null,
  192. canEndSelectCondition: null,
  193. maxCount: maxCount,
  194. canNoSelect: true,
  195. canEndNotMax: false,
  196. isShowOpponent: true,
  197. selectCardCoroutine: SelectCardCoroutine,
  198. afterSelectCardCoroutine: null,
  199. mode: SelectHandEffect.Mode.Custom,
  200. cardEffect: activateClass);
  201. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  202. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  203. yield return StartCoroutine(selectHandEffect.Activate());
  204. IEnumerator SelectCardCoroutine(CardSource cardSource)
  205. {
  206. selectedCards.Add(cardSource);
  207. yield return null;
  208. }
  209. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  210. }
  211. }
  212. }
  213. if (timing == EffectTiming.SecuritySkill)
  214. {
  215. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Opponent's Digimon and Tamer can't suspend and play 1 Tamer from hand");
  216. }
  217. return cardEffects;
  218. }
  219. }
  220. }