EX6_011.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. namespace DCGO.CardEffects.EX6
  6. {
  7. public class EX6_011 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Ace - Blast DNA Digivolve
  13. if (timing == EffectTiming.OnCounterTiming)
  14. {
  15. List<BlastDNACondition> blastDNAConditions = new List<BlastDNACondition>
  16. {
  17. new("Durandamon"),
  18. new("BryweLudramon")
  19. };
  20. cardEffects.Add(CardEffectFactory.BlastDNADigivolveEffect(card: card,
  21. blastDNAConditions: blastDNAConditions, condition: null));
  22. }
  23. #endregion
  24. #region DNA Digivolution
  25. if (timing == EffectTiming.None)
  26. {
  27. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  28. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  29. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  30. addJogressConditionClass.SetNotShowUI(true);
  31. cardEffects.Add(addJogressConditionClass);
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return true;
  35. }
  36. JogressCondition GetJogress(CardSource cardSource)
  37. {
  38. if (cardSource == card)
  39. {
  40. bool PermanentCondition1(Permanent permanent)
  41. {
  42. if (permanent != null)
  43. {
  44. if (permanent.TopCard != null)
  45. {
  46. if (permanent.TopCard.Owner == card.Owner)
  47. {
  48. if (permanent.IsDigimon)
  49. {
  50. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent,
  51. card))
  52. {
  53. if (permanent.TopCard.CardColors.Contains(CardColor.Red))
  54. {
  55. if (permanent.Levels_ForJogress(card).Contains(6))
  56. {
  57. return true;
  58. }
  59. }
  60. }
  61. }
  62. }
  63. }
  64. }
  65. return false;
  66. }
  67. bool PermanentCondition2(Permanent permanent)
  68. {
  69. if (permanent != null)
  70. {
  71. if (permanent.TopCard != null)
  72. {
  73. if (permanent.TopCard.Owner == card.Owner)
  74. {
  75. if (permanent.IsDigimon)
  76. {
  77. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent,
  78. card))
  79. {
  80. if (permanent.TopCard.CardColors.Contains(CardColor.Black))
  81. {
  82. if (permanent.Levels_ForJogress(card).Contains(6))
  83. {
  84. return true;
  85. }
  86. }
  87. }
  88. }
  89. }
  90. }
  91. }
  92. return false;
  93. }
  94. JogressConditionElement[] elements =
  95. {
  96. new(PermanentCondition1, "a level 6 Red Digimon"),
  97. new(PermanentCondition2, "a level 6 Black Digimon")
  98. };
  99. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  100. return jogressCondition;
  101. }
  102. return null;
  103. }
  104. }
  105. #endregion
  106. #region Raid
  107. if (timing == EffectTiming.OnAllyAttack)
  108. {
  109. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card,
  110. condition: null));
  111. }
  112. #endregion
  113. #region Reboot
  114. if (timing == EffectTiming.None)
  115. {
  116. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(
  117. isInheritedEffect: false,
  118. card: card,
  119. condition: null));
  120. }
  121. #endregion
  122. #region Shared On Play / When Digivolving
  123. bool CanActivateSharedCondition(Hashtable hashtable)
  124. {
  125. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  126. }
  127. bool CanUseImmunitySharedCondition(Hashtable hashtableI)
  128. {
  129. return CardEffectCommons.IsPermanentExistsOnBattleArea(card.PermanentOfThisCard());
  130. }
  131. bool CardImmunitySharedCondition(CardSource cardSource)
  132. {
  133. if (CardEffectCommons.IsExistOnBattleArea(card))
  134. {
  135. if (cardSource == card.PermanentOfThisCard().TopCard)
  136. {
  137. return true;
  138. }
  139. }
  140. return false;
  141. }
  142. bool SkillImmunitySharedCondition(ICardEffect cardEffect)
  143. {
  144. if (cardEffect != null)
  145. {
  146. if (cardEffect.EffectSourceCard)
  147. {
  148. if (CardEffectCommons.IsOpponentEffect(cardEffect, card))
  149. {
  150. return true;
  151. }
  152. }
  153. }
  154. return false;
  155. }
  156. bool IsEnemyPermanentShared(Permanent permanent)
  157. {
  158. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  159. }
  160. #endregion
  161. #region On Play
  162. if (timing == EffectTiming.OnEnterFieldAnyone)
  163. {
  164. ActivateClass activateClass = new ActivateClass();
  165. activateClass.SetUpICardEffect(
  166. "Trash the top card of your opponent's security stack and this Digimon isn't affected by your opponent's effects until the end of their turn.",
  167. CanUseCondition, card);
  168. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false,
  169. EffectDescription());
  170. cardEffects.Add(activateClass);
  171. string EffectDescription()
  172. {
  173. return
  174. "[On Play] Trash the top card of your opponent's security stack and this Digimon isn't affected by your opponent's effects until the end of their turn. Then, if DNA digivolving, all of your opponent's Digimon (Trash the top card. You can't trash past level 3 cards) and delete 1 of their Digimon.";
  175. }
  176. bool CanUseCondition(Hashtable hashtable)
  177. {
  178. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  179. }
  180. IEnumerator ActivateCoroutine(Hashtable hashtable)
  181. {
  182. // Trash Top of Opponent's Security Stack
  183. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  184. player: card.Owner.Enemy,
  185. destroySecurityCount: 1,
  186. cardEffect: activateClass,
  187. fromTop: true).DestroySecurity());
  188. // This Digimon isn't affected by your opponent's effects until the end of their turn.
  189. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  190. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's effects",
  191. CanUseImmunitySharedCondition, card);
  192. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardImmunitySharedCondition,
  193. SkillCondition: SkillImmunitySharedCondition);
  194. card.PermanentOfThisCard().UntilOpponentTurnEndEffects.Add(_ => canNotAffectedClass);
  195. // if DNA Digivolving
  196. if (CardEffectCommons.IsJogress(hashtable))
  197. {
  198. // De-Digivolve all Opponent's Digimon
  199. List<Permanent> enemyPermanents = card.Owner.Enemy.GetBattleAreaDigimons();
  200. foreach (Permanent permanent in enemyPermanents)
  201. {
  202. yield return ContinuousController.instance.StartCoroutine(
  203. new IDegeneration(permanent, 1, activateClass).Degeneration());
  204. }
  205. // Delete 1 Opponent's Digimon
  206. if (CardEffectCommons.HasMatchConditionPermanent(IsEnemyPermanentShared))
  207. {
  208. int enemyCount = Math.Min(1,
  209. CardEffectCommons.MatchConditionPermanentCount(IsEnemyPermanentShared));
  210. SelectPermanentEffect selectEnemyEffect =
  211. GManager.instance.GetComponent<SelectPermanentEffect>();
  212. selectEnemyEffect.SetUp(
  213. selectPlayer: card.Owner,
  214. canTargetCondition: IsEnemyPermanentShared,
  215. canTargetCondition_ByPreSelecetedList: null,
  216. canEndSelectCondition: null,
  217. maxCount: enemyCount,
  218. canNoSelect: false,
  219. canEndNotMax: false,
  220. selectPermanentCoroutine: null,
  221. afterSelectPermanentCoroutine: null,
  222. mode: SelectPermanentEffect.Mode.Destroy,
  223. cardEffect: activateClass);
  224. yield return ContinuousController.instance.StartCoroutine(selectEnemyEffect.Activate());
  225. }
  226. }
  227. }
  228. }
  229. #endregion
  230. #region When Digivolving
  231. if (timing == EffectTiming.OnEnterFieldAnyone)
  232. {
  233. ActivateClass activateClass = new ActivateClass();
  234. activateClass.SetUpICardEffect(
  235. "Trash the top card of your opponent's security stack and this Digimon isn't affected by your opponent's effects until the end of their turn.",
  236. CanUseCondition, card);
  237. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false,
  238. EffectDescription());
  239. cardEffects.Add(activateClass);
  240. string EffectDescription()
  241. {
  242. return
  243. "[When Digivolving] Trash the top card of your opponent's security stack and this Digimon isn't affected by your opponent's effects until the end of their turn. Then, if DNA digivolving, all of your opponent's Digimon (Trash the top card. You can't trash past level 3 cards) and delete 1 of their Digimon.";
  244. }
  245. bool CanUseCondition(Hashtable hashtable)
  246. {
  247. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  248. }
  249. IEnumerator ActivateCoroutine(Hashtable hashtable)
  250. {
  251. // Trash Top of Opponent's Security Stack
  252. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  253. player: card.Owner.Enemy,
  254. destroySecurityCount: 1,
  255. cardEffect: activateClass,
  256. fromTop: true).DestroySecurity());
  257. // This Digimon isn't affected by your opponent's effects until the end of their turn.
  258. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  259. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's effects",
  260. CanUseImmunitySharedCondition, card);
  261. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardImmunitySharedCondition,
  262. SkillCondition: SkillImmunitySharedCondition);
  263. card.PermanentOfThisCard().UntilOpponentTurnEndEffects.Add(_ => canNotAffectedClass);
  264. // if DNA Digivolving
  265. if (CardEffectCommons.IsJogress(hashtable))
  266. {
  267. // De-Digivolve all Opponent's Digimon
  268. List<Permanent> enemyPermanents = card.Owner.Enemy.GetBattleAreaDigimons().ToList();
  269. foreach (Permanent permanent in enemyPermanents)
  270. {
  271. yield return ContinuousController.instance.StartCoroutine(
  272. new IDegeneration(permanent, 1, activateClass).Degeneration());
  273. }
  274. // Delete 1 Opponent's Digimon
  275. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsEnemyPermanentShared))
  276. {
  277. SelectPermanentEffect selectEnemyEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  278. selectEnemyEffect.SetUp(
  279. selectPlayer: card.Owner,
  280. canTargetCondition: IsEnemyPermanentShared,
  281. canTargetCondition_ByPreSelecetedList: null,
  282. canEndSelectCondition: null,
  283. maxCount: 1,
  284. canNoSelect: false,
  285. canEndNotMax: false,
  286. selectPermanentCoroutine: null,
  287. afterSelectPermanentCoroutine: null,
  288. mode: SelectPermanentEffect.Mode.Destroy,
  289. cardEffect: activateClass);
  290. yield return ContinuousController.instance.StartCoroutine(selectEnemyEffect.Activate());
  291. }
  292. }
  293. }
  294. }
  295. #endregion
  296. return cardEffects;
  297. }
  298. }
  299. }