ST17_12.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. namespace DCGO.CardEffects.ST17
  9. {
  10. public class ST17_12 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.OptionSkill)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  19. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[Main] Suspend 1 of your opponent's Digimon. Then, return 1 of your opponent's suspended Digimon to the bottom of its owner's deck. 1 of your opponent's Digimon can't unsuspend until the end of your opponent's turn.";
  24. }
  25. bool CanSelectPermanentCondition(Permanent permanent)
  26. {
  27. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  28. }
  29. bool CanSelectPermanentCondition1(Permanent permanent)
  30. {
  31. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  32. {
  33. if (permanent.IsSuspended)
  34. {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }
  40. bool CanSelectPermanentCondition2(Permanent permanent)
  41. {
  42. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  43. {
  44. return true;
  45. }
  46. return false;
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  55. {
  56. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  57. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  58. selectPermanentEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: CanSelectPermanentCondition,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: maxCount,
  64. canNoSelect: false,
  65. canEndNotMax: false,
  66. selectPermanentCoroutine: null,
  67. afterSelectPermanentCoroutine: null,
  68. mode: SelectPermanentEffect.Mode.Tap,
  69. cardEffect: activateClass);
  70. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  71. }
  72. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  73. {
  74. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  75. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  76. selectPermanentEffect.SetUp(
  77. selectPlayer: card.Owner,
  78. canTargetCondition: CanSelectPermanentCondition1,
  79. canTargetCondition_ByPreSelecetedList: null,
  80. canEndSelectCondition: null,
  81. maxCount: maxCount,
  82. canNoSelect: false,
  83. canEndNotMax: false,
  84. selectPermanentCoroutine: null,
  85. afterSelectPermanentCoroutine: null,
  86. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  87. cardEffect: activateClass);
  88. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  89. }
  90. if(CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition2))
  91. {
  92. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  93. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  94. selectPermanentEffect.SetUp(
  95. selectPlayer: card.Owner,
  96. canTargetCondition: CanSelectPermanentCondition2,
  97. canTargetCondition_ByPreSelecetedList: null,
  98. canEndSelectCondition: null,
  99. maxCount: maxCount,
  100. canNoSelect: false,
  101. canEndNotMax: false,
  102. selectPermanentCoroutine: SelectPermanentCoroutine,
  103. afterSelectPermanentCoroutine: null,
  104. mode: SelectPermanentEffect.Mode.Custom,
  105. cardEffect: activateClass);
  106. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will not unsuspend.", "The opponent is selecting 1 Digimon that will not unsuspend.");
  107. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  108. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  109. {
  110. Permanent selectedPermanent = permanent;
  111. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd(
  112. targetPermanent: selectedPermanent,
  113. activateClass: activateClass
  114. ));
  115. }
  116. }
  117. }
  118. }
  119. if (timing == EffectTiming.SecuritySkill)
  120. {
  121. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  122. card: card,
  123. cardEffects: ref cardEffects,
  124. effectName: $"Suspend 1 Digimon and return a suspended Digimon to bottom of deck and prevent 1 Digimon from unsuspending.");
  125. }
  126. return cardEffects;
  127. }
  128. }
  129. }