LM_011.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. namespace DCGO.CardEffects.LM
  6. {
  7. public class LM_011 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region On Play/When Digivolving
  13. bool CanSelectSharedPermanentCondition(Permanent permanent)
  14. {
  15. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  16. }
  17. bool CanSelectBlockerCondition(Permanent permanent)
  18. {
  19. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  20. {
  21. return HasNoUnsuspendDigimon();
  22. }
  23. return false;
  24. }
  25. bool HasNoUnsuspendDigimon()
  26. {
  27. if (card.Owner.Enemy.GetBattleAreaDigimons().Count == 0)
  28. {
  29. return true;
  30. }
  31. foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaDigimons())
  32. {
  33. if (!permanent.IsSuspended)
  34. return false;
  35. }
  36. return true;
  37. }
  38. #endregion
  39. #region On Play
  40. if (timing == EffectTiming.OnEnterFieldAnyone)
  41. {
  42. ActivateClass activateClass = new ActivateClass();
  43. activateClass.SetUpICardEffect("Gain <Blocker>", 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. Then, if they have no unsuspended Digimon, 1 of your Digimon gains <Blocker> until the end of your opponent's turn.";
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  53. }
  54. bool CanActivateCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.IsExistOnBattleArea(card);
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable hashtable)
  59. {
  60. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  61. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSharedPermanentCondition))
  62. {
  63. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectSharedPermanentCondition));
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: CanSelectSharedPermanentCondition,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: maxCount,
  70. canNoSelect: false,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: null,
  73. afterSelectPermanentCoroutine: null,
  74. mode: SelectPermanentEffect.Mode.Tap,
  75. cardEffect: activateClass);
  76. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to Suspend.", "The opponent is selecting 1 Digimon to Suspend.");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. }
  79. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectBlockerCondition))
  80. {
  81. int blockerCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectBlockerCondition));
  82. selectPermanentEffect.SetUp(
  83. selectPlayer: card.Owner,
  84. canTargetCondition: CanSelectBlockerCondition,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canEndSelectCondition: null,
  87. maxCount: blockerCount,
  88. canNoSelect: false,
  89. canEndNotMax: false,
  90. selectPermanentCoroutine: SelectBlockerPermanent,
  91. afterSelectPermanentCoroutine: null,
  92. mode: SelectPermanentEffect.Mode.Custom,
  93. cardEffect: activateClass);
  94. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain <Blocker>.", "The opponent is selecting 1 Digimon to gain <Blocker>.");
  95. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  96. IEnumerator SelectBlockerPermanent(Permanent permanent)
  97. {
  98. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  99. targetPermanent: permanent,
  100. EffectDuration.UntilOpponentTurnEnd,
  101. activateClass: activateClass
  102. ));
  103. }
  104. }
  105. }
  106. }
  107. #endregion
  108. #region When Digivolving
  109. if (timing == EffectTiming.OnEnterFieldAnyone)
  110. {
  111. ActivateClass activateClass = new ActivateClass();
  112. activateClass.SetUpICardEffect("Gain <Blocker>", CanUseCondition, card);
  113. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  114. cardEffects.Add(activateClass);
  115. string EffectDiscription()
  116. {
  117. return "[When Digivolving] Suspend 1 of your opponent's Digimon. Then, if they have no unsuspended Digimon, 1 of your Digimon gains <Blocker> until the end of your opponent's turn.";
  118. }
  119. bool CanUseCondition(Hashtable hashtable)
  120. {
  121. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  122. }
  123. bool CanActivateCondition(Hashtable hashtable)
  124. {
  125. return CardEffectCommons.IsExistOnBattleArea(card);
  126. }
  127. IEnumerator ActivateCoroutine(Hashtable hashtable)
  128. {
  129. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  130. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSharedPermanentCondition))
  131. {
  132. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectSharedPermanentCondition));
  133. selectPermanentEffect.SetUp(
  134. selectPlayer: card.Owner,
  135. canTargetCondition: CanSelectSharedPermanentCondition,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. maxCount: maxCount,
  139. canNoSelect: false,
  140. canEndNotMax: false,
  141. selectPermanentCoroutine: null,
  142. afterSelectPermanentCoroutine: null,
  143. mode: SelectPermanentEffect.Mode.Tap,
  144. cardEffect: activateClass);
  145. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to Suspend.", "The opponent is selecting 1 Digimon to Suspend.");
  146. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  147. }
  148. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectBlockerCondition))
  149. {
  150. int blockerCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectBlockerCondition));
  151. selectPermanentEffect.SetUp(
  152. selectPlayer: card.Owner,
  153. canTargetCondition: CanSelectBlockerCondition,
  154. canTargetCondition_ByPreSelecetedList: null,
  155. canEndSelectCondition: null,
  156. maxCount: blockerCount,
  157. canNoSelect: false,
  158. canEndNotMax: false,
  159. selectPermanentCoroutine: SelectBlockerPermanent,
  160. afterSelectPermanentCoroutine: null,
  161. mode: SelectPermanentEffect.Mode.Custom,
  162. cardEffect: activateClass);
  163. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain <Blocker>.", "The opponent is selecting 1 Digimon to gain <Blocker>.");
  164. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  165. IEnumerator SelectBlockerPermanent(Permanent permanent)
  166. {
  167. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  168. targetPermanent: permanent,
  169. EffectDuration.UntilOpponentTurnEnd,
  170. activateClass: activateClass
  171. ));
  172. }
  173. }
  174. }
  175. }
  176. #endregion
  177. #region Your Turn - Inherited Effect
  178. if (timing == EffectTiming.None)
  179. {
  180. bool Condition()
  181. {
  182. if (CardEffectCommons.IsExistOnBattleArea(card))
  183. {
  184. if (CardEffectCommons.IsOwnerTurn(card))
  185. {
  186. if (card.PermanentOfThisCard().TopCard.HasText("Angoramon"))
  187. {
  188. return true;
  189. }
  190. }
  191. }
  192. return false;
  193. }
  194. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, condition: Condition));
  195. }
  196. #endregion
  197. return cardEffects;
  198. }
  199. }
  200. }