BT11_030.cs 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT11
  6. {
  7. public class BT11_030 : 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. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  15. changeCardNamesClass.SetUpICardEffect("Also treated as [MetalGreymon]/[Cyberdramon]", CanUseCondition, card);
  16. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  17. cardEffects.Add(changeCardNamesClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return true;
  21. }
  22. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  23. {
  24. if (cardSource == card)
  25. {
  26. CardNames.Add("MetalGreymon");
  27. CardNames.Add("Cyberdramon");
  28. }
  29. return CardNames;
  30. }
  31. }
  32. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  33. {
  34. cardEffects.Add(CardEffectFactory.ArmorPurgeEffect(card: card));
  35. }
  36. if (timing == EffectTiming.OnEnterFieldAnyone)
  37. {
  38. ActivateClass activateClass = new ActivateClass();
  39. activateClass.SetUpICardEffect("Place 1 card to digivolution cards and return Digimon to the bottom of deck", CanUseCondition, card);
  40. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  41. cardEffects.Add(activateClass);
  42. string EffectDiscription()
  43. {
  44. return "[On Play] You may place 1 Digimon card with [Blue Flare] in its traits from your hand, or from under your Tamers, under this Digimon as its bottom digivolution card. Then, return 1 of your opponent's level 3 Digimon to the bottom of its owner's deck. If [Cyberdramon] is in this Digimon's digivolution cards, return 1 of your opponent's level 4 or lower Digimon to the bottom of its owner's deck.";
  45. }
  46. bool CanSelectCardCondition(CardSource cardSource)
  47. {
  48. if (cardSource.IsDigimon)
  49. {
  50. if (cardSource.CardTraits.Contains("Blue Flare"))
  51. {
  52. return true;
  53. }
  54. if (cardSource.CardTraits.Contains("BlueFlare"))
  55. {
  56. return true;
  57. }
  58. }
  59. return false;
  60. }
  61. bool CanSelectPermanentCondition(Permanent permanent)
  62. {
  63. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  64. {
  65. if (permanent.IsTamer)
  66. {
  67. if (permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  68. {
  69. return true;
  70. }
  71. }
  72. }
  73. return false;
  74. }
  75. bool CanSelectPermanentCondition1(Permanent permanent)
  76. {
  77. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  78. {
  79. if (permanent.TopCard.Level == 3)
  80. {
  81. if (permanent.TopCard.HasLevel)
  82. {
  83. return true;
  84. }
  85. }
  86. }
  87. return false;
  88. }
  89. bool CanSelectPermanentCondition2(Permanent permanent)
  90. {
  91. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  92. {
  93. if (permanent.TopCard.Level <= 4)
  94. {
  95. if (permanent.TopCard.HasLevel)
  96. {
  97. return true;
  98. }
  99. }
  100. }
  101. return false;
  102. }
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  106. }
  107. bool CanActivateCondition(Hashtable hashtable)
  108. {
  109. if (CardEffectCommons.IsExistOnBattleArea(card))
  110. {
  111. if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1 || card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  112. {
  113. return true;
  114. }
  115. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  116. {
  117. return true;
  118. }
  119. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Cyberdramon")) >= 1)
  120. {
  121. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition2))
  122. {
  123. return true;
  124. }
  125. }
  126. }
  127. return false;
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  130. {
  131. if (CardEffectCommons.IsExistOnBattleArea(card))
  132. {
  133. bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
  134. bool canSelectTamer = card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1;
  135. if (canSelectHand || canSelectTamer)
  136. {
  137. if (canSelectHand && canSelectTamer)
  138. {
  139. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  140. {
  141. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  142. new SelectionElement<bool>(message: $"Under Tamer", value : false, spriteIndex: 1),
  143. };
  144. string selectPlayerMessage = "From which area do you select a card?";
  145. string notSelectPlayerMessage = "The opponent is choosing from which area to select a card.";
  146. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  147. }
  148. else
  149. {
  150. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  151. }
  152. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  153. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  154. if (fromHand)
  155. {
  156. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  157. {
  158. List<CardSource> selectedCards = new List<CardSource>();
  159. int maxCount = 1;
  160. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  161. selectHandEffect.SetUp(
  162. selectPlayer: card.Owner,
  163. canTargetCondition: CanSelectCardCondition,
  164. canTargetCondition_ByPreSelecetedList: null,
  165. canEndSelectCondition: null,
  166. maxCount: maxCount,
  167. canNoSelect: true,
  168. canEndNotMax: false,
  169. isShowOpponent: true,
  170. selectCardCoroutine: SelectCardCoroutine,
  171. afterSelectCardCoroutine: null,
  172. mode: SelectHandEffect.Mode.Custom,
  173. cardEffect: activateClass);
  174. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  175. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  176. yield return StartCoroutine(selectHandEffect.Activate());
  177. IEnumerator SelectCardCoroutine(CardSource cardSource)
  178. {
  179. selectedCards.Add(cardSource);
  180. yield return null;
  181. }
  182. if (selectedCards.Count >= 1)
  183. {
  184. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  185. }
  186. }
  187. }
  188. else
  189. {
  190. if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  191. {
  192. Permanent selectedPermanent = null;
  193. int maxCount = Math.Min(1, card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  194. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  195. selectPermanentEffect.SetUp(
  196. selectPlayer: card.Owner,
  197. canTargetCondition: CanSelectPermanentCondition,
  198. canTargetCondition_ByPreSelecetedList: null,
  199. canEndSelectCondition: null,
  200. maxCount: maxCount,
  201. canNoSelect: true,
  202. canEndNotMax: false,
  203. selectPermanentCoroutine: SelectPermanentCoroutine,
  204. afterSelectPermanentCoroutine: null,
  205. mode: SelectPermanentEffect.Mode.Custom,
  206. cardEffect: activateClass);
  207. selectPermanentEffect.SetUpCustomMessage("Select a Tamer.", "The opponent is selecting a Tamer.");
  208. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  209. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  210. {
  211. selectedPermanent = permanent;
  212. yield return null;
  213. }
  214. if (selectedPermanent != null)
  215. {
  216. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  217. {
  218. maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  219. List<CardSource> selectedCards = new List<CardSource>();
  220. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  221. selectCardEffect.SetUp(
  222. canTargetCondition: CanSelectCardCondition,
  223. canTargetCondition_ByPreSelecetedList: null,
  224. canEndSelectCondition: null,
  225. canNoSelect: () => true,
  226. selectCardCoroutine: SelectCardCoroutine,
  227. afterSelectCardCoroutine: null,
  228. message: "Select 1 digivolution card.",
  229. maxCount: maxCount,
  230. canEndNotMax: false,
  231. isShowOpponent: true,
  232. mode: SelectCardEffect.Mode.Custom,
  233. root: SelectCardEffect.Root.Custom,
  234. customRootCardList: selectedPermanent.DigivolutionCards,
  235. canLookReverseCard: true,
  236. selectPlayer: card.Owner,
  237. cardEffect: activateClass);
  238. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card.", "The opponent is selecting 1 digivolution card.");
  239. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  240. yield return StartCoroutine(selectCardEffect.Activate());
  241. IEnumerator SelectCardCoroutine(CardSource cardSource)
  242. {
  243. selectedCards.Add(cardSource);
  244. yield return null;
  245. }
  246. if (selectedCards.Count >= 1)
  247. {
  248. foreach (CardSource selectedCard in selectedCards)
  249. {
  250. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(selectedCard, selectedPermanent));
  251. }
  252. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  253. }
  254. }
  255. }
  256. }
  257. }
  258. }
  259. }
  260. if (CardEffectCommons.IsExistOnBattleArea(card))
  261. {
  262. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  263. {
  264. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  265. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  266. selectPermanentEffect.SetUp(
  267. selectPlayer: card.Owner,
  268. canTargetCondition: CanSelectPermanentCondition1,
  269. canTargetCondition_ByPreSelecetedList: null,
  270. canEndSelectCondition: null,
  271. maxCount: maxCount,
  272. canNoSelect: false,
  273. canEndNotMax: false,
  274. selectPermanentCoroutine: null,
  275. afterSelectPermanentCoroutine: null,
  276. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  277. cardEffect: activateClass);
  278. selectPermanentEffect.SetUpCustomMessage("Select 1 level 3 Digimon to put on bottom of the deck.", "The opponent is selecting 1 level 3 Digimon to put on bottom of the deck.");
  279. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  280. }
  281. }
  282. if (CardEffectCommons.IsExistOnBattleArea(card))
  283. {
  284. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Cyberdramon")) >= 1)
  285. {
  286. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition2))
  287. {
  288. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition2));
  289. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  290. selectPermanentEffect.SetUp(
  291. selectPlayer: card.Owner,
  292. canTargetCondition: CanSelectPermanentCondition2,
  293. canTargetCondition_ByPreSelecetedList: null,
  294. canEndSelectCondition: null,
  295. maxCount: maxCount,
  296. canNoSelect: false,
  297. canEndNotMax: false,
  298. selectPermanentCoroutine: null,
  299. afterSelectPermanentCoroutine: null,
  300. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  301. cardEffect: activateClass);
  302. selectPermanentEffect.SetUpCustomMessage("Select 1 level 4 or lower Digimon to put on bottom of the deck.", "The opponent is selecting 1 level 4 or lower Digimon to put on bottom of the deck.");
  303. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  304. }
  305. }
  306. }
  307. }
  308. }
  309. if (timing == EffectTiming.OnEnterFieldAnyone)
  310. {
  311. ActivateClass activateClass = new ActivateClass();
  312. activateClass.SetUpICardEffect("Place 1 card to digivolution cards and return Digimon to the bottom of deck", CanUseCondition, card);
  313. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  314. cardEffects.Add(activateClass);
  315. string EffectDiscription()
  316. {
  317. return "[When Digivolving] You may place 1 Digimon card with [Blue Flare] in its traits from your hand, or from under your Tamers, under this Digimon as its bottom digivolution card. Then, return 1 of your opponent's level 3 Digimon to the bottom of its owner's deck. If [Cyberdramon] is in this Digimon's digivolution cards, return 1 of your opponent's level 4 or lower Digimon to the bottom of its owner's deck.";
  318. }
  319. bool CanSelectCardCondition(CardSource cardSource)
  320. {
  321. if (cardSource.IsDigimon)
  322. {
  323. if (cardSource.CardTraits.Contains("Blue Flare"))
  324. {
  325. return true;
  326. }
  327. if (cardSource.CardTraits.Contains("BlueFlare"))
  328. {
  329. return true;
  330. }
  331. }
  332. return false;
  333. }
  334. bool CanSelectPermanentCondition(Permanent permanent)
  335. {
  336. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  337. {
  338. if (permanent.IsTamer)
  339. {
  340. if (permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  341. {
  342. return true;
  343. }
  344. }
  345. }
  346. return false;
  347. }
  348. bool CanSelectPermanentCondition1(Permanent permanent)
  349. {
  350. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  351. {
  352. if (permanent.TopCard.Level == 3)
  353. {
  354. if (permanent.TopCard.HasLevel)
  355. {
  356. return true;
  357. }
  358. }
  359. }
  360. return false;
  361. }
  362. bool CanSelectPermanentCondition2(Permanent permanent)
  363. {
  364. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  365. {
  366. if (permanent.TopCard.Level <= 4)
  367. {
  368. if (permanent.TopCard.HasLevel)
  369. {
  370. return true;
  371. }
  372. }
  373. }
  374. return false;
  375. }
  376. bool CanUseCondition(Hashtable hashtable)
  377. {
  378. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  379. }
  380. bool CanActivateCondition(Hashtable hashtable)
  381. {
  382. if (CardEffectCommons.IsExistOnBattleArea(card))
  383. {
  384. if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1 || card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  385. {
  386. return true;
  387. }
  388. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  389. {
  390. return true;
  391. }
  392. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Cyberdramon")) >= 1)
  393. {
  394. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition2))
  395. {
  396. return true;
  397. }
  398. }
  399. }
  400. return false;
  401. }
  402. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  403. {
  404. if (CardEffectCommons.IsExistOnBattleArea(card))
  405. {
  406. bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
  407. bool canSelectTamer = card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1;
  408. if (canSelectHand || canSelectTamer)
  409. {
  410. if (canSelectHand && canSelectTamer)
  411. {
  412. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  413. {
  414. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  415. new SelectionElement<bool>(message: $"Under Tamer", value : false, spriteIndex: 1),
  416. };
  417. string selectPlayerMessage = "From which area do you select a card?";
  418. string notSelectPlayerMessage = "The opponent is choosing from which area to select a card.";
  419. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  420. }
  421. else
  422. {
  423. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  424. }
  425. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  426. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  427. if (fromHand)
  428. {
  429. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  430. {
  431. List<CardSource> selectedCards = new List<CardSource>();
  432. int maxCount = 1;
  433. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  434. selectHandEffect.SetUp(
  435. selectPlayer: card.Owner,
  436. canTargetCondition: CanSelectCardCondition,
  437. canTargetCondition_ByPreSelecetedList: null,
  438. canEndSelectCondition: null,
  439. maxCount: maxCount,
  440. canNoSelect: true,
  441. canEndNotMax: false,
  442. isShowOpponent: true,
  443. selectCardCoroutine: SelectCardCoroutine,
  444. afterSelectCardCoroutine: null,
  445. mode: SelectHandEffect.Mode.Custom,
  446. cardEffect: activateClass);
  447. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  448. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  449. yield return StartCoroutine(selectHandEffect.Activate());
  450. IEnumerator SelectCardCoroutine(CardSource cardSource)
  451. {
  452. selectedCards.Add(cardSource);
  453. yield return null;
  454. }
  455. if (selectedCards.Count >= 1)
  456. {
  457. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  458. }
  459. }
  460. }
  461. else
  462. {
  463. if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  464. {
  465. Permanent selectedPermanent = null;
  466. int maxCount = Math.Min(1, card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  467. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  468. selectPermanentEffect.SetUp(
  469. selectPlayer: card.Owner,
  470. canTargetCondition: CanSelectPermanentCondition,
  471. canTargetCondition_ByPreSelecetedList: null,
  472. canEndSelectCondition: null,
  473. maxCount: maxCount,
  474. canNoSelect: true,
  475. canEndNotMax: false,
  476. selectPermanentCoroutine: SelectPermanentCoroutine,
  477. afterSelectPermanentCoroutine: null,
  478. mode: SelectPermanentEffect.Mode.Custom,
  479. cardEffect: activateClass);
  480. selectPermanentEffect.SetUpCustomMessage("Select a Tamer.", "The opponent is selecting a Tamer.");
  481. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  482. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  483. {
  484. selectedPermanent = permanent;
  485. yield return null;
  486. }
  487. if (selectedPermanent != null)
  488. {
  489. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  490. {
  491. maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  492. List<CardSource> selectedCards = new List<CardSource>();
  493. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  494. selectCardEffect.SetUp(
  495. canTargetCondition: CanSelectCardCondition,
  496. canTargetCondition_ByPreSelecetedList: null,
  497. canEndSelectCondition: null,
  498. canNoSelect: () => true,
  499. selectCardCoroutine: SelectCardCoroutine,
  500. afterSelectCardCoroutine: null,
  501. message: "Select 1 digivolution card.",
  502. maxCount: maxCount,
  503. canEndNotMax: false,
  504. isShowOpponent: true,
  505. mode: SelectCardEffect.Mode.Custom,
  506. root: SelectCardEffect.Root.Custom,
  507. customRootCardList: selectedPermanent.DigivolutionCards,
  508. canLookReverseCard: true,
  509. selectPlayer: card.Owner,
  510. cardEffect: activateClass);
  511. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card.", "The opponent is selecting 1 digivolution card.");
  512. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  513. yield return StartCoroutine(selectCardEffect.Activate());
  514. IEnumerator SelectCardCoroutine(CardSource cardSource)
  515. {
  516. selectedCards.Add(cardSource);
  517. yield return null;
  518. }
  519. if (selectedCards.Count >= 1)
  520. {
  521. foreach (CardSource selectedCard in selectedCards)
  522. {
  523. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(selectedCard, selectedPermanent));
  524. }
  525. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  526. }
  527. }
  528. }
  529. }
  530. }
  531. }
  532. }
  533. if (CardEffectCommons.IsExistOnBattleArea(card))
  534. {
  535. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  536. {
  537. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  538. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  539. selectPermanentEffect.SetUp(
  540. selectPlayer: card.Owner,
  541. canTargetCondition: CanSelectPermanentCondition1,
  542. canTargetCondition_ByPreSelecetedList: null,
  543. canEndSelectCondition: null,
  544. maxCount: maxCount,
  545. canNoSelect: false,
  546. canEndNotMax: false,
  547. selectPermanentCoroutine: null,
  548. afterSelectPermanentCoroutine: null,
  549. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  550. cardEffect: activateClass);
  551. selectPermanentEffect.SetUpCustomMessage("Select 1 level 3 Digimon to put on bottom of the deck.", "The opponent is selecting 1 level 3 Digimon to put on bottom of the deck.");
  552. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  553. }
  554. }
  555. if (CardEffectCommons.IsExistOnBattleArea(card))
  556. {
  557. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Cyberdramon")) >= 1)
  558. {
  559. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition2))
  560. {
  561. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition2));
  562. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  563. selectPermanentEffect.SetUp(
  564. selectPlayer: card.Owner,
  565. canTargetCondition: CanSelectPermanentCondition2,
  566. canTargetCondition_ByPreSelecetedList: null,
  567. canEndSelectCondition: null,
  568. maxCount: maxCount,
  569. canNoSelect: false,
  570. canEndNotMax: false,
  571. selectPermanentCoroutine: null,
  572. afterSelectPermanentCoroutine: null,
  573. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  574. cardEffect: activateClass);
  575. selectPermanentEffect.SetUpCustomMessage("Select 1 level 4 or lower Digimon to put on bottom of the deck.", "The opponent is selecting 1 level 4 or lower Digimon to put on bottom of the deck.");
  576. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  577. }
  578. }
  579. }
  580. }
  581. }
  582. if (timing == EffectTiming.None)
  583. {
  584. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  585. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  586. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  587. addDigiXrosConditionClass.SetNotShowUI(true);
  588. cardEffects.Add(addDigiXrosConditionClass);
  589. bool CanUseCondition(Hashtable hashtable)
  590. {
  591. return true;
  592. }
  593. DigiXrosCondition GetDigiXros(CardSource cardSource)
  594. {
  595. if (cardSource == card)
  596. {
  597. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "MetalGreymon");
  598. bool CanSelectCardCondition(CardSource cardSource)
  599. {
  600. if (cardSource != null)
  601. {
  602. if (cardSource.Owner == card.Owner)
  603. {
  604. if (cardSource.IsDigimon)
  605. {
  606. if (cardSource.CardNames_DigiXros.Contains("MetalGreymon"))
  607. {
  608. return true;
  609. }
  610. }
  611. }
  612. }
  613. return false;
  614. }
  615. DigiXrosConditionElement element1 = new DigiXrosConditionElement(CanSelectCardCondition1, "Cyberdramon");
  616. bool CanSelectCardCondition1(CardSource cardSource)
  617. {
  618. if (cardSource != null)
  619. {
  620. if (cardSource.Owner == card.Owner)
  621. {
  622. if (cardSource.IsDigimon)
  623. {
  624. if (cardSource.CardNames_DigiXros.Contains("Cyberdramon"))
  625. {
  626. return true;
  627. }
  628. }
  629. }
  630. }
  631. return false;
  632. }
  633. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element, element1 };
  634. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  635. return digiXrosCondition;
  636. }
  637. return null;
  638. }
  639. }
  640. return cardEffects;
  641. }
  642. }
  643. }