BT21_052.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. public class BT21_052 : 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 Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsCardName("Examon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Piercing
  22. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  23. {
  24. cardEffects.Add(CardEffectFactory.PierceSelfEffect(
  25. isInheritedEffect: false,
  26. card: card,
  27. condition: null));
  28. }
  29. #endregion
  30. #region Blocker
  31. if (timing == EffectTiming.None)
  32. {
  33. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  34. isInheritedEffect: false,
  35. card: card,
  36. condition: null));
  37. }
  38. #endregion
  39. #region Evade
  40. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  41. {
  42. cardEffects.Add(CardEffectFactory.EvadeSelfEffect(
  43. isInheritedEffect: false,
  44. card: card,
  45. condition: null));
  46. }
  47. #endregion
  48. #region When Digivolving
  49. if (timing == EffectTiming.OnEnterFieldAnyone)
  50. {
  51. ActivateClass activateClass = new ActivateClass();
  52. activateClass.SetUpICardEffect("Suspend all of you opponent's Digimon and Tamers and delete 1 of their suspended Digimon or Tamers", CanUseCondition, card);
  53. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  54. cardEffects.Add(activateClass);
  55. string EffectDescription()
  56. {
  57. return "[When Digivolving] Suspend all of your opponent's Digimon and Tamers. Then, delete 1 of their suspended Digimon or Tamers.";
  58. }
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  62. }
  63. bool CanActivateCondition(Hashtable hashtable)
  64. {
  65. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  66. }
  67. bool PermanentCondition(Permanent permanent)
  68. {
  69. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  70. {
  71. if (permanent.IsDigimon || permanent.IsTamer)
  72. {
  73. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  74. {
  75. return true;
  76. }
  77. }
  78. }
  79. return false;
  80. }
  81. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  82. {
  83. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) && (permanent.IsDigimon || permanent.IsTamer) && permanent.IsSuspended;
  84. }
  85. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  86. {
  87. List<Permanent> suspendTargetPermanents = card.Owner.Enemy.GetBattleAreaPermanents().Filter(PermanentCondition);
  88. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(suspendTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  89. if(CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  90. {
  91. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  92. selectPermanentEffect.SetUp(
  93. selectPlayer: card.Owner,
  94. canTargetCondition: CanSelectOpponentPermanentCondition,
  95. canTargetCondition_ByPreSelecetedList: null,
  96. canEndSelectCondition: null,
  97. maxCount: 1,
  98. canNoSelect: false,
  99. canEndNotMax: false,
  100. selectPermanentCoroutine: null,
  101. afterSelectPermanentCoroutine: null,
  102. mode: SelectPermanentEffect.Mode.Destroy,
  103. cardEffect: activateClass);
  104. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  105. }
  106. }
  107. }
  108. #endregion
  109. #region All Turns
  110. if (timing == EffectTiming.OnTappedAnyone)
  111. {
  112. ActivateClass activateClass = new ActivateClass();
  113. activateClass.SetUpICardEffect("Unsuspend this Digimon when it suspends and trash the opponent's top security card", CanUseCondition, card);
  114. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  115. activateClass.SetHashString("Unsuspend_BT21_052");
  116. cardEffects.Add(activateClass);
  117. string EffectDescription()
  118. {
  119. return "[All Turns] [Once Per Turn] When this Digimon suspends, it unsuspends. Then, if [Examon] or [X Antibody] is in this Digimon's digivolution cards, trash your opponent's top security card.";
  120. }
  121. bool CanUseCondition(Hashtable hashtable)
  122. {
  123. return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, permanent => permanent == card.PermanentOfThisCard());
  124. }
  125. bool CanActivateCondition(Hashtable hashtable)
  126. {
  127. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable hashtable)
  130. {
  131. Permanent selectedPermanent = card.PermanentOfThisCard();
  132. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  133. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.EqualsCardName("Examon") || cardSource.EqualsCardName("X Antibody")) >= 1)
  134. {
  135. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  136. player: card.Owner.Enemy,
  137. destroySecurityCount: 1,
  138. cardEffect: activateClass,
  139. fromTop: true).DestroySecurity());
  140. }
  141. }
  142. }
  143. #endregion
  144. return cardEffects;
  145. }
  146. }
  147. }