BT21_058.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. //Snatchmon
  7. public class BT21_058 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region On Play
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Reveal 3, add 1 [Vemmon] in text, trash rest, place up to 2 [Vemmon] from trash as 1 Digimon bottom evo cards", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] Reveal the top 3 cards of your deck. Add 1 card with [Vemmon] in its text among them to the hand. Trash the rest. Then, you may place up to 2 [Vemmon] from your trash as 1 of your Digimon's bottom digivolution cards.";
  22. }
  23. bool HasVemmonInText(CardSource cardSource)
  24. {
  25. return cardSource.HasText("Vemmon");
  26. }
  27. bool IsVemmon(CardSource cardSource)
  28. {
  29. return cardSource.EqualsCardName("Vemmon");
  30. }
  31. bool HasDigimonOnOwnerBattleArea(Permanent permanent)
  32. {
  33. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable hashtable)
  44. {
  45. List<CardSource> selectedCards = new List<CardSource>();
  46. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  47. revealCount: 3,
  48. simplifiedSelectCardConditions:
  49. new SimplifiedSelectCardConditionClass[]
  50. {
  51. new SimplifiedSelectCardConditionClass(
  52. canTargetCondition:HasVemmonInText,
  53. message: "Select 1 card with [Vemmon] in text.",
  54. mode: SelectCardEffect.Mode.AddHand,
  55. maxCount: 1,
  56. selectCardCoroutine: null),
  57. },
  58. remainingCardsPlace: RemainingCardsPlace.Trash,
  59. activateClass: activateClass,
  60. canNoSelect: false
  61. ));
  62. List<CardSource> selectedCardsFromTrash = new List<CardSource>();
  63. IEnumerator SelectCardCoroutine(CardSource cardSource)
  64. {
  65. selectedCardsFromTrash.Add(cardSource);
  66. yield return null;
  67. }
  68. int maxCountFromTrash = 2;
  69. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  70. selectCardEffect.SetUp(
  71. canTargetCondition: IsVemmon,
  72. canTargetCondition_ByPreSelecetedList: null,
  73. canEndSelectCondition: null,
  74. canNoSelect: () => true,
  75. selectCardCoroutine: SelectCardCoroutine,
  76. afterSelectCardCoroutine: null,
  77. message: "Select up to 2 cards to place on bottom of digivolution cards.",
  78. maxCount: maxCountFromTrash,
  79. canEndNotMax: true,
  80. isShowOpponent: true,
  81. mode: SelectCardEffect.Mode.Custom,
  82. root: SelectCardEffect.Root.Trash,
  83. customRootCardList: null,
  84. canLookReverseCard: true,
  85. selectPlayer: card.Owner,
  86. cardEffect: activateClass);
  87. selectCardEffect.SetUpCustomMessage("Select up to 2 cards to place on bottom of digivolution cards.", "The opponent is selecting up to 2 cards to place on bottom of digivolution cards.");
  88. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  89. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  90. if (selectedCardsFromTrash.Count >= 1)
  91. {
  92. if (CardEffectCommons.HasMatchConditionPermanent(HasDigimonOnOwnerBattleArea))
  93. {
  94. int maxCountReceiverDigimon = 1;
  95. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  96. selectPermanentEffect.SetUp(
  97. selectPlayer: card.Owner,
  98. canTargetCondition: HasDigimonOnOwnerBattleArea,
  99. canTargetCondition_ByPreSelecetedList: null,
  100. canEndSelectCondition: null,
  101. maxCount: maxCountReceiverDigimon,
  102. canNoSelect: true,
  103. canEndNotMax: false,
  104. selectPermanentCoroutine: SelectPermanentCoroutine,
  105. afterSelectPermanentCoroutine: null,
  106. mode: SelectPermanentEffect.Mode.Custom,
  107. cardEffect: activateClass);
  108. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get the digivolution card(s).", "The opponent is selecting 1 Digimon that will get the digivolution card(s).");
  109. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  110. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  111. {
  112. Permanent selectedPermanent = permanent;
  113. if (selectedPermanent != null)
  114. {
  115. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(selectedCardsFromTrash, activateClass));
  116. }
  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("Reveal 3, add 1 [Vemmon] in text, trash rest, place up to 2 [Vemmon] from trash as 1 Digimon bottom evo cards", CanUseCondition, card);
  128. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  129. cardEffects.Add(activateClass);
  130. string EffectDiscription()
  131. {
  132. return "[When Digivolving] Reveal the top 3 cards of your deck. Add 1 card with [Vemmon] in its text among them to the hand. Trash the rest. Then, you may place up to 2 [Vemmon] from your trash as 1 of your Digimon's bottom digivolution cards.";
  133. }
  134. bool HasVemmonInText(CardSource cardSource)
  135. {
  136. return cardSource.HasText("Vemmon");
  137. }
  138. bool IsVemmon(CardSource cardSource)
  139. {
  140. return cardSource.EqualsCardName("Vemmon");
  141. }
  142. bool HasDigimonOnOwnerBattleArea(Permanent permanent)
  143. {
  144. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  145. }
  146. bool CanUseCondition(Hashtable hashtable)
  147. {
  148. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  149. }
  150. bool CanActivateCondition(Hashtable hashtable)
  151. {
  152. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  153. }
  154. IEnumerator ActivateCoroutine(Hashtable hashtable)
  155. {
  156. List<CardSource> selectedCards = new List<CardSource>();
  157. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  158. revealCount: 3,
  159. simplifiedSelectCardConditions:
  160. new SimplifiedSelectCardConditionClass[]
  161. {
  162. new SimplifiedSelectCardConditionClass(
  163. canTargetCondition:HasVemmonInText,
  164. message: "Select 1 card with [Vemmon] in text.",
  165. mode: SelectCardEffect.Mode.AddHand,
  166. maxCount: 1,
  167. selectCardCoroutine: null),
  168. },
  169. remainingCardsPlace: RemainingCardsPlace.Trash,
  170. activateClass: activateClass,
  171. canNoSelect: false
  172. ));
  173. List<CardSource> selectedCardsFromTrash = new List<CardSource>();
  174. IEnumerator SelectCardCoroutine(CardSource cardSource)
  175. {
  176. selectedCardsFromTrash.Add(cardSource);
  177. yield return null;
  178. }
  179. int maxCountFromTrash = 2;
  180. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  181. selectCardEffect.SetUp(
  182. canTargetCondition: IsVemmon,
  183. canTargetCondition_ByPreSelecetedList: null,
  184. canEndSelectCondition: null,
  185. canNoSelect: () => true,
  186. selectCardCoroutine: SelectCardCoroutine,
  187. afterSelectCardCoroutine: null,
  188. message: "Select up to 2 cards to place on bottom of digivolution cards.",
  189. maxCount: maxCountFromTrash,
  190. canEndNotMax: true,
  191. isShowOpponent: true,
  192. mode: SelectCardEffect.Mode.Custom,
  193. root: SelectCardEffect.Root.Trash,
  194. customRootCardList: null,
  195. canLookReverseCard: true,
  196. selectPlayer: card.Owner,
  197. cardEffect: activateClass);
  198. selectCardEffect.SetUpCustomMessage("Select up to 2 cards to place on bottom of digivolution cards.", "The opponent is selecting up to 2 cards to place on bottom of digivolution cards.");
  199. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  200. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  201. if (selectedCardsFromTrash.Count >= 1)
  202. {
  203. if (CardEffectCommons.HasMatchConditionPermanent(HasDigimonOnOwnerBattleArea))
  204. {
  205. int maxCountReceiverDigimon = 1;
  206. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  207. selectPermanentEffect.SetUp(
  208. selectPlayer: card.Owner,
  209. canTargetCondition: HasDigimonOnOwnerBattleArea,
  210. canTargetCondition_ByPreSelecetedList: null,
  211. canEndSelectCondition: null,
  212. maxCount: maxCountReceiverDigimon,
  213. canNoSelect: true,
  214. canEndNotMax: false,
  215. selectPermanentCoroutine: SelectPermanentCoroutine,
  216. afterSelectPermanentCoroutine: null,
  217. mode: SelectPermanentEffect.Mode.Custom,
  218. cardEffect: activateClass);
  219. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get the digivolution card(s).", "The opponent is selecting 1 Digimon that will get the digivolution card(s).");
  220. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  221. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  222. {
  223. Permanent selectedPermanent = permanent;
  224. if (selectedPermanent != null)
  225. {
  226. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(selectedCardsFromTrash, activateClass));
  227. }
  228. }
  229. }
  230. }
  231. }
  232. }
  233. #endregion
  234. #region All Turns Inherited
  235. if (timing == EffectTiming.OnDigivolutionCardReturnToDeckBottom)
  236. {
  237. ActivateClass activateClass = new ActivateClass();
  238. activateClass.SetUpICardEffect("Delete 1 opponent Digimon with play cost 4 or less", CanUseCondition, card);
  239. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  240. activateClass.SetIsInheritedEffect(true);
  241. activateClass.SetHashString("Delete_BT21_058");
  242. cardEffects.Add(activateClass);
  243. string EffectDiscription()
  244. {
  245. return "[All Turns] [Once Per Turn] When any [Vemmon] are returned to the bottom of the deck from this Digimon's digivolution cards, delete 1 of your opponent's Digimon with a play cost of 4 or less.";
  246. }
  247. bool CanSelectPermanentCondition(Permanent permanent)
  248. {
  249. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  250. {
  251. if (permanent.TopCard.HasPlayCost & permanent.TopCard.GetCostItself <= 4)
  252. {
  253. return true;
  254. }
  255. }
  256. return false;
  257. }
  258. bool CanUseCondition(Hashtable hashtable)
  259. {
  260. return CardEffectCommons.CanTriggerOnReturnToLibraryBottomDigivolutionCard(hashtable, cardSource => cardSource.EqualsCardName("Vemmon"), card);
  261. }
  262. bool CanActivateCondition(Hashtable hashtable)
  263. {
  264. return CardEffectCommons.IsExistOnBattleArea(card);
  265. }
  266. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  267. {
  268. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  269. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  270. selectPermanentEffect.SetUp(
  271. selectPlayer: card.Owner,
  272. canTargetCondition: CanSelectPermanentCondition,
  273. canTargetCondition_ByPreSelecetedList: null,
  274. canEndSelectCondition: null,
  275. maxCount: maxCount,
  276. canNoSelect: false,
  277. canEndNotMax: false,
  278. selectPermanentCoroutine: null,
  279. afterSelectPermanentCoroutine: null,
  280. mode: SelectPermanentEffect.Mode.Destroy,
  281. cardEffect: activateClass);
  282. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  283. }
  284. }
  285. #endregion
  286. return cardEffects;
  287. }
  288. }
  289. }