BT13_111.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT13
  6. {
  7. public class BT13_111 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. int count()
  15. {
  16. return 2 * ((card.Owner.TrashCards.Count + card.Owner.Enemy.TrashCards.Count) / 5);
  17. }
  18. ChangeCostClass changeCostClass = new ChangeCostClass();
  19. changeCostClass.SetUpICardEffect($"Play Cost -", CanUseCondition, card);
  20. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  21. cardEffects.Add(changeCostClass);
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. if (card.Owner.HandCards.Contains(card))
  25. {
  26. if (count() >= 1)
  27. {
  28. if (card.Owner.GetBattleAreaDigimons().Count == 0)
  29. {
  30. changeCostClass.SetEffectName($"Play Cost -{count()}");
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  38. {
  39. if (CardSourceCondition(cardSource))
  40. {
  41. if (RootCondition(root))
  42. {
  43. if (PermanentsCondition(targetPermanents))
  44. {
  45. Cost -= count();
  46. }
  47. }
  48. }
  49. return Cost;
  50. }
  51. bool PermanentsCondition(List<Permanent> targetPermanents)
  52. {
  53. if (targetPermanents == null)
  54. {
  55. return true;
  56. }
  57. else
  58. {
  59. if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
  60. {
  61. return true;
  62. }
  63. }
  64. return false;
  65. }
  66. bool CardSourceCondition(CardSource cardSource)
  67. {
  68. return cardSource == card;
  69. }
  70. bool RootCondition(SelectCardEffect.Root root)
  71. {
  72. if (root == SelectCardEffect.Root.Hand)
  73. {
  74. return true;
  75. }
  76. return false;
  77. }
  78. bool isUpDown()
  79. {
  80. return true;
  81. }
  82. }
  83. if (timing == EffectTiming.None)
  84. {
  85. cardEffects.Add(CardEffectFactory.RushSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  86. }
  87. if (timing == EffectTiming.OnEnterFieldAnyone)
  88. {
  89. ActivateClass activateClass = new ActivateClass();
  90. activateClass.SetUpICardEffect("Delete 1 Digimon with 6000 DP or less, or delete 1 Digimon with 13000 DP or more", CanUseCondition, card);
  91. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  92. cardEffects.Add(activateClass);
  93. string EffectDiscription()
  94. {
  95. return "[On Play] Delete 1 of your opponent's Digimon with 6000 DP or less. If no opponent's Digimon was deleted by this effect, delete 1 of their Digimon with 13000 DP or more.";
  96. }
  97. bool CanSelectPermanentCondition(Permanent permanent)
  98. {
  99. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  100. {
  101. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  102. {
  103. return true;
  104. }
  105. }
  106. return false;
  107. }
  108. bool CanSelectPermanentCondition1(Permanent permanent)
  109. {
  110. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  111. {
  112. if (permanent.DP >= 13000)
  113. {
  114. return true;
  115. }
  116. }
  117. return false;
  118. }
  119. bool CanUseCondition(Hashtable hashtable)
  120. {
  121. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  122. }
  123. bool CanActivateCondition(Hashtable hashtable)
  124. {
  125. if (CardEffectCommons.IsExistOnBattleArea(card))
  126. {
  127. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  128. {
  129. return true;
  130. }
  131. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  132. {
  133. return true;
  134. }
  135. }
  136. return false;
  137. }
  138. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  139. {
  140. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  141. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  142. {
  143. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  144. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  145. selectPermanentEffect.SetUp(
  146. selectPlayer: card.Owner,
  147. canTargetCondition: CanSelectPermanentCondition,
  148. canTargetCondition_ByPreSelecetedList: null,
  149. canEndSelectCondition: null,
  150. maxCount: maxCount,
  151. canNoSelect: false,
  152. canEndNotMax: false,
  153. selectPermanentCoroutine: null,
  154. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  155. mode: SelectPermanentEffect.Mode.Custom,
  156. cardEffect: activateClass);
  157. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  158. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  159. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  160. {
  161. deleteTargetPermanents = permanents.Clone();
  162. yield return null;
  163. }
  164. }
  165. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  166. IEnumerator FailureProcess()
  167. {
  168. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  169. {
  170. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  171. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  172. selectPermanentEffect.SetUp(
  173. selectPlayer: card.Owner,
  174. canTargetCondition: CanSelectPermanentCondition1,
  175. canTargetCondition_ByPreSelecetedList: null,
  176. canEndSelectCondition: null,
  177. maxCount: maxCount,
  178. canNoSelect: false,
  179. canEndNotMax: false,
  180. selectPermanentCoroutine: null,
  181. afterSelectPermanentCoroutine: null,
  182. mode: SelectPermanentEffect.Mode.Destroy,
  183. cardEffect: activateClass);
  184. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  185. }
  186. }
  187. }
  188. }
  189. if (timing == EffectTiming.OnEnterFieldAnyone)
  190. {
  191. ActivateClass activateClass = new ActivateClass();
  192. activateClass.SetUpICardEffect("Delete 1 Digimon with 6000 DP or less, or delete 1 Digimon with 13000 DP or more", CanUseCondition, card);
  193. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  194. cardEffects.Add(activateClass);
  195. string EffectDiscription()
  196. {
  197. return "[When Digivolving] Delete 1 of your opponent's Digimon with 6000 DP or less. If no opponent's Digimon was deleted by this effect, delete 1 of their Digimon with 13000 DP or more.";
  198. }
  199. bool CanSelectPermanentCondition(Permanent permanent)
  200. {
  201. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  202. {
  203. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  204. {
  205. return true;
  206. }
  207. }
  208. return false;
  209. }
  210. bool CanSelectPermanentCondition1(Permanent permanent)
  211. {
  212. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  213. {
  214. if (permanent.DP >= 13000)
  215. {
  216. return true;
  217. }
  218. }
  219. return false;
  220. }
  221. bool CanUseCondition(Hashtable hashtable)
  222. {
  223. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  224. }
  225. bool CanActivateCondition(Hashtable hashtable)
  226. {
  227. if (CardEffectCommons.IsExistOnBattleArea(card))
  228. {
  229. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  230. {
  231. return true;
  232. }
  233. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  234. {
  235. return true;
  236. }
  237. }
  238. return false;
  239. }
  240. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  241. {
  242. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  243. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  244. {
  245. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  246. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  247. selectPermanentEffect.SetUp(
  248. selectPlayer: card.Owner,
  249. canTargetCondition: CanSelectPermanentCondition,
  250. canTargetCondition_ByPreSelecetedList: null,
  251. canEndSelectCondition: null,
  252. maxCount: maxCount,
  253. canNoSelect: false,
  254. canEndNotMax: false,
  255. selectPermanentCoroutine: null,
  256. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  257. mode: SelectPermanentEffect.Mode.Custom,
  258. cardEffect: activateClass);
  259. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  260. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  261. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  262. {
  263. deleteTargetPermanents = permanents.Clone();
  264. yield return null;
  265. }
  266. }
  267. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  268. IEnumerator FailureProcess()
  269. {
  270. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  271. {
  272. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  273. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  274. selectPermanentEffect.SetUp(
  275. selectPlayer: card.Owner,
  276. canTargetCondition: CanSelectPermanentCondition1,
  277. canTargetCondition_ByPreSelecetedList: null,
  278. canEndSelectCondition: null,
  279. maxCount: maxCount,
  280. canNoSelect: false,
  281. canEndNotMax: false,
  282. selectPermanentCoroutine: null,
  283. afterSelectPermanentCoroutine: null,
  284. mode: SelectPermanentEffect.Mode.Destroy,
  285. cardEffect: activateClass);
  286. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  287. }
  288. }
  289. }
  290. }
  291. if (timing == EffectTiming.OnAllyAttack)
  292. {
  293. ActivateClass activateClass = new ActivateClass();
  294. activateClass.SetUpICardEffect("Delete 1 Digimon with 6000 DP or less, or delete 1 Digimon with 13000 DP or more", CanUseCondition, card);
  295. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  296. cardEffects.Add(activateClass);
  297. string EffectDiscription()
  298. {
  299. return "[When Attacking] Delete 1 of your opponent's Digimon with 6000 DP or less. If no opponent's Digimon was deleted by this effect, delete 1 of their Digimon with 13000 DP or more.";
  300. }
  301. bool CanSelectPermanentCondition(Permanent permanent)
  302. {
  303. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  304. {
  305. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  306. {
  307. return true;
  308. }
  309. }
  310. return false;
  311. }
  312. bool CanSelectPermanentCondition1(Permanent permanent)
  313. {
  314. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  315. {
  316. if (permanent.DP >= 13000)
  317. {
  318. return true;
  319. }
  320. }
  321. return false;
  322. }
  323. bool CanUseCondition(Hashtable hashtable)
  324. {
  325. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  326. }
  327. bool CanActivateCondition(Hashtable hashtable)
  328. {
  329. if (CardEffectCommons.IsExistOnBattleArea(card))
  330. {
  331. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  332. {
  333. return true;
  334. }
  335. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  336. {
  337. return true;
  338. }
  339. }
  340. return false;
  341. }
  342. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  343. {
  344. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  345. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  346. {
  347. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  348. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  349. selectPermanentEffect.SetUp(
  350. selectPlayer: card.Owner,
  351. canTargetCondition: CanSelectPermanentCondition,
  352. canTargetCondition_ByPreSelecetedList: null,
  353. canEndSelectCondition: null,
  354. maxCount: maxCount,
  355. canNoSelect: false,
  356. canEndNotMax: false,
  357. selectPermanentCoroutine: null,
  358. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  359. mode: SelectPermanentEffect.Mode.Custom,
  360. cardEffect: activateClass);
  361. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  362. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  363. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  364. {
  365. deleteTargetPermanents = permanents.Clone();
  366. yield return null;
  367. }
  368. }
  369. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  370. IEnumerator FailureProcess()
  371. {
  372. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  373. {
  374. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  375. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  376. selectPermanentEffect.SetUp(
  377. selectPlayer: card.Owner,
  378. canTargetCondition: CanSelectPermanentCondition1,
  379. canTargetCondition_ByPreSelecetedList: null,
  380. canEndSelectCondition: null,
  381. maxCount: maxCount,
  382. canNoSelect: false,
  383. canEndNotMax: false,
  384. selectPermanentCoroutine: null,
  385. afterSelectPermanentCoroutine: null,
  386. mode: SelectPermanentEffect.Mode.Destroy,
  387. cardEffect: activateClass);
  388. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  389. }
  390. }
  391. }
  392. }
  393. return cardEffects;
  394. }
  395. }
  396. }