LM_041.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. //Regalecusmon
  5. namespace DCGO.CardEffects.LM
  6. {
  7. public class LM_041 : 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("DS"))
  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 On Play
  30. if (timing == EffectTiming.OnEnterFieldAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("1 [DS] digimon unsuspends", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[On Play] 1 of your Digimon with the [DS] trait unsuspends.";
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  43. {
  44. if (CardEffectCommons.CanTriggerOnAttack(hashtable, card))
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. bool CanActivateCondition(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  54. {
  55. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition))
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. bool CanSelectPermanentCondition(Permanent permanent)
  63. {
  64. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  65. {
  66. if (permanent.TopCard.EqualsTraits("DS"))
  67. {
  68. return true;
  69. }
  70. }
  71. return false;
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable hashtable)
  74. {
  75. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  76. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  77. selectPermanentEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: CanSelectPermanentCondition,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. maxCount: maxCount,
  83. canNoSelect: false,
  84. canEndNotMax: false,
  85. selectPermanentCoroutine: null,
  86. afterSelectPermanentCoroutine: null,
  87. mode: SelectPermanentEffect.Mode.UnTap,
  88. cardEffect: activateClass);
  89. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will be returned to unsuspend", "The opponent is selecting 1 Digimon that will be returned to unsuspend");
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. }
  92. }
  93. #endregion
  94. #region When Digivolving
  95. if (timing == EffectTiming.OnEnterFieldAnyone)
  96. {
  97. ActivateClass activateClass = new ActivateClass();
  98. activateClass.SetUpICardEffect("1 [DS] digimon unsuspends", CanUseCondition, card);
  99. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  100. cardEffects.Add(activateClass);
  101. string EffectDiscription()
  102. {
  103. return "[When Digivolving] 1 of your Digimon with the [DS] trait unsuspends.";
  104. }
  105. bool CanUseCondition(Hashtable hashtable)
  106. {
  107. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  108. {
  109. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  110. {
  111. return true;
  112. }
  113. }
  114. return false;
  115. }
  116. bool CanActivateCondition(Hashtable hashtable)
  117. {
  118. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  119. {
  120. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition))
  121. {
  122. return true;
  123. }
  124. }
  125. return false;
  126. }
  127. bool CanSelectPermanentCondition(Permanent permanent)
  128. {
  129. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  130. {
  131. if (permanent.TopCard.EqualsTraits("DS"))
  132. {
  133. return true;
  134. }
  135. }
  136. return false;
  137. }
  138. IEnumerator ActivateCoroutine(Hashtable hashtable)
  139. {
  140. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  141. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  142. selectPermanentEffect.SetUp(
  143. selectPlayer: card.Owner,
  144. canTargetCondition: CanSelectPermanentCondition,
  145. canTargetCondition_ByPreSelecetedList: null,
  146. canEndSelectCondition: null,
  147. maxCount: maxCount,
  148. canNoSelect: false,
  149. canEndNotMax: false,
  150. selectPermanentCoroutine: null,
  151. afterSelectPermanentCoroutine: null,
  152. mode: SelectPermanentEffect.Mode.UnTap,
  153. cardEffect: activateClass);
  154. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will be returned to unsuspend", "The opponent is selecting 1 Digimon that will be returned to unsuspend");
  155. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  156. }
  157. }
  158. #endregion
  159. #region When Digivolving OPT
  160. if (timing == EffectTiming.OnEnterFieldAnyone)
  161. {
  162. ActivateClass activateClass = new ActivateClass();
  163. activateClass.SetUpICardEffect("Add top sec to hand", CanUseCondition, card);
  164. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  165. activateClass.SetHashString("WD/WA_LM_041");
  166. cardEffects.Add(activateClass);
  167. string EffectDiscription()
  168. {
  169. return "[When Digivolving] [Once Per Turn] If you have 1 or more memory, your opponent adds their top security card to the hand. Then, if you have 1 or less, until your opponent's turn ends, 1 of their Digimon or Tamers can't be suspended.";
  170. }
  171. bool CanUseCondition(Hashtable hashtable)
  172. {
  173. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  174. {
  175. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  176. {
  177. return true;
  178. }
  179. }
  180. return false;
  181. }
  182. bool CanActivateCondition(Hashtable hashtable)
  183. {
  184. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  185. {
  186. return true;
  187. }
  188. return false;
  189. }
  190. bool CanSelectPermanentCondition(Permanent permanent)
  191. {
  192. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  193. {
  194. if (permanent.IsDigimon && permanent.IsTamer)
  195. {
  196. return true;
  197. }
  198. }
  199. return false;
  200. }
  201. IEnumerator ActivateCoroutine(Hashtable hashtable)
  202. {
  203. if (card.Owner.MemoryForPlayer >= 1 && card.Owner.Enemy.CanReduceSecurity() && card.Owner.Enemy.SecurityCards.Count >= 1)
  204. {
  205. CardSource topCard = card.Owner.Enemy.SecurityCards[0];
  206. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { topCard }, false, activateClass));
  207. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
  208. player: card.Owner.Enemy,
  209. refSkillInfos: ref ContinuousController.instance.nullSkillInfos).ReduceSecurity());
  210. }
  211. if (card.Owner.MemoryForPlayer <= 1 && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  212. {
  213. Permanent selectedPermanent = null;
  214. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  215. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  216. selectPermanentEffect.SetUp(
  217. selectPlayer: card.Owner,
  218. canTargetCondition: CanSelectPermanentCondition,
  219. canTargetCondition_ByPreSelecetedList: null,
  220. canEndSelectCondition: null,
  221. maxCount: maxCount,
  222. canNoSelect: false,
  223. canEndNotMax: false,
  224. selectPermanentCoroutine: SelectPermanentCoroutine,
  225. afterSelectPermanentCoroutine: null,
  226. mode: SelectPermanentEffect.Mode.Custom,
  227. cardEffect: activateClass);
  228. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimom or Tamer to stun", "The opponent is selecting 1 Digimom or tamer to stun");
  229. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  230. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  231. {
  232. selectedPermanent = permanent;
  233. yield return null;
  234. }
  235. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspendPlayerEffect(
  236. permanentCondition: permanent => permanent == selectedPermanent,
  237. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  238. activateClass: activateClass,
  239. isOnlyActivePhase: false,
  240. effectName: "Opponent Digimon or Tamer can't unsuspend"));
  241. }
  242. }
  243. }
  244. #endregion
  245. #region When Attacking OPT
  246. if (timing == EffectTiming.OnAllyAttack)
  247. {
  248. ActivateClass activateClass = new ActivateClass();
  249. activateClass.SetUpICardEffect("Add top sec to hand", CanUseCondition, card);
  250. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  251. activateClass.SetHashString("WD/WA_LM_041");
  252. cardEffects.Add(activateClass);
  253. string EffectDiscription()
  254. {
  255. return "[When Attacking] [Once Per Turn] If you have 1 or more memory, your opponent adds their top security card to the hand. Then, if you have 1 or less, until your opponent's turn ends, 1 of their Digimon or Tamers can't be suspended.";
  256. }
  257. bool CanUseCondition(Hashtable hashtable)
  258. {
  259. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  260. {
  261. if (CardEffectCommons.CanTriggerOnAttack(hashtable, card))
  262. {
  263. return true;
  264. }
  265. }
  266. return false;
  267. }
  268. bool CanActivateCondition(Hashtable hashtable)
  269. {
  270. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  271. {
  272. return true;
  273. }
  274. return false;
  275. }
  276. bool CanSelectPermanentCondition(Permanent permanent)
  277. {
  278. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  279. {
  280. if (permanent.IsDigimon && permanent.IsTamer)
  281. {
  282. return true;
  283. }
  284. }
  285. return false;
  286. }
  287. IEnumerator ActivateCoroutine(Hashtable hashtable)
  288. {
  289. if (card.Owner.MemoryForPlayer >= 1 && card.Owner.Enemy.CanReduceSecurity() && card.Owner.Enemy.SecurityCards.Count >= 1)
  290. {
  291. CardSource topCard = card.Owner.Enemy.SecurityCards[0];
  292. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { topCard }, false, activateClass));
  293. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
  294. player: card.Owner.Enemy,
  295. refSkillInfos: ref ContinuousController.instance.nullSkillInfos).ReduceSecurity());
  296. }
  297. if (card.Owner.MemoryForPlayer <= 1 && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  298. {
  299. Permanent selectedPermanent = null;
  300. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  301. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  302. selectPermanentEffect.SetUp(
  303. selectPlayer: card.Owner,
  304. canTargetCondition: CanSelectPermanentCondition,
  305. canTargetCondition_ByPreSelecetedList: null,
  306. canEndSelectCondition: null,
  307. maxCount: maxCount,
  308. canNoSelect: false,
  309. canEndNotMax: false,
  310. selectPermanentCoroutine: SelectPermanentCoroutine,
  311. afterSelectPermanentCoroutine: null,
  312. mode: SelectPermanentEffect.Mode.Custom,
  313. cardEffect: activateClass);
  314. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimom or Tamer to stun", "The opponent is selecting 1 Digimom or tamer to stun");
  315. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  316. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  317. {
  318. selectedPermanent = permanent;
  319. yield return null;
  320. }
  321. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspendPlayerEffect(
  322. permanentCondition: permanent => permanent == selectedPermanent,
  323. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  324. activateClass: activateClass,
  325. isOnlyActivePhase: false,
  326. effectName: "Opponent Digimon or Tamer can't unsuspend"));
  327. }
  328. }
  329. }
  330. #endregion
  331. return cardEffects;
  332. }
  333. }
  334. }