BT14_067.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT14
  5. {
  6. public class BT14_067 : 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("Reveal the top 3 cards of opponent's deck", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] Your opponent reveals the top 3 cards of their deck. Choose 1 Digimon card among them, and delete up to its play cost's total worth of your opponent's Digimon. Return the revealed cards to the top or bottom of the deck.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. return cardSource.IsDigimon;
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. if (CardEffectCommons.IsExistOnBattleArea(card))
  32. {
  33. if (card.Owner.Enemy.LibraryCards.Count >= 1)
  34. {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  41. {
  42. CardSource selectedCard = null;
  43. int maxCost = -1;
  44. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  45. revealCount: 3,
  46. simplifiedSelectCardConditions:
  47. new SimplifiedSelectCardConditionClass[]
  48. {
  49. new SimplifiedSelectCardConditionClass(
  50. canTargetCondition:CanSelectCardCondition,
  51. message: "Select 1 Digimon card.",
  52. mode: SelectCardEffect.Mode.Custom,
  53. maxCount: 1,
  54. selectCardCoroutine: selectCardCoroutine),
  55. },
  56. remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
  57. activateClass: activateClass,
  58. isSendAllCardsToSamePlace: true,
  59. isOpponentDeck: true
  60. ));
  61. IEnumerator selectCardCoroutine(CardSource cardSource)
  62. {
  63. selectedCard = cardSource;
  64. yield return null;
  65. }
  66. if (selectedCard != null)
  67. {
  68. if (selectedCard.HasPlayCost)
  69. {
  70. maxCost = selectedCard.GetCostItself;
  71. }
  72. }
  73. if (maxCost >= 0)
  74. {
  75. bool CanSelectPermanentCondition(Permanent permanent)
  76. {
  77. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  78. {
  79. if (permanent.TopCard.GetCostItself <= maxCost)
  80. {
  81. if (permanent.TopCard.HasPlayCost)
  82. {
  83. return true;
  84. }
  85. }
  86. }
  87. return false;
  88. }
  89. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  90. {
  91. int maxCount = card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition);
  92. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  93. selectPermanentEffect.SetUp(
  94. selectPlayer: card.Owner,
  95. canTargetCondition: CanSelectPermanentCondition,
  96. canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
  97. canEndSelectCondition: CanEndSelectCondition,
  98. maxCount: maxCount,
  99. canNoSelect: false,
  100. canEndNotMax: true,
  101. selectPermanentCoroutine: null,
  102. afterSelectPermanentCoroutine: null,
  103. mode: SelectPermanentEffect.Mode.Destroy,
  104. cardEffect: activateClass);
  105. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  106. bool CanEndSelectCondition(List<Permanent> permanents)
  107. {
  108. if (permanents.Count <= 0)
  109. {
  110. return false;
  111. }
  112. int sumCost = 0;
  113. foreach (Permanent permanent1 in permanents)
  114. {
  115. sumCost += permanent1.TopCard.GetCostItself;
  116. }
  117. if (sumCost > maxCost)
  118. {
  119. return false;
  120. }
  121. return true;
  122. }
  123. bool CanTargetCondition_ByPreSelecetedList(List<Permanent> permanents, Permanent permanent)
  124. {
  125. int sumCost = 0;
  126. foreach (Permanent permanent1 in permanents)
  127. {
  128. sumCost += permanent1.TopCard.GetCostItself;
  129. }
  130. sumCost += permanent.TopCard.GetCostItself;
  131. if (sumCost > maxCost)
  132. {
  133. return false;
  134. }
  135. return true;
  136. }
  137. }
  138. }
  139. }
  140. }
  141. if (timing == EffectTiming.OnEnterFieldAnyone)
  142. {
  143. ActivateClass activateClass = new ActivateClass();
  144. activateClass.SetUpICardEffect("Reveal the top 3 cards of opponent's deck", CanUseCondition, card);
  145. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  146. cardEffects.Add(activateClass);
  147. string EffectDiscription()
  148. {
  149. return "[When Digivolving] Your opponent reveals the top 3 cards of their deck. Choose 1 Digimon card among them, and delete up to its play cost's total worth of your opponent's Digimon. Return the revealed cards to the top or bottom of the deck.";
  150. }
  151. bool CanSelectCardCondition(CardSource cardSource)
  152. {
  153. return cardSource.IsDigimon;
  154. }
  155. bool CanUseCondition(Hashtable hashtable)
  156. {
  157. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  158. }
  159. bool CanActivateCondition(Hashtable hashtable)
  160. {
  161. if (CardEffectCommons.IsExistOnBattleArea(card))
  162. {
  163. if (card.Owner.Enemy.LibraryCards.Count >= 1)
  164. {
  165. return true;
  166. }
  167. }
  168. return false;
  169. }
  170. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  171. {
  172. CardSource selectedCard = null;
  173. int maxCost = -1;
  174. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  175. revealCount: 3,
  176. simplifiedSelectCardConditions:
  177. new SimplifiedSelectCardConditionClass[]
  178. {
  179. new SimplifiedSelectCardConditionClass(
  180. canTargetCondition:CanSelectCardCondition,
  181. message: "Select 1 Digimon card.",
  182. mode: SelectCardEffect.Mode.Custom,
  183. maxCount: 1,
  184. selectCardCoroutine: selectCardCoroutine),
  185. },
  186. remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
  187. activateClass: activateClass,
  188. isSendAllCardsToSamePlace: true,
  189. isOpponentDeck: true
  190. ));
  191. IEnumerator selectCardCoroutine(CardSource cardSource)
  192. {
  193. selectedCard = cardSource;
  194. yield return null;
  195. }
  196. if (selectedCard != null)
  197. {
  198. if (selectedCard.HasPlayCost)
  199. {
  200. maxCost = selectedCard.GetCostItself;
  201. }
  202. }
  203. if (maxCost >= 0)
  204. {
  205. bool CanSelectPermanentCondition(Permanent permanent)
  206. {
  207. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  208. {
  209. if (permanent.TopCard.GetCostItself <= maxCost)
  210. {
  211. if (permanent.TopCard.HasPlayCost)
  212. {
  213. return true;
  214. }
  215. }
  216. }
  217. return false;
  218. }
  219. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  220. {
  221. int maxCount = card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition);
  222. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  223. selectPermanentEffect.SetUp(
  224. selectPlayer: card.Owner,
  225. canTargetCondition: CanSelectPermanentCondition,
  226. canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
  227. canEndSelectCondition: CanEndSelectCondition,
  228. maxCount: maxCount,
  229. canNoSelect: false,
  230. canEndNotMax: true,
  231. selectPermanentCoroutine: null,
  232. afterSelectPermanentCoroutine: null,
  233. mode: SelectPermanentEffect.Mode.Destroy,
  234. cardEffect: activateClass);
  235. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  236. bool CanEndSelectCondition(List<Permanent> permanents)
  237. {
  238. if (permanents.Count <= 0)
  239. {
  240. return false;
  241. }
  242. int sumCost = 0;
  243. foreach (Permanent permanent1 in permanents)
  244. {
  245. sumCost += permanent1.TopCard.GetCostItself;
  246. }
  247. if (sumCost > maxCost)
  248. {
  249. return false;
  250. }
  251. return true;
  252. }
  253. bool CanTargetCondition_ByPreSelecetedList(List<Permanent> permanents, Permanent permanent)
  254. {
  255. int sumCost = 0;
  256. foreach (Permanent permanent1 in permanents)
  257. {
  258. sumCost += permanent1.TopCard.GetCostItself;
  259. }
  260. sumCost += permanent.TopCard.GetCostItself;
  261. if (sumCost > maxCost)
  262. {
  263. return false;
  264. }
  265. return true;
  266. }
  267. }
  268. }
  269. }
  270. }
  271. return cardEffects;
  272. }
  273. }
  274. }