BT12_063.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_063 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.HasSaveText && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3;
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[On Play] Reveal the top 3 cards of your deck. You may play 1 [Taiki Kudo], [Yuu Amano], or [Tagiru Akashi] card among them without paying its cost. Place the remaining cards at the bottom of your deck in any order.";
  28. }
  29. bool CanSelectCardCondition(CardSource cardSource)
  30. {
  31. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  32. {
  33. if (cardSource.CardNames.Contains("Taiki Kudo") || cardSource.CardNames.Contains("TaikiKudo"))
  34. {
  35. return true;
  36. }
  37. if (cardSource.CardNames.Contains("Yuu Amano") || cardSource.CardNames.Contains("YuuAmano"))
  38. {
  39. return true;
  40. }
  41. if (cardSource.CardNames.Contains("Tagiru Akashi") || cardSource.CardNames.Contains("TagiruAkashi"))
  42. {
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.IsExistOnBattleArea(card))
  55. {
  56. if (card.Owner.LibraryCards.Count >= 1)
  57. {
  58. return true;
  59. }
  60. }
  61. return false;
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  64. {
  65. List<CardSource> selectedCards = new List<CardSource>();
  66. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  67. revealCount: 3,
  68. simplifiedSelectCardConditions:
  69. new SimplifiedSelectCardConditionClass[]
  70. {
  71. new SimplifiedSelectCardConditionClass(
  72. canTargetCondition:CanSelectCardCondition,
  73. message: "Select 1 [Taiki Kudo], [Yuu Amano], or [Tagiru Akashi] card.",
  74. mode: SelectCardEffect.Mode.Custom,
  75. maxCount: 1,
  76. selectCardCoroutine: SelectCardCoroutine),
  77. },
  78. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  79. activateClass: activateClass,
  80. canNoSelect: true
  81. ));
  82. IEnumerator SelectCardCoroutine(CardSource cardSource)
  83. {
  84. selectedCards.Add(cardSource);
  85. yield return null;
  86. }
  87. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  88. cardSources: selectedCards,
  89. activateClass: activateClass,
  90. payCost: false,
  91. isTapped: false,
  92. root: SelectCardEffect.Root.Library,
  93. activateETB: true));
  94. }
  95. }
  96. if (timing == EffectTiming.OnEnterFieldAnyone)
  97. {
  98. ActivateClass activateClass = new ActivateClass();
  99. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  100. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  101. cardEffects.Add(activateClass);
  102. string EffectDiscription()
  103. {
  104. return "[When Digivolving] Reveal the top 3 cards of your deck. You may play 1 [Taiki Kudo], [Yuu Amano], or [Tagiru Akashi] card among them without paying its cost. Place the remaining cards at the bottom of your deck in any order.";
  105. }
  106. bool CanSelectCardCondition(CardSource cardSource)
  107. {
  108. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  109. {
  110. if (cardSource.CardNames.Contains("Taiki Kudo") || cardSource.CardNames.Contains("TaikiKudo"))
  111. {
  112. return true;
  113. }
  114. if (cardSource.CardNames.Contains("Yuu Amano") || cardSource.CardNames.Contains("YuuAmano"))
  115. {
  116. return true;
  117. }
  118. if (cardSource.CardNames.Contains("Tagiru Akashi") || cardSource.CardNames.Contains("TagiruAkashi"))
  119. {
  120. return true;
  121. }
  122. }
  123. return false;
  124. }
  125. bool CanUseCondition(Hashtable hashtable)
  126. {
  127. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  128. }
  129. bool CanActivateCondition(Hashtable hashtable)
  130. {
  131. if (CardEffectCommons.IsExistOnBattleArea(card))
  132. {
  133. if (card.Owner.LibraryCards.Count >= 1)
  134. {
  135. return true;
  136. }
  137. }
  138. return false;
  139. }
  140. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  141. {
  142. List<CardSource> selectedCards = new List<CardSource>();
  143. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  144. revealCount: 3,
  145. simplifiedSelectCardConditions:
  146. new SimplifiedSelectCardConditionClass[]
  147. {
  148. new SimplifiedSelectCardConditionClass(
  149. canTargetCondition:CanSelectCardCondition,
  150. message: "Select 1 [Taiki Kudo], [Yuu Amano], or [Tagiru Akashi] card.",
  151. mode: SelectCardEffect.Mode.Custom,
  152. maxCount: 1,
  153. selectCardCoroutine: SelectCardCoroutine),
  154. },
  155. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  156. activateClass: activateClass,
  157. canNoSelect: true
  158. ));
  159. IEnumerator SelectCardCoroutine(CardSource cardSource)
  160. {
  161. selectedCards.Add(cardSource);
  162. yield return null;
  163. }
  164. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  165. cardSources: selectedCards,
  166. activateClass: activateClass,
  167. payCost: false,
  168. isTapped: false,
  169. root: SelectCardEffect.Root.Library,
  170. activateETB: true));
  171. }
  172. }
  173. if (timing == EffectTiming.OnDestroyedAnyone)
  174. {
  175. ActivateClass activateClass = new ActivateClass();
  176. activateClass.SetUpICardEffect("Save and place 1 card under your 1 Tamer from trash", CanUseCondition, card);
  177. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  178. cardEffects.Add(activateClass);
  179. string EffectDiscription()
  180. {
  181. return "[On Deletion] <Save>. Then, place 1 Digimon card with <Save> in its text from your trash under 1 of your Tamers.";
  182. }
  183. bool CanSelectPermanentCondition(Permanent permanent)
  184. {
  185. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  186. {
  187. if (permanent.IsTamer)
  188. {
  189. if (!permanent.IsToken)
  190. {
  191. return true;
  192. }
  193. }
  194. }
  195. return false;
  196. }
  197. bool CanSelectCardCondition1(CardSource cardSource)
  198. {
  199. if (cardSource.HasSaveText)
  200. {
  201. if (cardSource.IsDigimon)
  202. {
  203. return true;
  204. }
  205. }
  206. return false;
  207. }
  208. bool CanUseCondition(Hashtable hashtable)
  209. {
  210. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  211. }
  212. bool CanActivateCondition(Hashtable hashtable)
  213. {
  214. return CardEffectCommons.CanActivateSave(hashtable, CanSelectPermanentCondition);
  215. }
  216. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  217. {
  218. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SaveProcess(_hashtable, activateClass, card, CanSelectPermanentCondition));
  219. List<CardSource> selectedCards = new List<CardSource>();
  220. int maxCount = 1;
  221. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  222. selectCardEffect.SetUp(
  223. canTargetCondition: CanSelectCardCondition1,
  224. canTargetCondition_ByPreSelecetedList: null,
  225. canEndSelectCondition: null,
  226. canNoSelect: () => false,
  227. selectCardCoroutine: SelectCardCoroutine,
  228. afterSelectCardCoroutine: null,
  229. message: "Select 1 card to place at the bottom of digivolution cards.",
  230. maxCount: maxCount,
  231. canEndNotMax: false,
  232. isShowOpponent: true,
  233. mode: SelectCardEffect.Mode.Custom,
  234. root: SelectCardEffect.Root.Trash,
  235. customRootCardList: null,
  236. canLookReverseCard: true,
  237. selectPlayer: card.Owner,
  238. cardEffect: activateClass);
  239. selectCardEffect.SetUpCustomMessage("Select 1 card to place at the bottom of digivolution cards.", "The opponent is selecting 1 card to place at the bottom of digivolution cards.");
  240. yield return StartCoroutine(selectCardEffect.Activate());
  241. IEnumerator SelectCardCoroutine(CardSource cardSource)
  242. {
  243. selectedCards.Add(cardSource);
  244. yield return null;
  245. }
  246. if (selectedCards.Count >= 1)
  247. {
  248. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  249. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  250. selectPermanentEffect.SetUp(
  251. selectPlayer: card.Owner,
  252. canTargetCondition: CanSelectPermanentCondition,
  253. canTargetCondition_ByPreSelecetedList: null,
  254. canEndSelectCondition: null,
  255. maxCount: maxCount,
  256. canNoSelect: false,
  257. canEndNotMax: false,
  258. selectPermanentCoroutine: SelectPermanentCoroutine,
  259. afterSelectPermanentCoroutine: null,
  260. mode: SelectPermanentEffect.Mode.Custom,
  261. cardEffect: activateClass);
  262. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer that will get a digivolution card.", "The opponent is selecting 1 Tamer that will get a digivolution card.");
  263. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  264. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  265. {
  266. Permanent selectedPermanent = permanent;
  267. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  268. }
  269. }
  270. }
  271. }
  272. if (timing == EffectTiming.None)
  273. {
  274. bool Condition()
  275. {
  276. if (CardEffectCommons.IsExistOnBattleArea(card))
  277. {
  278. if (CardEffectCommons.IsOpponentTurn(card))
  279. {
  280. if (card.PermanentOfThisCard().TopCard.HasSaveText)
  281. {
  282. return true;
  283. }
  284. }
  285. }
  286. return false;
  287. }
  288. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: true, card: card, condition: Condition));
  289. }
  290. if (timing == EffectTiming.None)
  291. {
  292. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  293. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  294. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  295. addDigiXrosConditionClass.SetNotShowUI(true);
  296. cardEffects.Add(addDigiXrosConditionClass);
  297. bool CanUseCondition(Hashtable hashtable)
  298. {
  299. return true;
  300. }
  301. DigiXrosCondition GetDigiXros(CardSource cardSource)
  302. {
  303. if (cardSource == card)
  304. {
  305. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "Digimon card with <Save> in text");
  306. bool CanSelectCardCondition(CardSource cardSource)
  307. {
  308. if (cardSource != null)
  309. {
  310. if (cardSource.Owner == card.Owner)
  311. {
  312. if (cardSource.IsDigimon)
  313. {
  314. if (cardSource.HasSaveText)
  315. {
  316. return true;
  317. }
  318. }
  319. }
  320. }
  321. return false;
  322. }
  323. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element };
  324. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  325. return digiXrosCondition;
  326. }
  327. return null;
  328. }
  329. }
  330. return cardEffects;
  331. }
  332. }
  333. }