BT24_096.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Seventh Graviton
  5. namespace DCGO.CardEffects.BT24
  6. {
  7. public class BT24_096 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region [Trash] Your Turn
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("By returning this card to deck, Activate [Main] effect", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  18. cardEffects.Add(activateClass);
  19. string EffectDescription()
  20. {
  21. return "[Trash] [Your Turn] When any of your Digimon digivolve into [Creepymon (X Antibody)], by returning this card to the bottom of the deck, activate this card's [Main] effects.";
  22. }
  23. bool PermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  26. && permanent.TopCard.EqualsCardName("Creepymon (X Antibody)");
  27. }
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.IsExistOnTrash(card)
  31. && CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition);
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.IsExistOnTrash(card);
  36. }
  37. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  38. {
  39. List<CardSource> cardSources = new List<CardSource>() { card };
  40. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources));
  41. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect2(cardSources, "Deck Bottom Card", true, true));
  42. if (card.Owner.LibraryCards.Contains(card))
  43. {
  44. ActivateClass mainActivateClass = CardEffectCommons.OptionMainEffect(card);
  45. if (mainActivateClass != null)
  46. {
  47. yield return ContinuousController.instance.StartCoroutine(mainActivateClass.Activate(CardEffectCommons.OptionMainCheckHashtable(card)));
  48. }
  49. }
  50. }
  51. }
  52. #endregion
  53. #region Main
  54. if (timing == EffectTiming.OptionSkill)
  55. {
  56. ActivateClass activateClass = new ActivateClass();
  57. activateClass.SetUpICardEffect("Delete 1 level 6 or higher. If not trash opponent's top 3 deck", CanUseCondition, card);
  58. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  59. cardEffects.Add(activateClass);
  60. string EffectDescription()
  61. {
  62. return "[Main] Delete 1 of your opponent's level 6 or higher Digimon. If this effect didn't delete, trash the top 3 cards of your opponent's deck.";
  63. }
  64. bool CanUseCondition(Hashtable hashtable)
  65. {
  66. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  67. }
  68. bool CanSelectPermament(Permanent permanent)
  69. {
  70. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  71. && permanent.TopCard.HasLevel && permanent.TopCard.Level >= 6;
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable hashtable)
  74. {
  75. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  76. bool failedToDelete = true;
  77. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermament))
  78. {
  79. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  80. selectPermanentEffect.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition: CanSelectPermament,
  83. canTargetCondition_ByPreSelecetedList: null,
  84. canEndSelectCondition: null,
  85. maxCount: 1,
  86. canNoSelect: false,
  87. canEndNotMax: false,
  88. selectPermanentCoroutine: null,
  89. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  90. mode: SelectPermanentEffect.Mode.Custom,
  91. cardEffect: activateClass);
  92. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  93. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  94. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  95. {
  96. deleteTargetPermanents = permanents.Clone();
  97. yield return null;
  98. }
  99. }
  100. if (deleteTargetPermanents.Count > 0)
  101. {
  102. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: SuccessDeleteProcess, failureProcess: null));
  103. IEnumerator SuccessDeleteProcess(List<Permanent> permanents)
  104. {
  105. if (permanents.Count > 0)
  106. failedToDelete = false;
  107. yield return null;
  108. }
  109. }
  110. if (failedToDelete)
  111. {
  112. int trashCount = 3;
  113. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(trashCount, card.Owner.Enemy, activateClass).AddTrashCardsFromLibraryTop());
  114. }
  115. }
  116. }
  117. #endregion
  118. #region Security
  119. if (timing == EffectTiming.SecuritySkill)
  120. {
  121. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  122. card: card,
  123. cardEffects: ref cardEffects,
  124. effectName: "Delete 1 level 6 or higher. If not trash opponent's top 3 deck");
  125. }
  126. #endregion
  127. return cardEffects;
  128. }
  129. }
  130. }