EX7_067.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX7
  6. {
  7. public class EX7_067 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OptionSkill)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  16. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return
  21. "[Main] trash the top 2 digivolution cards of all of your opponent's Digimon. If this effect didn't trash, you may play 1 level 4 or lower Digimon card with the [Ice-Snow] trait from your hand without paying the cost. Then, none of their Digimon with no digivolution cards can attack until the end of their turn.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.DigivolutionCards.Count((cardSource) =>
  28. !cardSource.CanNotTrashFromDigivolutionCards(activateClass)) >= 1)
  29. {
  30. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanSelectPermanentCondition1(Permanent permanent)
  37. {
  38. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  39. {
  40. if (permanent.HasNoDigivolutionCards)
  41. {
  42. if (permanent.CanSelectBySkill(activateClass))
  43. {
  44. return true;
  45. }
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanSelectCardCondition(CardSource cardSource)
  51. {
  52. if (cardSource.IsDigimon && cardSource.EqualsTraits("Ice-Snow") && cardSource.Level <= 4)
  53. {
  54. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  55. return true;
  56. }
  57. return false;
  58. }
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  64. {
  65. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  66. {
  67. foreach (Permanent selectedPermanent in card.Owner.Enemy.GetBattleAreaDigimons())
  68. {
  69. if (CanSelectPermanentCondition(selectedPermanent))
  70. {
  71. if (selectedPermanent != null)
  72. {
  73. if (selectedPermanent.DigivolutionCards.Count >= 1)
  74. {
  75. yield return ContinuousController.instance.StartCoroutine(
  76. CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(
  77. targetPermanent: selectedPermanent, trashCount: 2, isFromTop: true,
  78. activateClass: activateClass));
  79. }
  80. }
  81. }
  82. }
  83. }
  84. else
  85. {
  86. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  87. {
  88. List<CardSource> selectedCards = new List<CardSource>();
  89. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  90. selectHandEffect.SetUp(
  91. selectPlayer: card.Owner,
  92. canTargetCondition: CanSelectCardCondition,
  93. canTargetCondition_ByPreSelecetedList: null,
  94. canEndSelectCondition: null,
  95. maxCount: 1,
  96. canNoSelect: true,
  97. canEndNotMax: false,
  98. isShowOpponent: true,
  99. selectCardCoroutine: SelectCardCoroutine,
  100. afterSelectCardCoroutine: null,
  101. mode: SelectHandEffect.Mode.Custom,
  102. cardEffect: activateClass);
  103. selectHandEffect.SetUpCustomMessage("Select a digimon to play.", "The opponent is selecting a card to play.");
  104. selectHandEffect.SetUpCustomMessage_ShowCard("Played Cards");
  105. yield return StartCoroutine(selectHandEffect.Activate());
  106. IEnumerator SelectCardCoroutine(CardSource cardSource)
  107. {
  108. selectedCards.Add(cardSource);
  109. yield return null;
  110. }
  111. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  112. cardSources: selectedCards,
  113. activateClass: activateClass,
  114. payCost: false,
  115. isTapped: false,
  116. root: SelectCardEffect.Root.Hand,
  117. activateETB: true));
  118. }
  119. }
  120. yield return ContinuousController.instance.StartCoroutine(
  121. CardEffectCommons.GainCanNotAttackPlayerEffect(
  122. attackerCondition: CanSelectPermanentCondition1,
  123. defenderCondition: null,
  124. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  125. activateClass: activateClass,
  126. effectName: "Can't Attack"));
  127. yield return ContinuousController.instance.StartCoroutine(
  128. CardEffectCommons.GainCanNotBlockPlayerEffect(
  129. attackerCondition: CanSelectPermanentCondition1,
  130. defenderCondition: null,
  131. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  132. activateClass: activateClass,
  133. effectName: "Can't Block"));
  134. }
  135. }
  136. if (timing == EffectTiming.SecuritySkill)
  137. {
  138. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Trash top two digivolution cards or play a digimon, and opponent's digimon can't attack or block");
  139. }
  140. return cardEffects;
  141. }
  142. }
  143. }