BT25_071.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  91. revealCount: 3,
  92. simplifiedSelectCardConditions:
  93. new SimplifiedSelectCardConditionClass[]
  94. {
  95. new SimplifiedSelectCardConditionClass(
  96. canTargetCondition:CanSelectCardCondition,
  97. message: "Select 1 Digimon card to play for free.",
  98. mode: SelectCardEffect.Mode.Custom,
  99. maxCount: 1,
  100. selectCardCoroutine: SelectCardCoroutine),
  101. },
  102. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  103. activateClass: activateClass,
  104. canNoSelect: true
  105. ));
  106. IEnumerator SelectCardCoroutine(CardSource cardSource)
  107. {
  108. if (cardSource != null)
  109. {
  110. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  111. cardSources: new List<CardSource> { cardSource },
  112. activateClass: activateClass,
  113. payCost: false,
  114. isTapped: false,
  115. root: SelectCardEffect.Root.Library,
  116. activateETB: true));
  117. }
  118. }
  119. }
  120. #endregion
  121. #region All Turns
  122. if (timing == EffectTiming.OnTappedAnyone)
  123. {
  124. ActivateClass activateClass = new ActivateClass();
  125. activateClass.SetUpICardEffect(SharedEffectName1(), SharedCanUseCondition, card);
  126. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine1(hash, activateClass), 1, true, SharedEffectDescription1());
  127. activateClass.SetHashString("BT25_073_AT");
  128. cardEffects.Add(activateClass);
  129. }
  130. #endregion
  131. #region All Turns Inherited
  132. if (timing == EffectTiming.OnTappedAnyone)
  133. {
  134. ActivateClass activateClass = new ActivateClass();
  135. activateClass.SetUpICardEffect(SharedEffectName1(), SharedCanUseCondition, card);
  136. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine1(hash, activateClass), 1, true, SharedEffectDescription1());
  137. activateClass.SetIsInheritedEffect(true);
  138. activateClass.SetHashString("BT25_073_AT_ESS");
  139. cardEffects.Add(activateClass);
  140. }
  141. #endregion
  142. return cardEffects;
  143. }
  144. }
  145. }