BT4_062.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class BT4_062 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Suspend Digimon and return Digimon to deck", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] <Digi-Burst 4> (Trash 4 of this Digimon's digivolution cards to activate the effect below.) - Suspend all of your opponent's Digimon with 5000 DP or less. Then, place all of your opponent's suspended Digimon at the bottom of their owners' decks in any order. Trash all of the digivolution cards of those Digimon.";
  22. }
  23. bool PermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.DP <= 5000)
  28. {
  29. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool PermanentCondition1(Permanent permanent)
  38. {
  39. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  40. {
  41. if (permanent.IsSuspended)
  42. {
  43. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  44. {
  45. if (!permanent.CannotReturnToLibrary(activateClass))
  46. {
  47. return true;
  48. }
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.IsExistOnBattleArea(card))
  61. {
  62. if (new IDigiBurst(card.PermanentOfThisCard(), 4, activateClass).CanDigiBurst())
  63. {
  64. return true;
  65. }
  66. }
  67. return false;
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. yield return ContinuousController.instance.StartCoroutine(new IDigiBurst(card.PermanentOfThisCard(), 4, activateClass).DigiBurst());
  72. List<Permanent> suspendTargetPermanents = card.Owner.Enemy.GetBattleAreaDigimons().Filter(PermanentCondition);
  73. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(suspendTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  74. List<Permanent> libraryPermanents = card.Owner.Enemy.GetBattleAreaDigimons().Filter(PermanentCondition1);
  75. if (libraryPermanents.Count >= 1)
  76. {
  77. if (libraryPermanents.Count == 1)
  78. {
  79. yield return ContinuousController.instance.StartCoroutine(new DeckBottomBounceClass(libraryPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).DeckBounce());
  80. }
  81. else
  82. {
  83. List<CardSource> cardSources = libraryPermanents
  84. .Map(permanent => permanent.TopCard);
  85. List<SkillInfo> skillInfos = cardSources
  86. .Map(cardSource =>
  87. {
  88. ICardEffect cardEffect = new ChangeBaseDPClass();
  89. cardEffect.SetUpICardEffect(" ", null, cardSource);
  90. return new SkillInfo(cardEffect, null, EffectTiming.None);
  91. });
  92. List<CardSource> selectedCards = new List<CardSource>();
  93. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  94. selectCardEffect.SetUp(
  95. canTargetCondition: (cardSource) => true,
  96. canTargetCondition_ByPreSelecetedList: null,
  97. canEndSelectCondition: null,
  98. canNoSelect: () => false,
  99. selectCardCoroutine: null,
  100. afterSelectCardCoroutine: AfterSelectCardCoroutine1,
  101. message: "Specify the order to place the card at the bottom of the deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).",
  102. maxCount: cardSources.Count,
  103. canEndNotMax: false,
  104. isShowOpponent: false,
  105. mode: SelectCardEffect.Mode.Custom,
  106. root: SelectCardEffect.Root.Custom,
  107. customRootCardList: cardSources,
  108. canLookReverseCard: true,
  109. selectPlayer: card.Owner,
  110. cardEffect: activateClass);
  111. selectCardEffect.SetNotShowCard();
  112. selectCardEffect.SetNotAddLog();
  113. selectCardEffect.SetUpSkillInfos(skillInfos);
  114. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  115. IEnumerator AfterSelectCardCoroutine1(List<CardSource> cardSources)
  116. {
  117. if (cardSources.Count >= 1)
  118. {
  119. selectedCards = cardSources.Clone();
  120. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Bottom Cards", true, true));
  121. }
  122. }
  123. if (selectedCards.Count >= 1)
  124. {
  125. List<Permanent> libraryPermanets = selectedCards
  126. .Map(cardSource => cardSource.PermanentOfThisCard());
  127. if (libraryPermanets.Count >= 1)
  128. {
  129. DeckBottomBounceClass putLibraryBottomPermanent = new DeckBottomBounceClass(libraryPermanets, CardEffectCommons.CardEffectHashtable(activateClass));
  130. putLibraryBottomPermanent.SetNotShowCards();
  131. yield return ContinuousController.instance.StartCoroutine(putLibraryBottomPermanent.DeckBounce());
  132. }
  133. }
  134. }
  135. }
  136. }
  137. }
  138. return cardEffects;
  139. }
  140. }