BT14_047.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT14
  5. {
  6. public class BT14_047 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Suspend 1 Digimon and opponent's Digimon can't unsuspend", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] Suspend 1 of your opponent's Digimon. During your opponent's next unsuspend phase, all of your opponent's Digimon with 5000 DP or less don't unsuspend.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. if (CardEffectCommons.IsExistOnBattleArea(card))
  32. {
  33. return true;
  34. }
  35. return false;
  36. }
  37. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  38. {
  39. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  40. {
  41. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  42. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  43. selectPermanentEffect.SetUp(
  44. selectPlayer: card.Owner,
  45. canTargetCondition: CanSelectPermanentCondition,
  46. canTargetCondition_ByPreSelecetedList: null,
  47. canEndSelectCondition: null,
  48. maxCount: maxCount,
  49. canNoSelect: false,
  50. canEndNotMax: false,
  51. selectPermanentCoroutine: null,
  52. afterSelectPermanentCoroutine: null,
  53. mode: SelectPermanentEffect.Mode.Tap,
  54. cardEffect: activateClass);
  55. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  56. }
  57. bool PermanentCondition(Permanent permanent)
  58. {
  59. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  60. {
  61. if (permanent.DP <= 5000)
  62. {
  63. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  64. {
  65. return true;
  66. }
  67. }
  68. }
  69. return false;
  70. }
  71. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspendPlayerEffect(
  72. permanentCondition: PermanentCondition,
  73. effectDuration: EffectDuration.UntilOwnerActivePhase,
  74. activateClass: activateClass,
  75. isOnlyActivePhase: true,
  76. effectName: "Your Digimon can't unsuspend"));
  77. }
  78. }
  79. if (timing == EffectTiming.OnEnterFieldAnyone)
  80. {
  81. ActivateClass activateClass = new ActivateClass();
  82. activateClass.SetUpICardEffect("Suspend 1 Digimon and opponent's Digimon can't unsuspend", CanUseCondition, card);
  83. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  84. cardEffects.Add(activateClass);
  85. string EffectDiscription()
  86. {
  87. return "[When Digivolving] Suspend 1 of your opponent's Digimon. During your opponent's next unsuspend phase, all of your opponent's Digimon with 5000 DP or less don't unsuspend.";
  88. }
  89. bool CanSelectPermanentCondition(Permanent permanent)
  90. {
  91. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  92. }
  93. bool CanUseCondition(Hashtable hashtable)
  94. {
  95. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  96. }
  97. bool CanActivateCondition(Hashtable hashtable)
  98. {
  99. if (CardEffectCommons.IsExistOnBattleArea(card))
  100. {
  101. return true;
  102. }
  103. return false;
  104. }
  105. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  106. {
  107. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  108. {
  109. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  110. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  111. selectPermanentEffect.SetUp(
  112. selectPlayer: card.Owner,
  113. canTargetCondition: CanSelectPermanentCondition,
  114. canTargetCondition_ByPreSelecetedList: null,
  115. canEndSelectCondition: null,
  116. maxCount: maxCount,
  117. canNoSelect: false,
  118. canEndNotMax: false,
  119. selectPermanentCoroutine: null,
  120. afterSelectPermanentCoroutine: null,
  121. mode: SelectPermanentEffect.Mode.Tap,
  122. cardEffect: activateClass);
  123. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  124. }
  125. bool PermanentCondition(Permanent permanent)
  126. {
  127. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  128. {
  129. if (permanent.DP <= 5000)
  130. {
  131. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  132. {
  133. return true;
  134. }
  135. }
  136. }
  137. return false;
  138. }
  139. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspendPlayerEffect(
  140. permanentCondition: PermanentCondition,
  141. effectDuration: EffectDuration.UntilOwnerActivePhase,
  142. activateClass: activateClass,
  143. isOnlyActivePhase: true,
  144. effectName: "Your Digimon can't unsuspend"));
  145. }
  146. }
  147. return cardEffects;
  148. }
  149. }
  150. }