LM_023.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.LM
  4. {
  5. public class LM_023 : 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.EqualsCardName("Sakuyamon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition,
  18. digivolutionCost: 1, ignoreDigivolutionRequirement: true, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Ace - Blast Digivolve
  22. if (timing == EffectTiming.OnCounterTiming)
  23. {
  24. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  25. }
  26. #endregion
  27. #region On Play/ When Digivolving Shared
  28. bool CanSelectCardConditionShared(CardSource cardSource)
  29. {
  30. return (cardSource.IsTamer && cardSource.HasCardColor(CardColor.Yellow)) ||
  31. (cardSource.OptionCardColors.Count == 1 && cardSource.GetCostItself <= 5);
  32. }
  33. #endregion
  34. #region On Play
  35. if (timing == EffectTiming.OnEnterFieldAnyone)
  36. {
  37. ActivateClass activateClass = new ActivateClass();
  38. activateClass.SetUpICardEffect("Place 1 card from your hand on top of your security stack", CanUseCondition, card);
  39. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  40. cardEffects.Add(activateClass);
  41. string EffectDescription()
  42. {
  43. return
  44. "[On Play] You may place 1 yellow Tamer card or 1-color Option card with a cost of 5 or less from your hand on top of your security stack.";
  45. }
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  53. CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardConditionShared) &&
  54. card.Owner.CanAddSecurity(activateClass);
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable hashtable)
  57. {
  58. List<CardSource> selectedCards = new List<CardSource>();
  59. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  60. selectHandEffect.SetUp(
  61. selectPlayer: card.Owner,
  62. canTargetCondition: CanSelectCardConditionShared,
  63. canTargetCondition_ByPreSelecetedList: null,
  64. canEndSelectCondition: null,
  65. maxCount: 1,
  66. canNoSelect: true,
  67. canEndNotMax: false,
  68. isShowOpponent: true,
  69. selectCardCoroutine: SelectCardCoroutine,
  70. afterSelectCardCoroutine: null,
  71. mode: SelectHandEffect.Mode.Custom,
  72. cardEffect: activateClass);
  73. selectHandEffect.SetUpCustomMessage("Select 1 card to place at the top of security.",
  74. "The opponent is selecting 1 card to place at the top of security.");
  75. selectHandEffect.SetUpCustomMessage_ShowCard("Security Top Card");
  76. yield return StartCoroutine(selectHandEffect.Activate());
  77. IEnumerator SelectCardCoroutine(CardSource cardSource)
  78. {
  79. selectedCards.Add(cardSource);
  80. yield return null;
  81. }
  82. foreach (CardSource cardSource in selectedCards)
  83. {
  84. yield return ContinuousController.instance.StartCoroutine(
  85. CardObjectController.AddSecurityCard(cardSource, toTop: true));
  86. }
  87. }
  88. }
  89. #endregion
  90. #region When Digivolving
  91. if (timing == EffectTiming.OnEnterFieldAnyone)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("Place 1 card from your hand on top of your security stack", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  96. cardEffects.Add(activateClass);
  97. string EffectDescription()
  98. {
  99. return
  100. "[When Digivolving] You may place 1 yellow Tamer card or 1-color Option card with a cost of 5 or less from your hand on top of your security stack.";
  101. }
  102. bool CanUseCondition(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  105. }
  106. bool CanActivateCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  109. CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardConditionShared) &&
  110. card.Owner.CanAddSecurity(activateClass);
  111. }
  112. IEnumerator ActivateCoroutine(Hashtable hashtable)
  113. {
  114. List<CardSource> selectedCards = new List<CardSource>();
  115. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  116. selectHandEffect.SetUp(
  117. selectPlayer: card.Owner,
  118. canTargetCondition: CanSelectCardConditionShared,
  119. canTargetCondition_ByPreSelecetedList: null,
  120. canEndSelectCondition: null,
  121. maxCount: 1,
  122. canNoSelect: true,
  123. canEndNotMax: false,
  124. isShowOpponent: true,
  125. selectCardCoroutine: SelectCardCoroutine,
  126. afterSelectCardCoroutine: null,
  127. mode: SelectHandEffect.Mode.Custom,
  128. cardEffect: activateClass);
  129. selectHandEffect.SetUpCustomMessage("Select 1 card to place at the top of security.",
  130. "The opponent is selecting 1 card to place at the top of security.");
  131. selectHandEffect.SetUpCustomMessage_ShowCard("Security Top Card");
  132. yield return StartCoroutine(selectHandEffect.Activate());
  133. IEnumerator SelectCardCoroutine(CardSource cardSource)
  134. {
  135. selectedCards.Add(cardSource);
  136. yield return null;
  137. }
  138. foreach (CardSource cardSource in selectedCards)
  139. {
  140. yield return ContinuousController.instance.StartCoroutine(
  141. CardObjectController.AddSecurityCard(cardSource, toTop: true));
  142. }
  143. }
  144. }
  145. #endregion
  146. #region All Turns
  147. if (timing == EffectTiming.OnUseOption)
  148. {
  149. ActivateClass activateClass = new ActivateClass();
  150. activateClass.SetUpICardEffect("1 of your opponent’s Digimon gets -6000 DP for the turn", CanUseCondition, card);
  151. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  152. activateClass.SetHashString("AllTurns_LM_023");
  153. cardEffects.Add(activateClass);
  154. string EffectDescription()
  155. {
  156. return
  157. "[All Turns] (Once Per Turn) When an Option card is used, or when a card is added to a security stack, 1 of your opponent’s Digimon gets -6000 DP for the turn.";
  158. }
  159. bool CanUseCondition(Hashtable hashtable)
  160. {
  161. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  162. CardEffectCommons.CanTriggerWhenUseOption(hashtable, null, null, card);
  163. }
  164. bool CanSelectPermanentCondition(Permanent permanent)
  165. {
  166. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  167. }
  168. bool CanActivateCondition(Hashtable hashtable)
  169. {
  170. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  171. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  172. }
  173. IEnumerator ActivateCoroutine(Hashtable hashtable)
  174. {
  175. Permanent selectedPermanent = null;
  176. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  177. selectPermanentEffect.SetUp(
  178. selectPlayer: card.Owner,
  179. canTargetCondition: CanSelectPermanentCondition,
  180. canTargetCondition_ByPreSelecetedList: null,
  181. canEndSelectCondition: null,
  182. maxCount: 1,
  183. canNoSelect: false,
  184. canEndNotMax: false,
  185. selectPermanentCoroutine: SelectPermanentCoroutine,
  186. afterSelectPermanentCoroutine: null,
  187. mode: SelectPermanentEffect.Mode.Custom,
  188. cardEffect: activateClass);
  189. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -6000.",
  190. "The opponent is selecting 1 Digimon that will get DP -6000.");
  191. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  192. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  193. {
  194. selectedPermanent = permanent;
  195. yield return null;
  196. }
  197. if (selectedPermanent != null)
  198. {
  199. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  200. targetPermanent: selectedPermanent, changeValue: -6000, effectDuration: EffectDuration.UntilEachTurnEnd,
  201. activateClass: activateClass));
  202. }
  203. }
  204. }
  205. if (timing == EffectTiming.OnAddSecurity)
  206. {
  207. ActivateClass activateClass = new ActivateClass();
  208. activateClass.SetUpICardEffect("1 of your opponent’s Digimon gets -6000 DP for the turn", CanUseCondition, card);
  209. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  210. activateClass.SetHashString("AllTurns_LM_023");
  211. cardEffects.Add(activateClass);
  212. string EffectDescription()
  213. {
  214. return
  215. "[All Turns] (Once Per Turn) When an Option card is used, or when a card is added to a security stack, 1 of your opponent’s Digimon gets -6000 DP for the turn.";
  216. }
  217. bool CanUseCondition(Hashtable hashtable)
  218. {
  219. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  220. CardEffectCommons.CanTriggerWhenAddSecurity(hashtable, null);
  221. }
  222. bool CanSelectPermanentCondition(Permanent permanent)
  223. {
  224. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  225. }
  226. bool CanActivateCondition(Hashtable hashtable)
  227. {
  228. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  229. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  230. }
  231. IEnumerator ActivateCoroutine(Hashtable hashtable)
  232. {
  233. Permanent selectedPermanent = null;
  234. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  235. selectPermanentEffect.SetUp(
  236. selectPlayer: card.Owner,
  237. canTargetCondition: CanSelectPermanentCondition,
  238. canTargetCondition_ByPreSelecetedList: null,
  239. canEndSelectCondition: null,
  240. maxCount: 1,
  241. canNoSelect: false,
  242. canEndNotMax: false,
  243. selectPermanentCoroutine: SelectPermanentCoroutine,
  244. afterSelectPermanentCoroutine: null,
  245. mode: SelectPermanentEffect.Mode.Custom,
  246. cardEffect: activateClass);
  247. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -6000.",
  248. "The opponent is selecting 1 Digimon that will get DP -6000.");
  249. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  250. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  251. {
  252. selectedPermanent = permanent;
  253. yield return null;
  254. }
  255. if (selectedPermanent != null)
  256. {
  257. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  258. targetPermanent: selectedPermanent, changeValue: -6000, effectDuration: EffectDuration.UntilEachTurnEnd,
  259. activateClass: activateClass));
  260. }
  261. }
  262. }
  263. #endregion
  264. return cardEffects;
  265. }
  266. }
  267. }