BT10_015.cs 38 KB

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