BT19_101.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT19
  6. {
  7. public class BT19_101 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("MoonMillenniummon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Overclock
  23. if (timing == EffectTiming.OnEndTurn)
  24. {
  25. cardEffects.Add(CardEffectFactory.OverclockSelfEffect(trait: "Composite", isInheritedEffect: false, card: card,
  26. condition: null));
  27. }
  28. #endregion
  29. #region On Play
  30. if (timing == EffectTiming.OnEnterFieldAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Return 1 card from opponent's trash to deck top return 1 digimon to bottom of the deck", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[On Play] By returning 1 Digimon card from your opponent's trash to the top of the deck, return 1 of their Digimon to the bottom of the deck.";
  39. }
  40. bool CanSelectCardCondition(CardSource cardSource)
  41. {
  42. return cardSource.IsDigimon;
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass))
  47. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  48. return false;
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass))
  53. {
  54. if (card.Owner.Enemy.TrashCards.Count(CanSelectCardCondition) >= 1)
  55. {
  56. return true;
  57. }
  58. }
  59. return false;
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  62. {
  63. if (card.Owner.Enemy.TrashCards.Count(CanSelectCardCondition) >= 1)
  64. {
  65. int maxCount = 1;
  66. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  67. selectCardEffect.SetUp(
  68. canTargetCondition: (cardSource) => CanSelectCardCondition(cardSource),
  69. canTargetCondition_ByPreSelecetedList: null,
  70. canEndSelectCondition: null,
  71. canNoSelect: () => true,
  72. selectCardCoroutine: null,
  73. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  74. message: "Select 1 card to place at the top of the deck.",
  75. maxCount: maxCount,
  76. canEndNotMax: false,
  77. isShowOpponent: false,
  78. mode: SelectCardEffect.Mode.Custom,
  79. root: SelectCardEffect.Root.Custom,
  80. customRootCardList: card.Owner.Enemy.TrashCards,
  81. canLookReverseCard: true,
  82. selectPlayer: card.Owner,
  83. cardEffect: activateClass);
  84. selectCardEffect.SetNotShowCard();
  85. selectCardEffect.SetNotAddLog();
  86. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  87. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  88. {
  89. if (cardSources.Count == 1)
  90. {
  91. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryTopCards(cardSources));
  92. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Top Cards", true, true));
  93. bool CanSelectPermanentToBounce(Permanent permanent)
  94. {
  95. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  96. {
  97. return true;
  98. }
  99. return false;
  100. }
  101. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentToBounce));
  102. SelectPermanentEffect selectPermanentEffectBounce = GManager.instance.GetComponent<SelectPermanentEffect>();
  103. selectPermanentEffectBounce.SetUp(
  104. selectPlayer: card.Owner,
  105. canTargetCondition: CanSelectPermanentToBounce,
  106. canTargetCondition_ByPreSelecetedList: null,
  107. canEndSelectCondition: null,
  108. maxCount: maxCount,
  109. canNoSelect: false,
  110. canEndNotMax: false,
  111. selectPermanentCoroutine: null,
  112. afterSelectPermanentCoroutine: null,
  113. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  114. cardEffect: activateClass);
  115. selectPermanentEffectBounce.SetUpCustomMessage("Select 1 Digimon to return to the bottom of the deck.", "The opponent is selecting 1 Digimon to return to the bottom of the deck.");
  116. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffectBounce.Activate());
  117. }
  118. }
  119. }
  120. }
  121. }
  122. #endregion
  123. #region When Digivolving
  124. if (timing == EffectTiming.OnEnterFieldAnyone)
  125. {
  126. ActivateClass activateClass = new ActivateClass();
  127. activateClass.SetUpICardEffect("Return 1 card from opponent's trash to deck top return 1 digimon to bottom of the deck", CanUseCondition, card);
  128. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  129. cardEffects.Add(activateClass);
  130. string EffectDiscription()
  131. {
  132. return "[When Digivolving] By returning 1 Digimon card from your opponent's trash to the top of the deck, return 1 of their Digimon to the bottom of the deck.";
  133. }
  134. bool CanSelectCardCondition(CardSource cardSource)
  135. {
  136. return cardSource.IsDigimon;
  137. }
  138. bool CanUseCondition(Hashtable hashtable)
  139. {
  140. if (CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass))
  141. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  142. return false;
  143. }
  144. bool CanActivateCondition(Hashtable hashtable)
  145. {
  146. if (CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass))
  147. {
  148. if (card.Owner.Enemy.TrashCards.Count(CanSelectCardCondition) >= 1)
  149. {
  150. return true;
  151. }
  152. }
  153. return false;
  154. }
  155. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  156. {
  157. if (card.Owner.Enemy.TrashCards.Count(CanSelectCardCondition) >= 1)
  158. {
  159. int maxCount = 1;
  160. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  161. selectCardEffect.SetUp(
  162. canTargetCondition: (cardSource) => CanSelectCardCondition(cardSource),
  163. canTargetCondition_ByPreSelecetedList: null,
  164. canEndSelectCondition: null,
  165. canNoSelect: () => true,
  166. selectCardCoroutine: null,
  167. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  168. message: "Select 1 card to place at the top of the deck.",
  169. maxCount: maxCount,
  170. canEndNotMax: false,
  171. isShowOpponent: false,
  172. mode: SelectCardEffect.Mode.Custom,
  173. root: SelectCardEffect.Root.Custom,
  174. customRootCardList: card.Owner.Enemy.TrashCards,
  175. canLookReverseCard: true,
  176. selectPlayer: card.Owner,
  177. cardEffect: activateClass);
  178. selectCardEffect.SetNotShowCard();
  179. selectCardEffect.SetNotAddLog();
  180. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  181. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  182. {
  183. if (cardSources.Count == 1)
  184. {
  185. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryTopCards(cardSources));
  186. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Top Cards", true, true));
  187. bool CanSelectPermanentToBounce(Permanent permanent)
  188. {
  189. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  190. {
  191. return true;
  192. }
  193. return false;
  194. }
  195. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentToBounce));
  196. SelectPermanentEffect selectPermanentEffectBounce = GManager.instance.GetComponent<SelectPermanentEffect>();
  197. selectPermanentEffectBounce.SetUp(
  198. selectPlayer: card.Owner,
  199. canTargetCondition: CanSelectPermanentToBounce,
  200. canTargetCondition_ByPreSelecetedList: null,
  201. canEndSelectCondition: null,
  202. maxCount: maxCount,
  203. canNoSelect: false,
  204. canEndNotMax: false,
  205. selectPermanentCoroutine: null,
  206. afterSelectPermanentCoroutine: null,
  207. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  208. cardEffect: activateClass);
  209. selectPermanentEffectBounce.SetUpCustomMessage("Select 1 Digimon to return to the bottom of the deck.", "The opponent is selecting 1 Digimon to return to the bottom of the deck.");
  210. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffectBounce.Activate());
  211. }
  212. }
  213. }
  214. }
  215. }
  216. #endregion
  217. #region When Attacking
  218. if (timing == EffectTiming.OnAllyAttack)
  219. {
  220. ActivateClass activateClass = new ActivateClass();
  221. activateClass.SetUpICardEffect("Return 1 card from opponent's trash to deck top return 1 digimon to bottom of the deck", CanUseCondition, card);
  222. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  223. cardEffects.Add(activateClass);
  224. string EffectDiscription()
  225. {
  226. return "[When Attacking] By returning 1 Digimon card from your opponent's trash to the top of the deck, return 1 of their Digimon to the bottom of the deck.";
  227. }
  228. bool CanSelectCardCondition(CardSource cardSource)
  229. {
  230. return cardSource.IsDigimon;
  231. }
  232. bool CanUseCondition(Hashtable hashtable)
  233. {
  234. if (CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass))
  235. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  236. return false;
  237. }
  238. bool CanActivateCondition(Hashtable hashtable)
  239. {
  240. if (CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass))
  241. {
  242. if (card.Owner.Enemy.TrashCards.Count(CanSelectCardCondition) >= 1)
  243. {
  244. return true;
  245. }
  246. }
  247. return false;
  248. }
  249. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  250. {
  251. if (card.Owner.Enemy.TrashCards.Count(CanSelectCardCondition) >= 1)
  252. {
  253. int maxCount = 1;
  254. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  255. selectCardEffect.SetUp(
  256. canTargetCondition: (cardSource) => CanSelectCardCondition(cardSource),
  257. canTargetCondition_ByPreSelecetedList: null,
  258. canEndSelectCondition: null,
  259. canNoSelect: () => true,
  260. selectCardCoroutine: null,
  261. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  262. message: "Select 1 card to place at the top of the deck.",
  263. maxCount: maxCount,
  264. canEndNotMax: false,
  265. isShowOpponent: false,
  266. mode: SelectCardEffect.Mode.Custom,
  267. root: SelectCardEffect.Root.Custom,
  268. customRootCardList: card.Owner.Enemy.TrashCards,
  269. canLookReverseCard: true,
  270. selectPlayer: card.Owner,
  271. cardEffect: activateClass);
  272. selectCardEffect.SetNotShowCard();
  273. selectCardEffect.SetNotAddLog();
  274. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  275. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  276. {
  277. if (cardSources.Count == 1)
  278. {
  279. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryTopCards(cardSources));
  280. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Top Cards", true, true));
  281. bool CanSelectPermanentToBounce(Permanent permanent)
  282. {
  283. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  284. {
  285. return true;
  286. }
  287. return false;
  288. }
  289. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentToBounce));
  290. SelectPermanentEffect selectPermanentEffectBounce = GManager.instance.GetComponent<SelectPermanentEffect>();
  291. selectPermanentEffectBounce.SetUp(
  292. selectPlayer: card.Owner,
  293. canTargetCondition: CanSelectPermanentToBounce,
  294. canTargetCondition_ByPreSelecetedList: null,
  295. canEndSelectCondition: null,
  296. maxCount: maxCount,
  297. canNoSelect: false,
  298. canEndNotMax: false,
  299. selectPermanentCoroutine: null,
  300. afterSelectPermanentCoroutine: null,
  301. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  302. cardEffect: activateClass);
  303. selectPermanentEffectBounce.SetUpCustomMessage("Select 1 Digimon to return to the bottom of the deck.", "The opponent is selecting 1 Digimon to return to the bottom of the deck.");
  304. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffectBounce.Activate());
  305. }
  306. }
  307. }
  308. }
  309. }
  310. #endregion
  311. #region All Turns - Shared
  312. bool ImmunityAndNoSuspendCondition(Hashtable hashtable)
  313. {
  314. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  315. {
  316. if (card.PermanentOfThisCard().DigivolutionCards.Count == 0)
  317. {
  318. return true;
  319. }
  320. }
  321. return false;
  322. }
  323. #endregion
  324. #region All Turns - Immunity
  325. if (timing == EffectTiming.None)
  326. {
  327. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  328. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's effects", ImmunityAndNoSuspendCondition, card);
  329. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  330. cardEffects.Add(canNotAffectedClass);
  331. bool CardCondition(CardSource cardSource)
  332. {
  333. if (cardSource == card)
  334. {
  335. if (CardEffectCommons.IsExistOnBattleArea(card))
  336. {
  337. if (cardSource == card.PermanentOfThisCard().TopCard)
  338. {
  339. return true;
  340. }
  341. }
  342. }
  343. return false;
  344. }
  345. bool SkillCondition(ICardEffect cardEffect)
  346. {
  347. if (CardEffectCommons.IsOpponentEffect(cardEffect, card))
  348. {
  349. return true;
  350. }
  351. return false;
  352. }
  353. }
  354. #endregion
  355. #region All Turns - Cannot Suspend
  356. if (timing == EffectTiming.None)
  357. {
  358. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  359. canNotSuspendClass.SetUpICardEffect("Can't be suspended", ImmunityAndNoSuspendCondition, card);
  360. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  361. cardEffects.Add(canNotSuspendClass);
  362. bool PermanentCondition(Permanent permanent)
  363. {
  364. if (CardEffectCommons.IsExistOnBattleArea(card))
  365. {
  366. if (permanent == card.PermanentOfThisCard())
  367. {
  368. return true;
  369. }
  370. }
  371. return false;
  372. }
  373. }
  374. #endregion
  375. return cardEffects;
  376. }
  377. }
  378. }