BT12_011.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT12
  6. {
  7. public class BT12_011 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.HasSaveText && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. if (timing == EffectTiming.OnEnterFieldAnyone)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Play 1 [Taiki Kudo], [Yuu Amano] or [Tagiru Akashi] from hand", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[On Play] You may play 1 [Taiki Kudo], [Yuu Amano], or [Tagiru Akashi] card from your hand without paying its cost.";
  29. }
  30. bool CanSelectCardCondition(CardSource cardSource)
  31. {
  32. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  33. {
  34. if (cardSource.CardNames.Contains("Taiki Kudo") || cardSource.CardNames.Contains("TaikiKudo"))
  35. {
  36. return true;
  37. }
  38. if (cardSource.CardNames.Contains("Yuu Amano") || cardSource.CardNames.Contains("YuuAmano"))
  39. {
  40. return true;
  41. }
  42. if (cardSource.CardNames.Contains("Tagiru Akashi") || cardSource.CardNames.Contains("TagiruAkashi"))
  43. {
  44. return true;
  45. }
  46. }
  47. return false;
  48. }
  49. bool CanUseCondition(Hashtable hashtable)
  50. {
  51. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  52. }
  53. bool CanActivateCondition(Hashtable hashtable)
  54. {
  55. if (CardEffectCommons.IsExistOnBattleArea(card))
  56. {
  57. if (card.Owner.HandCards.Count >= 1)
  58. {
  59. return true;
  60. }
  61. }
  62. return false;
  63. }
  64. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  65. {
  66. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  67. {
  68. List<CardSource> selectedCards = new List<CardSource>();
  69. int maxCount = 1;
  70. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  71. selectHandEffect.SetUp(
  72. selectPlayer: card.Owner,
  73. canTargetCondition: CanSelectCardCondition,
  74. canTargetCondition_ByPreSelecetedList: null,
  75. canEndSelectCondition: null,
  76. maxCount: maxCount,
  77. canNoSelect: true,
  78. canEndNotMax: false,
  79. isShowOpponent: true,
  80. selectCardCoroutine: SelectCardCoroutine,
  81. afterSelectCardCoroutine: null,
  82. mode: SelectHandEffect.Mode.Custom,
  83. cardEffect: activateClass);
  84. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  85. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  86. yield return StartCoroutine(selectHandEffect.Activate());
  87. IEnumerator SelectCardCoroutine(CardSource cardSource)
  88. {
  89. selectedCards.Add(cardSource);
  90. yield return null;
  91. }
  92. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  93. }
  94. }
  95. }
  96. if (timing == EffectTiming.OnEnterFieldAnyone)
  97. {
  98. ActivateClass activateClass = new ActivateClass();
  99. activateClass.SetUpICardEffect("Play 1 [Taiki Kudo], [Yuu Amano] or [Tagiru Akashi] from hand", CanUseCondition, card);
  100. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  101. cardEffects.Add(activateClass);
  102. string EffectDiscription()
  103. {
  104. return "[When Digivolving] You may play 1 [Taiki Kudo], [Yuu Amano], or [Tagiru Akashi] card from your hand without paying its cost.";
  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.HandCards.Count >= 1)
  134. {
  135. return true;
  136. }
  137. }
  138. return false;
  139. }
  140. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  141. {
  142. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  143. {
  144. List<CardSource> selectedCards = new List<CardSource>();
  145. int maxCount = 1;
  146. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  147. selectHandEffect.SetUp(
  148. selectPlayer: card.Owner,
  149. canTargetCondition: CanSelectCardCondition,
  150. canTargetCondition_ByPreSelecetedList: null,
  151. canEndSelectCondition: null,
  152. maxCount: maxCount,
  153. canNoSelect: true,
  154. canEndNotMax: false,
  155. isShowOpponent: true,
  156. selectCardCoroutine: SelectCardCoroutine,
  157. afterSelectCardCoroutine: null,
  158. mode: SelectHandEffect.Mode.Custom,
  159. cardEffect: activateClass);
  160. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  161. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  162. yield return StartCoroutine(selectHandEffect.Activate());
  163. IEnumerator SelectCardCoroutine(CardSource cardSource)
  164. {
  165. selectedCards.Add(cardSource);
  166. yield return null;
  167. }
  168. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  169. }
  170. }
  171. }
  172. if (timing == EffectTiming.OnDestroyedAnyone)
  173. {
  174. ActivateClass activateClass = new ActivateClass();
  175. activateClass.SetUpICardEffect("Save and place 1 card under your 1 Tamer from trash", CanUseCondition, card);
  176. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  177. cardEffects.Add(activateClass);
  178. string EffectDiscription()
  179. {
  180. return "[On Deletion] <Save>. Then, place 1 Digimon card with <Save> in its text from your trash under 1 of your Tamers.";
  181. }
  182. bool CanSelectPermanentCondition(Permanent permanent)
  183. {
  184. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  185. {
  186. if (permanent.IsTamer)
  187. {
  188. if (!permanent.IsToken)
  189. {
  190. return true;
  191. }
  192. }
  193. }
  194. return false;
  195. }
  196. bool CanSelectCardCondition1(CardSource cardSource)
  197. {
  198. if (cardSource != null)
  199. {
  200. if (cardSource.Owner == card.Owner)
  201. {
  202. if (cardSource.HasSaveText)
  203. {
  204. if (cardSource.IsDigimon)
  205. {
  206. return true;
  207. }
  208. }
  209. }
  210. }
  211. return false;
  212. }
  213. bool CanUseCondition(Hashtable hashtable)
  214. {
  215. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  216. }
  217. bool CanActivateCondition(Hashtable hashtable)
  218. {
  219. return CardEffectCommons.CanActivateSave(hashtable, CanSelectPermanentCondition);
  220. }
  221. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  222. {
  223. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SaveProcess(_hashtable, activateClass, card, CanSelectPermanentCondition));
  224. List<CardSource> selectedCards = new List<CardSource>();
  225. int maxCount = 1;
  226. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  227. selectCardEffect.SetUp(
  228. canTargetCondition: CanSelectCardCondition1,
  229. canTargetCondition_ByPreSelecetedList: null,
  230. canEndSelectCondition: null,
  231. canNoSelect: () => false,
  232. selectCardCoroutine: SelectCardCoroutine,
  233. afterSelectCardCoroutine: null,
  234. message: "Select 1 card to place at the bottom of digivolution cards.",
  235. maxCount: maxCount,
  236. canEndNotMax: false,
  237. isShowOpponent: true,
  238. mode: SelectCardEffect.Mode.Custom,
  239. root: SelectCardEffect.Root.Trash,
  240. customRootCardList: null,
  241. canLookReverseCard: true,
  242. selectPlayer: card.Owner,
  243. cardEffect: activateClass);
  244. 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.");
  245. yield return StartCoroutine(selectCardEffect.Activate());
  246. IEnumerator SelectCardCoroutine(CardSource cardSource)
  247. {
  248. selectedCards.Add(cardSource);
  249. yield return null;
  250. }
  251. if (selectedCards.Count >= 1)
  252. {
  253. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  254. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  255. selectPermanentEffect.SetUp(
  256. selectPlayer: card.Owner,
  257. canTargetCondition: CanSelectPermanentCondition,
  258. canTargetCondition_ByPreSelecetedList: null,
  259. canEndSelectCondition: null,
  260. maxCount: maxCount,
  261. canNoSelect: false,
  262. canEndNotMax: false,
  263. selectPermanentCoroutine: SelectPermanentCoroutine,
  264. afterSelectPermanentCoroutine: null,
  265. mode: SelectPermanentEffect.Mode.Custom,
  266. cardEffect: activateClass);
  267. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer that will get a digivolution card.", "The opponent is selecting 1 Tamer that will get a digivolution card.");
  268. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  269. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  270. {
  271. Permanent selectedPermanent = permanent;
  272. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  273. }
  274. }
  275. }
  276. }
  277. if (timing == EffectTiming.OnAllyAttack)
  278. {
  279. ActivateClass activateClass = new ActivateClass();
  280. activateClass.SetUpICardEffect("Delete 1 Digimon with 4000 DP or less", CanUseCondition, card);
  281. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  282. activateClass.SetIsInheritedEffect(true);
  283. activateClass.SetHashString("Delete_BT12_011");
  284. cardEffects.Add(activateClass);
  285. string EffectDiscription()
  286. {
  287. return "[When Attacking][Once Per Turn] If this Digimon has <Save> in its text, delete 1 of your opponent's Digimon with 4000 DP or less.";
  288. }
  289. bool CanSelectPermanentCondition(Permanent permanent)
  290. {
  291. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  292. {
  293. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass))
  294. {
  295. return true;
  296. }
  297. }
  298. return false;
  299. }
  300. bool CanUseCondition(Hashtable hashtable)
  301. {
  302. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  303. }
  304. bool CanActivateCondition(Hashtable hashtable)
  305. {
  306. if (CardEffectCommons.IsExistOnBattleArea(card))
  307. {
  308. if (card.PermanentOfThisCard().TopCard.HasSaveText)
  309. {
  310. return true;
  311. }
  312. }
  313. return false;
  314. }
  315. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  316. {
  317. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  318. {
  319. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  320. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  321. selectPermanentEffect.SetUp(
  322. selectPlayer: card.Owner,
  323. canTargetCondition: CanSelectPermanentCondition,
  324. canTargetCondition_ByPreSelecetedList: null,
  325. canEndSelectCondition: null,
  326. maxCount: maxCount,
  327. canNoSelect: false,
  328. canEndNotMax: false,
  329. selectPermanentCoroutine: null,
  330. afterSelectPermanentCoroutine: null,
  331. mode: SelectPermanentEffect.Mode.Destroy,
  332. cardEffect: activateClass);
  333. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  334. }
  335. }
  336. }
  337. if (timing == EffectTiming.None)
  338. {
  339. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  340. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  341. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  342. addDigiXrosConditionClass.SetNotShowUI(true);
  343. cardEffects.Add(addDigiXrosConditionClass);
  344. bool CanUseCondition(Hashtable hashtable)
  345. {
  346. return true;
  347. }
  348. DigiXrosCondition GetDigiXros(CardSource cardSource)
  349. {
  350. if (cardSource == card)
  351. {
  352. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "Digimon card with <Save> in text");
  353. bool CanSelectCardCondition(CardSource cardSource)
  354. {
  355. if (cardSource != null)
  356. {
  357. if (cardSource.Owner == card.Owner)
  358. {
  359. if (cardSource.IsDigimon)
  360. {
  361. if (cardSource.HasSaveText)
  362. {
  363. return true;
  364. }
  365. }
  366. }
  367. }
  368. return false;
  369. }
  370. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element };
  371. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  372. return digiXrosCondition;
  373. }
  374. return null;
  375. }
  376. }
  377. return cardEffects;
  378. }
  379. }
  380. }