BT19_074.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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_074 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel6 && targetPermanent.TopCard.ContainsCardName("Beelzemon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 4,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null));
  25. }
  26. #endregion
  27. #region Blast Digivolve
  28. if (timing == EffectTiming.OnCounterTiming)
  29. {
  30. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  31. }
  32. #endregion
  33. #region On Play
  34. if (timing == EffectTiming.OnEnterFieldAnyone)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect("Delete 1 level 6 or lower Digimon or delete 1 Digimon", CanUseCondition, card);
  38. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  39. cardEffects.Add(activateClass);
  40. string EffectDiscription()
  41. {
  42. return "[On Play] Delete 1 of your opponent's level 6 or lower Digimon. If you have 10 or more cards in your trash, delete 1 of their Digimon instead.";
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  47. }
  48. bool CanSelectPermanentCondition(Permanent permanent)
  49. {
  50. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  51. {
  52. if (permanent.TopCard.HasLevel && permanent.Level <= 6)
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. bool CanSelectPermanentCondition1(Permanent permanent)
  60. {
  61. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  62. }
  63. bool CanActivateCondition(Hashtable hashtable)
  64. {
  65. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  68. {
  69. if (card.Owner.TrashCards.Count >= 10)
  70. {
  71. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  72. {
  73. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  74. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  75. selectPermanentEffect.SetUp(
  76. selectPlayer: card.Owner,
  77. canTargetCondition: CanSelectPermanentCondition1,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. maxCount: maxCount,
  81. canNoSelect: false,
  82. canEndNotMax: false,
  83. selectPermanentCoroutine: null,
  84. afterSelectPermanentCoroutine: null,
  85. mode: SelectPermanentEffect.Mode.Destroy,
  86. cardEffect: activateClass);
  87. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  88. }
  89. }
  90. else
  91. {
  92. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  93. {
  94. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  95. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  96. selectPermanentEffect.SetUp(
  97. selectPlayer: card.Owner,
  98. canTargetCondition: CanSelectPermanentCondition,
  99. canTargetCondition_ByPreSelecetedList: null,
  100. canEndSelectCondition: null,
  101. maxCount: maxCount,
  102. canNoSelect: false,
  103. canEndNotMax: false,
  104. selectPermanentCoroutine: null,
  105. afterSelectPermanentCoroutine: null,
  106. mode: SelectPermanentEffect.Mode.Destroy,
  107. cardEffect: activateClass);
  108. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  109. }
  110. }
  111. }
  112. }
  113. #endregion
  114. #region When Digivolving
  115. if (timing == EffectTiming.OnEnterFieldAnyone)
  116. {
  117. ActivateClass activateClass = new ActivateClass();
  118. activateClass.SetUpICardEffect("Delete 1 level 6 or lower Digimon or delete 1 Digimon", CanUseCondition, card);
  119. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  120. cardEffects.Add(activateClass);
  121. string EffectDiscription()
  122. {
  123. return "[When Digivolving] Delete 1 of your opponent's level 6 or lower Digimon. If you have 10 or more cards in your trash, delete 1 of their Digimon instead.";
  124. }
  125. bool CanUseCondition(Hashtable hashtable)
  126. {
  127. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  128. {
  129. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  130. {
  131. return true;
  132. }
  133. }
  134. return false;
  135. }
  136. bool CanSelectPermanentCondition(Permanent permanent)
  137. {
  138. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  139. {
  140. if (permanent.TopCard.HasLevel && permanent.Level <= 6)
  141. {
  142. return true;
  143. }
  144. }
  145. return false;
  146. }
  147. bool CanSelectPermanentCondition1(Permanent permanent)
  148. {
  149. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  150. }
  151. bool CanActivateCondition(Hashtable hashtable)
  152. {
  153. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  154. }
  155. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  156. {
  157. if (card.Owner.TrashCards.Count >= 10)
  158. {
  159. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  160. {
  161. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  162. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  163. selectPermanentEffect.SetUp(
  164. selectPlayer: card.Owner,
  165. canTargetCondition: CanSelectPermanentCondition1,
  166. canTargetCondition_ByPreSelecetedList: null,
  167. canEndSelectCondition: null,
  168. maxCount: maxCount,
  169. canNoSelect: false,
  170. canEndNotMax: false,
  171. selectPermanentCoroutine: null,
  172. afterSelectPermanentCoroutine: null,
  173. mode: SelectPermanentEffect.Mode.Destroy,
  174. cardEffect: activateClass);
  175. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  176. }
  177. }
  178. else
  179. {
  180. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  181. {
  182. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  183. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  184. selectPermanentEffect.SetUp(
  185. selectPlayer: card.Owner,
  186. canTargetCondition: CanSelectPermanentCondition,
  187. canTargetCondition_ByPreSelecetedList: null,
  188. canEndSelectCondition: null,
  189. maxCount: maxCount,
  190. canNoSelect: false,
  191. canEndNotMax: false,
  192. selectPermanentCoroutine: null,
  193. afterSelectPermanentCoroutine: null,
  194. mode: SelectPermanentEffect.Mode.Destroy,
  195. cardEffect: activateClass);
  196. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  197. }
  198. }
  199. }
  200. }
  201. #endregion
  202. #region When Attacking
  203. if (timing == EffectTiming.OnAllyAttack)
  204. {
  205. ActivateClass activateClass = new ActivateClass();
  206. activateClass.SetUpICardEffect("Return cards from trash to trash the opponent's top security card", CanUseCondition, card);
  207. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  208. activateClass.SetHashString("ReturnCards_BT19_074");
  209. cardEffects.Add(activateClass);
  210. string EffectDiscription()
  211. {
  212. return "[When Attacking][Once Per Turn] By returning 10 non-Digi-Egg cards from your trash to the top of the deck, trash your opponent's top security card.";
  213. }
  214. bool CanSelectCardCondition(CardSource cardSource)
  215. {
  216. return !cardSource.IsDigiEgg;
  217. }
  218. bool CanUseCondition(Hashtable hashtable)
  219. {
  220. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  221. }
  222. bool CanActivateCondition(Hashtable hashtable)
  223. {
  224. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  225. {
  226. if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 10)
  227. {
  228. return true;
  229. }
  230. }
  231. return false;
  232. }
  233. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  234. {
  235. int maxCount = 10;
  236. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  237. selectCardEffect.SetUp(
  238. canTargetCondition: (cardSource) => CanSelectCardCondition(cardSource),
  239. canTargetCondition_ByPreSelecetedList: null,
  240. canEndSelectCondition: null,
  241. canNoSelect: () => true,
  242. selectCardCoroutine: null,
  243. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  244. message: "Select cards to place at the top of the deck\n(cards will be placed back to the top of the deck so that cards with lower numbers are on top).",
  245. maxCount: maxCount,
  246. canEndNotMax: false,
  247. isShowOpponent: false,
  248. mode: SelectCardEffect.Mode.Custom,
  249. root: SelectCardEffect.Root.Trash,
  250. customRootCardList: null,
  251. canLookReverseCard: true,
  252. selectPlayer: card.Owner,
  253. cardEffect: activateClass);
  254. selectCardEffect.SetNotAddLog();
  255. selectCardEffect.SetUpCustomMessage_ShowCard("Deck Top Cards");
  256. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  257. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  258. {
  259. if (cardSources.Count == 10)
  260. {
  261. cardSources.Reverse();
  262. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryTopCards(cardSources));
  263. if (card.Owner.Enemy.SecurityCards.Count >= 1)
  264. {
  265. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  266. player: card.Owner.Enemy,
  267. destroySecurityCount: 1,
  268. cardEffect: activateClass,
  269. fromTop: true).DestroySecurity());
  270. }
  271. }
  272. }
  273. }
  274. }
  275. #endregion
  276. return cardEffects;
  277. }
  278. }
  279. }