SeventhFascination_EX7_072.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX7
  6. {
  7. public class SeventhFascination_EX7_072 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Trash Your Turn
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Return this to bottom of deck, Activate Main", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Trash] [Your Turn] When your Digimon digivolves into [Lilithmon (X Antibody)], by returning this card to the bottom of the deck, activate this card's [Main] effect.";
  22. }
  23. bool PermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  26. {
  27. if (permanent.TopCard.CardNames.Contains("Lilithmon (X Antibody)"))
  28. {
  29. return true;
  30. }
  31. if (permanent.TopCard.CardNames.Contains("Lilithmon(XAntibody)"))
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsExistOnTrash(card))
  41. {
  42. if (CardEffectCommons.IsOwnerTurn(card))
  43. {
  44. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition))
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.IsExistOnTrash(card);
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. if (CardEffectCommons.IsExistOnTrash(card))
  59. {
  60. List<CardSource> cardSources = new List<CardSource>() { card };
  61. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources));
  62. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect2(cardSources, "Deck Bottom Card", true, true));
  63. ActivateClass mainActivateClass = CardEffectCommons.OptionMainEffect(card);
  64. if (mainActivateClass != null)
  65. {
  66. yield return ContinuousController.instance.StartCoroutine(mainActivateClass.Activate(CardEffectCommons.OptionMainCheckHashtable(card)));
  67. }
  68. }
  69. }
  70. }
  71. #endregion
  72. #region Main
  73. if (timing == EffectTiming.OptionSkill)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("All Opponents Digimon gain \"Delete 1 of your Digimon\"", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  78. cardEffects.Add(activateClass);
  79. string EffectDiscription()
  80. {
  81. return "[Main] All your opponent's Digimon gain \" [End of Your Turn] Delete 1 of your Digimon.\" until the end of their turn.";
  82. }
  83. bool CanUseCondition(Hashtable hashtable)
  84. {
  85. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  86. }
  87. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  88. {
  89. bool PermanentCondition(Permanent permanent)
  90. {
  91. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  92. {
  93. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  94. {
  95. return true;
  96. }
  97. }
  98. return false;
  99. }
  100. foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaPermanents())
  101. {
  102. if (PermanentCondition(permanent))
  103. {
  104. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
  105. }
  106. }
  107. AddSkillClass addSkillClass = new AddSkillClass();
  108. addSkillClass.SetUpICardEffect("Delete 1 of your Digimon", CanUseCondition1, card);
  109. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
  110. card.Owner.UntilOpponentTurnEndEffects.Add((_timing) => addSkillClass);
  111. bool CanUseCondition1(Hashtable hashtable)
  112. {
  113. return true;
  114. }
  115. bool CardSourceCondition(CardSource cardSource)
  116. {
  117. if (PermanentCondition(cardSource.PermanentOfThisCard()))
  118. {
  119. if (cardSource == cardSource.PermanentOfThisCard().TopCard)
  120. {
  121. return true;
  122. }
  123. }
  124. return false;
  125. }
  126. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
  127. {
  128. if (_timing == EffectTiming.OnEndTurn)
  129. {
  130. ActivateClass activateClass1 = new ActivateClass();
  131. activateClass1.SetUpICardEffect("Delete 1 of your Digimon", CanUseCondition2, cardSource);
  132. activateClass1.SetUpActivateClass(CanActivateCondition2, ActivateCoroutine1, -1, false, EffectDiscription1());
  133. cardEffects.Add(activateClass1);
  134. if (cardSource.PermanentOfThisCard() != null)
  135. {
  136. activateClass1.SetEffectSourcePermanent(cardSource.PermanentOfThisCard());
  137. }
  138. string EffectDiscription1()
  139. {
  140. return "[End of Your Turn] Delete 1 of your Digimon.";
  141. }
  142. bool CanSelectPermanentCondition(Permanent permanent)
  143. {
  144. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, cardSource);
  145. }
  146. bool CanUseCondition2(Hashtable hashtable)
  147. {
  148. if (CardEffectCommons.IsOwnerTurn(cardSource))
  149. {
  150. if(CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource))
  151. return CardSourceCondition(cardSource);
  152. }
  153. return false;
  154. }
  155. bool CanActivateCondition2(Hashtable hashtable)
  156. {
  157. return CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource);
  158. }
  159. IEnumerator ActivateCoroutine1(Hashtable _hashtable)
  160. {
  161. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  162. {
  163. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  164. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  165. selectPermanentEffect.SetUp(
  166. selectPlayer: cardSource.Owner,
  167. canTargetCondition: CanSelectPermanentCondition,
  168. canTargetCondition_ByPreSelecetedList: null,
  169. canEndSelectCondition: null,
  170. maxCount: maxCount,
  171. canNoSelect: false,
  172. canEndNotMax: false,
  173. selectPermanentCoroutine: null,
  174. afterSelectPermanentCoroutine: null,
  175. mode: SelectPermanentEffect.Mode.Destroy,
  176. cardEffect: activateClass);
  177. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  178. }
  179. }
  180. }
  181. return cardEffects;
  182. }
  183. }
  184. }
  185. #endregion
  186. #region Security
  187. if (timing == EffectTiming.SecuritySkill)
  188. {
  189. ActivateClass activateClass = new ActivateClass();
  190. activateClass.SetUpICardEffect("Delete 1 Opponents unsuspended Digimon", CanUseCondition, card);
  191. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  192. activateClass.SetIsSecurityEffect(true);
  193. cardEffects.Add(activateClass);
  194. string EffectDiscription()
  195. {
  196. return "[Main] Delete 1 of your opponent's unsuspended Digimon.";
  197. }
  198. bool CanSelectPermanentCondition(Permanent permanent)
  199. {
  200. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  201. {
  202. if (!permanent.IsSuspended)
  203. {
  204. return true;
  205. }
  206. }
  207. return false;
  208. }
  209. bool CanUseCondition(Hashtable hashtable)
  210. {
  211. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  212. }
  213. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  214. {
  215. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  216. {
  217. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  218. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  219. selectPermanentEffect.SetUp(
  220. selectPlayer: card.Owner,
  221. canTargetCondition: CanSelectPermanentCondition,
  222. canTargetCondition_ByPreSelecetedList: null,
  223. canEndSelectCondition: null,
  224. maxCount: maxCount,
  225. canNoSelect: false,
  226. canEndNotMax: false,
  227. selectPermanentCoroutine: null,
  228. afterSelectPermanentCoroutine: null,
  229. mode: SelectPermanentEffect.Mode.Destroy,
  230. cardEffect: activateClass);
  231. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  232. }
  233. }
  234. }
  235. #endregion
  236. return cardEffects;
  237. }
  238. }
  239. }