LM_024.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.LM
  4. {
  5. public class LM_024 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.HasText("Pulsemon") && targetPermanent.TopCard.HasLevel &&
  16. targetPermanent.TopCard.Level == 5;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition,
  19. digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Ace - Blast Digivolve
  23. if (timing == EffectTiming.OnCounterTiming)
  24. {
  25. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  26. }
  27. #endregion
  28. #region On Play/When Digivolving Shared
  29. bool PermanentSuspendCondition(Permanent permanent)
  30. {
  31. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent) &&
  32. permanent.CanSuspend;
  33. }
  34. bool PermanentGetDPCondition(Permanent permanent)
  35. {
  36. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  37. }
  38. bool PermanentBottomDeckCondition(Permanent permanent)
  39. {
  40. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  41. permanent.IsSuspended;
  42. }
  43. bool CanActivateConditionShared(Hashtable hashtable)
  44. {
  45. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  46. {
  47. if (card.Owner.SecurityCards.Count >= 3)
  48. {
  49. if (CardEffectCommons.HasMatchConditionPermanent(PermanentSuspendCondition))
  50. {
  51. return true;
  52. }
  53. if (CardEffectCommons.HasMatchConditionPermanent(PermanentGetDPCondition))
  54. {
  55. return true;
  56. }
  57. }
  58. if (card.Owner.SecurityCards.Count <= 3)
  59. {
  60. if (CardEffectCommons.HasMatchConditionPermanent(PermanentBottomDeckCondition))
  61. {
  62. return true;
  63. }
  64. }
  65. }
  66. return false;
  67. }
  68. #endregion
  69. #region On Play
  70. if (timing == EffectTiming.OnEnterFieldAnyone)
  71. {
  72. ActivateClass activateClass = new ActivateClass();
  73. activateClass.SetUpICardEffect("Suspend & get +3000 DP and/or Bottom deck opponent's digimon", CanUseCondition, card);
  74. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  75. cardEffects.Add(activateClass);
  76. string EffectDescription()
  77. {
  78. return
  79. "[On Play] If you have 3 or more security cards, suspend 1 Digimon, and 1 of your Digimon gets +3000 DP until the end of your opponent's turn. If you have 3 or fewer security cards, return 1 of your opponent’s suspended Digimon to the bottom of the deck.";
  80. }
  81. bool CanUseCondition(Hashtable hashtable)
  82. {
  83. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  84. }
  85. IEnumerator ActivateCoroutine(Hashtable hashtable)
  86. {
  87. if (card.Owner.SecurityCards.Count >= 3)
  88. {
  89. if (CardEffectCommons.HasMatchConditionPermanent(PermanentSuspendCondition))
  90. {
  91. Permanent selectedPermanent = null;
  92. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  93. selectPermanentEffect.SetUp(
  94. selectPlayer: card.Owner,
  95. canTargetCondition: PermanentSuspendCondition,
  96. canTargetCondition_ByPreSelecetedList: null,
  97. canEndSelectCondition: null,
  98. maxCount: 1,
  99. canNoSelect: false,
  100. canEndNotMax: false,
  101. selectPermanentCoroutine: SelectPermanentCoroutine,
  102. afterSelectPermanentCoroutine: null,
  103. mode: SelectPermanentEffect.Mode.Custom,
  104. cardEffect: activateClass);
  105. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  106. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  107. {
  108. selectedPermanent = permanent;
  109. yield return null;
  110. }
  111. if (selectedPermanent != null &&
  112. selectedPermanent.TopCard &&
  113. !selectedPermanent.TopCard.CanNotBeAffected(activateClass) &&
  114. !selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  115. {
  116. yield return ContinuousController.instance.StartCoroutine(
  117. new SuspendPermanentsClass(new List<Permanent>() { selectedPermanent },
  118. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  119. }
  120. }
  121. if (CardEffectCommons.HasMatchConditionPermanent(PermanentGetDPCondition))
  122. {
  123. Permanent selectedPermanent = null;
  124. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  125. selectPermanentEffect.SetUp(
  126. selectPlayer: card.Owner,
  127. canTargetCondition: PermanentGetDPCondition,
  128. canTargetCondition_ByPreSelecetedList: null,
  129. canEndSelectCondition: null,
  130. maxCount: 1,
  131. canNoSelect: false,
  132. canEndNotMax: false,
  133. selectPermanentCoroutine: SelectPermanentCoroutine,
  134. afterSelectPermanentCoroutine: null,
  135. mode: SelectPermanentEffect.Mode.Custom,
  136. cardEffect: activateClass);
  137. selectPermanentEffect.SetUpCustomMessage(
  138. "Select 1 of your Digimon that will get DP +3000.",
  139. "The opponent is selecting 1 of their Digimon that will get DP +3000.");
  140. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  141. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  142. {
  143. selectedPermanent = permanent;
  144. yield return null;
  145. }
  146. if (selectedPermanent != null)
  147. {
  148. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  149. targetPermanent: selectedPermanent,
  150. changeValue: 3000,
  151. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  152. activateClass: activateClass));
  153. }
  154. }
  155. }
  156. if (card.Owner.SecurityCards.Count <= 3)
  157. {
  158. if (CardEffectCommons.HasMatchConditionPermanent(PermanentBottomDeckCondition))
  159. {
  160. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  161. selectPermanentEffect.SetUp(
  162. selectPlayer: card.Owner,
  163. canTargetCondition_ByPreSelecetedList: null,
  164. canTargetCondition: PermanentBottomDeckCondition,
  165. canEndSelectCondition: null,
  166. maxCount: 1,
  167. canNoSelect: false,
  168. canEndNotMax: false,
  169. selectPermanentCoroutine: null,
  170. afterSelectPermanentCoroutine: null,
  171. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  172. cardEffect: activateClass);
  173. selectPermanentEffect.SetUpCustomMessage("Select 1 suspended Digimon to bottom deck.",
  174. "The opponent is selecting 1 suspended Digimon to bottom deck.");
  175. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  176. }
  177. }
  178. }
  179. }
  180. #endregion
  181. #region When Digivolving
  182. if (timing == EffectTiming.OnEnterFieldAnyone)
  183. {
  184. ActivateClass activateClass = new ActivateClass();
  185. activateClass.SetUpICardEffect("Suspend & get +3000 DP and/or Bottom deck opponent's digimon", CanUseCondition, card);
  186. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  187. cardEffects.Add(activateClass);
  188. string EffectDescription()
  189. {
  190. return
  191. "[When Digivolving] If you have 3 or more security cards, suspend 1 Digimon, and 1 of your Digimon gets +3000 DP until the end of your opponent's turn. If you have 3 or fewer security cards, return 1 of your opponent’s suspended Digimon to the bottom of the deck.";
  192. }
  193. bool CanUseCondition(Hashtable hashtable)
  194. {
  195. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  196. }
  197. IEnumerator ActivateCoroutine(Hashtable hashtable)
  198. {
  199. if (card.Owner.SecurityCards.Count >= 3)
  200. {
  201. if (CardEffectCommons.HasMatchConditionPermanent(PermanentSuspendCondition))
  202. {
  203. Permanent selectedPermanent = null;
  204. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  205. selectPermanentEffect.SetUp(
  206. selectPlayer: card.Owner,
  207. canTargetCondition: PermanentSuspendCondition,
  208. canTargetCondition_ByPreSelecetedList: null,
  209. canEndSelectCondition: null,
  210. maxCount: 1,
  211. canNoSelect: false,
  212. canEndNotMax: false,
  213. selectPermanentCoroutine: SelectPermanentCoroutine,
  214. afterSelectPermanentCoroutine: null,
  215. mode: SelectPermanentEffect.Mode.Custom,
  216. cardEffect: activateClass);
  217. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  218. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  219. {
  220. selectedPermanent = permanent;
  221. yield return null;
  222. }
  223. if (selectedPermanent != null &&
  224. selectedPermanent.TopCard &&
  225. !selectedPermanent.TopCard.CanNotBeAffected(activateClass) &&
  226. !selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  227. {
  228. yield return ContinuousController.instance.StartCoroutine(
  229. new SuspendPermanentsClass(new List<Permanent>() { selectedPermanent },
  230. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  231. }
  232. }
  233. if (CardEffectCommons.HasMatchConditionPermanent(PermanentGetDPCondition))
  234. {
  235. Permanent selectedPermanent = null;
  236. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  237. selectPermanentEffect.SetUp(
  238. selectPlayer: card.Owner,
  239. canTargetCondition: PermanentGetDPCondition,
  240. canTargetCondition_ByPreSelecetedList: null,
  241. canEndSelectCondition: null,
  242. maxCount: 1,
  243. canNoSelect: false,
  244. canEndNotMax: false,
  245. selectPermanentCoroutine: SelectPermanentCoroutine,
  246. afterSelectPermanentCoroutine: null,
  247. mode: SelectPermanentEffect.Mode.Custom,
  248. cardEffect: activateClass);
  249. selectPermanentEffect.SetUpCustomMessage(
  250. "Select 1 of your Digimon that will get DP +3000.",
  251. "The opponent is selecting 1 of their Digimon that will get DP +3000.");
  252. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  253. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  254. {
  255. selectedPermanent = permanent;
  256. yield return null;
  257. }
  258. if (selectedPermanent != null)
  259. {
  260. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  261. targetPermanent: selectedPermanent,
  262. changeValue: 3000,
  263. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  264. activateClass: activateClass));
  265. }
  266. }
  267. }
  268. if (card.Owner.SecurityCards.Count <= 3)
  269. {
  270. if (CardEffectCommons.HasMatchConditionPermanent(PermanentBottomDeckCondition))
  271. {
  272. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  273. selectPermanentEffect.SetUp(
  274. selectPlayer: card.Owner,
  275. canTargetCondition_ByPreSelecetedList: null,
  276. canTargetCondition: PermanentBottomDeckCondition,
  277. canEndSelectCondition: null,
  278. maxCount: 1,
  279. canNoSelect: false,
  280. canEndNotMax: false,
  281. selectPermanentCoroutine: null,
  282. afterSelectPermanentCoroutine: null,
  283. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  284. cardEffect: activateClass);
  285. selectPermanentEffect.SetUpCustomMessage("Select 1 suspended Digimon to bottom deck.",
  286. "The opponent is selecting 1 suspended Digimon to bottom deck.");
  287. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  288. }
  289. }
  290. }
  291. }
  292. #endregion
  293. #region All Turns
  294. if (timing == EffectTiming.None)
  295. {
  296. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  297. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's Digimon's effects", CanUseCondition, card);
  298. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  299. cardEffects.Add(canNotAffectedClass);
  300. bool CanUseCondition(Hashtable hashtable)
  301. {
  302. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  303. card.PermanentOfThisCard().IsSuspended;
  304. }
  305. bool CardCondition(CardSource cardSource)
  306. {
  307. return cardSource == card &&
  308. CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  309. cardSource == card.PermanentOfThisCard().TopCard;
  310. }
  311. bool SkillCondition(ICardEffect cardEffect)
  312. {
  313. return CardEffectCommons.IsOpponentEffect(cardEffect, card) && cardEffect.IsDigimonEffect;
  314. }
  315. }
  316. #endregion
  317. return cardEffects;
  318. }
  319. }
  320. }