BT20_034.cs 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects
  4. {
  5. public class BT20_034 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alt Digivovle Cost
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.IsLevel4 &&
  16. (targetPermanent.TopCard.HasText("Pulsemon") ||
  17. targetPermanent.TopCard.HasSeekersTraits);
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false,
  21. card: card, condition: null));
  22. }
  23. #endregion
  24. #region Fortitude
  25. if (timing == EffectTiming.OnDestroyedAnyone)
  26. {
  27. cardEffects.Add(CardEffectFactory.FortitudeSelfEffect(isInheritedEffect: false, card: card, condition: null));
  28. }
  29. #endregion
  30. #region All Turns
  31. if (timing == EffectTiming.OnAddDigivolutionCards)
  32. {
  33. ActivateClass activateClass = new ActivateClass();
  34. activateClass.SetUpICardEffect("", CanUseCondition, card);
  35. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  36. cardEffects.Add(activateClass);
  37. string EffectDiscription()
  38. {
  39. return "[All Turns] When Tamer cards are placed in this Digimon's digivolution cards, 1 of your opponent's Digimon can't activate [When Digivolving] effects until the end of their turn.";
  40. }
  41. bool IsOpponentsDigimon(Permanent permanent)
  42. {
  43. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  44. }
  45. bool CanUseCondition(Hashtable hashtable)
  46. {
  47. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  48. CardEffectCommons.CanTriggerOnAddDigivolutionCard(
  49. hashtable: hashtable,
  50. permanentCondition: permanent => permanent == card.PermanentOfThisCard(),
  51. cardEffectCondition: null,
  52. cardCondition: cardSource =>
  53. cardSource.IsTamer);
  54. }
  55. bool CanActivateCondition(Hashtable hashtable)
  56. {
  57. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  58. CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon);
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable hashtable)
  61. {
  62. Permanent selectedPermanent = null;
  63. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: IsOpponentsDigimon,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: 1,
  70. canNoSelect: false,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: SelectPermanentCoroutine,
  73. afterSelectPermanentCoroutine: null,
  74. mode: SelectPermanentEffect.Mode.Custom,
  75. cardEffect: activateClass);
  76. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will disable effects.", "The opponent is selecting 1 Digimon that will disable effects.");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  79. {
  80. if (permanent != null)
  81. selectedPermanent = permanent;
  82. yield return null;
  83. }
  84. if (selectedPermanent != null)
  85. {
  86. DisableEffectClass invalidationClass = new DisableEffectClass();
  87. invalidationClass.SetUpICardEffect("Ignore [When Digivolving] Effect", CanUseCondition1, card);
  88. invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateCondition);
  89. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => invalidationClass);
  90. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  91. {
  92. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  93. }
  94. bool CanUseCondition1(Hashtable hashtable)
  95. {
  96. if (selectedPermanent.TopCard != null)
  97. {
  98. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  99. {
  100. return true;
  101. }
  102. }
  103. return false;
  104. }
  105. bool InvalidateCondition(ICardEffect cardEffect)
  106. {
  107. if (cardEffect != null)
  108. {
  109. if (cardEffect is ActivateICardEffect)
  110. {
  111. if (cardEffect.EffectSourceCard != null)
  112. {
  113. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(cardEffect.EffectSourceCard.PermanentOfThisCard(), card))
  114. {
  115. if (cardEffect.EffectSourceCard.PermanentOfThisCard() == selectedPermanent)
  116. {
  117. if (!cardEffect.EffectSourceCard.PermanentOfThisCard().TopCard.CanNotBeAffected(invalidationClass))
  118. {
  119. if (cardEffect.IsWhenDigivolving)
  120. {
  121. return true;
  122. }
  123. }
  124. }
  125. }
  126. }
  127. }
  128. }
  129. return false;
  130. }
  131. }
  132. }
  133. }
  134. #endregion
  135. #region ESS
  136. if (timing == EffectTiming.OnEndBattle)
  137. {
  138. ActivateClass activateClass = new ActivateClass();
  139. activateClass.SetUpICardEffect("Trash top security", CanUseCondition, card);
  140. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  141. activateClass.SetHashString("TrashSecurity_BT20-034");
  142. cardEffects.Add(activateClass);
  143. string EffectDiscription()
  144. {
  145. return "[All Turns] [Once Per Turn] When this Digimon deletes your opponent's Digimon in battle, trash their top security card.";
  146. }
  147. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  148. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  149. bool CanUseCondition(Hashtable hashtable)
  150. {
  151. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  152. CardEffectCommons.IsOwnerTurn(card) &&
  153. CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable,
  154. winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false);
  155. }
  156. bool CanActivateCondition(Hashtable hashtable)
  157. {
  158. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  159. }
  160. IEnumerator ActivateCoroutine(Hashtable hashtable)
  161. {
  162. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  163. player: card.Owner.Enemy,
  164. destroySecurityCount: 1,
  165. cardEffect: activateClass,
  166. fromTop: true).DestroySecurity());
  167. }
  168. }
  169. #endregion
  170. return cardEffects;
  171. }
  172. }
  173. }