P_220.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. // Millenniummon
  6. namespace DCGO.CardEffects.P
  7. {
  8. public class P_220 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alt Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.EqualsCardName("Kimeramon");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 6,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region DNA Digivolution
  30. if (timing == EffectTiming.None)
  31. {
  32. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  33. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  34. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  35. addJogressConditionClass.SetNotShowUI(true);
  36. cardEffects.Add(addJogressConditionClass);
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return true;
  40. }
  41. JogressCondition GetJogress(CardSource cardSource)
  42. {
  43. if (cardSource == card)
  44. {
  45. bool PermanentCondition1(Permanent permanent)
  46. {
  47. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  48. {
  49. if (permanent.TopCard.EqualsCardName("Kimeramon"))
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. bool PermanentCondition2(Permanent permanent)
  57. {
  58. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  59. {
  60. if (permanent.TopCard.EqualsCardName("Machinedramon"))
  61. {
  62. return true;
  63. }
  64. }
  65. return false;
  66. }
  67. JogressConditionElement[] elements = new JogressConditionElement[]
  68. {
  69. new JogressConditionElement(PermanentCondition1, "Kimeramon"),
  70. new JogressConditionElement(PermanentCondition2, "Machinedramon"),
  71. };
  72. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  73. return jogressCondition;
  74. }
  75. return null;
  76. }
  77. }
  78. #endregion
  79. #region Assembly
  80. if (timing == EffectTiming.None)
  81. {
  82. AddAssemblyConditionClass addAssemblyConditionClass = new AddAssemblyConditionClass();
  83. addAssemblyConditionClass.SetUpICardEffect($"Assembly", CanUseCondition, card);
  84. addAssemblyConditionClass.SetUpAddAssemblyConditionClass(getAssemblyCondition: GetAssembly);
  85. addAssemblyConditionClass.SetNotShowUI(true);
  86. cardEffects.Add(addAssemblyConditionClass);
  87. bool CanUseCondition(Hashtable hashtable)
  88. {
  89. return true;
  90. }
  91. AssemblyCondition GetAssembly(CardSource cardSource)
  92. {
  93. if (cardSource == card)
  94. {
  95. AssemblyConditionElement element = new AssemblyConditionElement(CanSelectCardCondition);
  96. bool CanSelectCardCondition(CardSource cardSource)
  97. {
  98. return cardSource != null &&
  99. cardSource.Owner == card.Owner &&
  100. cardSource.IsDigimon &&
  101. cardSource.HasLevel &&
  102. (cardSource.EqualsTraits("Composite") ||
  103. cardSource.EqualsTraits("Ver.3") ||
  104. cardSource.EqualsTraits("Ver.5"));
  105. }
  106. bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource cardSource)
  107. {
  108. List<int> cardLevels = new List<int>();
  109. foreach (CardSource cardSource1 in cardSources)
  110. {
  111. if (!cardLevels.Contains(cardSource1.Level))
  112. {
  113. cardLevels.Add(cardSource1.Level);
  114. }
  115. foreach (int level in cardSource1.Level_Assembly)
  116. {
  117. if (!cardLevels.Contains(level))
  118. {
  119. cardLevels.Add(level);
  120. }
  121. }
  122. }
  123. if (cardSource.Level_Assembly.Count((level) => cardLevels.Contains(level)) >= 1 || cardLevels.Contains(cardSource.Level))
  124. {
  125. return false;
  126. }
  127. return true;
  128. }
  129. AssemblyCondition assemblyCondition = new AssemblyCondition(
  130. element:element,
  131. CanTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
  132. selectMessage: "3 [Composite]/[Ver.3]/[Ver.5] Trait Digimon cards w/different levels",
  133. elementCount: 3,
  134. reduceCost: 6);
  135. return assemblyCondition;
  136. }
  137. return null;
  138. }
  139. }
  140. #endregion
  141. #region Reboot
  142. if (timing == EffectTiming.None)
  143. {
  144. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  145. }
  146. #endregion
  147. #region Blocker
  148. if (timing == EffectTiming.None)
  149. {
  150. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  151. }
  152. #endregion
  153. #region Shared OP / WD
  154. string SharedEffectName = "<De-Digivolve 2>. Then Delete 1 Digimon";
  155. string SharedEffectDescription(string tag)
  156. {
  157. return $"[{tag}] <De-Digivolve 2> 1 of your opponent's Digimon. Then, you may delete 1 Digimon.";
  158. }
  159. bool PermanentSelectCondition(Permanent permanent)
  160. {
  161. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  162. }
  163. bool PermanentSelectCondition1(Permanent permanent)
  164. {
  165. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  166. }
  167. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  168. {
  169. #region De-digivolve 2
  170. if (CardEffectCommons.HasMatchConditionPermanent(PermanentSelectCondition))
  171. {
  172. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentSelectCondition));
  173. var selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  174. selectPermanentEffect.SetUp(
  175. selectPlayer: card.Owner,
  176. canTargetCondition: PermanentSelectCondition,
  177. canTargetCondition_ByPreSelecetedList: null,
  178. canEndSelectCondition: null,
  179. maxCount: maxCount,
  180. canNoSelect: false,
  181. canEndNotMax: false,
  182. selectPermanentCoroutine: SelectPermanentCoroutine,
  183. afterSelectPermanentCoroutine: null,
  184. mode: SelectPermanentEffect.Mode.Custom,
  185. cardEffect: activateClass);
  186. selectPermanentEffect.SetUpCustomMessage(
  187. "Select 1 Digimon to De-Digivolve.",
  188. "The opponent is selecting 1 Digimon to De-Digivolve.");
  189. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  190. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  191. {
  192. if (!permanent.TopCard.CanNotBeAffected(activateClass) && !permanent.ImmuneFromDeDigivolve()) {
  193. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 2, activateClass).Degeneration());
  194. }
  195. }
  196. }
  197. #endregion
  198. #region Delete 1
  199. if (CardEffectCommons.HasMatchConditionPermanent(PermanentSelectCondition1))
  200. {
  201. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentSelectCondition1));
  202. var selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  203. selectPermanentEffect.SetUp(
  204. selectPlayer: card.Owner,
  205. canTargetCondition: PermanentSelectCondition1,
  206. canTargetCondition_ByPreSelecetedList: null,
  207. canEndSelectCondition: null,
  208. maxCount: maxCount,
  209. canNoSelect: true,
  210. canEndNotMax: false,
  211. selectPermanentCoroutine: null,
  212. afterSelectPermanentCoroutine: null,
  213. mode: SelectPermanentEffect.Mode.Destroy,
  214. cardEffect: activateClass);
  215. selectPermanentEffect.SetUpCustomMessage(
  216. "Select 1 Digimon to Delete.",
  217. "The opponent is selecting 1 Digimon to Delete.");
  218. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  219. }
  220. #endregion
  221. }
  222. CardEffectFactory.ActivateClassesForSharedEffects
  223. (ref cardEffects, timing, card,
  224. SharedEffectName,
  225. SharedActivateCoroutine,
  226. SharedEffectDescription,
  227. optional: false,
  228. onPlay: true,
  229. whenDigivolving: true);
  230. #endregion
  231. #region On Deletion
  232. if (timing == EffectTiming.OnDestroyedAnyone)
  233. {
  234. ActivateClass activateClass = new ActivateClass();
  235. activateClass.SetUpICardEffect("Return 3 cards to play 2 digimon from Trash", CanUseCondition, card);
  236. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  237. cardEffects.Add(activateClass);
  238. string EffectDiscription()
  239. {
  240. return "[On Deletion] By returning 3 [Composite], [Wicked God] or [DM] trait cards from your trash to the bottom of the deck, you may play 2 level 6 or lower [Composite], [Ver.3] or [Ver.5] trait Digimon cards from your trash without paying the costs. This effect can't play cards of the same level.";
  241. }
  242. bool CanUseCondition(Hashtable hashtable)
  243. {
  244. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  245. }
  246. bool CanActivateCondition(Hashtable hashtable)
  247. {
  248. return CardEffectCommons.CanActivateOnDeletion(card, activateClass) &&
  249. card.Owner.TrashCards.Count(CardSelectCondition) >= 3;
  250. }
  251. bool CardSelectCondition(CardSource cardSource)
  252. {
  253. return cardSource.EqualsTraits("Composite") ||
  254. cardSource.EqualsTraits("Wicked God") ||
  255. cardSource.HasDMTraits;
  256. }
  257. bool CardSelectCondition1(CardSource cardSource)
  258. {
  259. return cardSource.IsDigimon &&
  260. cardSource.HasLevel &&
  261. cardSource.Level <= 6 &&
  262. (cardSource.EqualsTraits("Composite") ||
  263. cardSource.EqualsTraits("Ver.3") ||
  264. cardSource.EqualsTraits("Ver.5"));
  265. }
  266. bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource cardSource)
  267. {
  268. List<int> cardLevels = new List<int>();
  269. foreach (CardSource cardSource1 in cardSources)
  270. {
  271. if (!cardLevels.Contains(cardSource1.Level))
  272. {
  273. cardLevels.Add(cardSource1.Level);
  274. }
  275. }
  276. if (cardSource.Level_Assembly.Count((level) => cardLevels.Contains(level)) >= 1 || cardLevels.Contains(cardSource.Level))
  277. {
  278. return false;
  279. }
  280. return true;
  281. }
  282. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  283. {
  284. if (card.Owner.TrashCards.Count(CardSelectCondition) >= 3)
  285. {
  286. List<CardSource> selectedCards = new List<CardSource>();
  287. int maxCount = Math.Min(3, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, CardSelectCondition));
  288. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  289. selectCardEffect.SetUp(
  290. canTargetCondition: CardSelectCondition,
  291. canTargetCondition_ByPreSelecetedList: null,
  292. canEndSelectCondition: null,
  293. canNoSelect: () => true,
  294. selectCardCoroutine: SelectCardCoroutine,
  295. afterSelectCardCoroutine: null,
  296. message: "3 [Composite]/[Wicked God]/[DM] Trait Digimon cards",
  297. maxCount: maxCount,
  298. canEndNotMax: false,
  299. isShowOpponent: true,
  300. mode: SelectCardEffect.Mode.Custom,
  301. root: SelectCardEffect.Root.Trash,
  302. customRootCardList: null,
  303. canLookReverseCard: true,
  304. selectPlayer: card.Owner,
  305. cardEffect: activateClass);
  306. IEnumerator SelectCardCoroutine(CardSource cardSource)
  307. {
  308. selectedCards.Add(cardSource);
  309. yield return null;
  310. }
  311. selectCardEffect.SetUpCustomMessage("Select 3 [Composite]/[Wicked God]/[DM] Trait Digimon cards to bottom deck", "Your opponent is selecting 3 Digimon cards to bottom deck");
  312. selectCardEffect.SetUpCustomMessage_ShowCard("Selected Cards");
  313. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  314. if (selectedCards.Count == 3)
  315. {
  316. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ReturnRevealedCardsToLibraryBottom(
  317. remainingCards: selectedCards,
  318. activateClass: activateClass));
  319. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CardSelectCondition1)){
  320. List<CardSource> selectedCards1 = new List<CardSource>();
  321. int maxCount1 = Math.Min(2, card.Owner.TrashCards.Filter(CardSelectCondition1).Map(cardSource => cardSource.Level).Distinct().Count());
  322. SelectCardEffect selectCardEffect1 = GManager.instance.GetComponent<SelectCardEffect>();
  323. selectCardEffect1.SetUp(
  324. canTargetCondition: CardSelectCondition1,
  325. canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
  326. canEndSelectCondition: null,
  327. canNoSelect: () => true,
  328. selectCardCoroutine: SelectCardCoroutine1,
  329. afterSelectCardCoroutine: null,
  330. message: "2 [Composite]/[Ver.3]/[Ver.5] Trait Digimon cards with different levels",
  331. maxCount: maxCount1,
  332. canEndNotMax: false,
  333. isShowOpponent: true,
  334. mode: SelectCardEffect.Mode.Custom,
  335. root: SelectCardEffect.Root.Trash,
  336. customRootCardList: null,
  337. canLookReverseCard: true,
  338. selectPlayer: card.Owner,
  339. cardEffect: activateClass);
  340. IEnumerator SelectCardCoroutine1(CardSource cardSource)
  341. {
  342. selectedCards1.Add(cardSource);
  343. yield return null;
  344. }
  345. selectCardEffect1.SetUpCustomMessage("Select 2 [Composite]/[Ver.3]/[Ver.5] Trait Digimon cards to play", "Your opponent is selecting 2 Digimon cards to play");
  346. selectCardEffect1.SetUpCustomMessage_ShowCard("Selected Cards");
  347. yield return ContinuousController.instance.StartCoroutine(selectCardEffect1.Activate());
  348. if (selectedCards1.Count() > 0)
  349. {
  350. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  351. cardSources: selectedCards1,
  352. activateClass: activateClass,
  353. payCost: false,
  354. isTapped: false,
  355. root: SelectCardEffect.Root.Trash,
  356. activateETB: true));
  357. }
  358. }
  359. }
  360. }
  361. }
  362. }
  363. #endregion
  364. return cardEffects;
  365. }
  366. }
  367. }