BT20_021.cs 38 KB

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