BT25_071.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Orochimon
  4. namespace DCGO.CardEffects.BT25
  5. {
  6. public class BT25_071 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsTraits("TS");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 4, permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Shared OP / WD
  22. string SharedEffectName = "1 enemy Digimon/Tamer can't attack until their turn ends";
  23. CardEffectFactory.ActivateClassesForSharedEffects
  24. (ref cardEffects, timing, card,
  25. SharedEffectName,
  26. SharedActivateCoroutine,
  27. SharedEffectDescription,
  28. optional: false,
  29. onPlay: true,
  30. whenDigivolving: true);
  31. string SharedEffectDescription(string tag) => $"[{tag}] 1 of your opponent's Digimon or Tamers can't attack until their turn ends.";
  32. bool CanSelectPermanentCondition(Permanent permanent)
  33. {
  34. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  35. && (permanent.IsDigimon
  36. || permanent.IsTamer);
  37. }
  38. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  39. {
  40. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  41. {
  42. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  43. selectPermanentEffect.SetUp(
  44. selectPlayer: card.Owner,
  45. canTargetCondition: CanSelectPermanentCondition,
  46. canTargetCondition_ByPreSelecetedList: null,
  47. canEndSelectCondition: null,
  48. maxCount: 1,
  49. canNoSelect: false,
  50. canEndNotMax: false,
  51. selectPermanentCoroutine: SelectPermanentCoroutine,
  52. afterSelectPermanentCoroutine: null,
  53. mode: SelectPermanentEffect.Mode.Custom,
  54. cardEffect: activateClass);
  55. selectPermanentEffect.SetUpCustomMessage("Select Digimon/Tamer to give can't attack until their turn ends.", "The opponent is selecting Digimon/Tamer to give can't attack until your turn ends.");
  56. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  57. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  58. {
  59. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  60. targetPermanent: permanent,
  61. defenderCondition: null,
  62. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  63. activateClass: activateClass,
  64. effectName: "Can't Attack"));
  65. }
  66. }
  67. }
  68. #endregion
  69. #region Shared AT/Inherited
  70. string SharedEffectName1() => "Reveal 3, may play 1 play cost 4 or lower [TS] trait Digimon card, bot deck the rest.";
  71. string SharedEffectDescription1() => "[All Turns] [Once Per Turn] When this Digimon suspends, reveal the top 3 cards of your deck. You may play 1 play cost 4 or lower [TS] trait Digimon card among them without paying the cost. Return the rest to the bottom of the deck.";
  72. bool SharedCanActivateCondition(Hashtable hashtable)
  73. {
  74. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  75. }
  76. bool SharedCanUseCondition(Hashtable hashtable)
  77. {
  78. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  79. && CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card);
  80. }
  81. IEnumerator SharedActivateCoroutine1(Hashtable hashtable, ActivateClass activateClass)
  82. {
  83. bool CanSelectCardCondition(CardSource cardSource)
  84. {
  85. return cardSource.IsDigimon
  86. && cardSource.HasPlayCost
  87. && cardSource.GetCostItself <= 4
  88. && cardSource.EqualsTraits("TS");
  89. }
  90. List<CardSource> selectedCards = new List<CardSource>();
  91. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  92. revealCount: 3,
  93. simplifiedSelectCardConditions:
  94. new SimplifiedSelectCardConditionClass[]
  95. {
  96. new SimplifiedSelectCardConditionClass(
  97. canTargetCondition:CanSelectCardCondition,
  98. message: "Select 1 Digimon card to play for free.",
  99. mode: SelectCardEffect.Mode.Custom,
  100. maxCount: 1,
  101. selectCardCoroutine: SelectCardCoroutine),
  102. },
  103. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  104. activateClass: activateClass,
  105. canNoSelect: true
  106. ));
  107. IEnumerator SelectCardCoroutine(CardSource cardSource)
  108. {
  109. selectedCards.Add(cardSource);
  110. yield return null;
  111. }
  112. if (selectedCards.Count > 0)
  113. {
  114. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  115. cardSources: selectedCards,
  116. activateClass: activateClass,
  117. payCost: false,
  118. isTapped: false,
  119. root: SelectCardEffect.Root.Library,
  120. activateETB: true));
  121. }
  122. }
  123. #endregion
  124. #region All Turns
  125. if (timing == EffectTiming.WhenRemoveField)
  126. {
  127. ActivateClass activateClass = new ActivateClass();
  128. activateClass.SetUpICardEffect(SharedEffectName1(), SharedCanUseCondition, card);
  129. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine1(hash, activateClass), 1, true, SharedEffectDescription1());
  130. activateClass.SetHashString("BT25_073_AT");
  131. cardEffects.Add(activateClass);
  132. }
  133. #endregion
  134. #region All Turns Inherited
  135. if (timing == EffectTiming.WhenRemoveField)
  136. {
  137. ActivateClass activateClass = new ActivateClass();
  138. activateClass.SetUpICardEffect(SharedEffectName1(), SharedCanUseCondition, card);
  139. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine1(hash, activateClass), 1, true, SharedEffectDescription1());
  140. activateClass.SetIsInheritedEffect(true);
  141. activateClass.SetHashString("BT25_073_AT_ESS");
  142. cardEffects.Add(activateClass);
  143. }
  144. #endregion
  145. return cardEffects;
  146. }
  147. }
  148. }