LM_042.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  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. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd(
  141. targetPermanent: selectedPermanent,
  142. activateClass: activateClass
  143. ));
  144. DisableEffectClass invalidationClass = new DisableEffectClass();
  145. invalidationClass.SetUpICardEffect("Ignore [When Digivolving] Effect", hashtableDebuff => true, card);
  146. invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateCondition);
  147. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => invalidationClass);
  148. bool InvalidateCondition(ICardEffect cardEffect)
  149. {
  150. if (selectedPermanent.TopCard != null)
  151. {
  152. if (cardEffect != null)
  153. {
  154. if (cardEffect.EffectSourceCard != null)
  155. {
  156. if (isExistOnField(cardEffect.EffectSourceCard))
  157. {
  158. if (cardEffect.EffectSourceCard.PermanentOfThisCard() == selectedPermanent)
  159. {
  160. if (cardEffect.IsWhenDigivolving)
  161. {
  162. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  163. {
  164. return true;
  165. }
  166. }
  167. }
  168. }
  169. }
  170. }
  171. }
  172. return false;
  173. }
  174. }
  175. }
  176. #endregion
  177. #region When Digivolving
  178. if (timing == EffectTiming.OnEnterFieldAnyone)
  179. {
  180. ActivateClass activateClass = new ActivateClass();
  181. activateClass.SetUpICardEffect("Suspend 1 digimon", CanUseCondition, card);
  182. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  183. cardEffects.Add(activateClass);
  184. string EffectDiscription()
  185. {
  186. 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.";
  187. }
  188. bool CanUseCondition(Hashtable hashtable)
  189. {
  190. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  191. {
  192. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  193. {
  194. return true;
  195. }
  196. }
  197. return false;
  198. }
  199. bool CanActivateCondition(Hashtable hashtable)
  200. {
  201. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  202. {
  203. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentConditionSuspend))
  204. {
  205. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentConditionStopWD))
  206. {
  207. return true;
  208. }
  209. }
  210. }
  211. return false;
  212. }
  213. bool CanSelectPermanentConditionSuspend(Permanent permanent)
  214. {
  215. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  216. {
  217. if (permanent.IsTamer || permanent.IsDigimon)
  218. {
  219. return true;
  220. }
  221. }
  222. return false;
  223. }
  224. bool CanSelectPermanentConditionStopWD(Permanent permanent)
  225. {
  226. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  227. {
  228. if (permanent.IsTamer || permanent.IsDigimon)
  229. {
  230. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  231. {
  232. return true;
  233. }
  234. }
  235. }
  236. return false;
  237. }
  238. IEnumerator ActivateCoroutine(Hashtable hashtable)
  239. {
  240. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionSuspend));
  241. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  242. selectPermanentEffect.SetUp(
  243. selectPlayer: card.Owner,
  244. canTargetCondition: CanSelectPermanentConditionSuspend,
  245. canTargetCondition_ByPreSelecetedList: null,
  246. canEndSelectCondition: null,
  247. maxCount: maxCount,
  248. canNoSelect: false,
  249. canEndNotMax: false,
  250. selectPermanentCoroutine: null,
  251. afterSelectPermanentCoroutine: null,
  252. mode: SelectPermanentEffect.Mode.Tap,
  253. cardEffect: activateClass);
  254. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer to suspend", "The opponent is selecting 1 Digimon or tamer to suspend");
  255. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  256. Permanent selectedPermanent = null;
  257. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionStopWD));
  258. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  259. selectPermanentEffect1.SetUp(
  260. selectPlayer: card.Owner,
  261. canTargetCondition: CanSelectPermanentConditionStopWD,
  262. canTargetCondition_ByPreSelecetedList: null,
  263. canEndSelectCondition: null,
  264. maxCount: maxCount1,
  265. canNoSelect: false,
  266. canEndNotMax: false,
  267. selectPermanentCoroutine: SelectPermanentCoroutine,
  268. afterSelectPermanentCoroutine: null,
  269. mode: SelectPermanentEffect.Mode.Custom,
  270. cardEffect: activateClass);
  271. selectPermanentEffect1.SetUpCustomMessage("Select 1 Digimon or Tamer to disable WD effects", "The opponent is selecting 1 Digimon or tamer to disable WD effects");
  272. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  273. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  274. {
  275. selectedPermanent = permanent;
  276. yield return null;
  277. }
  278. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd(
  279. targetPermanent: selectedPermanent,
  280. activateClass: activateClass
  281. ));
  282. DisableEffectClass invalidationClass = new DisableEffectClass();
  283. invalidationClass.SetUpICardEffect("Ignore [When Digivolving] Effect", hashtableDebuff => true, card);
  284. invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateCondition);
  285. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => invalidationClass);
  286. bool InvalidateCondition(ICardEffect cardEffect)
  287. {
  288. if (selectedPermanent.TopCard != null)
  289. {
  290. if (cardEffect != null)
  291. {
  292. if (cardEffect.EffectSourceCard != null)
  293. {
  294. if (isExistOnField(cardEffect.EffectSourceCard))
  295. {
  296. if (cardEffect.EffectSourceCard.PermanentOfThisCard() == selectedPermanent)
  297. {
  298. if (cardEffect.IsWhenDigivolving)
  299. {
  300. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  301. {
  302. return true;
  303. }
  304. }
  305. }
  306. }
  307. }
  308. }
  309. }
  310. return false;
  311. }
  312. }
  313. }
  314. #endregion
  315. #region On Deletion
  316. if (timing == EffectTiming.OnDestroyedAnyone)
  317. {
  318. ActivateClass activateClass = new ActivateClass();
  319. activateClass.SetUpICardEffect("Place as the bottom security card", CanUseCondition, card);
  320. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  321. cardEffects.Add(activateClass);
  322. string EffectDiscription()
  323. {
  324. return "[On Deletion] Place this card as the bottom security card.";
  325. }
  326. bool CanUseCondition(Hashtable hashtable)
  327. {
  328. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  329. }
  330. bool CanActivateCondition(Hashtable hashtable)
  331. {
  332. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  333. {
  334. if (card.Owner.CanAddSecurity(activateClass))
  335. {
  336. return true;
  337. }
  338. }
  339. return false;
  340. }
  341. IEnumerator ActivateCoroutine(Hashtable hashtable)
  342. {
  343. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(card, toTop: false));
  344. }
  345. }
  346. #endregion
  347. return cardEffects;
  348. }
  349. }
  350. }