EX4_013.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX4
  5. {
  6. public class EX4_013 : 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. DontBattleSecurityDigimonClass dontBattleSecurityDigimonClass = new DontBattleSecurityDigimonClass();
  14. dontBattleSecurityDigimonClass.SetUpICardEffect("Ignore Battle", CanUseCondition, card);
  15. dontBattleSecurityDigimonClass.SetUpDontBattleSecurityDigimonClass(CardSourceCondition: CardSourceCondition);
  16. dontBattleSecurityDigimonClass.SetIsSecurityEffect(true);
  17. dontBattleSecurityDigimonClass.SetNotShowUI(true);
  18. cardEffects.Add(dontBattleSecurityDigimonClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. return CardEffectCommons.CanUseIgnoreBattle(hashtable, card);
  22. }
  23. bool CardSourceCondition(CardSource cardSource)
  24. {
  25. return cardSource == card;
  26. }
  27. }
  28. if (timing == EffectTiming.SecuritySkill)
  29. {
  30. ActivateClass activateClass = new ActivateClass();
  31. activateClass.SetUpICardEffect("Play this card without battling and return this Digimon to hand at the end of the turn", CanUseCondition, card);
  32. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  33. activateClass.SetIsSecurityEffect(true);
  34. cardEffects.Add(activateClass);
  35. string EffectDiscription()
  36. {
  37. return "[Security] Play this card without battling and without paying the cost. At the end of the turn, return this Digimon to your hand.";
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  42. }
  43. bool CanActivateCondition(Hashtable hashtable)
  44. {
  45. if (CardEffectCommons.IsExistOnExecutingArea(card))
  46. {
  47. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: card, payCost: false, cardEffect: activateClass))
  48. {
  49. return true;
  50. }
  51. }
  52. return false;
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  55. {
  56. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: card, payCost: false, cardEffect: activateClass))
  57. {
  58. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  59. cardSources: new List<CardSource>() { card },
  60. activateClass: activateClass,
  61. payCost: false,
  62. isTapped: false,
  63. root: SelectCardEffect.Root.Security,
  64. activateETB: true));
  65. if (CardEffectCommons.IsExistOnBattleArea(card))
  66. {
  67. Permanent selectedPermanent = null;
  68. ActivateClass activateClass1 = new ActivateClass();
  69. activateClass1.SetUpICardEffect("Return the Digimon to hand", CanUseCondition1, card);
  70. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, "");
  71. CardEffectCommons.AddEffectToPlayer(effectDuration: EffectDuration.UntilEachTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnEndTurn);
  72. bool CanUseCondition1(Hashtable hashtable)
  73. {
  74. return true;
  75. }
  76. bool CanActivateCondition1(Hashtable hashtable)
  77. {
  78. selectedPermanent = card.PermanentOfThisCard();
  79. if (selectedPermanent.TopCard != null)
  80. {
  81. if (!selectedPermanent.CannotReturnToHand(activateClass1))
  82. {
  83. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass1))
  84. {
  85. return true;
  86. }
  87. }
  88. }
  89. return false;
  90. }
  91. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  92. {
  93. yield return ContinuousController.instance.StartCoroutine(new HandBounceClaass(new List<Permanent>() { selectedPermanent }, CardEffectCommons.CardEffectHashtable(activateClass1)).Bounce());
  94. }
  95. }
  96. }
  97. }
  98. }
  99. if (timing == EffectTiming.OnEnterFieldAnyone)
  100. {
  101. ActivateClass activateClass = new ActivateClass();
  102. activateClass.SetUpICardEffect("Delete 1 Digimon with 6000 DP or less, or suspend 1 Digimon", CanUseCondition, card);
  103. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  104. cardEffects.Add(activateClass);
  105. string EffectDiscription()
  106. {
  107. return "[On Play] Delete 1 of your opponent's Digimon with 6000 DP or less. If no Digimon was deleted by this effect, suspend 1 of your opponent's Digimon, and that Digimon doesn't unsuspend during your opponent's next unsuspend phase.";
  108. }
  109. bool CanSelectPermanentCondition(Permanent permanent)
  110. {
  111. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  112. {
  113. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  114. {
  115. return true;
  116. }
  117. }
  118. return false;
  119. }
  120. bool CanSelectPermanentCondition1(Permanent permanent)
  121. {
  122. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  123. }
  124. bool CanUseCondition(Hashtable hashtable)
  125. {
  126. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  127. }
  128. bool CanActivateCondition(Hashtable hashtable)
  129. {
  130. if (CardEffectCommons.IsExistOnBattleArea(card))
  131. {
  132. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  133. {
  134. return true;
  135. }
  136. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  137. {
  138. return true;
  139. }
  140. }
  141. return false;
  142. }
  143. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  144. {
  145. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  146. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  147. {
  148. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  149. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  150. selectPermanentEffect.SetUp(
  151. selectPlayer: card.Owner,
  152. canTargetCondition: CanSelectPermanentCondition,
  153. canTargetCondition_ByPreSelecetedList: null,
  154. canEndSelectCondition: null,
  155. maxCount: maxCount,
  156. canNoSelect: false,
  157. canEndNotMax: false,
  158. selectPermanentCoroutine: null,
  159. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  160. mode: SelectPermanentEffect.Mode.Custom,
  161. cardEffect: activateClass);
  162. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  163. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  164. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  165. {
  166. foreach (Permanent permanent in permanents)
  167. {
  168. deleteTargetPermanents.Add(permanent);
  169. }
  170. yield return null;
  171. }
  172. }
  173. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  174. IEnumerator FailureProcess()
  175. {
  176. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  177. {
  178. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  179. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  180. selectPermanentEffect.SetUp(
  181. selectPlayer: card.Owner,
  182. canTargetCondition: CanSelectPermanentCondition1,
  183. canTargetCondition_ByPreSelecetedList: null,
  184. canEndSelectCondition: null,
  185. maxCount: maxCount,
  186. canNoSelect: false,
  187. canEndNotMax: false,
  188. selectPermanentCoroutine: null,
  189. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  190. mode: SelectPermanentEffect.Mode.Tap,
  191. cardEffect: activateClass);
  192. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  193. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  194. {
  195. foreach (Permanent selectedPermanent in permanents)
  196. {
  197. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendNextActivePhase(
  198. targetPermanent: selectedPermanent,
  199. activateClass: activateClass
  200. ));
  201. }
  202. }
  203. }
  204. }
  205. }
  206. }
  207. if (timing == EffectTiming.OnAllyAttack)
  208. {
  209. ActivateClass activateClass = new ActivateClass();
  210. activateClass.SetUpICardEffect("Delete 1 Digimon with 6000 DP or less, or suspend 1 Digimon", CanUseCondition, card);
  211. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  212. cardEffects.Add(activateClass);
  213. string EffectDiscription()
  214. {
  215. return "[When Attacking] Delete 1 of your opponent's Digimon with 6000 DP or less. If no Digimon was deleted by this effect, suspend 1 of your opponent's Digimon, and that Digimon doesn't unsuspend during your opponent's next unsuspend phase.";
  216. }
  217. bool CanSelectPermanentCondition(Permanent permanent)
  218. {
  219. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  220. {
  221. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  222. {
  223. return true;
  224. }
  225. }
  226. return false;
  227. }
  228. bool CanSelectPermanentCondition1(Permanent permanent)
  229. {
  230. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  231. }
  232. bool CanUseCondition(Hashtable hashtable)
  233. {
  234. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  235. }
  236. bool CanActivateCondition(Hashtable hashtable)
  237. {
  238. if (CardEffectCommons.IsExistOnBattleArea(card))
  239. {
  240. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  241. {
  242. return true;
  243. }
  244. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  245. {
  246. return true;
  247. }
  248. }
  249. return false;
  250. }
  251. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  252. {
  253. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  254. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  255. {
  256. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  257. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  258. selectPermanentEffect.SetUp(
  259. selectPlayer: card.Owner,
  260. canTargetCondition: CanSelectPermanentCondition,
  261. canTargetCondition_ByPreSelecetedList: null,
  262. canEndSelectCondition: null,
  263. maxCount: maxCount,
  264. canNoSelect: false,
  265. canEndNotMax: false,
  266. selectPermanentCoroutine: null,
  267. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  268. mode: SelectPermanentEffect.Mode.Custom,
  269. cardEffect: activateClass);
  270. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  271. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  272. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  273. {
  274. foreach (Permanent permanent in permanents)
  275. {
  276. deleteTargetPermanents.Add(permanent);
  277. }
  278. yield return null;
  279. }
  280. }
  281. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  282. IEnumerator FailureProcess()
  283. {
  284. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  285. {
  286. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  287. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  288. selectPermanentEffect.SetUp(
  289. selectPlayer: card.Owner,
  290. canTargetCondition: CanSelectPermanentCondition1,
  291. canTargetCondition_ByPreSelecetedList: null,
  292. canEndSelectCondition: null,
  293. maxCount: maxCount,
  294. canNoSelect: false,
  295. canEndNotMax: false,
  296. selectPermanentCoroutine: null,
  297. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  298. mode: SelectPermanentEffect.Mode.Tap,
  299. cardEffect: activateClass);
  300. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  301. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  302. {
  303. foreach (Permanent selectedPermanent in permanents)
  304. {
  305. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendNextActivePhase(
  306. targetPermanent: selectedPermanent,
  307. activateClass: activateClass
  308. ));
  309. }
  310. }
  311. }
  312. }
  313. }
  314. }
  315. return cardEffects;
  316. }
  317. }
  318. }