BT14_043.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT14
  5. {
  6. public class BT14_043 : 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 your 1 Digimon to suspend opponent's 1 Digimon", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] By suspending 1 of your Digimon, suspend 1 of your opponent's Digimon.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  24. {
  25. if (CardEffectCommons.CanActivateSuspendCostEffect(permanent.TopCard))
  26. {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanSelectPermanentCondition1(Permanent permanent)
  33. {
  34. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  52. {
  53. Permanent selectedPermanent = null;
  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: true,
  65. canEndNotMax: false,
  66. selectPermanentCoroutine: SelectPermanentCoroutine,
  67. afterSelectPermanentCoroutine: null,
  68. mode: SelectPermanentEffect.Mode.Custom,
  69. cardEffect: activateClass);
  70. selectPermanentEffect.SetUpCustomMessage("Select 1 your Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  71. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  72. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  73. {
  74. selectedPermanent = permanent;
  75. yield return null;
  76. }
  77. }
  78. if (selectedPermanent != null)
  79. {
  80. if (selectedPermanent.TopCard != null)
  81. {
  82. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  83. {
  84. if (!selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  85. {
  86. Permanent suspendTargetPermanent = selectedPermanent;
  87. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { suspendTargetPermanent }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  88. if (suspendTargetPermanent.TopCard != null)
  89. {
  90. if (suspendTargetPermanent.IsSuspended)
  91. {
  92. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  93. {
  94. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  95. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  96. selectPermanentEffect.SetUp(
  97. selectPlayer: card.Owner,
  98. canTargetCondition: CanSelectPermanentCondition1,
  99. canTargetCondition_ByPreSelecetedList: null,
  100. canEndSelectCondition: null,
  101. maxCount: maxCount,
  102. canNoSelect: false,
  103. canEndNotMax: false,
  104. selectPermanentCoroutine: null,
  105. afterSelectPermanentCoroutine: null,
  106. mode: SelectPermanentEffect.Mode.Tap,
  107. cardEffect: activateClass);
  108. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  109. }
  110. }
  111. }
  112. }
  113. }
  114. }
  115. }
  116. }
  117. }
  118. return cardEffects;
  119. }
  120. }
  121. }