EX6_070.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace DCGO.CardEffects.EX6
  5. {
  6. public class EX6_070 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Main Option
  12. if (timing == EffectTiming.OptionSkill)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("1 Opponent's Digimon gains, [End of Your Turn] Delete this digimon.", 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 their Digimon gains \"[End of Your Turn] Delete this Digimon.\" Then, place this card in the battle area.";
  21. }
  22. bool SelectOpponentDigimon(Permanent permanent)
  23. {
  24. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  25. }
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  29. }
  30. IEnumerator ActivateCoroutine(Hashtable hashtable)
  31. {
  32. Permanent selectedPermanent = null;
  33. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SelectOpponentDigimon))
  34. {
  35. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  36. selectPermanentEffect.SetUp(
  37. selectPlayer: card.Owner,
  38. canTargetCondition: SelectOpponentDigimon,
  39. canTargetCondition_ByPreSelecetedList: null,
  40. canEndSelectCondition: null,
  41. maxCount: 1,
  42. canNoSelect: false,
  43. canEndNotMax: false,
  44. selectPermanentCoroutine: SelectPermanentCoroutine,
  45. afterSelectPermanentCoroutine: null,
  46. mode: SelectPermanentEffect.Mode.Custom,
  47. cardEffect: activateClass);
  48. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  49. }
  50. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  51. {
  52. selectedPermanent = permanent;
  53. yield return null;
  54. }
  55. #region Grant effect
  56. if (selectedPermanent != null)
  57. {
  58. ActivateClass activateClass1 = new ActivateClass();
  59. activateClass1.SetUpICardEffect("Delete this Digimon", CanUseCondition1, selectedPermanent.TopCard);
  60. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  61. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  62. selectedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  63. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  64. {
  65. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  66. }
  67. string EffectDiscription1()
  68. {
  69. return "[End of Your Turn] Delete this Digimon.";
  70. }
  71. bool CanUseCondition1(Hashtable hashtable1)
  72. {
  73. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  74. {
  75. if (selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent))
  76. {
  77. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer == selectedPermanent.TopCard.Owner)
  78. {
  79. return true;
  80. }
  81. }
  82. }
  83. return false;
  84. }
  85. bool CanActivateCondition1(Hashtable hashtable1)
  86. {
  87. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  88. {
  89. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  90. {
  91. return true;
  92. }
  93. }
  94. return false;
  95. }
  96. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  97. {
  98. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  99. {
  100. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
  101. new List<Permanent>() { selectedPermanent },
  102. CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
  103. }
  104. }
  105. ICardEffect GetCardEffect(EffectTiming _timing)
  106. {
  107. if (_timing == EffectTiming.OnEndTurn)
  108. {
  109. return activateClass1;
  110. }
  111. return null;
  112. }
  113. }
  114. #endregion
  115. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  116. }
  117. }
  118. #endregion
  119. #region End of Opponents Turn - Delay
  120. if (timing == EffectTiming.OnEndTurn)
  121. {
  122. ActivateClass activateClass = new ActivateClass();
  123. activateClass.SetUpICardEffect("Delete 1 of your opponent's unsuspended Digimon", CanUseCondition, card);
  124. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, true, EffectDiscription());
  125. cardEffects.Add(activateClass);
  126. string EffectDiscription()
  127. {
  128. return "[End of Opponent's Turn] If you have a Digimon with [Lilithmon] in its name, <Delay>.\r\n• Delete 1 of your opponent's unsuspended Digimon.";
  129. }
  130. bool HasLilithmon(Permanent permanent)
  131. {
  132. if(CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  133. {
  134. return permanent.TopCard.ContainsCardName("Lilithmon");
  135. }
  136. return false;
  137. }
  138. bool SelectOpponentUnsuspendedDigimon(Permanent permanent)
  139. {
  140. if(CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  141. {
  142. return !permanent.IsSuspended;
  143. }
  144. return false;
  145. }
  146. bool CanUseCondition(Hashtable hashtable)
  147. {
  148. if (!CardEffectCommons.IsOwnerTurn(card))
  149. {
  150. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasLilithmon))
  151. {
  152. return CardEffectCommons.CanDeclareOptionDelayEffect(card);
  153. }
  154. }
  155. return false;
  156. }
  157. IEnumerator ActivateCoroutine(Hashtable hashtable)
  158. {
  159. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  160. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  161. activateClass: activateClass,
  162. successProcess: permanents => SuccessProcess(),
  163. failureProcess: null));
  164. IEnumerator SuccessProcess()
  165. {
  166. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SelectOpponentUnsuspendedDigimon))
  167. {
  168. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  169. selectPermanentEffect.SetUp(
  170. selectPlayer: card.Owner,
  171. canTargetCondition: SelectOpponentUnsuspendedDigimon,
  172. canTargetCondition_ByPreSelecetedList: null,
  173. canEndSelectCondition: null,
  174. maxCount: 1,
  175. canNoSelect: false,
  176. canEndNotMax: false,
  177. selectPermanentCoroutine: null,
  178. afterSelectPermanentCoroutine: null,
  179. mode: SelectPermanentEffect.Mode.Destroy,
  180. cardEffect: activateClass);
  181. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  182. }
  183. }
  184. }
  185. }
  186. #endregion
  187. #region Security Effect
  188. if (timing == EffectTiming.SecuritySkill)
  189. {
  190. ActivateClass activateClass = new ActivateClass();
  191. activateClass.SetUpICardEffect($"Delete an unsuspended Digimon", CanUseCondition, card);
  192. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  193. activateClass.SetIsSecurityEffect(true);
  194. cardEffects.Add(activateClass);
  195. string EffectDiscription()
  196. {
  197. return "[Security] Delete 1 of your opponent's unsuspended Digimon.";
  198. }
  199. bool CanSelectPermanentCondition(Permanent permanent)
  200. {
  201. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  202. {
  203. if (!permanent.IsSuspended)
  204. {
  205. return true;
  206. }
  207. }
  208. return false;
  209. }
  210. bool CanUseCondition(Hashtable hashtable)
  211. {
  212. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  213. }
  214. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  215. {
  216. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  217. {
  218. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  219. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  220. selectPermanentEffect.SetUp(
  221. selectPlayer: card.Owner,
  222. canTargetCondition: CanSelectPermanentCondition,
  223. canTargetCondition_ByPreSelecetedList: null,
  224. canEndSelectCondition: null,
  225. maxCount: maxCount,
  226. canNoSelect: false,
  227. canEndNotMax: false,
  228. selectPermanentCoroutine: null,
  229. afterSelectPermanentCoroutine: null,
  230. mode: SelectPermanentEffect.Mode.Destroy,
  231. cardEffect: activateClass);
  232. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  233. }
  234. }
  235. }
  236. #endregion
  237. return cardEffects;
  238. }
  239. }
  240. }