ST18_15.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.ST18
  4. {
  5. public class ST18_15 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Main Effect
  11. if (timing == EffectTiming.OptionSkill)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  15. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  16. cardEffects.Add(activateClass);
  17. string EffectDescription()
  18. {
  19. return
  20. "[Main] Suspend 1 Digimon. If this effect suspended your Digimon, return 1 of your opponent's suspended Digimon to the bottom of the deck. Then, unsuspend 1 Digimon.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  25. }
  26. bool CanSelectPermanentCondition(Permanent permanent)
  27. {
  28. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  29. }
  30. bool CanSelectSuspendedPermanentCondition(Permanent permanent)
  31. {
  32. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  33. permanent.IsSuspended;
  34. }
  35. IEnumerator ActivateCoroutine(Hashtable hashtable)
  36. {
  37. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  38. {
  39. Permanent selectedPermanent = null;
  40. bool ownDigimon = false;
  41. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  42. selectPermanentEffect.SetUp(
  43. selectPlayer: card.Owner,
  44. canTargetCondition: CanSelectPermanentCondition,
  45. canTargetCondition_ByPreSelecetedList: null,
  46. canEndSelectCondition: null,
  47. maxCount: 1,
  48. canNoSelect: false,
  49. canEndNotMax: false,
  50. selectPermanentCoroutine: SelectPermanentCoroutine,
  51. afterSelectPermanentCoroutine: null,
  52. mode: SelectPermanentEffect.Mode.Custom,
  53. cardEffect: activateClass);
  54. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  55. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  56. {
  57. selectedPermanent = permanent;
  58. yield return null;
  59. }
  60. if (selectedPermanent != null &&
  61. selectedPermanent.TopCard &&
  62. !selectedPermanent.TopCard.CanNotBeAffected(activateClass) &&
  63. !selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  64. {
  65. yield return ContinuousController.instance.StartCoroutine(
  66. new SuspendPermanentsClass(new List<Permanent>() { selectedPermanent },
  67. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  68. ownDigimon = selectedPermanent.IsSuspended &&
  69. CardEffectCommons.IsOwnerPermanent(selectedPermanent, card);
  70. }
  71. if (ownDigimon && CardEffectCommons.HasMatchConditionPermanent(CanSelectSuspendedPermanentCondition))
  72. {
  73. selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  74. selectPermanentEffect.SetUp(
  75. selectPlayer: card.Owner,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canTargetCondition: CanSelectSuspendedPermanentCondition,
  78. canEndSelectCondition: null,
  79. maxCount: 1,
  80. canNoSelect: false,
  81. canEndNotMax: false,
  82. selectPermanentCoroutine: null,
  83. afterSelectPermanentCoroutine: null,
  84. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  85. cardEffect: activateClass);
  86. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to bottom deck.",
  87. "The opponent is selecting 1 Digimon to bottom deck.");
  88. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  89. }
  90. selectPermanentEffect.SetUp(
  91. selectPlayer: card.Owner,
  92. canTargetCondition: permanent => CanSelectPermanentCondition(permanent) && permanent.CanUnsuspend,
  93. canTargetCondition_ByPreSelecetedList: null,
  94. canEndSelectCondition: null,
  95. maxCount: 1,
  96. canNoSelect: false,
  97. canEndNotMax: false,
  98. selectPermanentCoroutine: null,
  99. afterSelectPermanentCoroutine: null,
  100. mode: SelectPermanentEffect.Mode.UnTap,
  101. cardEffect: activateClass);
  102. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  103. }
  104. }
  105. }
  106. #endregion
  107. #region Security Effect
  108. if (timing == EffectTiming.SecuritySkill)
  109. {
  110. ActivateClass activateClass = new ActivateClass();
  111. activateClass.SetUpICardEffect("Return 1 of your opponent's suspended Digimon to the bottom of the deck", CanUseCondition, card);
  112. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  113. activateClass.SetIsSecurityEffect(true);
  114. cardEffects.Add(activateClass);
  115. string EffectDescription()
  116. {
  117. return
  118. "[Security] Return 1 of your opponent's suspended Digimon to the bottom of the deck.";
  119. }
  120. bool CanUseCondition(Hashtable hashtable)
  121. {
  122. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  123. }
  124. bool CanSelectSuspendedPermanentCondition(Permanent permanent)
  125. {
  126. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  127. permanent.IsSuspended;
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable hashtable)
  130. {
  131. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSuspendedPermanentCondition))
  132. {
  133. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  134. selectPermanentEffect.SetUp(
  135. selectPlayer: card.Owner,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canTargetCondition: CanSelectSuspendedPermanentCondition,
  138. canEndSelectCondition: null,
  139. maxCount: 1,
  140. canNoSelect: false,
  141. canEndNotMax: false,
  142. selectPermanentCoroutine: null,
  143. afterSelectPermanentCoroutine: null,
  144. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  145. cardEffect: activateClass);
  146. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to bottom deck.",
  147. "The opponent is selecting 1 Digimon to bottom deck.");
  148. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  149. }
  150. }
  151. }
  152. #endregion
  153. return cardEffects;
  154. }
  155. }
  156. }