BT15_100.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT15
  5. {
  6. public class BT15_100 : 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.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Delete 1 level 4 Digimon and 1 level 6 Digimon", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Trash] [All Turns] When one of your Digimon digivolves into [Leviamon (X Antibody)], by returning this card to the bottom of the deck, delete 1 of your opponent's level 4 and 1 of their level 6 Digimon.";
  20. }
  21. bool PermanentCondition(Permanent permanent)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  24. {
  25. if (permanent.TopCard.CardNames.Contains("Leviamon (X Antibody)"))
  26. {
  27. return true;
  28. }
  29. if (permanent.TopCard.CardNames.Contains("Leviamon(XAntibody)"))
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanSelectLevel4Condition(Permanent permanent)
  37. {
  38. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  39. {
  40. if (permanent.TopCard.HasLevel)
  41. {
  42. if (permanent.Level == 4)
  43. {
  44. return true;
  45. }
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanSelectLevel6Condition(Permanent permanent)
  51. {
  52. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  53. {
  54. if (permanent.TopCard.HasLevel)
  55. {
  56. if (permanent.Level == 6)
  57. {
  58. return true;
  59. }
  60. }
  61. }
  62. return false;
  63. }
  64. bool CanUseCondition(Hashtable hashtable)
  65. {
  66. if (CardEffectCommons.IsExistOnTrash(card))
  67. {
  68. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition))
  69. {
  70. return true;
  71. }
  72. }
  73. return false;
  74. }
  75. bool CanActivateCondition(Hashtable hashtable)
  76. {
  77. return CardEffectCommons.IsExistOnTrash(card);
  78. }
  79. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  80. {
  81. if (CardEffectCommons.IsExistOnTrash(card))
  82. {
  83. List<CardSource> cardSources = new List<CardSource>() { card };
  84. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources));
  85. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect2(cardSources, "Deck Bottom Card", true, true));
  86. List<Permanent> selectedPermanents = new List<Permanent>();
  87. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectLevel4Condition))
  88. {
  89. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectLevel4Condition));
  90. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  91. selectPermanentEffect.SetUp(
  92. selectPlayer: card.Owner,
  93. canTargetCondition: CanSelectLevel4Condition,
  94. canTargetCondition_ByPreSelecetedList: null,
  95. canEndSelectCondition: null,
  96. maxCount: maxCount,
  97. canNoSelect: false,
  98. canEndNotMax: false,
  99. selectPermanentCoroutine: SelectPermanentCoroutine,
  100. afterSelectPermanentCoroutine: null,
  101. mode: SelectPermanentEffect.Mode.Custom,
  102. cardEffect: activateClass);
  103. selectPermanentEffect.SetUpCustomMessage("Select 1 level 4 Digimon to delete.", "The opponent is selecting 1 level 4 Digimon to delete.");
  104. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  105. }
  106. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectLevel6Condition))
  107. {
  108. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectLevel6Condition));
  109. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  110. selectPermanentEffect.SetUp(
  111. selectPlayer: card.Owner,
  112. canTargetCondition: CanSelectLevel6Condition,
  113. canTargetCondition_ByPreSelecetedList: null,
  114. canEndSelectCondition: null,
  115. maxCount: maxCount,
  116. canNoSelect: false,
  117. canEndNotMax: false,
  118. selectPermanentCoroutine: SelectPermanentCoroutine,
  119. afterSelectPermanentCoroutine: null,
  120. mode: SelectPermanentEffect.Mode.Custom,
  121. cardEffect: activateClass);
  122. selectPermanentEffect.SetUpCustomMessage("Select 1 level 6 Digimon to delete.", "The opponent is selecting 1 level 6 Digimon to delete.");
  123. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  124. }
  125. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  126. {
  127. selectedPermanents.Add(permanent);
  128. yield return null;
  129. }
  130. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
  131. selectedPermanents,
  132. CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  133. }
  134. }
  135. }
  136. if (timing == EffectTiming.OptionSkill)
  137. {
  138. ActivateClass activateClass = new ActivateClass();
  139. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  140. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  141. cardEffects.Add(activateClass);
  142. string EffectDiscription()
  143. {
  144. return "[Main] By trashing 1 card in your hand, delete 1 of your opponent's level 4 and 1 of their level 6 Digimon.";
  145. }
  146. bool CanSelectPermanentCondition(Permanent permanent)
  147. {
  148. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  149. {
  150. if (permanent.TopCard.HasLevel)
  151. {
  152. if (permanent.Level == 4)
  153. {
  154. return true;
  155. }
  156. }
  157. }
  158. return false;
  159. }
  160. bool CanSelectPermanentCondition1(Permanent permanent)
  161. {
  162. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  163. {
  164. if (permanent.TopCard.HasLevel)
  165. {
  166. if (permanent.Level == 6)
  167. {
  168. return true;
  169. }
  170. }
  171. }
  172. return false;
  173. }
  174. bool CanUseCondition(Hashtable hashtable)
  175. {
  176. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  177. }
  178. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  179. {
  180. if (card.Owner.HandCards.Count >= 1)
  181. {
  182. bool discarded = false;
  183. int discardCount = 1;
  184. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  185. selectHandEffect.SetUp(
  186. selectPlayer: card.Owner,
  187. canTargetCondition: cardSource => true,
  188. canTargetCondition_ByPreSelecetedList: null,
  189. canEndSelectCondition: null,
  190. maxCount: discardCount,
  191. canNoSelect: true,
  192. canEndNotMax: false,
  193. isShowOpponent: true,
  194. selectCardCoroutine: null,
  195. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  196. mode: SelectHandEffect.Mode.Discard,
  197. cardEffect: activateClass);
  198. yield return StartCoroutine(selectHandEffect.Activate());
  199. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  200. {
  201. if (cardSources.Count == 1)
  202. {
  203. discarded = true;
  204. yield return null;
  205. }
  206. }
  207. if (discarded)
  208. {
  209. List<Permanent> selectedPermanents = new List<Permanent>();
  210. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  211. {
  212. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  213. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  214. selectPermanentEffect.SetUp(
  215. selectPlayer: card.Owner,
  216. canTargetCondition: CanSelectPermanentCondition,
  217. canTargetCondition_ByPreSelecetedList: null,
  218. canEndSelectCondition: null,
  219. maxCount: maxCount,
  220. canNoSelect: false,
  221. canEndNotMax: false,
  222. selectPermanentCoroutine: SelectPermanentCoroutine,
  223. afterSelectPermanentCoroutine: null,
  224. mode: SelectPermanentEffect.Mode.Custom,
  225. cardEffect: activateClass);
  226. selectPermanentEffect.SetUpCustomMessage("Select 1 level 4 Digimon to delete.", "The opponent is selecting 1 level 4 Digimon to delete.");
  227. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  228. }
  229. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  230. {
  231. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  232. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  233. selectPermanentEffect.SetUp(
  234. selectPlayer: card.Owner,
  235. canTargetCondition: CanSelectPermanentCondition1,
  236. canTargetCondition_ByPreSelecetedList: null,
  237. canEndSelectCondition: null,
  238. maxCount: maxCount,
  239. canNoSelect: false,
  240. canEndNotMax: false,
  241. selectPermanentCoroutine: SelectPermanentCoroutine,
  242. afterSelectPermanentCoroutine: null,
  243. mode: SelectPermanentEffect.Mode.Custom,
  244. cardEffect: activateClass);
  245. selectPermanentEffect.SetUpCustomMessage("Select 1 level 6 Digimon to delete.", "The opponent is selecting 1 level 6 Digimon to delete.");
  246. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  247. }
  248. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  249. {
  250. selectedPermanents.Add(permanent);
  251. yield return null;
  252. }
  253. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
  254. selectedPermanents,
  255. CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  256. }
  257. }
  258. }
  259. }
  260. if (timing == EffectTiming.SecuritySkill)
  261. {
  262. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Trash 1 card from hand to delete 1 level 4 Digimon and 1 level 6 Digimon");
  263. }
  264. return cardEffects;
  265. }
  266. }
  267. }