EX8_064.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX8
  6. {
  7. public class EX8_064 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region DNA Digivolution - Names
  13. if (timing == EffectTiming.None)
  14. {
  15. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  16. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  17. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  18. addJogressConditionClass.SetNotShowUI(true);
  19. cardEffects.Add(addJogressConditionClass);
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. return true;
  23. }
  24. JogressCondition GetJogress(CardSource cardSource)
  25. {
  26. if (cardSource == card)
  27. {
  28. bool PermanentConditionPiedmon(Permanent permanent)
  29. {
  30. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  31. {
  32. if (permanent.TopCard.CardNames.Contains("Piedmon"))
  33. {
  34. return true;
  35. }
  36. }
  37. return false;
  38. }
  39. bool PermanentConditionMyotismon(Permanent permanent)
  40. {
  41. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  42. {
  43. if (permanent.TopCard.CardNames.Contains("Myotismon"))
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. JogressConditionElement[] elements = new JogressConditionElement[]
  51. {
  52. new JogressConditionElement(PermanentConditionPiedmon, "Piedmon"),
  53. new JogressConditionElement(PermanentConditionMyotismon, "Myotismon"),
  54. };
  55. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  56. return jogressCondition;
  57. }
  58. return null;
  59. }
  60. }
  61. #endregion
  62. #region DNA Digivolution - Colors
  63. if (timing == EffectTiming.None)
  64. {
  65. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  66. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  67. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  68. addJogressConditionClass.SetNotShowUI(true);
  69. cardEffects.Add(addJogressConditionClass);
  70. bool CanUseCondition(Hashtable hashtable)
  71. {
  72. return true;
  73. }
  74. JogressCondition GetJogress(CardSource cardSource)
  75. {
  76. if (cardSource == card)
  77. {
  78. bool PermanentConditionPurpleBlack(Permanent permanent)
  79. {
  80. if (permanent != null)
  81. {
  82. if (permanent.TopCard != null)
  83. {
  84. if (permanent.TopCard.Owner == card.Owner)
  85. {
  86. if (permanent.IsDigimon)
  87. {
  88. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent,
  89. card))
  90. {
  91. if (permanent.TopCard.CardColors.Contains(CardColor.Purple) ||
  92. permanent.TopCard.CardColors.Contains(CardColor.Black))
  93. {
  94. if (permanent.Levels_ForJogress(card).Contains(6))
  95. {
  96. return true;
  97. }
  98. }
  99. }
  100. }
  101. }
  102. }
  103. }
  104. return false;
  105. }
  106. bool PermanentConditionYellowGreen(Permanent permanent)
  107. {
  108. if (permanent != null)
  109. {
  110. if (permanent.TopCard != null)
  111. {
  112. if (permanent.TopCard.Owner == card.Owner)
  113. {
  114. if (permanent.IsDigimon)
  115. {
  116. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent,
  117. card))
  118. {
  119. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow) ||
  120. permanent.TopCard.CardColors.Contains(CardColor.Green))
  121. {
  122. if (permanent.Levels_ForJogress(card).Contains(6))
  123. {
  124. return true;
  125. }
  126. }
  127. }
  128. }
  129. }
  130. }
  131. }
  132. return false;
  133. }
  134. JogressConditionElement[] elements =
  135. {
  136. new(PermanentConditionPurpleBlack, "a level 6 Purple or Black Digimon"),
  137. new(PermanentConditionYellowGreen, "a level 6 Yellow or Green Digimon")
  138. };
  139. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  140. return jogressCondition;
  141. }
  142. return null;
  143. }
  144. }
  145. #endregion
  146. #region When Digivolving
  147. if (timing == EffectTiming.OnEnterFieldAnyone)
  148. {
  149. ActivateClass activateClass = new ActivateClass();
  150. activateClass.SetUpICardEffect("De-Digivolve 3 on 1 Digimon and DP reduce. Then play digimon from the trash.", CanUseCondition, card);
  151. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  152. cardEffects.Add(activateClass);
  153. string EffectDescription()
  154. {
  155. return "[When Digivolving] <De-Digivolve 3> 1 of your opponent's Digimon and, for the turn, all of their Digimon get -6000 DP. Then, if DNA digivolving, you may play 10 cost's total worth of [NSo] trait Digimon cards from your trash without paying the cost.";
  156. }
  157. bool CanSelectPermanentForDeDigivolveCondition(Permanent permanent)
  158. {
  159. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  160. }
  161. bool CanUseCondition(Hashtable hashtable)
  162. {
  163. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  164. }
  165. bool CanActivateCondition(Hashtable hashtable)
  166. {
  167. if (CardEffectCommons.IsExistOnBattleArea(card))
  168. {
  169. return true;
  170. }
  171. return false;
  172. }
  173. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  174. {
  175. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentForDeDigivolveCondition))
  176. {
  177. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentForDeDigivolveCondition));
  178. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  179. selectPermanentEffect.SetUp(
  180. selectPlayer: card.Owner,
  181. canTargetCondition: CanSelectPermanentForDeDigivolveCondition,
  182. canTargetCondition_ByPreSelecetedList: null,
  183. canEndSelectCondition: null,
  184. maxCount: maxCount,
  185. canNoSelect: false,
  186. canEndNotMax: false,
  187. selectPermanentCoroutine: SelectPermanentCoroutine,
  188. afterSelectPermanentCoroutine: null,
  189. mode: SelectPermanentEffect.Mode.Custom,
  190. cardEffect: activateClass);
  191. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  192. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  193. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  194. {
  195. Permanent selectedPermanent = permanent;
  196. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 3, activateClass).Degeneration());
  197. }
  198. }
  199. bool PermanentCondition(Permanent permanent)
  200. {
  201. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  202. }
  203. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
  204. permanentCondition: PermanentCondition,
  205. changeValue: -6000,
  206. effectDuration: EffectDuration.UntilEachTurnEnd,
  207. activateClass: activateClass));
  208. if (CardEffectCommons.IsJogress(_hashtable))
  209. {
  210. const int maxCost = 10;
  211. bool CanSelectNSoDigimonCondition(CardSource cardSource)
  212. {
  213. return CardEffectCommons.CanPlayAsNewPermanent(
  214. cardSource: cardSource,
  215. payCost: false,
  216. cardEffect: activateClass) &&
  217. cardSource.GetCostItself <= maxCost &&
  218. cardSource.ContainsTraits("NSo");
  219. }
  220. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectNSoDigimonCondition))
  221. {
  222. List<CardSource> selectedCards = new List<CardSource>();
  223. int maxCount = CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, CanSelectNSoDigimonCondition);
  224. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  225. selectCardEffect.SetUp(
  226. canTargetCondition: CanSelectNSoDigimonCondition,
  227. canTargetCondition_ByPreSelecetedList: CanTargetCardCondition_ByPreSelecetedList,
  228. canEndSelectCondition: CanEndSelectCardCondition,
  229. canNoSelect: () => true,
  230. selectCardCoroutine: SelectCardCoroutine,
  231. afterSelectCardCoroutine: null,
  232. message: "Select up to 10 play cost to play.",
  233. maxCount: maxCount,
  234. canEndNotMax: true,
  235. isShowOpponent: true,
  236. mode: SelectCardEffect.Mode.Custom,
  237. root: SelectCardEffect.Root.Trash,
  238. customRootCardList: null,
  239. canLookReverseCard: true,
  240. selectPlayer: card.Owner,
  241. cardEffect: activateClass);
  242. selectCardEffect.SetUpCustomMessage("Select up to 10 play cost to play.", "The opponent is selecting up to 10 play cost to play.");
  243. yield return StartCoroutine(selectCardEffect.Activate());
  244. bool CanEndSelectCardCondition(List<CardSource> cards)
  245. {
  246. if (cards.Count <= 0)
  247. {
  248. return false;
  249. }
  250. int sumCost = 0;
  251. foreach (CardSource source in cards)
  252. {
  253. sumCost += source.GetCostItself;
  254. }
  255. if (sumCost > maxCost)
  256. {
  257. return false;
  258. }
  259. return true;
  260. }
  261. bool CanTargetCardCondition_ByPreSelecetedList(List<CardSource> cards, CardSource source)
  262. {
  263. int sumCost = 0;
  264. foreach (CardSource source1 in cards)
  265. {
  266. sumCost += source1.GetCostItself;
  267. }
  268. sumCost += source.GetCostItself;
  269. if (sumCost > maxCost)
  270. {
  271. return false;
  272. }
  273. return true;
  274. }
  275. IEnumerator SelectCardCoroutine(CardSource cardSource)
  276. {
  277. selectedCards.Add(cardSource);
  278. yield return null;
  279. }
  280. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  281. cardSources: selectedCards,
  282. activateClass: activateClass,
  283. payCost: false,
  284. isTapped: false,
  285. root: SelectCardEffect.Root.Trash,
  286. activateETB: true));
  287. }
  288. }
  289. }
  290. }
  291. #endregion
  292. #region All Turns
  293. if (timing == EffectTiming.OnDestroyedAnyone)
  294. {
  295. ActivateClass activateClass = new ActivateClass();
  296. activateClass.SetUpICardEffect("Trash your opponent's top security card", CanUseCondition, card);
  297. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  298. activateClass.SetHashString("TrashSecurity_EX8_064");
  299. cardEffects.Add(activateClass);
  300. string EffectDiscription()
  301. {
  302. return "[All Turns] [Once Per Turn] When other Digimon are deleted, trash your opponent's top security card.";
  303. }
  304. bool PermanentCondition(Permanent permanent)
  305. {
  306. if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent))
  307. {
  308. if (permanent.IsDigimon)
  309. {
  310. if (permanent != card.PermanentOfThisCard())
  311. {
  312. return true;
  313. }
  314. }
  315. }
  316. return false;
  317. }
  318. bool CanUseCondition(Hashtable hashtable)
  319. {
  320. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  321. {
  322. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition))
  323. {
  324. return true;
  325. }
  326. }
  327. return false;
  328. }
  329. bool CanActivateCondition(Hashtable hashtable)
  330. {
  331. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  332. {
  333. return true;
  334. }
  335. return false;
  336. }
  337. IEnumerator ActivateCoroutine(Hashtable hashtable)
  338. {
  339. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  340. player: card.Owner.Enemy,
  341. destroySecurityCount: 1,
  342. cardEffect: activateClass,
  343. fromTop: true).DestroySecurity());
  344. }
  345. }
  346. #endregion
  347. return cardEffects;
  348. }
  349. }
  350. }