EX4_060.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX4
  6. {
  7. public class EX4_060 : 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.None)
  13. {
  14. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  15. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  16. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  17. addJogressConditionClass.SetNotShowUI(true);
  18. cardEffects.Add(addJogressConditionClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. return true;
  22. }
  23. JogressCondition GetJogress(CardSource cardSource)
  24. {
  25. if (cardSource == card)
  26. {
  27. bool PermanentCondition1(Permanent permanent)
  28. {
  29. if (permanent != null)
  30. {
  31. if (permanent.TopCard != null)
  32. {
  33. if (permanent.TopCard.Owner == card.Owner)
  34. {
  35. if (permanent.IsDigimon)
  36. {
  37. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  38. {
  39. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  40. {
  41. if (permanent.Levels_ForJogress(card).Contains(6))
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. bool PermanentCondition2(Permanent permanent)
  54. {
  55. if (permanent != null)
  56. {
  57. if (permanent.TopCard != null)
  58. {
  59. if (permanent.TopCard.Owner == card.Owner)
  60. {
  61. if (permanent.IsDigimon)
  62. {
  63. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  64. {
  65. if (permanent.TopCard.CardColors.Contains(CardColor.Red))
  66. {
  67. if (permanent.Levels_ForJogress(card).Contains(6))
  68. {
  69. return true;
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. }
  77. return false;
  78. }
  79. JogressConditionElement[] elements = new JogressConditionElement[]
  80. {
  81. new JogressConditionElement(PermanentCondition1, "a level 6 blue Digimon"),
  82. new JogressConditionElement(PermanentCondition2, "a level 6 red Digimon"),
  83. };
  84. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  85. return jogressCondition;
  86. }
  87. return null;
  88. }
  89. }
  90. if (timing == EffectTiming.OnEnterFieldAnyone)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("Delete 1 Digimon with 8000 DP or less and return 1 Digimon with level 6 or more to the bottom of deck", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  95. cardEffects.Add(activateClass);
  96. string EffectDiscription()
  97. {
  98. return "[When Digivolving] Delete 1 of your opponent's Digimon with 8000 DP or less, and return 1 of your opponent's level 6 or higher Digimon to the bottom of its owner's deck.";
  99. }
  100. bool CanSelectPermanentCondition(Permanent permanent)
  101. {
  102. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  103. {
  104. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(8000, activateClass))
  105. {
  106. return true;
  107. }
  108. }
  109. return false;
  110. }
  111. bool CanSelectPermanentCondition1(Permanent permanent)
  112. {
  113. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  114. {
  115. if (permanent.Level >= 6)
  116. {
  117. if (permanent.TopCard.HasLevel)
  118. {
  119. return true;
  120. }
  121. }
  122. }
  123. return false;
  124. }
  125. bool CanUseCondition(Hashtable hashtable)
  126. {
  127. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  128. }
  129. bool CanActivateCondition(Hashtable hashtable)
  130. {
  131. if (CardEffectCommons.IsExistOnBattleArea(card))
  132. {
  133. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  134. {
  135. return true;
  136. }
  137. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  138. {
  139. return true;
  140. }
  141. }
  142. return false;
  143. }
  144. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  145. {
  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: null,
  160. mode: SelectPermanentEffect.Mode.Destroy,
  161. cardEffect: activateClass);
  162. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  163. }
  164. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  165. {
  166. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  167. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  168. selectPermanentEffect.SetUp(
  169. selectPlayer: card.Owner,
  170. canTargetCondition: CanSelectPermanentCondition1,
  171. canTargetCondition_ByPreSelecetedList: null,
  172. canEndSelectCondition: null,
  173. maxCount: maxCount,
  174. canNoSelect: false,
  175. canEndNotMax: false,
  176. selectPermanentCoroutine: null,
  177. afterSelectPermanentCoroutine: null,
  178. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  179. cardEffect: activateClass);
  180. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  181. }
  182. }
  183. }
  184. if (timing == EffectTiming.WhenRemoveField)
  185. {
  186. ActivateClass activateClass = new ActivateClass();
  187. activateClass.SetUpICardEffect("Play [BlitzGreymon] and [CresGarurumon] from digivolution cards and place this Digimon at the bottom of security", CanUseCondition, card);
  188. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  189. activateClass.SetHashString("PlayAndPutSecurity_EX4_060");
  190. cardEffects.Add(activateClass);
  191. string EffectDiscription()
  192. {
  193. return "[All Turns] When this Digimon would leave the battle area other than by one of your effects, play 1 [BlitzGreymon] and 1 [CresGarurumon] from this Digimon's digivolution cards without paying the costs. Then, place this Digimon at the bottom of your security stack face down.";
  194. }
  195. bool CanSelectCardCondition(CardSource cardSource)
  196. {
  197. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  198. {
  199. if (cardSource.CardNames.Contains("BlitzGreymon"))
  200. {
  201. return true;
  202. }
  203. }
  204. return false;
  205. }
  206. bool CanSelectCardCondition1(CardSource cardSource)
  207. {
  208. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  209. {
  210. if (cardSource.CardNames.Contains("CresGarurumon"))
  211. {
  212. return true;
  213. }
  214. }
  215. return false;
  216. }
  217. bool CanUseCondition(Hashtable hashtable)
  218. {
  219. if (CardEffectCommons.IsExistOnBattleArea(card))
  220. {
  221. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  222. {
  223. if (!CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOwnerEffect(cardEffect, card)))
  224. {
  225. return true;
  226. }
  227. }
  228. }
  229. return false;
  230. }
  231. bool CanActivateCondition(Hashtable hashtable)
  232. {
  233. if (CardEffectCommons.IsExistOnBattleArea(card))
  234. {
  235. return true;
  236. }
  237. return false;
  238. }
  239. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  240. {
  241. if (CardEffectCommons.IsExistOnBattleArea(card))
  242. {
  243. List<CardSource> selectedCards = new List<CardSource>();
  244. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => CanSelectCardCondition(cardSource)) >= 1)
  245. {
  246. int maxCount = 1;
  247. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  248. selectCardEffect.SetUp(
  249. canTargetCondition: (cardSource) => CanSelectCardCondition(cardSource),
  250. canTargetCondition_ByPreSelecetedList: null,
  251. canEndSelectCondition: null,
  252. canNoSelect: () => false,
  253. selectCardCoroutine: SelectCardCoroutine,
  254. afterSelectCardCoroutine: null,
  255. message: "Select 1 [BlitzGreymon] to play.",
  256. maxCount: maxCount,
  257. canEndNotMax: false,
  258. isShowOpponent: true,
  259. mode: SelectCardEffect.Mode.Custom,
  260. root: SelectCardEffect.Root.Custom,
  261. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  262. canLookReverseCard: true,
  263. selectPlayer: card.Owner,
  264. cardEffect: activateClass);
  265. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  266. IEnumerator SelectCardCoroutine(CardSource cardSource)
  267. {
  268. selectedCards.Add(cardSource);
  269. yield return null;
  270. }
  271. }
  272. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => CanSelectCardCondition1(cardSource)) >= 1)
  273. {
  274. int maxCount = 1;
  275. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  276. selectCardEffect.SetUp(
  277. canTargetCondition: (cardSource) => CanSelectCardCondition1(cardSource),
  278. canTargetCondition_ByPreSelecetedList: null,
  279. canEndSelectCondition: null,
  280. canNoSelect: () => false,
  281. selectCardCoroutine: SelectCardCoroutine,
  282. afterSelectCardCoroutine: null,
  283. message: "Select 1 [CresGarurumon] to play.",
  284. maxCount: maxCount,
  285. canEndNotMax: false,
  286. isShowOpponent: true,
  287. mode: SelectCardEffect.Mode.Custom,
  288. root: SelectCardEffect.Root.Custom,
  289. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  290. canLookReverseCard: true,
  291. selectPlayer: card.Owner,
  292. cardEffect: activateClass);
  293. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  294. IEnumerator SelectCardCoroutine(CardSource cardSource)
  295. {
  296. selectedCards.Add(cardSource);
  297. yield return null;
  298. }
  299. }
  300. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  301. cardSources: selectedCards,
  302. activateClass: activateClass,
  303. payCost: false,
  304. isTapped: false,
  305. root: SelectCardEffect.Root.DigivolutionCards,
  306. activateETB: true));
  307. }
  308. if (CardEffectCommons.IsExistOnBattleArea(card))
  309. {
  310. yield return ContinuousController.instance.StartCoroutine(new IPutSecurityPermanent(
  311. card.PermanentOfThisCard(),
  312. CardEffectCommons.CardEffectHashtable(activateClass),
  313. toTop: false).PutSecurity());
  314. }
  315. }
  316. }
  317. return cardEffects;
  318. }
  319. }
  320. }