BT19_046.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_046 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region On Play/When Digivolving Shared
  11. bool OpponentsDigimon(Permanent permanent)
  12. {
  13. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  14. }
  15. bool OpponentsDataTraitDigimon(Permanent permanent)
  16. {
  17. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  18. permanent.TopCard.EqualsTraits("Data");
  19. }
  20. #endregion
  21. #region On Play
  22. if (timing == EffectTiming.OnEnterFieldAnyone)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("Suspend 1 digimon, then 1 Digimon with [Data] trait can't unsuspend", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  27. cardEffects.Add(activateClass);
  28. string EffectDiscription()
  29. {
  30. return "[On Play] Suspend 1 of your opponent's Digimon. Then, 1 of their Digimon with the [Data] trait can't unsuspend until the end of their turn.";
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable hashtable)
  41. {
  42. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  43. if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimon))
  44. {
  45. selectPermanentEffect.SetUp(
  46. selectPlayer: card.Owner,
  47. canTargetCondition: OpponentsDigimon,
  48. canTargetCondition_ByPreSelecetedList: null,
  49. canEndSelectCondition: null,
  50. maxCount: 1,
  51. canNoSelect: false,
  52. canEndNotMax: false,
  53. selectPermanentCoroutine: null,
  54. afterSelectPermanentCoroutine: null,
  55. mode: SelectPermanentEffect.Mode.Tap,
  56. cardEffect: activateClass);
  57. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  58. }
  59. if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDataTraitDigimon))
  60. {
  61. Permanent selectedPermanent = null;
  62. selectPermanentEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: OpponentsDataTraitDigimon,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: 1,
  68. canNoSelect: false,
  69. canEndNotMax: false,
  70. selectPermanentCoroutine: SelectCantUnsuspendTarget,
  71. afterSelectPermanentCoroutine: null,
  72. mode: SelectPermanentEffect.Mode.Custom,
  73. cardEffect: activateClass);
  74. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  75. IEnumerator SelectCantUnsuspendTarget(Permanent permanent)
  76. {
  77. selectedPermanent = permanent;
  78. yield return null;
  79. }
  80. if(selectedPermanent != null)
  81. {
  82. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspend(
  83. targetPermanent: selectedPermanent,
  84. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  85. activateClass: activateClass,
  86. condition: null,
  87. effectName: "Can't unsuspend"
  88. ));
  89. }
  90. }
  91. }
  92. }
  93. #endregion
  94. #region When Digivolving
  95. if (timing == EffectTiming.OnEnterFieldAnyone)
  96. {
  97. ActivateClass activateClass = new ActivateClass();
  98. activateClass.SetUpICardEffect("Suspend 1 digimon, then 1 Digimon with [Data] trait can't unsuspend", CanUseCondition, card);
  99. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  100. cardEffects.Add(activateClass);
  101. string EffectDiscription()
  102. {
  103. return "[When Digivolving] Suspend 1 of your opponent's Digimon. Then, 1 of their Digimon with the [Data] trait can't unsuspend until the end of their turn.";
  104. }
  105. bool CanUseCondition(Hashtable hashtable)
  106. {
  107. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  108. }
  109. bool CanActivateCondition(Hashtable hashtable)
  110. {
  111. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  112. }
  113. IEnumerator ActivateCoroutine(Hashtable hashtable)
  114. {
  115. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  116. if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimon))
  117. {
  118. selectPermanentEffect.SetUp(
  119. selectPlayer: card.Owner,
  120. canTargetCondition: OpponentsDigimon,
  121. canTargetCondition_ByPreSelecetedList: null,
  122. canEndSelectCondition: null,
  123. maxCount: 1,
  124. canNoSelect: false,
  125. canEndNotMax: false,
  126. selectPermanentCoroutine: null,
  127. afterSelectPermanentCoroutine: null,
  128. mode: SelectPermanentEffect.Mode.Tap,
  129. cardEffect: activateClass);
  130. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  131. }
  132. if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDataTraitDigimon))
  133. {
  134. Permanent selectedPermanent = null;
  135. selectPermanentEffect.SetUp(
  136. selectPlayer: card.Owner,
  137. canTargetCondition: OpponentsDataTraitDigimon,
  138. canTargetCondition_ByPreSelecetedList: null,
  139. canEndSelectCondition: null,
  140. maxCount: 1,
  141. canNoSelect: false,
  142. canEndNotMax: false,
  143. selectPermanentCoroutine: SelectCantUnsuspendTarget,
  144. afterSelectPermanentCoroutine: null,
  145. mode: SelectPermanentEffect.Mode.Custom,
  146. cardEffect: activateClass);
  147. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  148. IEnumerator SelectCantUnsuspendTarget(Permanent permanent)
  149. {
  150. selectedPermanent = permanent;
  151. yield return null;
  152. }
  153. if (selectedPermanent != null)
  154. {
  155. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspend(
  156. targetPermanent: selectedPermanent,
  157. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  158. activateClass: activateClass,
  159. condition: null,
  160. effectName: "Can't unsuspend"
  161. ));
  162. }
  163. }
  164. }
  165. }
  166. #endregion
  167. return cardEffects;
  168. }
  169. }
  170. }