CardEffectCommons.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. using UnityEngine;
  6. using UnityEditor;
  7. public partial class CardEffectCommons
  8. {
  9. #region Play cards as new permanents
  10. public static IEnumerator PlayPermanentCards(List<CardSource> cardSources, ICardEffect activateClass, bool payCost, bool isTapped, SelectCardEffect.Root root, bool activateETB, bool isBreedingArea = false)
  11. {
  12. if (cardSources == null) yield break;
  13. cardSources = cardSources
  14. .Filter(cardSource => cardSource != null)
  15. .Filter(cardSource => CanPlayAsNewPermanent(
  16. cardSource: cardSource,
  17. payCost: payCost,
  18. cardEffect: activateClass,
  19. isBreedingArea: isBreedingArea));
  20. if (cardSources.Count == 0) yield break;
  21. PlayCardClass playCardClass = new PlayCardClass(
  22. cardSources: cardSources,
  23. hashtable: CardEffectHashtable(activateClass),
  24. payCost: payCost,
  25. targetPermanent: null,
  26. isTapped: isTapped,
  27. root: root,
  28. activateETB: activateETB);
  29. if (isBreedingArea)
  30. {
  31. playCardClass.SetIsBreedingArea();
  32. }
  33. yield return ContinuousController.instance.StartCoroutine(playCardClass.PlayCard());
  34. }
  35. #endregion
  36. #region Play option cards
  37. public static IEnumerator PlayOptionCards(List<CardSource> cardSources, ICardEffect activateClass, bool payCost, SelectCardEffect.Root root,
  38. bool setAddSecurityEndOption = false)
  39. {
  40. if (cardSources == null) yield break;
  41. cardSources = cardSources
  42. .Filter(cardSource => cardSource != null)
  43. .Filter(cardSource => !cardSource.CanNotPlayThisOption);
  44. if (cardSources.Count == 0) yield break;
  45. PlayCardClass playCard = new PlayCardClass(
  46. cardSources: cardSources,
  47. hashtable: CardEffectHashtable(activateClass),
  48. payCost: payCost,
  49. targetPermanent: null,
  50. isTapped: false,
  51. root: root,
  52. activateETB: true);
  53. if (activateClass != null)
  54. {
  55. playCard.SetShowEffect();
  56. }
  57. if (setAddSecurityEndOption)
  58. {
  59. playCard.SetAddSecurityEndOption();
  60. }
  61. yield return ContinuousController.instance.StartCoroutine(playCard.PlayCard());
  62. }
  63. #endregion
  64. #region Play Delay Option cards as new permanents
  65. public static IEnumerator PlaceDelayOptionCards(CardSource card, ICardEffect cardEffect, SelectCardEffect.Root root = SelectCardEffect.Root.Execution)
  66. {
  67. if (CanPlayAsNewPermanent(cardSource: card, payCost: false, cardEffect: cardEffect, isPlayOption: true))
  68. {
  69. PlayPermanentClass playPermanent = new PlayPermanentClass(
  70. cardSources: new List<CardSource>() { card },
  71. hashtable: CardEffectHashtable(cardEffect),
  72. targetPermanent: null,
  73. isTapped: false,
  74. root: root,
  75. ActivateETB: true);
  76. playPermanent.SetISPlayOption();
  77. yield return ContinuousController.instance.StartCoroutine(playPermanent.PlayPermanent());
  78. if (IsExistOnBattleArea(card))
  79. {
  80. card.PermanentOfThisCard().IsPlayedOptionPermanent = true;
  81. }
  82. }
  83. }
  84. #endregion
  85. #region Play 1 Token
  86. public static IEnumerator PlayToken(CEntity_Base tokenData, ICardEffect activateClass, bool isOwnerPermanent, bool isTapped)
  87. {
  88. if (activateClass == null) yield break;
  89. if (activateClass.EffectSourceCard == null) yield break;
  90. if (tokenData == null) yield break;
  91. CardSource card = activateClass.EffectSourceCard;
  92. Player player = isOwnerPermanent ? card.Owner : card.Owner.Enemy;
  93. if (card.Owner.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()) >= 1)
  94. {
  95. CardSource tokenCard = CardObjectController.CreateCardSource(
  96. player.PlayerID,
  97. tokenData,
  98. true);
  99. if (CanPlayAsNewPermanent(cardSource: tokenCard, payCost: false, cardEffect: activateClass))
  100. {
  101. yield return ContinuousController.instance.StartCoroutine(new PlayCardClass(
  102. cardSources: new List<CardSource>() { tokenCard },
  103. hashtable: CardEffectHashtable(activateClass),
  104. payCost: false,
  105. targetPermanent: null,
  106. isTapped: isTapped,
  107. root: SelectCardEffect.Root.None,
  108. activateETB: true).PlayCard());
  109. }
  110. }
  111. }
  112. #endregion
  113. #region Play 1 [Diaboromon] Token
  114. public static IEnumerator PlayDiaboromonToken(ICardEffect activateClass)
  115. {
  116. yield return ContinuousController.instance.StartCoroutine(PlayToken(
  117. tokenData: ContinuousController.instance.DiaboromonToken,
  118. activateClass: activateClass,
  119. isOwnerPermanent: true,
  120. isTapped: false
  121. ));
  122. }
  123. #endregion
  124. #region Play 1 [Amon of Crimson Flame] Token
  125. public static IEnumerator PlayAmonToken(ICardEffect activateClass)
  126. {
  127. yield return ContinuousController.instance.StartCoroutine(PlayToken(
  128. tokenData: ContinuousController.instance.AmonToken,
  129. activateClass: activateClass,
  130. isOwnerPermanent: true,
  131. isTapped: false
  132. ));
  133. }
  134. #endregion
  135. #region Play 1 [Umon of Blue Thunder] Token
  136. public static IEnumerator PlayUmonToken(ICardEffect activateClass)
  137. {
  138. yield return ContinuousController.instance.StartCoroutine(PlayToken(
  139. tokenData: ContinuousController.instance.UmonToken,
  140. activateClass: activateClass,
  141. isOwnerPermanent: true,
  142. isTapped: false
  143. ));
  144. }
  145. #endregion
  146. #region Play 1 [Fujitsumon] Token
  147. public static IEnumerator PlayFujitsumonToken(ICardEffect activateClass, bool isOwnerPermanent)
  148. {
  149. yield return ContinuousController.instance.StartCoroutine(PlayToken(
  150. tokenData: ContinuousController.instance.FujitsumonToken,
  151. activateClass: activateClass,
  152. isOwnerPermanent: isOwnerPermanent,
  153. isTapped: true
  154. ));
  155. }
  156. #endregion
  157. #region Play 1 [Gyuukimon] Token
  158. public static IEnumerator PlayGyuukimonToken(ICardEffect activateClass)
  159. {
  160. yield return ContinuousController.instance.StartCoroutine(PlayToken(
  161. tokenData: ContinuousController.instance.GyuukimonToken,
  162. activateClass: activateClass,
  163. isOwnerPermanent: true,
  164. isTapped: false
  165. ));
  166. }
  167. #endregion
  168. #region Security effect of "add this card to hand"
  169. public static IEnumerator AddThisCardToHand(CardSource card1, ICardEffect activateClass)
  170. {
  171. yield return new WaitForSeconds(0.5f);
  172. yield return ContinuousController.instance.StartCoroutine(card1.Owner.brainStormObject.CloseBrainstrorm(card1));
  173. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { card1 }, false, activateClass));
  174. }
  175. #endregion
  176. #region Delete target permanents, and the effect determines whether the permanent has been deleted or not
  177. public static IEnumerator DeletePeremanentAndProcessAccordingToResult(List<Permanent> targetPermanents, ICardEffect activateClass, Func<List<Permanent>, IEnumerator> successProcess, Func<IEnumerator> failureProcess)
  178. {
  179. DestroyPermanentsClass destroyPermanentsClass = new DestroyPermanentsClass(targetPermanents, CardEffectHashtable(activateClass));
  180. yield return ContinuousController.instance.StartCoroutine(destroyPermanentsClass.Destroy());
  181. if (targetPermanents.Some((permanent) => destroyPermanentsClass.IsDestroyed(permanent)))
  182. {
  183. if (successProcess != null)
  184. {
  185. yield return ContinuousController.instance.StartCoroutine(successProcess(destroyPermanentsClass.DestroyedPermanents));
  186. }
  187. }
  188. else
  189. {
  190. if (failureProcess != null)
  191. {
  192. yield return ContinuousController.instance.StartCoroutine(failureProcess());
  193. }
  194. }
  195. }
  196. #endregion
  197. #region Bounce target 1 permanent, and the effect determines whether the permanent has been bounced or not
  198. public static IEnumerator BouncePeremanentAndProcessAccordingToResult(List<Permanent> targetPermanents, ICardEffect activateClass, IEnumerator successProcess, IEnumerator failureProcess)
  199. {
  200. HandBounceClaass bouncePermanentClass = new HandBounceClaass(targetPermanents, CardEffectHashtable(activateClass));
  201. yield return ContinuousController.instance.StartCoroutine(bouncePermanentClass.Bounce());
  202. if (targetPermanents.Some((permanent) => bouncePermanentClass.IsBounced(permanent)))
  203. {
  204. if (successProcess != null)
  205. {
  206. yield return ContinuousController.instance.StartCoroutine(successProcess);
  207. }
  208. }
  209. else
  210. {
  211. if (failureProcess != null)
  212. {
  213. yield return ContinuousController.instance.StartCoroutine(failureProcess);
  214. }
  215. }
  216. }
  217. #endregion
  218. #region Deck Bounce target 1 permanent, and the effect determines whether the permanent has been bounced or not
  219. public static IEnumerator DeckBouncePeremanentAndProcessAccordingToResult(List<Permanent> targetPermanents, ICardEffect activateClass, IEnumerator successProcess, IEnumerator failureProcess)
  220. {
  221. DeckBottomBounceClass deckBounceClass = new DeckBottomBounceClass(targetPermanents, CardEffectHashtable(activateClass));
  222. yield return ContinuousController.instance.StartCoroutine(deckBounceClass.DeckBounce());
  223. if (targetPermanents.Some((permanent) => deckBounceClass.IsDeckBounced(permanent)))
  224. {
  225. if (successProcess != null)
  226. {
  227. yield return ContinuousController.instance.StartCoroutine(successProcess);
  228. }
  229. }
  230. else
  231. {
  232. if (failureProcess != null)
  233. {
  234. yield return ContinuousController.instance.StartCoroutine(failureProcess);
  235. }
  236. }
  237. }
  238. #endregion
  239. #region Trash digivolution cards from top or bottom
  240. public static IEnumerator TrashDigivolutionCardsFromTopOrBottom(Permanent targetPermanent, int trashCount, bool isFromTop, ICardEffect activateClass)
  241. {
  242. if (activateClass == null) yield break;
  243. if (targetPermanent == null) yield break;
  244. if (targetPermanent.TopCard == null) yield break;
  245. if (targetPermanent.DigivolutionCards.Count((cardSource) => !cardSource.CanNotTrashFromDigivolutionCards(activateClass)) == 0) yield break;
  246. if (targetPermanent.TopCard.CanNotBeAffected(activateClass)) yield break;
  247. if (trashCount <= 0) yield break;
  248. List<CardSource> trashTargetCards = new List<CardSource>();
  249. for (int i = 0; i < trashCount; i++)
  250. {
  251. if (targetPermanent.DigivolutionCards.Count >= i + 1)
  252. {
  253. int index = isFromTop ? i : targetPermanent.DigivolutionCards.Count - 1 - i;
  254. CardSource trashTargetCard = targetPermanent.DigivolutionCards[index];
  255. trashTargetCards.Add(trashTargetCard);
  256. }
  257. }
  258. yield return ContinuousController.instance.StartCoroutine(new ITrashDigivolutionCards(targetPermanent, trashTargetCards, activateClass).TrashDigivolutionCards());
  259. }
  260. #endregion
  261. #region this Option card's Main effect
  262. public static ActivateClass OptionMainEffect(CardSource card) => card.EffectList(EffectTiming.OptionSkill).Find(cardEffect => cardEffect != null && cardEffect is ActivateClass && cardEffect.EffectDiscription.Contains("[Main]")) as ActivateClass;
  263. #endregion
  264. #region Add Option's Security effect that "Activate this card's Main effect" to cardEffects
  265. public static void AddActivateMainOptionSecurityEffect(CardSource card, ref List<ICardEffect> cardEffects, string effectName, string effectDiscription = "", Func<ICardEffect, IEnumerator> afterMainEffect = null)
  266. {
  267. if (OptionMainEffect(card) == null) return;
  268. cardEffects.Add(CardEffectFactory.ActivateMainOptionSecurityEffect(card, effectName, effectDiscription, afterMainEffect));
  269. }
  270. #endregion
  271. #region Target permanent Digivolves into Digimon card from hand or trash
  272. public static IEnumerator DigivolveIntoHandOrTrashCard(
  273. Permanent targetPermanent,
  274. Func<CardSource, bool> cardCondition,
  275. bool payCost,
  276. (int reduceCost, Func<CardSource, bool> reduceCostCardCondition)? reduceCostTuple,
  277. (int fixedCost, Func<CardSource, bool> fixedCostCardCondition)? fixedCostTuple,
  278. int ignoreDigivolutionRequirementFixedCost,
  279. bool isHand,
  280. ICardEffect activateClass,
  281. IEnumerator successProcess,
  282. bool ignoreLevel = false,
  283. bool ignoreSelection = false)
  284. {
  285. if (targetPermanent == null) yield break;
  286. if (targetPermanent.TopCard == null) yield break;
  287. if (activateClass == null) yield break;
  288. if (activateClass.EffectSourceCard == null) yield break;
  289. Player owner = targetPermanent.TopCard.Owner;
  290. SelectCardEffect.Root root = isHand ? SelectCardEffect.Root.Hand : SelectCardEffect.Root.Trash;
  291. bool ignoreDigivolutionRequirement = ignoreDigivolutionRequirementFixedCost >= 0;
  292. int fixedCost = -1;
  293. if (fixedCostTuple != null)
  294. {
  295. fixedCost = fixedCostTuple.Value.fixedCost;
  296. }
  297. if (ignoreDigivolutionRequirement)
  298. {
  299. fixedCost = ignoreDigivolutionRequirementFixedCost;
  300. }
  301. bool CanSelectCardCondition(CardSource cardSource)
  302. {
  303. if (cardSource.IsDigimon)
  304. {
  305. if (cardCondition == null || cardCondition(cardSource))
  306. {
  307. if (!cardSource.CanNotEvolve(targetPermanent))
  308. {
  309. if (ignoreLevel
  310. || cardSource.CanPlayCardTargetFrame(
  311. frame: targetPermanent.PermanentFrame,
  312. PayCost: payCost,
  313. cardEffect: activateClass,
  314. root: root,
  315. fixedCost: fixedCost))
  316. {
  317. return true;
  318. }
  319. }
  320. }
  321. }
  322. return false;
  323. }
  324. #region reduce cost
  325. Func<EffectTiming, ICardEffect> getChangeCostEffect = null;
  326. if (reduceCostTuple != null)
  327. {
  328. bool PermanentCondition(Permanent permanent)
  329. {
  330. return permanent == targetPermanent;
  331. }
  332. bool CardCondition(CardSource cardSource)
  333. {
  334. if (cardSource != null)
  335. {
  336. if (cardSource.Owner == owner)
  337. {
  338. if (reduceCostTuple.Value.reduceCostCardCondition == null || reduceCostTuple.Value.reduceCostCardCondition(cardSource))
  339. {
  340. return true;
  341. }
  342. }
  343. }
  344. return false;
  345. }
  346. getChangeCostEffect = ChangeDigivolutionCostPlayerEffect(
  347. permanentCondition: PermanentCondition,
  348. cardCondition: CardCondition,
  349. rootCondition: null,
  350. changeValue: -reduceCostTuple.Value.reduceCost,
  351. activateClass: activateClass,
  352. setFixedCost: false);
  353. if (getChangeCostEffect != null)
  354. {
  355. AddEffectToPlayer(
  356. effectDuration: EffectDuration.UntilCalculateFixedCost,
  357. card: targetPermanent.TopCard,
  358. cardEffect: null,
  359. timing: EffectTiming.None,
  360. getCardEffect: getChangeCostEffect);
  361. }
  362. }
  363. #endregion
  364. #region set fixed cost
  365. Func<EffectTiming, ICardEffect> getFixedCostEffect = null;
  366. if (fixedCostTuple != null)
  367. {
  368. bool PermanentCondition(Permanent permanent)
  369. {
  370. return permanent == targetPermanent;
  371. }
  372. bool CardCondition(CardSource cardSource)
  373. {
  374. if (cardSource != null)
  375. {
  376. if (cardSource.Owner == owner)
  377. {
  378. if (fixedCostTuple.Value.fixedCostCardCondition == null || fixedCostTuple.Value.fixedCostCardCondition(cardSource))
  379. {
  380. return true;
  381. }
  382. }
  383. }
  384. return false;
  385. }
  386. getFixedCostEffect = ChangeDigivolutionCostPlayerEffect(
  387. permanentCondition: PermanentCondition,
  388. cardCondition: CardCondition,
  389. rootCondition: null,
  390. changeValue: fixedCost,
  391. activateClass: activateClass,
  392. setFixedCost: true);
  393. if (getChangeCostEffect != null)
  394. {
  395. AddEffectToPlayer(
  396. effectDuration: EffectDuration.UntilCalculateFixedCost,
  397. card: targetPermanent.TopCard,
  398. cardEffect: null,
  399. timing: EffectTiming.None,
  400. getCardEffect: getFixedCostEffect);
  401. }
  402. }
  403. #endregion
  404. #region ignore digivolution requirement
  405. Func<EffectTiming, ICardEffect> getIgnoreDigivolutionRequirementEffect = null;
  406. if (ignoreDigivolutionRequirement)
  407. {
  408. bool PermanentCondition(Permanent permanent)
  409. {
  410. return permanent == targetPermanent;
  411. }
  412. bool CardCondition(CardSource cardSource)
  413. {
  414. if (cardSource == null)
  415. {
  416. return false;
  417. }
  418. if (cardSource.Owner != owner)
  419. {
  420. return false;
  421. }
  422. if (cardCondition == null || cardCondition(cardSource))
  423. {
  424. return true;
  425. }
  426. return false;
  427. }
  428. getIgnoreDigivolutionRequirementEffect = GainIgnoreDigivolutionRequirementPlayerEffect(
  429. permanentCondition: PermanentCondition,
  430. cardCondition: CardCondition,
  431. ignoreDigivolutionRequirement: ignoreDigivolutionRequirement,
  432. digivolutionCost: fixedCost,
  433. activateClass: activateClass);
  434. if (getIgnoreDigivolutionRequirementEffect != null)
  435. {
  436. AddEffectToPlayer(
  437. effectDuration: EffectDuration.UntilCalculateFixedCost,
  438. card: targetPermanent.TopCard,
  439. cardEffect: null,
  440. timing: EffectTiming.None,
  441. getCardEffect: getIgnoreDigivolutionRequirementEffect);
  442. }
  443. }
  444. #endregion
  445. List<CardSource> selectedCards = new List<CardSource>();
  446. IEnumerator SelectCardCoroutine(CardSource cardSource)
  447. {
  448. selectedCards.Add(cardSource);
  449. yield return null;
  450. }
  451. if (isHand)
  452. {
  453. if (owner.HandCards.Count(CanSelectCardCondition) >= 1)
  454. {
  455. int maxCount = 1;
  456. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  457. selectHandEffect.SetUp(
  458. selectPlayer: owner,
  459. canTargetCondition: CanSelectCardCondition,
  460. canTargetCondition_ByPreSelecetedList: null,
  461. canEndSelectCondition: null,
  462. maxCount: maxCount,
  463. canNoSelect: true,
  464. canEndNotMax: false,
  465. isShowOpponent: true,
  466. selectCardCoroutine: SelectCardCoroutine,
  467. afterSelectCardCoroutine: null,
  468. mode: SelectHandEffect.Mode.Custom,
  469. cardEffect: activateClass);
  470. selectHandEffect.SetUpCustomMessage("Select 1 card to digivolve.", "The opponent is selecting 1 card to digivolve.");
  471. selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
  472. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  473. }
  474. }
  475. else
  476. {
  477. if (HasMatchConditionOwnersCardInTrash(targetPermanent.TopCard, CanSelectCardCondition) && !ignoreSelection)
  478. {
  479. int maxCount = 1;
  480. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  481. selectCardEffect.SetUp(
  482. canTargetCondition: CanSelectCardCondition,
  483. canTargetCondition_ByPreSelecetedList: null,
  484. canEndSelectCondition: null,
  485. canNoSelect: () => true,
  486. selectCardCoroutine: SelectCardCoroutine,
  487. afterSelectCardCoroutine: null,
  488. message: "Select 1 card to digivolve.",
  489. maxCount: maxCount,
  490. canEndNotMax: false,
  491. isShowOpponent: true,
  492. mode: SelectCardEffect.Mode.Custom,
  493. root: SelectCardEffect.Root.Trash,
  494. customRootCardList: null,
  495. canLookReverseCard: true,
  496. selectPlayer: owner,
  497. cardEffect: activateClass);
  498. selectCardEffect.SetUpCustomMessage("Select 1 card to digivolve.", "The opponent is selecting 1 card to digivolve.");
  499. selectCardEffect.SetUpCustomMessage_ShowCard("Selected Card");
  500. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  501. }
  502. else
  503. {
  504. selectedCards.Add(activateClass.EffectSourceCard);
  505. }
  506. }
  507. PlayCardClass playCardClass = new PlayCardClass(
  508. cardSources: selectedCards,
  509. hashtable: CardEffectHashtable(activateClass),
  510. payCost: payCost,
  511. targetPermanent: targetPermanent,
  512. isTapped: false,
  513. root: root,
  514. activateETB: true);
  515. if (ignoreLevel) playCardClass.SetIgnoreLevel();
  516. if (!ignoreDigivolutionRequirement && fixedCost >= 0) playCardClass.SetFixedCost(fixedCost);
  517. yield return ContinuousController.instance.StartCoroutine(playCardClass.PlayCard());
  518. #region release effect
  519. if (getChangeCostEffect != null) owner.UntilCalculateFixedCostEffect.Remove(getChangeCostEffect);
  520. #endregion
  521. #region release effect
  522. if (getFixedCostEffect != null) owner.UntilCalculateFixedCostEffect.Remove(getFixedCostEffect);
  523. #endregion
  524. #region release effect
  525. if (getIgnoreDigivolutionRequirementEffect != null) owner.UntilCalculateFixedCostEffect.Remove(getIgnoreDigivolutionRequirementEffect);
  526. #endregion
  527. if (selectedCards.Count >= 1)
  528. {
  529. if (IsDigivolvedByTheEffect(targetPermanent, selectedCards[0], activateClass))
  530. {
  531. if (successProcess != null)
  532. {
  533. yield return ContinuousController.instance.StartCoroutine(successProcess);
  534. }
  535. }
  536. }
  537. }
  538. #endregion
  539. #region Get the effect given by EffectTiming
  540. public static Func<EffectTiming, ICardEffect> GetCardEffectByEffectTiming(EffectTiming timing, ICardEffect cardEffect) => (_timing) => _timing == timing ? cardEffect : null;
  541. #endregion
  542. }