ST21_03.cs 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //ST21 Ikkakumon
  4. namespace DCGO.CardEffects.ST21
  5. {
  6. public class ST21_03 : 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
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent permanent)
  15. {
  16. return permanent.Level == 3 && permanent.TopCard.HasAdventureTraits;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 2, false, card, null));
  19. }
  20. #endregion
  21. #region Security
  22. if (timing == EffectTiming.SecuritySkill)
  23. {
  24. cardEffects.Add(CardEffectFactory.PlaySelfDigimonAfterBattleSecurityEffect(card: card));
  25. }
  26. #endregion
  27. #region On Play/When Digivolving shared
  28. bool CanActivateConditonShared(Hashtable hashtable)
  29. => CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  30. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  31. {
  32. bool CanSelectPermanentCondition(Permanent permanent)
  33. => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  34. bool CanSelectPermanentCondition2(Permanent permanent)
  35. => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  36. && permanent.HasNoDigivolutionCards;
  37. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, permanent => CanSelectPermanentCondition(permanent)))
  38. {
  39. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  40. selectPermanentEffect.SetUp(
  41. selectPlayer: card.Owner,
  42. canTargetCondition: (permanent) => CanSelectPermanentCondition(permanent),
  43. canTargetCondition_ByPreSelecetedList: null,
  44. canEndSelectCondition: null,
  45. maxCount: 1,
  46. canNoSelect: false,
  47. canEndNotMax: false,
  48. selectPermanentCoroutine: SelectPermanentCoroutine,
  49. afterSelectPermanentCoroutine: null,
  50. mode: SelectPermanentEffect.Mode.Custom,
  51. cardEffect: activateClass);
  52. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  53. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  54. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  55. {
  56. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: permanent, trashCount: 2, isFromTop: true, activateClass: activateClass));
  57. }
  58. }
  59. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, permanent => CanSelectPermanentCondition2(permanent)))
  60. {
  61. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  62. selectPermanentEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: (permanent) => CanSelectPermanentCondition2(permanent),
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: 1,
  68. canNoSelect: false,
  69. canEndNotMax: false,
  70. selectPermanentCoroutine: SelectPermanentCoroutine2,
  71. afterSelectPermanentCoroutine: null,
  72. mode: SelectPermanentEffect.Mode.Custom,
  73. cardEffect: activateClass);
  74. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that cant attack or block.", "The opponent is selecting 1 Digimon that cant attack or block");
  75. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  76. IEnumerator SelectPermanentCoroutine2(Permanent permanent)
  77. {
  78. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  79. targetPermanent: permanent,
  80. defenderCondition: null,
  81. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  82. activateClass: activateClass,
  83. effectName: "Can't Attack"));
  84. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBlock(
  85. targetPermanent: permanent,
  86. attackerCondition: null,
  87. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  88. activateClass: activateClass,
  89. effectName: "Can't Block"));
  90. }
  91. }
  92. }
  93. #endregion
  94. #region On Play
  95. if (timing == EffectTiming.OnEnterFieldAnyone)
  96. {
  97. ActivateClass activateClass = new ActivateClass();
  98. activateClass.SetUpICardEffect("Strip top 2, then freeze", CanUseCondition, card);
  99. activateClass.SetUpActivateClass(CanActivateConditonShared, (hashtable) => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDescription());
  100. cardEffects.Add(activateClass);
  101. string EffectDescription()
  102. => "[On Play] Trash the top 2 digivolution cards of 1 of your opponent's Digimon. Then, 1 of their Digimon with no digivolution cards can't attack or block until their turn ends.";
  103. bool CanUseCondition(Hashtable hashtable)
  104. => CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  105. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  106. }
  107. #endregion
  108. #region When Digivolving
  109. if (timing == EffectTiming.OnEnterFieldAnyone)
  110. {
  111. ActivateClass activateClass = new ActivateClass();
  112. activateClass.SetUpICardEffect("Strip top 2, then freeze", CanUseCondition, card);
  113. activateClass.SetUpActivateClass(CanActivateConditonShared, (hashtable) => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDescription());
  114. cardEffects.Add(activateClass);
  115. string EffectDescription()
  116. => "[When Digivolving] Trash the top 2 digivolution cards of 1 of your opponent's Digimon. Then, 1 of their Digimon with no digivolution cards can't attack or block until their turn ends.";
  117. bool CanUseCondition(Hashtable hashtable)
  118. => CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  119. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  120. }
  121. #endregion
  122. #region When Attacking - ESS
  123. if (timing == EffectTiming.OnAllyAttack)
  124. {
  125. ActivateClass activateClass = new ActivateClass();
  126. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  127. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  128. activateClass.SetHashString("WhenAttacking_ST21_03");
  129. activateClass.SetIsInheritedEffect(true);
  130. cardEffects.Add(activateClass);
  131. string EffectDescription()
  132. {
  133. return
  134. "[When Attacking] [Once Per Turn] If you have 7 or fewer cards in your hand, <Draw 1>. (Draw 1 card from your deck.)";
  135. }
  136. bool CanUseCondition(Hashtable hashtable)
  137. {
  138. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  139. }
  140. bool CanActivateCondition(Hashtable hashtable)
  141. {
  142. if (CardEffectCommons.IsExistOnBattleArea(card))
  143. {
  144. if (card.Owner.HandCards.Count <= 7)
  145. {
  146. if (card.Owner.LibraryCards.Count >= 1)
  147. {
  148. return true;
  149. }
  150. }
  151. }
  152. return false;
  153. }
  154. IEnumerator ActivateCoroutine(Hashtable hashtable)
  155. {
  156. yield return ContinuousController.instance.StartCoroutine(
  157. new DrawClass(card.Owner, 1, activateClass).Draw());
  158. }
  159. }
  160. #endregion
  161. return cardEffects;
  162. }
  163. }
  164. }