EX10_061.cs 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. using System.Diagnostics;
  6. namespace DCGO.CardEffects.EX10
  7. {
  8. public class EX10_061 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Digivolution Requirements
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.HasDarkMastersTrait &&
  19. targetPermanent.TopCard.IsLevel6;
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 5, ignoreDigivolutionRequirement: false, card: card, condition: null));
  22. }
  23. #endregion
  24. #region Cost Reduction
  25. #region Before Pay Cost - Condition Effect
  26. if (timing == EffectTiming.BeforePayCost)
  27. {
  28. ActivateClass activateClass = new ActivateClass();
  29. activateClass.SetUpICardEffect("Placing 1 [Dark Masters] to get Play Cost -4", CanUseCondition, card);
  30. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  31. activateClass.SetHashString("PlayCost-_EX10-061");
  32. cardEffects.Add(activateClass);
  33. string EffectDiscription()
  34. {
  35. return "When this card would be played, by placing 1 of each face-up [Dark Masters] trait card with different names from your security stack under this card, reduce the play cost by 4 for each card placed.";
  36. }
  37. bool CanSelectCardCondition(CardSource cardSource)
  38. {
  39. return cardSource.IsDigimon &&
  40. !cardSource.IsFlipped &&
  41. cardSource.HasDarkMastersTrait;
  42. }
  43. bool CardCondition(CardSource cardSource)
  44. {
  45. return cardSource == card;
  46. }
  47. bool CanNoSelect(CardSource cardSource)
  48. {
  49. if (cardSource != null)
  50. {
  51. if (cardSource.PayingCost(SelectCardEffect.Root.Hand, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost)
  52. {
  53. return false;
  54. }
  55. if (cardSource.PayingCost(SelectCardEffect.Root.Trash, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost)
  56. {
  57. return false;
  58. }
  59. if (cardSource.PayingCost(SelectCardEffect.Root.DigivolutionCards, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost)
  60. {
  61. return false;
  62. }
  63. if (cardSource.PayingCost(SelectCardEffect.Root.Security, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost)
  64. {
  65. return false;
  66. }
  67. if (cardSource.PayingCost(SelectCardEffect.Root.Library, null, checkAvailability: false) > cardSource.Owner.MaxMemoryCost)
  68. {
  69. return false;
  70. }
  71. }
  72. return true;
  73. }
  74. bool CanUseCondition(Hashtable hashtable)
  75. {
  76. return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, CardCondition);
  77. }
  78. bool CanActivateCondition(Hashtable hashtable)
  79. {
  80. return CardEffectCommons.HasMatchConditionOwnersSecurity(card, CanSelectCardCondition, false);
  81. }
  82. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  83. {
  84. List<CardSource> digivolutionCards = new List<CardSource>();
  85. bool CanSelectSecurityCardCondition(CardSource cardSource)
  86. {
  87. if (CanSelectCardCondition(cardSource))
  88. {
  89. if (digivolutionCards.Count((filteredCard) => filteredCard.CardNames.Contains(cardSource.CardNames[0])) == 0)
  90. {
  91. return true;
  92. }
  93. }
  94. return false;
  95. }
  96. if (CardEffectCommons.HasMatchConditionOwnersSecurity(card, CanSelectSecurityCardCondition, false))
  97. {
  98. bool noSelect = CanNoSelect(CardEffectCommons.GetCardFromHashtable(_hashtable));
  99. List<CardSource> selectedCards = new List<CardSource>();
  100. List<string> cardNames = card.Owner.SecurityCards.Filter(CanSelectSecurityCardCondition)
  101. .Map(cardSource1 => cardSource1.CardNames)
  102. .Flat()
  103. .Distinct()
  104. .ToList();
  105. int maxCount = Math.Min(4, cardNames.Count);
  106. if (maxCount >= 1)
  107. {
  108. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  109. selectCardEffect.SetUp(
  110. canTargetCondition: CanSelectSecurityCardCondition,
  111. canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
  112. canEndSelectCondition: CanEndSelectCondition,
  113. canNoSelect: () => noSelect,
  114. selectCardCoroutine: SelectCardCoroutine,
  115. afterSelectCardCoroutine: null,
  116. message: "Select cards to place in Digivolution cards.",
  117. maxCount: maxCount,
  118. canEndNotMax: false,
  119. isShowOpponent: true,
  120. mode: SelectCardEffect.Mode.Custom,
  121. root: SelectCardEffect.Root.Security,
  122. customRootCardList: null,
  123. canLookReverseCard: false,
  124. selectPlayer: card.Owner,
  125. cardEffect: activateClass);
  126. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  127. bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource cardSource)
  128. {
  129. List<string> cardNames = new List<string>();
  130. foreach (CardSource cardSource1 in cardSources)
  131. {
  132. if (!cardNames.Contains(cardSource1.CardNames[0]))
  133. {
  134. cardNames.Add(cardSource1.CardNames[0]);
  135. }
  136. }
  137. foreach (CardSource cardSource1 in digivolutionCards)
  138. {
  139. if (!cardNames.Contains(cardSource1.CardNames[0]))
  140. {
  141. cardNames.Add(cardSource1.CardNames[0]);
  142. }
  143. }
  144. if (cardNames.Contains(cardSource.CardNames[0]))
  145. {
  146. return false;
  147. }
  148. return true;
  149. }
  150. bool CanEndSelectCondition(List<CardSource> cardSources)
  151. {
  152. List<string> cardNames = new List<string>();
  153. foreach (CardSource cardSource1 in cardSources)
  154. {
  155. if (!cardNames.Contains(cardSource1.CardNames[0]))
  156. {
  157. cardNames.Add(cardSource1.CardNames[0]);
  158. }
  159. }
  160. foreach (CardSource cardSource1 in digivolutionCards)
  161. {
  162. if (!cardNames.Contains(cardSource1.CardNames[0]))
  163. {
  164. cardNames.Add(cardSource1.CardNames[0]);
  165. }
  166. }
  167. if (cardNames.Count != cardSources.Count + digivolutionCards.Count)
  168. {
  169. return false;
  170. }
  171. return true;
  172. }
  173. IEnumerator SelectCardCoroutine(CardSource cardSource)
  174. {
  175. selectedCards.Add(cardSource);
  176. digivolutionCards.Add(cardSource);
  177. yield return null;
  178. }
  179. if (selectedCards.Count >= 1)
  180. {
  181. GManager.instance.GetComponent<SelectDigiXrosClass>().AddDigivolutionCardInfos(new AddDigivolutionCardsInfo(activateClass, selectedCards));
  182. yield return ContinuousController.instance.StartCoroutine(AfterSelectCardCoroutine(selectedCards));
  183. }
  184. }
  185. }
  186. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  187. {
  188. if (card.Owner.CanReduceCost(null, card))
  189. {
  190. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  191. }
  192. ChangeCostClass changeCostClass = new ChangeCostClass();
  193. changeCostClass.SetUpICardEffect("Play Cost -4", CanUseCondition1, card);
  194. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  195. card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
  196. bool CanUseCondition1(Hashtable hashtable)
  197. {
  198. return true;
  199. }
  200. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  201. {
  202. if (CardSourceCondition(cardSource))
  203. {
  204. if (RootCondition(root))
  205. {
  206. if (PermanentsCondition(targetPermanents))
  207. {
  208. Cost -= cardSources.Count * 4;
  209. }
  210. }
  211. }
  212. return Cost;
  213. }
  214. bool PermanentsCondition(List<Permanent> targetPermanents)
  215. {
  216. if (targetPermanents == null)
  217. {
  218. return true;
  219. }
  220. else
  221. {
  222. if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
  223. {
  224. return true;
  225. }
  226. }
  227. return false;
  228. }
  229. bool CardSourceCondition(CardSource cardSource)
  230. {
  231. return cardSource == card;
  232. }
  233. bool RootCondition(SelectCardEffect.Root root)
  234. {
  235. return true;
  236. }
  237. bool isUpDown()
  238. {
  239. return true;
  240. }
  241. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
  242. yield return null;
  243. }
  244. }
  245. }
  246. #endregion
  247. #region Reduce Play Cost - Not Shown
  248. if (timing == EffectTiming.None)
  249. {
  250. ChangeCostClass changeCostClass = new ChangeCostClass();
  251. changeCostClass.SetUpICardEffect("Play Cost -4", CanUseCondition, card);
  252. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true);
  253. changeCostClass.SetNotShowUI(true);
  254. cardEffects.Add(changeCostClass);
  255. bool CanSelectCardCondition(CardSource cardSource)
  256. {
  257. return cardSource.IsDigimon &&
  258. !cardSource.IsFlipped &&
  259. cardSource.EqualsTraits("Dark Masters");
  260. }
  261. bool CanUseCondition(Hashtable hashtable)
  262. {
  263. ICardEffect activateClass = card.EffectList(EffectTiming.BeforePayCost).Find(cardEffect => cardEffect.EffectName == "Placing 1 [Dark Masters] to get Play Cost -4");
  264. if (activateClass != null)
  265. {
  266. return CardEffectCommons.HasMatchConditionOwnersSecurity(card, CanSelectCardCondition, false);
  267. }
  268. return false;
  269. }
  270. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  271. {
  272. if (CardSourceCondition(cardSource))
  273. {
  274. if (RootCondition(root))
  275. {
  276. if (PermanentsCondition(targetPermanents))
  277. {
  278. List<CardSource> securitySources = card.Owner.SecurityCards.Filter(CanSelectCardCondition);
  279. int targetCount = (from securityCard in securitySources select securityCard.CardNames).Distinct().Count();
  280. Cost -= targetCount * 4;
  281. }
  282. }
  283. }
  284. return Cost;
  285. }
  286. bool PermanentsCondition(List<Permanent> targetPermanents)
  287. {
  288. if (targetPermanents == null)
  289. {
  290. return true;
  291. }
  292. else
  293. {
  294. if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
  295. {
  296. return true;
  297. }
  298. }
  299. return false;
  300. }
  301. bool CardSourceCondition(CardSource cardSource)
  302. {
  303. if (cardSource != null)
  304. {
  305. if (cardSource == card)
  306. {
  307. return true;
  308. }
  309. }
  310. return false;
  311. }
  312. bool RootCondition(SelectCardEffect.Root root)
  313. {
  314. return true;
  315. }
  316. bool isUpDown()
  317. {
  318. return true;
  319. }
  320. }
  321. #endregion
  322. #endregion
  323. #region On Play
  324. if (timing == EffectTiming.OnEnterFieldAnyone)
  325. {
  326. ActivateClass activateClass = new ActivateClass();
  327. activateClass.SetUpICardEffect("Play 1 [Dark Masters] from sources, give <Rush>, Delete them at end of turn", CanUseCondition, card);
  328. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  329. cardEffects.Add(activateClass);
  330. string EffectDiscription()
  331. {
  332. return "[On Play] You may play 1 of each [Dark Masters] trait card with different names from this Digimon's digivolution cards without paying the costs. Then, all of your [Dark Masters] trait Digimon gain <Rush> for the turn. At turn end, delete the Digimon this effect played.";
  333. }
  334. bool CanUseCondition(Hashtable hashtable)
  335. {
  336. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  337. CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  338. }
  339. bool CanActivateCondition(Hashtable hashtable)
  340. {
  341. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  342. }
  343. bool CanSelectCardCondition(CardSource cardSource)
  344. {
  345. return cardSource.IsDigimon &&
  346. cardSource.EqualsTraits("Dark Masters") &&
  347. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass, root:SelectCardEffect.Root.DigivolutionCards);
  348. }
  349. bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource cardSource)
  350. {
  351. List<string> cardNames = GetNamesList(cardSources);
  352. foreach (string name in cardNames)
  353. {
  354. if (cardSource.CardNames.Contains(name))
  355. return false;
  356. }
  357. return true;
  358. }
  359. List<string> GetNamesList(List<CardSource> cardSources)
  360. {
  361. List<string> cardNames = new List<string>();
  362. foreach (CardSource cardName in cardSources)
  363. {
  364. foreach (string name in cardName.CardNames)
  365. {
  366. if (!cardNames.Contains(name))
  367. {
  368. cardNames.Add(name);
  369. }
  370. }
  371. }
  372. return cardNames;
  373. }
  374. IEnumerator ActivateCoroutine(Hashtable hashtable)
  375. {
  376. Permanent selectedPermanent = card.PermanentOfThisCard();
  377. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  378. {
  379. int maxCount = Math.Min(4, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  380. List<CardSource> selectedCards = new List<CardSource>();
  381. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  382. selectCardEffect.SetUp(
  383. canTargetCondition: CanSelectCardCondition,
  384. canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
  385. canEndSelectCondition: null,
  386. canNoSelect: () => true,
  387. selectCardCoroutine: SelectCardCoroutine,
  388. afterSelectCardCoroutine: null,
  389. message: "Select 1 digivolution card to play.",
  390. maxCount: maxCount,
  391. canEndNotMax: false,
  392. isShowOpponent: true,
  393. mode: SelectCardEffect.Mode.Custom,
  394. root: SelectCardEffect.Root.Custom,
  395. customRootCardList: selectedPermanent.DigivolutionCards,
  396. canLookReverseCard: true,
  397. selectPlayer: card.Owner,
  398. cardEffect: activateClass);
  399. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.", "The opponent is selecting 1 digivolution card to play.");
  400. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  401. yield return StartCoroutine(selectCardEffect.Activate());
  402. IEnumerator SelectCardCoroutine(CardSource cardSource)
  403. {
  404. selectedCards.Add(cardSource);
  405. yield return null;
  406. }
  407. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  408. cardSources: selectedCards,
  409. activateClass: activateClass,
  410. payCost: false,
  411. isTapped: false,
  412. root: SelectCardEffect.Root.DigivolutionCards,
  413. activateETB: true));
  414. bool PermanentCondition(Permanent permanent)
  415. {
  416. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  417. permanent.TopCard.EqualsTraits("Dark Masters");
  418. }
  419. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRushPlayerEffect(
  420. permanentCondition: PermanentCondition,
  421. effectDuration: EffectDuration.UntilEachTurnEnd,
  422. activateClass: activateClass));
  423. #region Delete Digimon Played
  424. foreach (CardSource source in selectedCards)
  425. {
  426. Permanent playedPermanent = source.PermanentOfThisCard();
  427. ActivateClass activateClass1 = new ActivateClass();
  428. activateClass1.SetUpICardEffect($"[{source.BaseENGCardNameFromEntity}] Delete the Digimon", CanUseCondition2, playedPermanent.TopCard);
  429. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  430. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  431. playedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  432. if (!playedPermanent.TopCard.CanNotBeAffected(activateClass))
  433. {
  434. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(playedPermanent));
  435. }
  436. string EffectDiscription1()
  437. {
  438. return "[End of Your Turn] Delete this Digimon.";
  439. }
  440. bool CanUseCondition2(Hashtable hashtable1)
  441. {
  442. if (CardEffectCommons.IsOwnerTurn(card))
  443. {
  444. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(playedPermanent, playedPermanent.TopCard))
  445. {
  446. return true;
  447. }
  448. }
  449. return false;
  450. }
  451. bool CanActivateCondition1(Hashtable hashtable1)
  452. {
  453. if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedPermanent))
  454. {
  455. if (!playedPermanent.TopCard.CanNotBeAffected(activateClass))
  456. {
  457. return true;
  458. }
  459. }
  460. return false;
  461. }
  462. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  463. {
  464. if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedPermanent))
  465. {
  466. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
  467. new List<Permanent>() { playedPermanent },
  468. CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
  469. }
  470. }
  471. ICardEffect GetCardEffect(EffectTiming _timing)
  472. {
  473. if (_timing == EffectTiming.OnEndTurn)
  474. {
  475. return activateClass1;
  476. }
  477. return null;
  478. }
  479. }
  480. #endregion
  481. }
  482. }
  483. }
  484. #endregion
  485. #region When Digivolving
  486. if (timing == EffectTiming.OnEnterFieldAnyone)
  487. {
  488. ActivateClass activateClass = new ActivateClass();
  489. activateClass.SetUpICardEffect("Play 1 [Dark Masters] from sources, give <Rush>, Delete them at end of turn", CanUseCondition, card);
  490. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  491. cardEffects.Add(activateClass);
  492. string EffectDiscription()
  493. {
  494. return "[When Digivolving] You may play 1 of each [Dark Masters] trait card with different names from this Digimon's digivolution cards without paying the costs. Then, all of your [Dark Masters] trait Digimon gain <Rush> for the turn. (This Digimon can attack the turn it comes into play.) At turn end, delete the Digimon this effect played.";
  495. }
  496. bool CanUseCondition(Hashtable hashtable)
  497. {
  498. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  499. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  500. }
  501. bool CanActivateCondition(Hashtable hashtable)
  502. {
  503. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  504. }
  505. bool CanSelectCardCondition(CardSource cardSource)
  506. {
  507. return cardSource.IsDigimon &&
  508. cardSource.EqualsTraits("Dark Masters") &&
  509. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass, root:SelectCardEffect.Root.DigivolutionCards);
  510. }
  511. bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource cardSource)
  512. {
  513. List<string> cardNames = GetNamesList(cardSources);
  514. foreach (string name in cardNames)
  515. {
  516. if (cardSource.CardNames.Contains(name))
  517. return false;
  518. }
  519. return true;
  520. }
  521. List<string> GetNamesList(List<CardSource> cardSources)
  522. {
  523. List<string> cardNames = new List<string>();
  524. foreach (CardSource cardName in cardSources)
  525. {
  526. foreach (string name in cardName.CardNames)
  527. {
  528. if (!cardNames.Contains(name))
  529. {
  530. cardNames.Add(name);
  531. }
  532. }
  533. }
  534. return cardNames;
  535. }
  536. IEnumerator ActivateCoroutine(Hashtable hashtable)
  537. {
  538. Permanent selectedPermanent = card.PermanentOfThisCard();
  539. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  540. {
  541. int maxCount = Math.Min(4, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  542. List<CardSource> selectedCards = new List<CardSource>();
  543. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  544. selectCardEffect.SetUp(
  545. canTargetCondition: CanSelectCardCondition,
  546. canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
  547. canEndSelectCondition: null,
  548. canNoSelect: () => true,
  549. selectCardCoroutine: SelectCardCoroutine,
  550. afterSelectCardCoroutine: null,
  551. message: "Select 1 digivolution card to play.",
  552. maxCount: maxCount,
  553. canEndNotMax: false,
  554. isShowOpponent: true,
  555. mode: SelectCardEffect.Mode.Custom,
  556. root: SelectCardEffect.Root.Custom,
  557. customRootCardList: selectedPermanent.DigivolutionCards,
  558. canLookReverseCard: true,
  559. selectPlayer: card.Owner,
  560. cardEffect: activateClass);
  561. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.", "The opponent is selecting 1 digivolution card to play.");
  562. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  563. yield return StartCoroutine(selectCardEffect.Activate());
  564. IEnumerator SelectCardCoroutine(CardSource cardSource)
  565. {
  566. selectedCards.Add(cardSource);
  567. yield return null;
  568. }
  569. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  570. cardSources: selectedCards,
  571. activateClass: activateClass,
  572. payCost: false,
  573. isTapped: false,
  574. root: SelectCardEffect.Root.DigivolutionCards,
  575. activateETB: true));
  576. bool PermanentCondition(Permanent permanent)
  577. {
  578. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  579. permanent.TopCard.EqualsTraits("Dark Masters");
  580. }
  581. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRushPlayerEffect(
  582. permanentCondition: PermanentCondition,
  583. effectDuration: EffectDuration.UntilEachTurnEnd,
  584. activateClass: activateClass));
  585. #region Delete Digimon Played
  586. foreach (CardSource source in selectedCards)
  587. {
  588. Permanent playedPermanent = source.PermanentOfThisCard();
  589. ActivateClass activateClass1 = new ActivateClass();
  590. activateClass1.SetUpICardEffect("Delete the Digimon", CanUseCondition2, playedPermanent.TopCard);
  591. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  592. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  593. playedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  594. if (!playedPermanent.TopCard.CanNotBeAffected(activateClass))
  595. {
  596. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(playedPermanent));
  597. }
  598. string EffectDiscription1()
  599. {
  600. return "[End of Your Turn] Delete this Digimon.";
  601. }
  602. bool CanUseCondition2(Hashtable hashtable1)
  603. {
  604. if (CardEffectCommons.IsOwnerTurn(card))
  605. {
  606. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(playedPermanent, playedPermanent.TopCard))
  607. {
  608. return true;
  609. }
  610. }
  611. return false;
  612. }
  613. bool CanActivateCondition1(Hashtable hashtable1)
  614. {
  615. if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedPermanent))
  616. {
  617. if (!playedPermanent.TopCard.CanNotBeAffected(activateClass))
  618. {
  619. return true;
  620. }
  621. }
  622. return false;
  623. }
  624. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  625. {
  626. if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedPermanent))
  627. {
  628. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
  629. new List<Permanent>() { playedPermanent },
  630. CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
  631. }
  632. }
  633. ICardEffect GetCardEffect(EffectTiming _timing)
  634. {
  635. if (_timing == EffectTiming.OnEndTurn)
  636. {
  637. return activateClass1;
  638. }
  639. return null;
  640. }
  641. }
  642. #endregion
  643. }
  644. }
  645. }
  646. #endregion
  647. return cardEffects;
  648. }
  649. }
  650. }