LM_042.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. //Rasielmon
  5. namespace DCGO.CardEffects.LM
  6. {
  7. public class LM_042 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. if (targetPermanent.TopCard.IsLevel5)
  18. {
  19. if (targetPermanent.TopCard.EqualsTraits("Angel") || targetPermanent.TopCard.EqualsTraits("Archangel"))
  20. {
  21. return true;
  22. }
  23. }
  24. return false;
  25. }
  26. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, false, card: card, condition: null));
  27. }
  28. #endregion
  29. #region Sec +1
  30. if (timing == EffectTiming.None)
  31. {
  32. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(
  33. changeValue: 1,
  34. isInheritedEffect: false,
  35. card: card,
  36. condition: null));
  37. }
  38. #endregion
  39. #region On Play
  40. if (timing == EffectTiming.OnEnterFieldAnyone)
  41. {
  42. ActivateClass activateClass = new ActivateClass();
  43. activateClass.SetUpICardEffect("Suspend 1 digimon", CanUseCondition, card);
  44. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  45. cardEffects.Add(activateClass);
  46. string EffectDiscription()
  47. {
  48. return "[On Play] Suspend 1 of your opponent's Digimon or Tamers. Then, until their turn ends, 1 of their Digimon or Tamers can't activate [When Digivolving] effects or unsuspend.";
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  53. {
  54. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  55. {
  56. return true;
  57. }
  58. }
  59. return false;
  60. }
  61. bool CanActivateCondition(Hashtable hashtable)
  62. {
  63. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  64. {
  65. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentConditionSuspend))
  66. {
  67. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentConditionStopWD))
  68. {
  69. return true;
  70. }
  71. }
  72. }
  73. return false;
  74. }
  75. bool CanSelectPermanentConditionSuspend(Permanent permanent)
  76. {
  77. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  78. {
  79. if (permanent.IsTamer || permanent.IsDigimon)
  80. {
  81. return true;
  82. }
  83. }
  84. return false;
  85. }
  86. bool CanSelectPermanentConditionStopWD(Permanent permanent)
  87. {
  88. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  89. {
  90. if (permanent.IsTamer || permanent.IsDigimon)
  91. {
  92. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  93. {
  94. return true;
  95. }
  96. }
  97. }
  98. return false;
  99. }
  100. IEnumerator ActivateCoroutine(Hashtable hashtable)
  101. {
  102. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionSuspend));
  103. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  104. selectPermanentEffect.SetUp(
  105. selectPlayer: card.Owner,
  106. canTargetCondition: CanSelectPermanentConditionSuspend,
  107. canTargetCondition_ByPreSelecetedList: null,
  108. canEndSelectCondition: null,
  109. maxCount: maxCount,
  110. canNoSelect: false,
  111. canEndNotMax: false,
  112. selectPermanentCoroutine: null,
  113. afterSelectPermanentCoroutine: null,
  114. mode: SelectPermanentEffect.Mode.Tap,
  115. cardEffect: activateClass);
  116. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer to suspend", "The opponent is selecting 1 Digimon or tamer to suspend");
  117. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  118. Permanent selectedPermanent = null;
  119. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionStopWD));
  120. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  121. selectPermanentEffect1.SetUp(
  122. selectPlayer: card.Owner,
  123. canTargetCondition: CanSelectPermanentConditionStopWD,
  124. canTargetCondition_ByPreSelecetedList: null,
  125. canEndSelectCondition: null,
  126. maxCount: maxCount1,
  127. canNoSelect: false,
  128. canEndNotMax: false,
  129. selectPermanentCoroutine: SelectPermanentCoroutine,
  130. afterSelectPermanentCoroutine: null,
  131. mode: SelectPermanentEffect.Mode.Custom,
  132. cardEffect: activateClass);
  133. selectPermanentEffect1.SetUpCustomMessage("Select 1 Digimon or Tamer to disable WD effects", "The opponent is selecting 1 Digimon or tamer to disable WD effects");
  134. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  135. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  136. {
  137. selectedPermanent = permanent;
  138. yield return null;
  139. }
  140. DisableEffectClass invalidationClass = new DisableEffectClass();
  141. invalidationClass.SetUpICardEffect("Ignore [When Digivolving] Effect", hashtableDebuff => true, card);
  142. invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateCondition);
  143. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => invalidationClass);
  144. bool InvalidateCondition(ICardEffect cardEffect)
  145. {
  146. if (selectedPermanent.TopCard != null)
  147. {
  148. if (cardEffect != null)
  149. {
  150. if (cardEffect.EffectSourceCard != null)
  151. {
  152. if (isExistOnField(cardEffect.EffectSourceCard))
  153. {
  154. if (cardEffect.EffectSourceCard.PermanentOfThisCard() == selectedPermanent)
  155. {
  156. if (cardEffect.IsWhenDigivolving)
  157. {
  158. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  159. {
  160. return true;
  161. }
  162. }
  163. }
  164. }
  165. }
  166. }
  167. }
  168. return false;
  169. }
  170. }
  171. }
  172. #endregion
  173. #region When Digivolving
  174. if (timing == EffectTiming.OnEnterFieldAnyone)
  175. {
  176. ActivateClass activateClass = new ActivateClass();
  177. activateClass.SetUpICardEffect("Suspend 1 digimon", CanUseCondition, card);
  178. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  179. cardEffects.Add(activateClass);
  180. string EffectDiscription()
  181. {
  182. return "[When Digivolving] Suspend 1 of your opponent's Digimon or Tamers. Then, until their turn ends, 1 of their Digimon or Tamers can't activate [When Digivolving] effects or unsuspend.";
  183. }
  184. bool CanUseCondition(Hashtable hashtable)
  185. {
  186. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  187. {
  188. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  189. {
  190. return true;
  191. }
  192. }
  193. return false;
  194. }
  195. bool CanActivateCondition(Hashtable hashtable)
  196. {
  197. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  198. {
  199. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentConditionSuspend))
  200. {
  201. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentConditionStopWD))
  202. {
  203. return true;
  204. }
  205. }
  206. }
  207. return false;
  208. }
  209. bool CanSelectPermanentConditionSuspend(Permanent permanent)
  210. {
  211. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  212. {
  213. if (permanent.IsTamer || permanent.IsDigimon)
  214. {
  215. return true;
  216. }
  217. }
  218. return false;
  219. }
  220. bool CanSelectPermanentConditionStopWD(Permanent permanent)
  221. {
  222. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  223. {
  224. if (permanent.IsTamer || permanent.IsDigimon)
  225. {
  226. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  227. {
  228. return true;
  229. }
  230. }
  231. }
  232. return false;
  233. }
  234. IEnumerator ActivateCoroutine(Hashtable hashtable)
  235. {
  236. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionSuspend));
  237. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  238. selectPermanentEffect.SetUp(
  239. selectPlayer: card.Owner,
  240. canTargetCondition: CanSelectPermanentConditionSuspend,
  241. canTargetCondition_ByPreSelecetedList: null,
  242. canEndSelectCondition: null,
  243. maxCount: maxCount,
  244. canNoSelect: false,
  245. canEndNotMax: false,
  246. selectPermanentCoroutine: null,
  247. afterSelectPermanentCoroutine: null,
  248. mode: SelectPermanentEffect.Mode.Tap,
  249. cardEffect: activateClass);
  250. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer to suspend", "The opponent is selecting 1 Digimon or tamer to suspend");
  251. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  252. Permanent selectedPermanent = null;
  253. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionStopWD));
  254. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  255. selectPermanentEffect1.SetUp(
  256. selectPlayer: card.Owner,
  257. canTargetCondition: CanSelectPermanentConditionStopWD,
  258. canTargetCondition_ByPreSelecetedList: null,
  259. canEndSelectCondition: null,
  260. maxCount: maxCount1,
  261. canNoSelect: false,
  262. canEndNotMax: false,
  263. selectPermanentCoroutine: SelectPermanentCoroutine,
  264. afterSelectPermanentCoroutine: null,
  265. mode: SelectPermanentEffect.Mode.Custom,
  266. cardEffect: activateClass);
  267. selectPermanentEffect1.SetUpCustomMessage("Select 1 Digimon or Tamer to disable WD effects", "The opponent is selecting 1 Digimon or tamer to disable WD effects");
  268. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  269. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  270. {
  271. selectedPermanent = permanent;
  272. yield return null;
  273. }
  274. DisableEffectClass invalidationClass = new DisableEffectClass();
  275. invalidationClass.SetUpICardEffect("Ignore [When Digivolving] Effect", hashtableDebuff => true, card);
  276. invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateCondition);
  277. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => invalidationClass);
  278. bool InvalidateCondition(ICardEffect cardEffect)
  279. {
  280. if (selectedPermanent.TopCard != null)
  281. {
  282. if (cardEffect != null)
  283. {
  284. if (cardEffect.EffectSourceCard != null)
  285. {
  286. if (isExistOnField(cardEffect.EffectSourceCard))
  287. {
  288. if (cardEffect.EffectSourceCard.PermanentOfThisCard() == selectedPermanent)
  289. {
  290. if (cardEffect.IsWhenDigivolving)
  291. {
  292. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  293. {
  294. return true;
  295. }
  296. }
  297. }
  298. }
  299. }
  300. }
  301. }
  302. return false;
  303. }
  304. }
  305. }
  306. #endregion
  307. #region On Deletion
  308. if (timing == EffectTiming.OnDestroyedAnyone)
  309. {
  310. ActivateClass activateClass = new ActivateClass();
  311. activateClass.SetUpICardEffect("Place as the bottom security card", CanUseCondition, card);
  312. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  313. cardEffects.Add(activateClass);
  314. string EffectDiscription()
  315. {
  316. return "[On Deletion] Place this card as the bottom security card.";
  317. }
  318. bool CanUseCondition(Hashtable hashtable)
  319. {
  320. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  321. }
  322. bool CanActivateCondition(Hashtable hashtable)
  323. {
  324. if (CardEffectCommons.CanActivateOnDeletion(card))
  325. {
  326. if (card.Owner.CanAddSecurity(activateClass))
  327. {
  328. return true;
  329. }
  330. }
  331. return false;
  332. }
  333. IEnumerator ActivateCoroutine(Hashtable hashtable)
  334. {
  335. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(card, toTop: false));
  336. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateRecoveryEffect(card.Owner));
  337. yield return ContinuousController.instance.StartCoroutine(new IAddSecurity(card.Owner).AddSecurity());
  338. }
  339. }
  340. #endregion
  341. return cardEffects;
  342. }
  343. }
  344. }