BT14_051.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT14
  5. {
  6. public class BT14_051 : 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.OnEndTurn)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Suspend your 1 Digimon to reveal the top 5 cards of deck", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  16. activateClass.SetHashString("Reveal_BT14_051");
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[End of Opponent's Turn][Once Per Turn] By suspending 1 of your Digimon, reveal the top 5 cards of your deck. Add 2 green Digimon cards among them to the hand. Return the rest to the bottom of deck.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  25. {
  26. if (CardEffectCommons.CanActivateSuspendCostEffect(permanent.TopCard))
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanSelectCardCondition(CardSource cardSource)
  34. {
  35. return cardSource.HasCardColor(CardColor.Green) && cardSource.IsDigimon;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleArea(card))
  40. {
  41. if (CardEffectCommons.IsOpponentTurn(card))
  42. {
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.IsExistOnBattleArea(card))
  51. {
  52. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. bool suspended = false;
  62. Permanent selectedPermanent = null;
  63. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  64. {
  65. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  66. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  67. selectPermanentEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: CanSelectPermanentCondition,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: maxCount,
  73. canNoSelect: true,
  74. canEndNotMax: false,
  75. selectPermanentCoroutine: SelectPermanentCoroutine,
  76. afterSelectPermanentCoroutine: null,
  77. mode: SelectPermanentEffect.Mode.Custom,
  78. cardEffect: activateClass);
  79. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  80. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  81. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  82. {
  83. selectedPermanent = permanent;
  84. yield return null;
  85. }
  86. }
  87. if (selectedPermanent != null)
  88. {
  89. if (selectedPermanent.TopCard != null)
  90. {
  91. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  92. {
  93. if (!selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  94. {
  95. Permanent suspendTargetPermanent = selectedPermanent;
  96. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { suspendTargetPermanent }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  97. if (suspendTargetPermanent.TopCard != null)
  98. {
  99. if (suspendTargetPermanent.IsSuspended)
  100. {
  101. suspended = true;
  102. }
  103. }
  104. }
  105. }
  106. }
  107. }
  108. if (suspended)
  109. {
  110. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  111. revealCount: 5,
  112. simplifiedSelectCardConditions:
  113. new SimplifiedSelectCardConditionClass[]
  114. {
  115. new SimplifiedSelectCardConditionClass(
  116. canTargetCondition:CanSelectCardCondition,
  117. message: "Select 2 green Digimon cards.",
  118. mode: SelectCardEffect.Mode.AddHand,
  119. maxCount: 2,
  120. selectCardCoroutine: null),
  121. },
  122. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  123. activateClass: activateClass
  124. ));
  125. }
  126. }
  127. }
  128. return cardEffects;
  129. }
  130. }
  131. }