BT14_050.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT14
  5. {
  6. public class BT14_050 : 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("Opponent's 1 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] 1 of your opponent's Digimon cannot unsuspend until the end of your opponent's turn.";
  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. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  34. {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  41. {
  42. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  43. {
  44. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  45. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  46. selectPermanentEffect.SetUp(
  47. selectPlayer: card.Owner,
  48. canTargetCondition: CanSelectPermanentCondition,
  49. canTargetCondition_ByPreSelecetedList: null,
  50. canEndSelectCondition: null,
  51. maxCount: maxCount,
  52. canNoSelect: false,
  53. canEndNotMax: false,
  54. selectPermanentCoroutine: SelectPermanentCoroutine,
  55. afterSelectPermanentCoroutine: null,
  56. mode: SelectPermanentEffect.Mode.Custom,
  57. cardEffect: activateClass);
  58. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get unable to unsuspend.", "The opponent is selecting 1 Digimon that will get unable to unsuspend.");
  59. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  60. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  61. {
  62. Permanent selectedPermanent = permanent;
  63. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd(
  64. targetPermanent: selectedPermanent,
  65. activateClass: activateClass
  66. ));
  67. }
  68. }
  69. }
  70. }
  71. if (timing == EffectTiming.OnEnterFieldAnyone)
  72. {
  73. ActivateClass activateClass = new ActivateClass();
  74. activateClass.SetUpICardEffect("Opponent's 1 Digimon can't unsuspend", CanUseCondition, card);
  75. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  76. cardEffects.Add(activateClass);
  77. string EffectDiscription()
  78. {
  79. return "[When Digivolving] 1 of your opponent's Digimon cannot unsuspend until the end of your opponent's turn.";
  80. }
  81. bool CanSelectPermanentCondition(Permanent permanent)
  82. {
  83. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  84. }
  85. bool CanUseCondition(Hashtable hashtable)
  86. {
  87. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  88. }
  89. bool CanActivateCondition(Hashtable hashtable)
  90. {
  91. if (CardEffectCommons.IsExistOnBattleArea(card))
  92. {
  93. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  94. {
  95. return true;
  96. }
  97. }
  98. return false;
  99. }
  100. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  101. {
  102. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  103. {
  104. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  105. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  106. selectPermanentEffect.SetUp(
  107. selectPlayer: card.Owner,
  108. canTargetCondition: CanSelectPermanentCondition,
  109. canTargetCondition_ByPreSelecetedList: null,
  110. canEndSelectCondition: null,
  111. maxCount: maxCount,
  112. canNoSelect: false,
  113. canEndNotMax: false,
  114. selectPermanentCoroutine: SelectPermanentCoroutine,
  115. afterSelectPermanentCoroutine: null,
  116. mode: SelectPermanentEffect.Mode.Custom,
  117. cardEffect: activateClass);
  118. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get unable to unsuspend.", "The opponent is selecting 1 Digimon that will get unable to unsuspend.");
  119. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  120. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  121. {
  122. Permanent selectedPermanent = permanent;
  123. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd(
  124. targetPermanent: selectedPermanent,
  125. activateClass: activateClass
  126. ));
  127. }
  128. }
  129. }
  130. }
  131. return cardEffects;
  132. }
  133. }
  134. }