ST24_02.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Gaomon
  4. namespace DCGO.CardEffects.ST24
  5. {
  6. public class ST24_02 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alt Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsTraits("DATA SQUAD");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 2, permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region On Play
  22. if (timing == EffectTiming.OnEnterFieldAnyone)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("Place 1 card under 1 [DATA SQUAD] Tamer to <Draw 2>", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  27. cardEffects.Add(activateClass);
  28. string EffectDescription()
  29. {
  30. return
  31. "[On Play] By placing 1 card from your hand face down under any of your Tamers with the [DATA SQUAD] trait, <Draw 2>. (Draw 2 cards from your deck.)";
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.IsExistOnBattleArea(card)
  36. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.IsExistOnBattleArea(card)
  41. && card.Owner.HandCards.Count > 0
  42. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsOwnTamerCondition);
  43. }
  44. bool IsOwnTamerCondition(Permanent permanent)
  45. {
  46. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  47. && permanent.IsTamer
  48. && permanent.TopCard.EqualsTraits("DATA SQUAD");
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable hashtable)
  51. {
  52. List<CardSource> selectedCards = new List<CardSource>();
  53. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  54. selectHandEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: _ => true,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: 1,
  60. canNoSelect: true,
  61. canEndNotMax: false,
  62. isShowOpponent: false,
  63. selectCardCoroutine: SelectCardCoroutine,
  64. afterSelectCardCoroutine: null,
  65. mode: SelectHandEffect.Mode.Custom,
  66. cardEffect: activateClass);
  67. selectHandEffect.SetUpCustomMessage("Select 1 card to place under a tamer.",
  68. "The opponent is selecting 1 card to place under a tamer.");
  69. selectHandEffect.SetUpCustomMessage_ShowCard("Selected card");
  70. yield return StartCoroutine(selectHandEffect.Activate());
  71. IEnumerator SelectCardCoroutine(CardSource cardSource)
  72. {
  73. selectedCards.Add(cardSource);
  74. yield return null;
  75. }
  76. if (selectedCards.Count >= 1)
  77. {
  78. Permanent selectedPermanent = null;
  79. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  80. selectPermanentEffect.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition: IsOwnTamerCondition,
  83. canTargetCondition_ByPreSelecetedList: null,
  84. canEndSelectCondition: null,
  85. maxCount: 1,
  86. canNoSelect: true,
  87. canEndNotMax: false,
  88. selectPermanentCoroutine: SelectPermanentCoroutine,
  89. afterSelectPermanentCoroutine: null,
  90. mode: SelectPermanentEffect.Mode.Custom,
  91. cardEffect: activateClass);
  92. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to place the chosen card under.",
  93. "The opponent is selecting 1 Tamer to place the chosen card under.");
  94. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  95. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  96. {
  97. selectedPermanent = permanent;
  98. yield return null;
  99. }
  100. if (selectedPermanent != null)
  101. {
  102. yield return ContinuousController.instance.StartCoroutine(
  103. selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass, false, true));
  104. yield return ContinuousController.instance.StartCoroutine(
  105. new DrawClass(card.Owner, 2, activateClass).Draw());
  106. }
  107. }
  108. }
  109. }
  110. #endregion
  111. #region Inherited
  112. if (timing == EffectTiming.OnAllyAttack)
  113. {
  114. ActivateClass activateClass = new ActivateClass();
  115. activateClass.SetUpICardEffect("If you have 7 or fewer cards in hand, <Draw 1>.", CanUseCondition, card);
  116. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  117. activateClass.SetIsInheritedEffect(true);
  118. activateClass.SetHashString("ST24_02_Inherited");
  119. cardEffects.Add(activateClass);
  120. string EffectDiscription()
  121. => "[When Attacking] [Once Per Turn] If your hand has 7 or fewer cards, <Draw 1>. (Draw 1 card from your deck.)";
  122. bool CanUseCondition(Hashtable hashtable)
  123. {
  124. return CardEffectCommons.IsExistOnBattleArea(card) &&
  125. CardEffectCommons.IsOwnerTurn(card) &&
  126. CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  127. }
  128. bool CanActivateCondition(Hashtable hashtable)
  129. {
  130. return CardEffectCommons.IsExistOnBattleArea(card) &&
  131. card.Owner.HandCards.Count <= 7;
  132. }
  133. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  134. {
  135. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  136. }
  137. }
  138. #endregion
  139. return cardEffects;
  140. }
  141. }
  142. }