BT20_043.cs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using UnityEngine;
  6. using Photon.Pun;
  7. namespace DCGO.CardEffects.BT20
  8. {
  9. public class BT20_043 : CEntity_Effect
  10. {
  11. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  12. {
  13. List<ICardEffect> cardEffects = new List<ICardEffect>();
  14. #region Alternate Digivolution Requirement
  15. if (timing == EffectTiming.None)
  16. {
  17. static bool PermanentCondition(Permanent targetPermanent)
  18. {
  19. return targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel5 && targetPermanent.TopCard.EqualsTraits("ACCEL");
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  22. }
  23. #endregion
  24. #region Reduce Play Cost
  25. bool HasAccelTraitInPlay(Permanent permanent)
  26. {
  27. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  28. {
  29. if (permanent.TopCard.EqualsTraits("ACCEL"))
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. #region Before Pay Cost - Condition Effect
  37. if (timing == EffectTiming.BeforePayCost)
  38. {
  39. ActivateClass activateClass = new ActivateClass();
  40. activateClass.SetUpICardEffect("Reduce the play cost by 5", CanUseCondition, card);
  41. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  42. activateClass.SetHashString("PlayCost-5_BT20_043");
  43. cardEffects.Add(activateClass);
  44. string EffectDiscription()
  45. {
  46. return "When this card would be played, if you have a Digimon with the [ACCEL] trait, reduce the play cost by 5.";
  47. }
  48. bool CardCondition(CardSource cardSource)
  49. {
  50. if (cardSource == card)
  51. {
  52. if (CardEffectCommons.IsExistOnHand(cardSource))
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, CardCondition);
  62. }
  63. bool CanActivateCondition(Hashtable hashtable)
  64. {
  65. if (CardEffectCommons.IsExistOnHand(card))
  66. {
  67. return CardEffectCommons.HasMatchConditionPermanent(HasAccelTraitInPlay);
  68. }
  69. return false;
  70. }
  71. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  72. {
  73. if (card.Owner.CanReduceCost(null, card))
  74. {
  75. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  76. }
  77. ChangeCostClass changeCostClass = new ChangeCostClass();
  78. changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition1, card);
  79. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  80. card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
  81. bool CanUseCondition1(Hashtable hashtable)
  82. {
  83. return true;
  84. }
  85. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  86. {
  87. if (CardSourceCondition(cardSource))
  88. {
  89. if (RootCondition(root))
  90. {
  91. if (PermanentsCondition(targetPermanents))
  92. {
  93. int targetCost = 0;
  94. if (CardEffectCommons.HasMatchConditionPermanent(HasAccelTraitInPlay))
  95. targetCost += 5;
  96. Cost -= targetCost;
  97. }
  98. }
  99. }
  100. return Cost;
  101. }
  102. bool PermanentsCondition(List<Permanent> targetPermanents)
  103. {
  104. if (targetPermanents == null)
  105. {
  106. return true;
  107. }
  108. else
  109. {
  110. if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
  111. {
  112. return true;
  113. }
  114. }
  115. return false;
  116. }
  117. bool CardSourceCondition(CardSource cardSource)
  118. {
  119. return cardSource == card;
  120. }
  121. bool RootCondition(SelectCardEffect.Root root)
  122. {
  123. return true;
  124. }
  125. bool isUpDown()
  126. {
  127. return true;
  128. }
  129. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
  130. }
  131. }
  132. #endregion
  133. #region Reduce Play Cost - Not Shown
  134. if (timing == EffectTiming.None)
  135. {
  136. ChangeCostClass changeCostClass = new ChangeCostClass();
  137. changeCostClass.SetUpICardEffect("Play Cost -5", CanUseCondition, card);
  138. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true);
  139. changeCostClass.SetNotShowUI(true);
  140. cardEffects.Add(changeCostClass);
  141. bool CanUseCondition(Hashtable hashtable)
  142. {
  143. if (card.Owner.HandCards.Contains(card))
  144. {
  145. ICardEffect activateClass = card.EffectList(EffectTiming.BeforePayCost).Find(cardEffect => cardEffect.EffectName == "Reduce the play cost by 5");
  146. if (activateClass != null)
  147. {
  148. return CardEffectCommons.HasMatchConditionPermanent(HasAccelTraitInPlay);
  149. }
  150. }
  151. return false;
  152. }
  153. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  154. {
  155. if (CardSourceCondition(cardSource))
  156. {
  157. if (RootCondition(root))
  158. {
  159. if (PermanentsCondition(targetPermanents))
  160. {
  161. int targetCount = 0;
  162. if (CardEffectCommons.HasMatchConditionPermanent(HasAccelTraitInPlay))
  163. targetCount += 5;
  164. Cost -= targetCount;
  165. }
  166. }
  167. }
  168. return Cost;
  169. }
  170. bool PermanentsCondition(List<Permanent> targetPermanents)
  171. {
  172. if (targetPermanents == null)
  173. {
  174. return true;
  175. }
  176. else
  177. {
  178. if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
  179. {
  180. return true;
  181. }
  182. }
  183. return false;
  184. }
  185. bool CardSourceCondition(CardSource cardSource)
  186. {
  187. if (cardSource != null)
  188. {
  189. if (cardSource == card)
  190. {
  191. return true;
  192. }
  193. }
  194. return false;
  195. }
  196. bool RootCondition(SelectCardEffect.Root root)
  197. {
  198. return true;
  199. }
  200. bool isUpDown()
  201. {
  202. return true;
  203. }
  204. }
  205. #endregion
  206. #endregion
  207. #region On Play
  208. if (timing == EffectTiming.OnEnterFieldAnyone)
  209. {
  210. ActivateClass activateClass = new ActivateClass();
  211. activateClass.SetUpICardEffect("Suspend all of your opponent's Digimon, 1 of your Digimon gets +3000DP, then attack", CanUseCondition, card);
  212. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  213. cardEffects.Add(activateClass);
  214. string EffectDiscription()
  215. {
  216. return "[On Play] Suspend all of your opponent's Digimon and 1 of your Digimon gets +3000 DP for the turn. Then, 1 of your Digimon may attack.";
  217. }
  218. bool IsYourBoostedDigimon(Permanent permanent)
  219. {
  220. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  221. }
  222. bool IsYourAttackingDigimon(Permanent permanent)
  223. {
  224. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  225. permanent.CanAttack(activateClass);
  226. }
  227. bool CanUseCondition(Hashtable hashtable)
  228. {
  229. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  230. }
  231. bool CanActivateCondition(Hashtable hashtable)
  232. {
  233. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  234. }
  235. IEnumerator ActivateCoroutine(Hashtable hashtable)
  236. {
  237. List<Permanent> suspendTargetPermanents = card.Owner.Enemy.GetBattleAreaPermanents().Filter(permanent => permanent.IsDigimon);
  238. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(suspendTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  239. if (CardEffectCommons.HasMatchConditionPermanent(IsYourBoostedDigimon))
  240. {
  241. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  242. selectPermanentEffect.SetUp(
  243. selectPlayer: card.Owner,
  244. canTargetCondition: IsYourBoostedDigimon,
  245. canTargetCondition_ByPreSelecetedList: null,
  246. canEndSelectCondition: null,
  247. maxCount: 1,
  248. canNoSelect: false,
  249. canEndNotMax: false,
  250. selectPermanentCoroutine: SelectBoostedDigimon,
  251. afterSelectPermanentCoroutine: null,
  252. mode: SelectPermanentEffect.Mode.Custom,
  253. cardEffect: activateClass);
  254. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to get +3000DP.", "The opponent is selecting 1 Digimon to get +3000DP.");
  255. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  256. IEnumerator SelectBoostedDigimon(Permanent target)
  257. {
  258. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: target, changeValue: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  259. }
  260. }
  261. if (CardEffectCommons.HasMatchConditionPermanent(IsYourAttackingDigimon))
  262. {
  263. Permanent selectedPermanent = null;
  264. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  265. selectPermanentEffect.SetUp(
  266. selectPlayer: card.Owner,
  267. canTargetCondition: IsYourAttackingDigimon,
  268. canTargetCondition_ByPreSelecetedList: null,
  269. canEndSelectCondition: null,
  270. maxCount: 1,
  271. canNoSelect: false,
  272. canEndNotMax: false,
  273. selectPermanentCoroutine: SelectPermanentCoroutine,
  274. afterSelectPermanentCoroutine: null,
  275. mode: SelectPermanentEffect.Mode.Custom,
  276. cardEffect: activateClass);
  277. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to attack.", "The opponent is selecting 1 Digimon to attack.");
  278. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  279. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  280. {
  281. selectedPermanent = permanent;
  282. yield return null;
  283. }
  284. if (selectedPermanent != null)
  285. {
  286. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  287. selectAttackEffect.SetUp(
  288. attacker: selectedPermanent,
  289. canAttackPlayerCondition: () => true,
  290. defenderCondition: _ => true,
  291. cardEffect: activateClass);
  292. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  293. }
  294. }
  295. }
  296. }
  297. #endregion
  298. #region When Digivolving
  299. if (timing == EffectTiming.OnEnterFieldAnyone)
  300. {
  301. ActivateClass activateClass = new ActivateClass();
  302. activateClass.SetUpICardEffect("Suspend all of your opponent's Digimon, 1 of your Digimon gets +3000DP, then attack", CanUseCondition, card);
  303. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  304. cardEffects.Add(activateClass);
  305. string EffectDiscription()
  306. {
  307. return "[When Digivolving] Suspend all of your opponent's Digimon and 1 of your Digimon gets +3000 DP for the turn. Then, 1 of your Digimon may attack.";
  308. }
  309. bool IsYourBoostedDigimon(Permanent permanent)
  310. {
  311. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  312. }
  313. bool IsYourAttackingDigimon(Permanent permanent)
  314. {
  315. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  316. permanent.CanAttack(activateClass);
  317. }
  318. bool CanUseCondition(Hashtable hashtable)
  319. {
  320. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  321. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  322. }
  323. bool CanActivateCondition(Hashtable hashtable)
  324. {
  325. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  326. }
  327. IEnumerator ActivateCoroutine(Hashtable hashtable)
  328. {
  329. List<Permanent> suspendTargetPermanents = card.Owner.Enemy.GetBattleAreaPermanents().Filter(permanent => permanent.IsDigimon);
  330. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(suspendTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  331. if (CardEffectCommons.HasMatchConditionPermanent(IsYourBoostedDigimon))
  332. {
  333. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  334. selectPermanentEffect.SetUp(
  335. selectPlayer: card.Owner,
  336. canTargetCondition: IsYourBoostedDigimon,
  337. canTargetCondition_ByPreSelecetedList: null,
  338. canEndSelectCondition: null,
  339. maxCount: 1,
  340. canNoSelect: false,
  341. canEndNotMax: false,
  342. selectPermanentCoroutine: SelectBoostedDigimon,
  343. afterSelectPermanentCoroutine: null,
  344. mode: SelectPermanentEffect.Mode.Custom,
  345. cardEffect: activateClass);
  346. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to get +3000DP.", "The opponent is selecting 1 Digimon to get +3000DP.");
  347. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  348. IEnumerator SelectBoostedDigimon(Permanent target)
  349. {
  350. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: target, changeValue: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  351. }
  352. }
  353. if (CardEffectCommons.HasMatchConditionPermanent(IsYourAttackingDigimon))
  354. {
  355. Permanent selectedPermanent = null;
  356. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  357. selectPermanentEffect.SetUp(
  358. selectPlayer: card.Owner,
  359. canTargetCondition: IsYourAttackingDigimon,
  360. canTargetCondition_ByPreSelecetedList: null,
  361. canEndSelectCondition: null,
  362. maxCount: 1,
  363. canNoSelect: false,
  364. canEndNotMax: false,
  365. selectPermanentCoroutine: SelectPermanentCoroutine,
  366. afterSelectPermanentCoroutine: null,
  367. mode: SelectPermanentEffect.Mode.Custom,
  368. cardEffect: activateClass);
  369. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to attack.", "The opponent is selecting 1 Digimon to attack.");
  370. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  371. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  372. {
  373. selectedPermanent = permanent;
  374. yield return null;
  375. }
  376. if (selectedPermanent != null)
  377. {
  378. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  379. selectAttackEffect.SetUp(
  380. attacker: selectedPermanent,
  381. canAttackPlayerCondition: () => true,
  382. defenderCondition: _ => true,
  383. cardEffect: activateClass);
  384. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  385. }
  386. }
  387. }
  388. }
  389. #endregion
  390. #region End of Turn
  391. if (timing == EffectTiming.OnEndTurn)
  392. {
  393. ActivateClass activateClass = new ActivateClass();
  394. activateClass.SetUpICardEffect("DNA digivolve this Digimon", CanUseCondition, card);
  395. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  396. cardEffects.Add(activateClass);
  397. string EffectDiscription()
  398. {
  399. return "[End of Your Turn] This Digimon and any of your other Digimon may DNA digivolve into a Digimon card with [Chaosmon] in its name in the hand. Then, the DNA digivolved Digimon may attack.";
  400. }
  401. bool CanSelectCardCondition(CardSource cardSource)
  402. {
  403. if (cardSource != null)
  404. {
  405. if (cardSource.IsDigimon)
  406. {
  407. if (cardSource.ContainsCardName("Chaosmon"))
  408. {
  409. if (cardSource.CanPlayJogress(true))
  410. {
  411. if (cardSource.CanJogressFromTargetPermanent(card.PermanentOfThisCard(), true))
  412. {
  413. return true;
  414. }
  415. }
  416. }
  417. }
  418. }
  419. return false;
  420. }
  421. bool CanUseCondition(Hashtable hashtable)
  422. {
  423. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  424. }
  425. bool CanActivateCondition(Hashtable hashtable)
  426. {
  427. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  428. {
  429. if (CardEffectCommons.IsOwnerTurn(card))
  430. {
  431. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  432. {
  433. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard()))
  434. {
  435. return true;
  436. }
  437. }
  438. }
  439. }
  440. return false;
  441. }
  442. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  443. {
  444. CardSource selectedCard = null;
  445. int maxCount = 1;
  446. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  447. selectHandEffect.SetUp(
  448. selectPlayer: card.Owner,
  449. canTargetCondition: CanSelectCardCondition,
  450. canTargetCondition_ByPreSelecetedList: null,
  451. canEndSelectCondition: null,
  452. maxCount: maxCount,
  453. canNoSelect: true,
  454. canEndNotMax: false,
  455. isShowOpponent: true,
  456. selectCardCoroutine: SelectCardCoroutine,
  457. afterSelectCardCoroutine: null,
  458. mode: SelectHandEffect.Mode.Custom,
  459. cardEffect: activateClass);
  460. selectHandEffect.SetUpCustomMessage("Select 1 card to DNA digivolve.", "The opponent is selecting 1 card to DNA digivolve.");
  461. selectHandEffect.SetNotShowCard();
  462. yield return StartCoroutine(selectHandEffect.Activate());
  463. IEnumerator SelectCardCoroutine(CardSource cardSource)
  464. {
  465. selectedCard = cardSource;
  466. yield return null;
  467. }
  468. if (selectedCard != null)
  469. {
  470. if (selectedCard.CanPlayJogress(true) && selectedCard.CanJogressFromTargetPermanent(card.PermanentOfThisCard(), true))
  471. {
  472. JogressEvoRootsFrameIDs = new int[0];
  473. yield return GManager.instance.photonWaitController.StartWait("BanchoLeomon_BT20_036");
  474. if (card.Owner.isYou || GManager.instance.IsAI)
  475. {
  476. GManager.instance.selectJogressEffect.SetUp_SelectDigivolutionRoots
  477. (card: selectedCard,
  478. isLocal: true,
  479. isPayCost: true,
  480. canNoSelect: true,
  481. endSelectCoroutine_SelectDigivolutionRoots: EndSelectCoroutine_SelectDigivolutionRoots,
  482. noSelectCoroutine: null);
  483. GManager.instance.selectJogressEffect.SetUpCustomPermanentConditions(new Func<Permanent, bool>[] { (permanent) => permanent == card.PermanentOfThisCard() });
  484. yield return ContinuousController.instance.StartCoroutine(GManager.instance.selectJogressEffect.SelectDigivolutionRoots());
  485. IEnumerator EndSelectCoroutine_SelectDigivolutionRoots(List<Permanent> permanents)
  486. {
  487. permanents = permanents.Distinct().ToList();
  488. if (permanents.Count == 2)
  489. {
  490. JogressEvoRootsFrameIDs = new int[2];
  491. for (int i = 0; i < permanents.Count; i++)
  492. {
  493. if (i < JogressEvoRootsFrameIDs.Length)
  494. {
  495. JogressEvoRootsFrameIDs[i] = permanents[i].PermanentFrame.FrameID;
  496. }
  497. }
  498. }
  499. if (!permanents.Contains(card.PermanentOfThisCard()))
  500. {
  501. JogressEvoRootsFrameIDs = new int[0];
  502. }
  503. yield return null;
  504. }
  505. photonView.RPC("SetJogressEvoRootsFrameIDs", RpcTarget.All, JogressEvoRootsFrameIDs);
  506. }
  507. else
  508. {
  509. GManager.instance.commandText.OpenCommandText("The opponent is choosing a card to DNA digivolve.");
  510. }
  511. yield return new WaitWhile(() => !endSelect);
  512. endSelect = false;
  513. GManager.instance.commandText.CloseCommandText();
  514. yield return new WaitWhile(() => GManager.instance.commandText.gameObject.activeSelf);
  515. if (JogressEvoRootsFrameIDs.Length == 2)
  516. {
  517. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(new List<CardSource>() { selectedCard }, "Played Card", true, true));
  518. PlayCardClass playCard = new PlayCardClass(
  519. cardSources: new List<CardSource>() { selectedCard },
  520. hashtable: CardEffectCommons.CardEffectHashtable(activateClass),
  521. payCost: true,
  522. targetPermanent: null,
  523. isTapped: false,
  524. root: SelectCardEffect.Root.Hand,
  525. activateETB: true);
  526. playCard.SetJogress(JogressEvoRootsFrameIDs);
  527. yield return ContinuousController.instance.StartCoroutine(playCard.PlayCard());
  528. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  529. selectAttackEffect.SetUp(
  530. attacker: selectedCard.PermanentOfThisCard(),
  531. canAttackPlayerCondition: () => true,
  532. defenderCondition: _ => true,
  533. cardEffect: activateClass);
  534. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  535. }
  536. }
  537. }
  538. }
  539. }
  540. #endregion
  541. #region When Attacking - ESS
  542. if (timing == EffectTiming.OnAllyAttack)
  543. {
  544. ActivateClass activateClass = new ActivateClass();
  545. activateClass.SetUpICardEffect("1 Opponent's Digimon gets -4000 DP", CanUseCondition, card);
  546. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  547. activateClass.SetIsInheritedEffect(true);
  548. activateClass.SetHashString("WhenAttacking_BT20-043");
  549. cardEffects.Add(activateClass);
  550. string EffectDiscription()
  551. {
  552. return "[When Attacking] [Once Per Turn] 1 of your opponent's Digimon gets -4000 DP for the turn.";
  553. }
  554. bool IsOpponentsDigimon(Permanent permanent)
  555. {
  556. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  557. }
  558. bool CanUseCondition(Hashtable hashtable)
  559. {
  560. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  561. }
  562. bool CanActivateCondition(Hashtable hashtable)
  563. {
  564. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  565. }
  566. IEnumerator ActivateCoroutine(Hashtable hashtable)
  567. {
  568. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  569. {
  570. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  571. selectPermanentEffect.SetUp(
  572. selectPlayer: card.Owner,
  573. canTargetCondition: IsOpponentsDigimon,
  574. canTargetCondition_ByPreSelecetedList: null,
  575. canEndSelectCondition: null,
  576. maxCount: 1,
  577. canNoSelect: false,
  578. canEndNotMax: false,
  579. selectPermanentCoroutine: SelectedPermanent,
  580. afterSelectPermanentCoroutine: null,
  581. mode: SelectPermanentEffect.Mode.Custom,
  582. cardEffect: activateClass);
  583. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -4000.", "The opponent is selecting 1 Digimon that will get DP -4000.");
  584. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  585. IEnumerator SelectedPermanent(Permanent target)
  586. {
  587. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: target, changeValue: -4000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  588. }
  589. }
  590. }
  591. }
  592. #endregion
  593. return cardEffects;
  594. }
  595. bool endSelect = false;
  596. int[] JogressEvoRootsFrameIDs = new int[0];
  597. [PunRPC]
  598. public void SetJogressEvoRootsFrameIDs(int[] JogressEvoRootsFrameIDs)
  599. {
  600. this.JogressEvoRootsFrameIDs = JogressEvoRootsFrameIDs;
  601. endSelect = true;
  602. }
  603. }
  604. }