EX4_067.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX4
  5. {
  6. public class EX4_067 : 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.OptionSkill)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  15. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Main] Return 2 of your opponent's level 4 or lower Digimon to their owners' hands. Then, if your opponent has 8 or more cards in their hand, return 1 of your opponent's level 6 or higher Digimon to the bottom of its owner's deck.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  24. {
  25. if (permanent.Level <= 4)
  26. {
  27. if (permanent.TopCard.HasLevel)
  28. {
  29. if (permanent.CanSelectBySkill(activateClass))
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanSelectPermanentCondition1(Permanent permanent)
  39. {
  40. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  41. {
  42. if (permanent.Level >= 6)
  43. {
  44. if (permanent.TopCard.HasLevel)
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  59. {
  60. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  61. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  62. selectPermanentEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: CanSelectPermanentCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: maxCount,
  68. canNoSelect: false,
  69. canEndNotMax: false,
  70. selectPermanentCoroutine: null,
  71. afterSelectPermanentCoroutine: null,
  72. mode: SelectPermanentEffect.Mode.Bounce,
  73. cardEffect: activateClass);
  74. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  75. }
  76. if (card.Owner.Enemy.HandCards.Count >= 8)
  77. {
  78. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  79. {
  80. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  81. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  82. selectPermanentEffect.SetUp(
  83. selectPlayer: card.Owner,
  84. canTargetCondition: CanSelectPermanentCondition1,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canEndSelectCondition: null,
  87. maxCount: maxCount,
  88. canNoSelect: false,
  89. canEndNotMax: false,
  90. selectPermanentCoroutine: null,
  91. afterSelectPermanentCoroutine: null,
  92. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  93. cardEffect: activateClass);
  94. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  95. }
  96. }
  97. }
  98. }
  99. if (timing == EffectTiming.SecuritySkill)
  100. {
  101. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Return 1 level 4 or lower Digimon to hand and return 1 level 6 or more Digimon to the bottom of deck");
  102. }
  103. return cardEffects;
  104. }
  105. }
  106. }