LM_025.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.LM
  4. {
  5. public class LM_025 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Ace - Blast Digivolve
  11. if (timing == EffectTiming.OnCounterTiming)
  12. {
  13. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  14. }
  15. #endregion
  16. #region On Play/ When Digivolving Shared
  17. bool CanSelectPermanentConditionShared(Permanent permanent)
  18. {
  19. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  20. }
  21. bool CanActivateConditionShared(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  24. card.Owner.LibraryCards.Count >= 1;
  25. }
  26. #endregion
  27. #region On Play
  28. if (timing == EffectTiming.OnEnterFieldAnyone)
  29. {
  30. ActivateClass activateClass = new ActivateClass();
  31. activateClass.SetUpICardEffect("Reveal the top 5 cards of your deck", CanUseCondition, card);
  32. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  33. cardEffects.Add(activateClass);
  34. string EffectDescription()
  35. {
  36. return
  37. "[On Play] Reveal the top 5 cards of your deck. You may play 1 black Tamer card with a play cost of 4 or less among without paying the cost. Return the rest to the top or bottom of the deck. Then, if you have a Tamer, <De-Digivolve 1> 1 of your opponent's Digimon.";
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  42. }
  43. bool CanSelectCardCondition(CardSource cardSource)
  44. {
  45. return cardSource.HasCardColor(CardColor.Black) && cardSource.IsTamer &&
  46. cardSource.HasPlayCost && cardSource.GetCostItself <= 4 &&
  47. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable hashtable)
  50. {
  51. List<CardSource> selectedCards = new List<CardSource>();
  52. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  53. revealCount: 5,
  54. simplifiedSelectCardConditions:
  55. new SimplifiedSelectCardConditionClass[]
  56. {
  57. new(
  58. canTargetCondition: CanSelectCardCondition,
  59. message: "Select 1 black Tamer card with a play cost of 4 or less.",
  60. mode: SelectCardEffect.Mode.Custom,
  61. maxCount: 1,
  62. selectCardCoroutine: SelectCardCoroutine),
  63. },
  64. remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
  65. activateClass: activateClass,
  66. canNoSelect: true
  67. ));
  68. IEnumerator SelectCardCoroutine(CardSource cardSource)
  69. {
  70. selectedCards.Add(cardSource);
  71. yield return null;
  72. }
  73. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  74. cardSources: selectedCards,
  75. activateClass: activateClass,
  76. payCost: false,
  77. isTapped: false,
  78. root: SelectCardEffect.Root.Library,
  79. activateETB: true));
  80. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, permanent => permanent.IsTamer))
  81. {
  82. Permanent selectedPermanent = null;
  83. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  84. selectPermanentEffect.SetUp(
  85. selectPlayer: card.Owner,
  86. canTargetCondition: CanSelectPermanentConditionShared,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: 1,
  90. canNoSelect: false,
  91. canEndNotMax: false,
  92. selectPermanentCoroutine: SelectPermanentCoroutine,
  93. afterSelectPermanentCoroutine: null,
  94. mode: SelectPermanentEffect.Mode.Custom,
  95. cardEffect: activateClass);
  96. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.",
  97. "The opponent is selecting 1 Digimon to De-Digivolve.");
  98. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  99. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  100. {
  101. selectedPermanent = permanent;
  102. yield return null;
  103. }
  104. if (selectedPermanent != null)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(
  107. selectedPermanent, 1, activateClass).Degeneration());
  108. }
  109. }
  110. }
  111. }
  112. #endregion
  113. #region When Digivolving
  114. if (timing == EffectTiming.OnEnterFieldAnyone)
  115. {
  116. ActivateClass activateClass = new ActivateClass();
  117. activateClass.SetUpICardEffect("Reveal the top 5 cards of your deck", CanUseCondition, card);
  118. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  119. cardEffects.Add(activateClass);
  120. string EffectDescription()
  121. {
  122. return
  123. "[When Digivolving] Reveal the top 5 cards of your deck. You may play 1 black Tamer card with a play cost of 4 or less among without paying the cost. Return the rest to the top or bottom of the deck. Then, if you have a Tamer, <De-Digivolve 1> 1 of your opponent's Digimon.";
  124. }
  125. bool CanUseCondition(Hashtable hashtable)
  126. {
  127. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  128. }
  129. bool CanSelectCardCondition(CardSource cardSource)
  130. {
  131. return cardSource.HasCardColor(CardColor.Black) && cardSource.IsTamer &&
  132. cardSource.HasPlayCost && cardSource.GetCostItself <= 4 &&
  133. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  134. }
  135. IEnumerator ActivateCoroutine(Hashtable hashtable)
  136. {
  137. List<CardSource> selectedCards = new List<CardSource>();
  138. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  139. revealCount: 5,
  140. simplifiedSelectCardConditions:
  141. new SimplifiedSelectCardConditionClass[]
  142. {
  143. new(
  144. canTargetCondition: CanSelectCardCondition,
  145. message: "Select 1 black Tamer card with a play cost of 4 or less.",
  146. mode: SelectCardEffect.Mode.Custom,
  147. maxCount: 1,
  148. selectCardCoroutine: SelectCardCoroutine),
  149. },
  150. remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
  151. activateClass: activateClass,
  152. canNoSelect: true
  153. ));
  154. IEnumerator SelectCardCoroutine(CardSource cardSource)
  155. {
  156. selectedCards.Add(cardSource);
  157. yield return null;
  158. }
  159. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  160. cardSources: selectedCards,
  161. activateClass: activateClass,
  162. payCost: false,
  163. isTapped: false,
  164. root: SelectCardEffect.Root.Library,
  165. activateETB: true));
  166. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, permanent => permanent.IsTamer))
  167. {
  168. Permanent selectedPermanent = null;
  169. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  170. selectPermanentEffect.SetUp(
  171. selectPlayer: card.Owner,
  172. canTargetCondition: CanSelectPermanentConditionShared,
  173. canTargetCondition_ByPreSelecetedList: null,
  174. canEndSelectCondition: null,
  175. maxCount: 1,
  176. canNoSelect: false,
  177. canEndNotMax: false,
  178. selectPermanentCoroutine: SelectPermanentCoroutine,
  179. afterSelectPermanentCoroutine: null,
  180. mode: SelectPermanentEffect.Mode.Custom,
  181. cardEffect: activateClass);
  182. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.",
  183. "The opponent is selecting 1 Digimon to De-Digivolve.");
  184. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  185. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  186. {
  187. selectedPermanent = permanent;
  188. yield return null;
  189. }
  190. if (selectedPermanent != null)
  191. {
  192. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(
  193. selectedPermanent, 1, activateClass).Degeneration());
  194. }
  195. }
  196. }
  197. }
  198. #endregion
  199. #region When Attacking - ESS
  200. if (timing == EffectTiming.OnAllyAttack)
  201. {
  202. ActivateClass activateClass = new ActivateClass();
  203. activateClass.SetUpICardEffect("<De-Digivolve 1> 1 of your opponent's Digimon", CanUseCondition, card);
  204. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  205. activateClass.SetIsInheritedEffect(true);
  206. activateClass.SetHashString("WhenAttack_LM-025");
  207. cardEffects.Add(activateClass);
  208. string EffectDescription()
  209. {
  210. return
  211. "[When Attacking] (Once Per Turn) <De-Digivolve 1> 1 of your opponent's Digimon.";
  212. }
  213. bool CanUseCondition(Hashtable hashtable)
  214. {
  215. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  216. }
  217. bool CanSelectPermanentCondition(Permanent permanent)
  218. {
  219. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  220. }
  221. bool CanActivateCondition(Hashtable hashtable)
  222. {
  223. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  224. }
  225. IEnumerator ActivateCoroutine(Hashtable hashtable)
  226. {
  227. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  228. {
  229. Permanent selectedPermanent = null;
  230. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  231. selectPermanentEffect.SetUp(
  232. selectPlayer: card.Owner,
  233. canTargetCondition: CanSelectPermanentCondition,
  234. canTargetCondition_ByPreSelecetedList: null,
  235. canEndSelectCondition: null,
  236. maxCount: 1,
  237. canNoSelect: false,
  238. canEndNotMax: false,
  239. selectPermanentCoroutine: SelectPermanentCoroutine,
  240. afterSelectPermanentCoroutine: null,
  241. mode: SelectPermanentEffect.Mode.Custom,
  242. cardEffect: activateClass);
  243. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.",
  244. "The opponent is selecting 1 Digimon to De-Digivolve.");
  245. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  246. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  247. {
  248. selectedPermanent = permanent;
  249. yield return null;
  250. }
  251. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(
  252. selectedPermanent, 1, activateClass).Degeneration());
  253. }
  254. }
  255. }
  256. #endregion
  257. return cardEffects;
  258. }
  259. }
  260. }