EX6_060.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace DCGO.CardEffects.EX6
  5. {
  6. public class EX6_060 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.ContainsCardName("Belphemon: Sleep Mode");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 1,
  21. ignoreDigivolutionRequirement: false,
  22. card: card,
  23. condition: null));
  24. }
  25. #endregion
  26. #region On Play
  27. if (timing == EffectTiming.OnEnterFieldAnyone)
  28. {
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect("Trash up to 3 cards, suspend 1 opponent's digimon. Then delete all opponents suspended digimon with lowest play cost.", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  32. cardEffects.Add(activateClass);
  33. string EffectDiscription()
  34. {
  35. return "[On Play] You may trash up to 3 cards in your hand. For each card trashed by this effect, suspend 1 of your opponent's level 5 or lower Digimon. Then, delete all of your opponent's suspended Digimon with the lowest play cost.";
  36. }
  37. bool OpponentsSuspendableTargets(Permanent permanent)
  38. {
  39. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  40. {
  41. if (permanent.TopCard.HasLevel && permanent.Level <= 5)
  42. {
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48. bool LowestPlayCostCondition(Permanent permanent)
  49. {
  50. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  51. {
  52. if (CardEffectCommons.IsMinCost(permanent, card.Owner.Enemy, true, (permanent) => permanent.IsSuspended))
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  62. }
  63. bool CanActivateCondition(Hashtable hashtable)
  64. {
  65. return CardEffectCommons.IsExistOnBattleArea(card);
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable hashtable)
  68. {
  69. List<CardSource> discarded = new List<CardSource>();
  70. if(card.Owner.HandCards.Count > 0)
  71. {
  72. int discardCount = Math.Min(3, card.Owner.HandCards.Count);
  73. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  74. selectHandEffect.SetUp(
  75. selectPlayer: card.Owner,
  76. canTargetCondition: (cardSource) => true,
  77. canTargetCondition_ByPreSelecetedList: null,
  78. canEndSelectCondition: null,
  79. maxCount: discardCount,
  80. canNoSelect: false,
  81. canEndNotMax: true,
  82. isShowOpponent: true,
  83. selectCardCoroutine: null,
  84. afterSelectCardCoroutine: AfterSelectionCoroutine,
  85. mode: SelectHandEffect.Mode.Discard,
  86. cardEffect: activateClass);
  87. yield return StartCoroutine(selectHandEffect.Activate());
  88. }
  89. IEnumerator AfterSelectionCoroutine(List<CardSource> cardSources)
  90. {
  91. discarded = cardSources.Clone();
  92. yield return null;
  93. }
  94. if(discarded.Count > 0)
  95. {
  96. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  97. int suspendCount = Math.Min(discarded.Count, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, OpponentsSuspendableTargets));
  98. selectPermanentEffect.SetUp(
  99. selectPlayer: card.Owner,
  100. canTargetCondition: OpponentsSuspendableTargets,
  101. canTargetCondition_ByPreSelecetedList: null,
  102. canEndSelectCondition: null,
  103. maxCount: suspendCount,
  104. canNoSelect: false,
  105. canEndNotMax: false,
  106. selectPermanentCoroutine: null,
  107. afterSelectPermanentCoroutine: null,
  108. mode: SelectPermanentEffect.Mode.Tap,
  109. cardEffect: activateClass);
  110. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  111. }
  112. List<Permanent> destroyTargetPermanents = card.Owner.Enemy.GetBattleAreaDigimons().Filter(LowestPlayCostCondition);
  113. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(destroyTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  114. }
  115. }
  116. #endregion
  117. #region When Digivolving
  118. if (timing == EffectTiming.OnEnterFieldAnyone)
  119. {
  120. ActivateClass activateClass = new ActivateClass();
  121. activateClass.SetUpICardEffect("Trash up to 3 cards, suspend 1 opponent's digimon. Then delete all opponents suspended digimon with lowest play cost.", CanUseCondition, card);
  122. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  123. cardEffects.Add(activateClass);
  124. string EffectDiscription()
  125. {
  126. return "[When Digivolving] You may trash up to 3 cards in your hand. For each card trashed by this effect, suspend 1 of your opponent's level 5 or lower Digimon. Then, delete all of your opponent's suspended Digimon with the lowest play cost.";
  127. }
  128. bool OpponentsSuspendableTargets(Permanent permanent)
  129. {
  130. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  131. {
  132. if (permanent.TopCard.HasLevel && permanent.Level <= 5)
  133. {
  134. return true;
  135. }
  136. }
  137. return false;
  138. }
  139. bool LowestPlayCostCondition(Permanent permanent)
  140. {
  141. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  142. {
  143. if (CardEffectCommons.IsMinCost(permanent, card.Owner.Enemy, true, (permanent) => permanent.IsSuspended))
  144. {
  145. return true;
  146. }
  147. }
  148. return false;
  149. }
  150. bool CanUseCondition(Hashtable hashtable)
  151. {
  152. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  153. }
  154. bool CanActivateCondition(Hashtable hashtable)
  155. {
  156. return CardEffectCommons.IsExistOnBattleArea(card);
  157. }
  158. IEnumerator ActivateCoroutine(Hashtable hashtable)
  159. {
  160. List<CardSource> discarded = new List<CardSource>();
  161. if (card.Owner.HandCards.Count > 0)
  162. {
  163. int discardCount = Math.Min(3, card.Owner.HandCards.Count);
  164. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  165. selectHandEffect.SetUp(
  166. selectPlayer: card.Owner,
  167. canTargetCondition: (cardSource) => true,
  168. canTargetCondition_ByPreSelecetedList: null,
  169. canEndSelectCondition: null,
  170. maxCount: discardCount,
  171. canNoSelect: false,
  172. canEndNotMax: true,
  173. isShowOpponent: true,
  174. selectCardCoroutine: null,
  175. afterSelectCardCoroutine: AfterSelectionCoroutine,
  176. mode: SelectHandEffect.Mode.Discard,
  177. cardEffect: activateClass);
  178. yield return StartCoroutine(selectHandEffect.Activate());
  179. }
  180. IEnumerator AfterSelectionCoroutine(List<CardSource> cardSources)
  181. {
  182. discarded = cardSources.Clone();
  183. yield return null;
  184. }
  185. if (discarded.Count > 0)
  186. {
  187. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  188. int suspendCount = Math.Min(discarded.Count, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, OpponentsSuspendableTargets));
  189. selectPermanentEffect.SetUp(
  190. selectPlayer: card.Owner,
  191. canTargetCondition: OpponentsSuspendableTargets,
  192. canTargetCondition_ByPreSelecetedList: null,
  193. canEndSelectCondition: null,
  194. maxCount: suspendCount,
  195. canNoSelect: false,
  196. canEndNotMax: false,
  197. selectPermanentCoroutine: null,
  198. afterSelectPermanentCoroutine: null,
  199. mode: SelectPermanentEffect.Mode.Tap,
  200. cardEffect: activateClass);
  201. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  202. }
  203. List<Permanent> destroyTargetPermanents = card.Owner.Enemy.GetBattleAreaDigimons().Filter(LowestPlayCostCondition);
  204. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(destroyTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  205. }
  206. }
  207. #endregion
  208. #region All Turns
  209. if (timing == EffectTiming.WhenRemoveField)
  210. {
  211. ActivateClass activateClass = new ActivateClass();
  212. activateClass.SetUpICardEffect("Place 1 7GDL from trash to bottom of [Gate of Deadly Sins]", CanUseCondition, card);
  213. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  214. cardEffects.Add(activateClass);
  215. string EffectDiscription()
  216. {
  217. return "[All Turns] When this Digimon would leave the battle area other than in battle, place 1 card with the [Seven Great Demon Lord] trait from your trash as the bottom digivolution cards of one of your [Gate of Deadly Sins] in your breeding area.";
  218. }
  219. bool CanUseCondition(Hashtable hashtable)
  220. {
  221. if (CardEffectCommons.IsExistOnBattleArea(card))
  222. {
  223. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  224. {
  225. if (!CardEffectCommons.IsByBattle(hashtable))
  226. {
  227. return true;
  228. }
  229. }
  230. }
  231. return false;
  232. }
  233. bool CanSelect7GDLinTrash(CardSource cardSource)
  234. {
  235. if (cardSource.CardTraits.Contains("SevenGreatDemonLords") || cardSource.CardTraits.Contains("Seven Great Demon Lords"))
  236. {
  237. return true;
  238. }
  239. return false;
  240. }
  241. bool CanSelectPermanentCondition(Permanent permanent)
  242. {
  243. if (CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card))
  244. {
  245. if (permanent.TopCard.CardNames.Contains("Gate of Deadly Sins"))
  246. {
  247. return true;
  248. }
  249. }
  250. return false;
  251. }
  252. bool CanActivateCondition(Hashtable hashtable)
  253. {
  254. if (CardEffectCommons.IsExistOnBattleArea(card))
  255. {
  256. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelect7GDLinTrash))
  257. {
  258. return true;
  259. }
  260. }
  261. return false;
  262. }
  263. IEnumerator ActivateCoroutine(Hashtable hashtable)
  264. {
  265. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelect7GDLinTrash))
  266. {
  267. List<CardSource> selectedCards = new List<CardSource>();
  268. int maxCount = 1;
  269. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  270. selectCardEffect.SetUp(
  271. canTargetCondition: CanSelect7GDLinTrash,
  272. canTargetCondition_ByPreSelecetedList: null,
  273. canEndSelectCondition: null,
  274. canNoSelect: () => false,
  275. selectCardCoroutine: SelectCardCoroutine,
  276. afterSelectCardCoroutine: null,
  277. message: "Select 1 card to place at the bottom of digivolution cards.",
  278. maxCount: maxCount,
  279. canEndNotMax: false,
  280. isShowOpponent: true,
  281. mode: SelectCardEffect.Mode.Custom,
  282. root: SelectCardEffect.Root.Trash,
  283. customRootCardList: null,
  284. canLookReverseCard: true,
  285. selectPlayer: card.Owner,
  286. cardEffect: activateClass);
  287. selectCardEffect.SetUpCustomMessage("Select 1 card to place at the bottom of digivolution cards.", "The opponent is selecting 1 card to place at the bottom of digivolution cards.");
  288. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  289. IEnumerator SelectCardCoroutine(CardSource cardSource)
  290. {
  291. selectedCards.Add(cardSource);
  292. yield return null;
  293. }
  294. if (selectedCards.Count >= 1)
  295. {
  296. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition, true))
  297. {
  298. Permanent selectedPermanent = card.Owner.GetBreedingAreaPermanents()[0];
  299. if (selectedPermanent != null)
  300. {
  301. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  302. }
  303. }
  304. }
  305. }
  306. }
  307. }
  308. #endregion
  309. return cardEffects;
  310. }
  311. }
  312. }