EX5_025.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.EX5
  5. {
  6. public class EX5_025 : 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. static bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5)
  16. {
  17. if (targetPermanent.TopCard.CardTraits.Contains("Light Fang"))
  18. {
  19. return true;
  20. }
  21. if (targetPermanent.TopCard.CardTraits.Contains("LightFung"))
  22. {
  23. return true;
  24. }
  25. if (targetPermanent.TopCard.CardTraits.Contains("Night Claw"))
  26. {
  27. return true;
  28. }
  29. if (targetPermanent.TopCard.CardTraits.Contains("NightClaw"))
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
  37. }
  38. if (timing == EffectTiming.None)
  39. {
  40. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  41. }
  42. if (timing == EffectTiming.OnEnterFieldAnyone)
  43. {
  44. ActivateClass activateClass = new ActivateClass();
  45. activateClass.SetUpICardEffect("Trash digivolution cards and opponent's Digimon can't suspend", CanUseCondition, card);
  46. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  47. activateClass.SetHashString("TrashDigivolutionCards_EX5_025");
  48. cardEffects.Add(activateClass);
  49. string EffectDiscription()
  50. {
  51. return "[When Digivolving] [Once Per Turn] For each of this Digimon's digivolution cards, trash any 1 digivolution card from 1 of your opponent's Digimon. Then, until the end of your opponent's turn, all of their Digimon with no digivolution cards can't suspend.";
  52. }
  53. bool CanSelectPermanentCondition(Permanent permanent)
  54. {
  55. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  56. {
  57. if (permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  58. {
  59. return true;
  60. }
  61. }
  62. return false;
  63. }
  64. bool CanSelectCardCondition(CardSource cardSource)
  65. {
  66. if (!cardSource.CanNotTrashFromDigivolutionCards(activateClass))
  67. {
  68. return true;
  69. }
  70. return false;
  71. }
  72. bool CanUseCondition(Hashtable hashtable)
  73. {
  74. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  75. }
  76. bool CanActivateCondition(Hashtable hashtable)
  77. {
  78. if (CardEffectCommons.IsExistOnBattleArea(card))
  79. {
  80. return true;
  81. }
  82. return false;
  83. }
  84. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  85. {
  86. if (CardEffectCommons.IsExistOnBattleArea(card))
  87. {
  88. int maxCount = card.PermanentOfThisCard().DigivolutionCards.Count;
  89. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  90. permanentCondition: CanSelectPermanentCondition,
  91. cardCondition: CanSelectCardCondition,
  92. maxCount: maxCount,
  93. canNoTrash: false,
  94. isFromOnly1Permanent: true,
  95. activateClass: activateClass
  96. ));
  97. }
  98. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  99. canNotSuspendClass.SetUpICardEffect("Opponent's Digimon without digivolution cards can't Suspend", CanUseCondition1, card);
  100. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  101. card.Owner.UntilOpponentTurnEndEffects.Add(_timing => canNotSuspendClass);
  102. bool CanUseCondition1(Hashtable hashtable)
  103. {
  104. return true;
  105. }
  106. bool PermanentCondition(Permanent permanent)
  107. {
  108. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  109. {
  110. if (permanent.HasNoDigivolutionCards)
  111. {
  112. if (!permanent.TopCard.CanNotBeAffected(canNotSuspendClass))
  113. {
  114. return true;
  115. }
  116. }
  117. }
  118. return false;
  119. }
  120. foreach (Permanent permanent in GManager.instance.turnStateMachine.gameContext.PermanentsForTurnPlayer)
  121. {
  122. if (PermanentCondition(permanent))
  123. {
  124. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
  125. }
  126. }
  127. }
  128. }
  129. if (timing == EffectTiming.OnAllyAttack)
  130. {
  131. ActivateClass activateClass = new ActivateClass();
  132. activateClass.SetUpICardEffect("Trash digivolution cards and opponent's Digimon can't suspend", CanUseCondition, card);
  133. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  134. activateClass.SetHashString("TrashDigivolutionCards_EX5_025");
  135. cardEffects.Add(activateClass);
  136. string EffectDiscription()
  137. {
  138. return "[When Attacking] [Once Per Turn] For each of this Digimon's digivolution cards, trash any 1 digivolution card from 1 of your opponent's Digimon. Then, until the end of your opponent's turn, all of their Digimon with no digivolution cards can't suspend.";
  139. }
  140. bool CanSelectPermanentCondition(Permanent permanent)
  141. {
  142. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  143. {
  144. if (permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  145. {
  146. return true;
  147. }
  148. }
  149. return false;
  150. }
  151. bool CanSelectCardCondition(CardSource cardSource)
  152. {
  153. if (!cardSource.CanNotTrashFromDigivolutionCards(activateClass))
  154. {
  155. return true;
  156. }
  157. return false;
  158. }
  159. bool CanUseCondition(Hashtable hashtable)
  160. {
  161. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  162. }
  163. bool CanActivateCondition(Hashtable hashtable)
  164. {
  165. if (CardEffectCommons.IsExistOnBattleArea(card))
  166. {
  167. return true;
  168. }
  169. return false;
  170. }
  171. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  172. {
  173. if (CardEffectCommons.IsExistOnBattleArea(card))
  174. {
  175. int maxCount = card.PermanentOfThisCard().DigivolutionCards.Count;
  176. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  177. permanentCondition: CanSelectPermanentCondition,
  178. cardCondition: CanSelectCardCondition,
  179. maxCount: maxCount,
  180. canNoTrash: false,
  181. isFromOnly1Permanent: true,
  182. activateClass: activateClass
  183. ));
  184. }
  185. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  186. canNotSuspendClass.SetUpICardEffect("Opponent's Digimon without digivolution cards can't Suspend", CanUseCondition1, card);
  187. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  188. card.Owner.UntilOpponentTurnEndEffects.Add(_timing => canNotSuspendClass);
  189. bool CanUseCondition1(Hashtable hashtable)
  190. {
  191. return true;
  192. }
  193. bool PermanentCondition(Permanent permanent)
  194. {
  195. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  196. {
  197. if (permanent.HasNoDigivolutionCards)
  198. {
  199. if (!permanent.TopCard.CanNotBeAffected(canNotSuspendClass))
  200. {
  201. return true;
  202. }
  203. }
  204. }
  205. return false;
  206. }
  207. foreach (Permanent permanent in GManager.instance.turnStateMachine.gameContext.PermanentsForTurnPlayer)
  208. {
  209. if (PermanentCondition(permanent))
  210. {
  211. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
  212. }
  213. }
  214. }
  215. }
  216. if (timing == EffectTiming.OnDigivolutionCardDiscarded)
  217. {
  218. ActivateClass activateClass = new ActivateClass();
  219. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  220. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  221. activateClass.SetHashString("Unsuspend_EX5_025");
  222. cardEffects.Add(activateClass);
  223. string EffectDiscription()
  224. {
  225. return "[All Turns] [Once Per Turn] When an opponent's Digimon's digivolution card is trashed, unsuspend this Digimon.";
  226. }
  227. bool PermanentCondition(Permanent permanent)
  228. {
  229. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  230. }
  231. bool CanUseCondition(Hashtable hashtable)
  232. {
  233. if (CardEffectCommons.IsExistOnBattleArea(card))
  234. {
  235. if (CardEffectCommons.CanTriggerOnTrashDigivolutionCard(hashtable, PermanentCondition, cardEffect => true, cardSource => true))
  236. {
  237. return true;
  238. }
  239. }
  240. return false;
  241. }
  242. bool CanActivateCondition(Hashtable hashtable)
  243. {
  244. if (CardEffectCommons.IsExistOnBattleArea(card))
  245. {
  246. return true;
  247. }
  248. return false;
  249. }
  250. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  251. {
  252. Permanent selectedPermanent = card.PermanentOfThisCard();
  253. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(
  254. new List<Permanent>() { selectedPermanent },
  255. activateClass).Unsuspend());
  256. }
  257. }
  258. return cardEffects;
  259. }
  260. }
  261. }