BT24_022.cs 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Ikkakumon
  6. namespace DCGO.CardEffects.BT24
  7. {
  8. public class BT24_022 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alt Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. static bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.IsLevel3 && targetPermanent.TopCard.HasTSTraits;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. #endregion
  23. #region Jamming
  24. if (timing == EffectTiming.None)
  25. {
  26. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(false, card, null));
  27. }
  28. #endregion
  29. #region Shared OP / WD
  30. string SharedEffectName()
  31. {
  32. return "Trash top 2 digivolution cards of 1 opponent's Digimon. 1 of their Digimon with as many of fewer sources as this Digimon can't suspend until their turn ends.";
  33. }
  34. string SharedEffectDescription(string tag)
  35. {
  36. return $"[{tag}] Trash the top 2 digivolution cards of 1 of your opponent's Digimon. Then, 1 of their Digimon with as many of fewer digivolution cards as this Digimon can't suspend until their turn ends.";
  37. }
  38. bool SharedCanActivateCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.IsExistOnBattleArea(card) &&
  41. card.Owner.Enemy.GetBattleAreaDigimons().Count() > 0;
  42. }
  43. bool CanStripCondition(Permanent permanent)
  44. {
  45. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  46. }
  47. bool CanStunCondition(Permanent permanent)
  48. {
  49. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  50. && permanent.DigivolutionCards.Count() <= card.PermanentOfThisCard().DigivolutionCards.Count();
  51. }
  52. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  53. {
  54. #region Strip 2 sources
  55. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanStripCondition))
  56. {
  57. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  58. selectPermanentEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: CanStripCondition,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: 1,
  64. canNoSelect: false,
  65. canEndNotMax: false,
  66. selectPermanentCoroutine: SelectPermanentCoroutine,
  67. afterSelectPermanentCoroutine: null,
  68. mode: SelectPermanentEffect.Mode.Custom,
  69. cardEffect: activateClass);
  70. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  71. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  72. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  73. {
  74. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: permanent, trashCount: 2, isFromTop: true, activateClass: activateClass));
  75. }
  76. }
  77. #endregion
  78. #region Stun 1 Digimon
  79. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanStunCondition))
  80. {
  81. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  82. selectPermanentEffect.SetUp(
  83. selectPlayer: card.Owner,
  84. canTargetCondition: CanStunCondition,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canEndSelectCondition: null,
  87. maxCount: 1,
  88. canNoSelect: false,
  89. canEndNotMax: false,
  90. selectPermanentCoroutine: SelectPermanentCoroutine,
  91. afterSelectPermanentCoroutine: null,
  92. mode: SelectPermanentEffect.Mode.Custom,
  93. cardEffect: activateClass);
  94. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that cannot suspend.", "The opponent is selecting 1 Digimon that cannot suspend.");
  95. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  96. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  97. {
  98. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  99. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCanNotSuspendCondition, card);
  100. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCanNotSuspendCondition);
  101. permanent.UntilOwnerTurnEndEffects.Add(_ => canNotSuspendClass);
  102. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  103. {
  104. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>()
  105. .CreateDebuffEffect(permanent));
  106. }
  107. bool CanUseCanNotSuspendCondition(Hashtable hashtableCanNotSuspend)
  108. {
  109. return permanent.TopCard != null && !permanent.TopCard.CanNotBeAffected(activateClass);
  110. }
  111. bool PermanentCanNotSuspendCondition(Permanent permanentCanNotSuspend)
  112. {
  113. return permanentCanNotSuspend == permanent;
  114. }
  115. }
  116. }
  117. #endregion
  118. }
  119. #endregion
  120. #region On Play
  121. if (timing == EffectTiming.OnEnterFieldAnyone)
  122. {
  123. ActivateClass activateClass = new ActivateClass();
  124. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  125. activateClass.SetUpActivateClass(SharedCanActivateCondition,(hash) => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("On Play"));
  126. cardEffects.Add(activateClass);
  127. bool CanUseCondition(Hashtable hashtable)
  128. {
  129. return CardEffectCommons.CanTriggerOnPlay(hashtable, card)
  130. && CardEffectCommons.IsExistOnBattleArea(card);
  131. }
  132. }
  133. #endregion
  134. #region When Digivolving
  135. if (timing == EffectTiming.OnEnterFieldAnyone)
  136. {
  137. ActivateClass activateClass = new ActivateClass();
  138. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  139. activateClass.SetUpActivateClass(SharedCanActivateCondition,(hash) => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("When Digivolving"));
  140. cardEffects.Add(activateClass);
  141. bool CanUseCondition(Hashtable hashtable)
  142. {
  143. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card)
  144. && CardEffectCommons.IsExistOnBattleArea(card);
  145. }
  146. }
  147. #endregion
  148. #region ESS
  149. if (timing == EffectTiming.OnUnTappedAnyone)
  150. {
  151. ActivateClass activateClass = new ActivateClass();
  152. activateClass.SetUpICardEffect("If you have 7 or fewer cards in hand, <Draw 1>.", CanUseCondition, card);
  153. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  154. activateClass.SetIsInheritedEffect(true);
  155. activateClass.SetHashString("BT24_022_YT_Draw1");
  156. cardEffects.Add(activateClass);
  157. string EffectDiscription()
  158. => "[Your Turn] [Once Per Turn] When this Digimon unsuspends, if you have 7 or fewer cards in your hand, <Draw 1>.";
  159. bool CanUseCondition(Hashtable hashtable)
  160. {
  161. return CardEffectCommons.IsExistOnBattleArea(card) &&
  162. CardEffectCommons.IsOwnerTurn(card) &&
  163. CardEffectCommons.CanTriggerWhenPermanentUnsuspends(hashtable, permanent => permanent == card.PermanentOfThisCard());
  164. }
  165. bool CanActivateCondition(Hashtable hashtable)
  166. {
  167. return CardEffectCommons.IsExistOnBattleArea(card) &&
  168. card.Owner.HandCards.Count <= 7;
  169. }
  170. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  171. {
  172. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  173. }
  174. }
  175. #endregion
  176. return cardEffects;
  177. }
  178. }
  179. }