BT10_086.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  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_086 : 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. bool PermanentCondition(Permanent targetPermanent)
  18. {
  19. return targetPermanent.TopCard.CardNames.Contains("Omnimon");
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  22. permanentCondition: PermanentCondition,
  23. digivolutionCost: 3,
  24. ignoreDigivolutionRequirement: false,
  25. card: card,
  26. condition: null));
  27. }
  28. if (timing == EffectTiming.None)
  29. {
  30. bool Condition()
  31. {
  32. return !CardEffectCommons.IsExistOnField(card);
  33. }
  34. bool PermanentCondition(Permanent targetPermanent)
  35. {
  36. if (targetPermanent != null)
  37. {
  38. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(targetPermanent, card))
  39. {
  40. if (targetPermanent.DigivolutionCards.Some((cardSource) =>
  41. cardSource.CardNames.Contains("XAntibody") || cardSource.CardNames.Contains("X Antibody")))
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. return false;
  48. }
  49. bool CardSourceCondition(CardSource cardSource)
  50. {
  51. return cardSource == card;
  52. }
  53. bool RootCondition(SelectCardEffect.Root root)
  54. {
  55. return true;
  56. }
  57. cardEffects.Add(
  58. CardEffectFactory.ChangeDigivolutionCostStaticEffect(
  59. changeValue: -2,
  60. permanentCondition: PermanentCondition,
  61. cardCondition: CardSourceCondition,
  62. rootCondition: RootCondition,
  63. isInheritedEffect: false,
  64. card: card,
  65. condition: Condition,
  66. setFixedCost: false));
  67. }
  68. if (timing == EffectTiming.OnEnterFieldAnyone)
  69. {
  70. ActivateClass activateClass = new ActivateClass();
  71. activateClass.SetUpICardEffect("Return all opponent's Digimon with the highest level to the bottom of deck", CanUseCondition, card);
  72. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  73. cardEffects.Add(activateClass);
  74. string EffectDiscription()
  75. {
  76. return "[When Digivolving] Return all of your opponent's Digimon with the highest level to the bottom of their owners' decks in any order.";
  77. }
  78. bool CanSelectPermanentCondition(Permanent permanent)
  79. {
  80. return CardEffectCommons.IsMaxLevel(permanent, card.Owner.Enemy);
  81. }
  82. bool CanUseCondition(Hashtable hashtable)
  83. {
  84. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  85. }
  86. bool CanActivateCondition(Hashtable hashtable)
  87. {
  88. if (CardEffectCommons.IsExistOnBattleArea(card))
  89. {
  90. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  91. {
  92. return true;
  93. }
  94. }
  95. return false;
  96. }
  97. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  98. {
  99. if (CardEffectCommons.IsExistOnBattleArea(card))
  100. {
  101. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  102. {
  103. List<Permanent> selectedPermanents = new List<Permanent>();
  104. foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaDigimons())
  105. {
  106. if (CanSelectPermanentCondition(permanent))
  107. {
  108. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  109. {
  110. if (!permanent.CannotReturnToLibrary(activateClass))
  111. {
  112. selectedPermanents.Add(permanent);
  113. }
  114. }
  115. }
  116. }
  117. if (selectedPermanents.Count >= 1)
  118. {
  119. if (selectedPermanents.Count == 1)
  120. {
  121. yield return ContinuousController.instance.StartCoroutine(new DeckBottomBounceClass(selectedPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).DeckBounce());
  122. }
  123. else
  124. {
  125. List<CardSource> cardSources = selectedPermanents.Map(permanent => permanent.TopCard);
  126. List<SkillInfo> skillInfos = cardSources.Map(cardSource =>
  127. {
  128. ChangeBaseDPClass cardEffect = new ChangeBaseDPClass();
  129. cardEffect.SetUpICardEffect(" ", null, cardSource);
  130. return new SkillInfo(cardEffect, null, EffectTiming.None);
  131. });
  132. List<CardSource> selectedCards = new List<CardSource>();
  133. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  134. selectCardEffect.SetUp(
  135. canTargetCondition: (cardSource) => true,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. canNoSelect: () => false,
  139. selectCardCoroutine: null,
  140. afterSelectCardCoroutine: AfterSelectCardCoroutine1,
  141. message: "Specify the order to place the card at the bottom of the deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).",
  142. maxCount: cardSources.Count,
  143. canEndNotMax: false,
  144. isShowOpponent: false,
  145. mode: SelectCardEffect.Mode.Custom,
  146. root: SelectCardEffect.Root.Custom,
  147. customRootCardList: cardSources,
  148. canLookReverseCard: true,
  149. selectPlayer: card.Owner,
  150. cardEffect: activateClass);
  151. selectCardEffect.SetNotShowCard();
  152. selectCardEffect.SetNotAddLog();
  153. selectCardEffect.SetUpSkillInfos(skillInfos);
  154. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  155. IEnumerator AfterSelectCardCoroutine1(List<CardSource> cardSources)
  156. {
  157. if (cardSources.Count >= 1)
  158. {
  159. selectedCards = cardSources.Clone();
  160. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Bottom Cards", true, true));
  161. }
  162. }
  163. if (selectedCards.Count >= 1)
  164. {
  165. List<Permanent> libraryPermanets = selectedCards.Map(cardSource => cardSource.PermanentOfThisCard());
  166. if (libraryPermanets.Count >= 1)
  167. {
  168. DeckBottomBounceClass putLibraryBottomPermanent = new DeckBottomBounceClass(libraryPermanets, CardEffectCommons.CardEffectHashtable(activateClass));
  169. putLibraryBottomPermanent.SetNotShowCards();
  170. yield return ContinuousController.instance.StartCoroutine(putLibraryBottomPermanent.DeckBounce());
  171. }
  172. }
  173. }
  174. }
  175. }
  176. }
  177. }
  178. }
  179. if (timing == EffectTiming.OnEnterFieldAnyone)
  180. {
  181. ActivateClass activateClass = new ActivateClass();
  182. activateClass.SetUpICardEffect("Return 1 digivolution card to bottom of deck and trash Security", CanUseCondition, card);
  183. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  184. activateClass.SetHashString("TrashSecurity_BT10_086");
  185. cardEffects.Add(activateClass);
  186. string EffectDiscription()
  187. {
  188. return "[When Digivolving][Once Per Turn] By placing 1 [X Antibody] or level 6 card from this Digimon's digivolution cards at the bottom of its owner's deck, reveal all of your opponent's security cards, and trash 1 of them. Place the rest in your opponent's security stack face down. Then, your opponent shuffles their security stack.";
  189. }
  190. bool CanSelectCardCondition(CardSource cardSource)
  191. {
  192. if (cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody"))
  193. {
  194. return true;
  195. }
  196. if (cardSource.Level == 6)
  197. {
  198. if (cardSource.HasLevel)
  199. {
  200. return true;
  201. }
  202. }
  203. return false;
  204. }
  205. bool CanSelectCardCondition1(CardSource cardSource)
  206. {
  207. return true;
  208. }
  209. bool CanUseCondition(Hashtable hashtable)
  210. {
  211. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  212. }
  213. bool CanActivateCondition(Hashtable hashtable)
  214. {
  215. if (CardEffectCommons.IsExistOnBattleArea(card))
  216. {
  217. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  218. {
  219. return true;
  220. }
  221. }
  222. return false;
  223. }
  224. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  225. {
  226. bool returnedToLibrary = false;
  227. List<CardSource> selectedCards = new List<CardSource>();
  228. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  229. selectCardEffect.SetUp(
  230. canTargetCondition: CanSelectCardCondition,
  231. canTargetCondition_ByPreSelecetedList: null,
  232. canEndSelectCondition: null,
  233. canNoSelect: () => false,
  234. selectCardCoroutine: SelectCardCoroutine,
  235. afterSelectCardCoroutine: null,
  236. message: "Select 1 digivolution card to return to the bottom of deck.",
  237. maxCount: 1,
  238. canEndNotMax: false,
  239. isShowOpponent: true,
  240. mode: SelectCardEffect.Mode.Custom,
  241. root: SelectCardEffect.Root.Custom,
  242. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  243. canLookReverseCard: true,
  244. selectPlayer: card.Owner,
  245. cardEffect: null);
  246. selectCardEffect.SetUpCustomMessage(
  247. "Select 1 digivolution card to return to the bottom of deck.",
  248. "The opponent is selecting 1 digivolution card to return to the bottom of deck.");
  249. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  250. IEnumerator SelectCardCoroutine(CardSource cardSource)
  251. {
  252. selectedCards.Add(cardSource);
  253. yield return null;
  254. }
  255. foreach (CardSource cardSource in selectedCards)
  256. {
  257. if (!cardSource.IsToken)
  258. {
  259. returnedToLibrary = true;
  260. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(
  261. new List<CardSource>() { cardSource }));
  262. }
  263. }
  264. if (returnedToLibrary)
  265. {
  266. if (card.Owner.Enemy.SecurityCards.Count >= 1)
  267. {
  268. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(card.Owner.Enemy.SecurityCards, "Security Cards", true, true));
  269. int maxCount = 1;
  270. CardSource selectedCard = null;
  271. selectCardEffect.SetUp(
  272. canTargetCondition: CanSelectCardCondition1,
  273. canTargetCondition_ByPreSelecetedList: null,
  274. canEndSelectCondition: null,
  275. canNoSelect: () => false,
  276. selectCardCoroutine: SelectCardCoroutine1,
  277. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  278. message: "Select 1 card to discard.",
  279. maxCount: maxCount,
  280. canEndNotMax: false,
  281. isShowOpponent: true,
  282. mode: SelectCardEffect.Mode.Custom,
  283. root: SelectCardEffect.Root.Security,
  284. customRootCardList: card.Owner.Enemy.SecurityCards,
  285. canLookReverseCard: true,
  286. selectPlayer: card.Owner,
  287. cardEffect: activateClass);
  288. selectCardEffect.SetIsSecurity();
  289. selectCardEffect.SetUpCustomMessage_ShowCard("Trash card");
  290. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  291. IEnumerator SelectCardCoroutine1(CardSource cardSource)
  292. {
  293. selectedCard = cardSource;
  294. yield return null;
  295. }
  296. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  297. {
  298. if (cardSources.Count >= 1)
  299. {
  300. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
  301. player: card.Owner.Enemy,
  302. refSkillInfos: ref ContinuousController.instance.nullSkillInfos,
  303. activateClass).ReduceSecurity());
  304. }
  305. }
  306. if (selectedCard != null)
  307. {
  308. #region
  309. selectedCard.Owner.securityObject.securityBreakGlass.ShowBlueMatarial();
  310. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().BreakSecurityEffect(selectedCard.Owner));
  311. yield return new WaitForSeconds(0.1f);
  312. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().EnterSecurityCardEffect(selectedCard));
  313. yield return new WaitForSeconds(0.5f);
  314. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().DestroySecurityEffect(selectedCard));
  315. #endregion
  316. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(selectedCard));
  317. }
  318. ContinuousController.instance.PlaySE(GManager.instance.ShuffleSE);
  319. card.Owner.Enemy.SecurityCards = RandomUtility.ShuffledDeckCards(card.Owner.Enemy.SecurityCards);
  320. }
  321. }
  322. }
  323. }
  324. if (timing == EffectTiming.OnAllyAttack)
  325. {
  326. ActivateClass activateClass = new ActivateClass();
  327. activateClass.SetUpICardEffect("Return 1 digivolution card to bottom of deck and trash Security", CanUseCondition, card);
  328. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  329. activateClass.SetHashString("TrashSecurity_BT10_086");
  330. cardEffects.Add(activateClass);
  331. string EffectDiscription()
  332. {
  333. return "[When Attacking][Once Per Turn] By placing 1 [X Antibody] or level 6 card from this Digimon's digivolution cards at the bottom of its owner's deck, reveal all of your opponent's security cards, and trash 1 of them. Place the rest in your opponent's security stack face down. Then, your opponent shuffles their security stack.";
  334. }
  335. bool CanSelectCardCondition(CardSource cardSource)
  336. {
  337. if (cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody"))
  338. {
  339. return true;
  340. }
  341. if (cardSource.Level == 6)
  342. {
  343. if (cardSource.HasLevel)
  344. {
  345. return true;
  346. }
  347. }
  348. return false;
  349. }
  350. bool CanSelectCardCondition1(CardSource cardSource)
  351. {
  352. return true;
  353. }
  354. bool CanUseCondition(Hashtable hashtable)
  355. {
  356. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  357. }
  358. bool CanActivateCondition(Hashtable hashtable)
  359. {
  360. if (CardEffectCommons.IsExistOnBattleArea(card))
  361. {
  362. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  363. {
  364. return true;
  365. }
  366. }
  367. return false;
  368. }
  369. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  370. {
  371. bool returnedToLibrary = false;
  372. List<CardSource> selectedCards = new List<CardSource>();
  373. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  374. selectCardEffect.SetUp(
  375. canTargetCondition: CanSelectCardCondition,
  376. canTargetCondition_ByPreSelecetedList: null,
  377. canEndSelectCondition: null,
  378. canNoSelect: () => false,
  379. selectCardCoroutine: SelectCardCoroutine,
  380. afterSelectCardCoroutine: null,
  381. message: "Select 1 digivolution card to return to the bottom of deck.",
  382. maxCount: 1,
  383. canEndNotMax: false,
  384. isShowOpponent: true,
  385. mode: SelectCardEffect.Mode.Custom,
  386. root: SelectCardEffect.Root.Custom,
  387. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  388. canLookReverseCard: true,
  389. selectPlayer: card.Owner,
  390. cardEffect: null);
  391. selectCardEffect.SetUpCustomMessage(
  392. "Select 1 digivolution card to return to the bottom of deck.",
  393. "The opponent is selecting 1 digivolution card to return to the bottom of deck.");
  394. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  395. IEnumerator SelectCardCoroutine(CardSource cardSource)
  396. {
  397. selectedCards.Add(cardSource);
  398. yield return null;
  399. }
  400. foreach (CardSource cardSource in selectedCards)
  401. {
  402. if (!cardSource.IsToken)
  403. {
  404. returnedToLibrary = true;
  405. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(new List<CardSource>() { cardSource }));
  406. }
  407. }
  408. if (returnedToLibrary)
  409. {
  410. if (card.Owner.Enemy.SecurityCards.Count >= 1)
  411. {
  412. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(
  413. card.Owner.Enemy.SecurityCards,
  414. "Security Cards",
  415. true,
  416. true));
  417. int maxCount = 1;
  418. CardSource selectedCard = null;
  419. selectCardEffect.SetUp(
  420. canTargetCondition: CanSelectCardCondition1,
  421. canTargetCondition_ByPreSelecetedList: null,
  422. canEndSelectCondition: null,
  423. canNoSelect: () => false,
  424. selectCardCoroutine: SelectCardCoroutine1,
  425. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  426. message: "Select 1 card to discard.",
  427. maxCount: maxCount,
  428. canEndNotMax: false,
  429. isShowOpponent: true,
  430. mode: SelectCardEffect.Mode.Custom,
  431. root: SelectCardEffect.Root.Security,
  432. customRootCardList: card.Owner.Enemy.SecurityCards,
  433. canLookReverseCard: true,
  434. selectPlayer: card.Owner,
  435. cardEffect: activateClass);
  436. selectCardEffect.SetUpCustomMessage_ShowCard("Trash card");
  437. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  438. IEnumerator SelectCardCoroutine1(CardSource cardSource)
  439. {
  440. selectedCard = cardSource;
  441. yield return null;
  442. }
  443. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  444. {
  445. if (cardSources.Count >= 1)
  446. {
  447. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
  448. player: card.Owner.Enemy,
  449. refSkillInfos: ref ContinuousController.instance.nullSkillInfos,
  450. activateClass).ReduceSecurity());
  451. }
  452. }
  453. if (selectedCard != null)
  454. {
  455. #region
  456. selectedCard.Owner.securityObject.securityBreakGlass.ShowBlueMatarial();
  457. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().BreakSecurityEffect(selectedCard.Owner));
  458. yield return new WaitForSeconds(0.1f);
  459. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().EnterSecurityCardEffect(selectedCard));
  460. yield return new WaitForSeconds(0.5f);
  461. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().DestroySecurityEffect(selectedCard));
  462. #endregion
  463. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(selectedCard));
  464. }
  465. ContinuousController.instance.PlaySE(GManager.instance.ShuffleSE);
  466. card.Owner.Enemy.SecurityCards = RandomUtility.ShuffledDeckCards(card.Owner.Enemy.SecurityCards);
  467. }
  468. }
  469. }
  470. }
  471. return cardEffects;
  472. }
  473. }
  474. }