ST24_03.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Gaogamon
  5. namespace DCGO.CardEffects.ST24
  6. {
  7. public class ST24_03 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alt Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsTraits("DATA SQUAD");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 3, permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Shared OP/WD
  23. string SharedEffectName = "May bounce enemy lvl 3, may place top deck face down under [DATA SQUAD] tamer";
  24. CardEffectFactory.ActivateClassesForSharedEffects
  25. (ref cardEffects, timing, card,
  26. SharedEffectName,
  27. SharedActivateCoroutine,
  28. SharedEffectDescription,
  29. optional: false,
  30. onPlay: true,
  31. whenDigivolving: true);
  32. string SharedEffectDescription(string tag) => $"[{tag}] You may return 1 of your opponent's level 3 Digimon to the hand. Then, you may place the top card of your deck face down under any of your [DATA SQUAD] trait Tamers.";
  33. bool CanSelectOpponentLevel3Digimon(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  36. && permanent.TopCard.IsLevel3;
  37. }
  38. bool CanSelectOwnDataSquadTamer(Permanent permanent)
  39. {
  40. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaTamer(permanent, card)
  41. && permanent.TopCard.EqualsTraits("DATA SQUAD");
  42. }
  43. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  44. {
  45. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentLevel3Digimon));
  46. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  47. selectPermanentEffect.SetUp(
  48. selectPlayer: card.Owner,
  49. canTargetCondition: CanSelectOpponentLevel3Digimon,
  50. canTargetCondition_ByPreSelecetedList: null,
  51. canEndSelectCondition: null,
  52. maxCount: maxCount,
  53. canNoSelect: true,
  54. canEndNotMax: false,
  55. selectPermanentCoroutine: null,
  56. afterSelectPermanentCoroutine: null,
  57. mode: SelectPermanentEffect.Mode.Bounce,
  58. cardEffect: activateClass);
  59. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to bounce.", "The opponent is selecting a digimon to bounce.");
  60. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  61. if (card.Owner.LibraryCards.Count > 1 && CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnDataSquadTamer))
  62. {
  63. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  64. selectPermanentEffect1.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: CanSelectOwnDataSquadTamer,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: 1,
  70. canNoSelect: true,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: null,
  73. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  74. mode: SelectPermanentEffect.Mode.Custom,
  75. cardEffect: activateClass);
  76. selectPermanentEffect1.SetUpCustomMessage("Select 1 [DATA SQUAD] trait Tamer to place the top card of your deck face down under.", "The opponent is selecting 1 [DATA SQUAD] trait Tamer to place the top card of your deck face down under.");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  78. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanent)
  79. {
  80. if (permanent != null)
  81. {
  82. yield return ContinuousController.instance.StartCoroutine(permanent[0].AddDigivolutionCardsBottom(
  83. new List<CardSource> { card.Owner.LibraryCards[0] }, activateClass, isFacedown: true));
  84. }
  85. }
  86. }
  87. }
  88. #endregion
  89. #region Inherited
  90. if (timing == EffectTiming.OnAllyAttack)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("If you have 7 or fewer cards in hand, <Draw 1>.", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  95. activateClass.SetIsInheritedEffect(true);
  96. activateClass.SetHashString("ST24_03_Inherited");
  97. cardEffects.Add(activateClass);
  98. string EffectDiscription()
  99. => "[When Attacking] [Once Per Turn] If your hand has 7 or fewer cards, <Draw 1>. (Draw 1 card from your deck.)";
  100. bool CanUseCondition(Hashtable hashtable)
  101. {
  102. return CardEffectCommons.IsExistOnBattleArea(card) &&
  103. CardEffectCommons.IsOwnerTurn(card) &&
  104. CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  105. }
  106. bool CanActivateCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.IsExistOnBattleArea(card) &&
  109. card.Owner.HandCards.Count <= 7;
  110. }
  111. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  112. {
  113. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  114. }
  115. }
  116. #endregion
  117. return cardEffects;
  118. }
  119. }
  120. }