BT16_095.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_095 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Option Skill
  12. if (timing == EffectTiming.OptionSkill)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Suspend Digimon or tamers and activate effects", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Main] Suspend 2 of your opponent's Digimon. Then, return all of your opponent's suspended Digimon with the lowest DP to the bottom of the deck. All of your Digimon get +3000 DP until the end of your opponent's turn.";
  21. }
  22. bool PermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  25. {
  26. return true;
  27. }
  28. return false;
  29. }
  30. bool CanSelectPermanentsToBotDeck(Permanent permanent)
  31. {
  32. return CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy, (permanent) => permanent.IsSuspended);
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  37. }
  38. IEnumerator ActivateCoroutine(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  41. {
  42. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  43. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  44. selectPermanentEffect.SetUp(
  45. selectPlayer: card.Owner,
  46. canTargetCondition: PermanentCondition,
  47. canTargetCondition_ByPreSelecetedList: null,
  48. canEndSelectCondition: null,
  49. maxCount: maxCount,
  50. canNoSelect: false,
  51. canEndNotMax: false,
  52. selectPermanentCoroutine: null,
  53. afterSelectPermanentCoroutine: null,
  54. mode: SelectPermanentEffect.Mode.Tap,
  55. cardEffect: activateClass);
  56. selectPermanentEffect.SetUpCustomMessage("Select 2 of your opponent's Digimon to suspend.", "The opponent is selecting 2 Digimon to suspend.");
  57. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  58. }
  59. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentsToBotDeck))
  60. {
  61. List<Permanent> selectedPermanents = new List<Permanent>();
  62. foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaDigimons())
  63. {
  64. if (!CanSelectPermanentsToBotDeck(permanent))
  65. continue;
  66. if (permanent.TopCard.CanNotBeAffected(activateClass))
  67. continue;
  68. if (permanent.CannotReturnToLibrary(activateClass))
  69. continue;
  70. selectedPermanents.Add(permanent);
  71. }
  72. if (selectedPermanents.Count >= 1)
  73. {
  74. if (selectedPermanents.Count == 1)
  75. {
  76. yield return ContinuousController.instance.StartCoroutine(new DeckBottomBounceClass(selectedPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).DeckBounce());
  77. }
  78. else
  79. {
  80. List<CardSource> cardSources = selectedPermanents.Map(permanent => permanent.TopCard);
  81. List<SkillInfo> skillInfos = cardSources.Map(cardSource =>
  82. {
  83. ChangeBaseDPClass cardEffect = new ChangeBaseDPClass();
  84. cardEffect.SetUpICardEffect(" ", null, cardSource);
  85. return new SkillInfo(cardEffect, null, EffectTiming.None);
  86. });
  87. List<CardSource> selectedCards = new List<CardSource>();
  88. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  89. selectCardEffect.SetUp(
  90. canTargetCondition: (cardSource) => true,
  91. canTargetCondition_ByPreSelecetedList: null,
  92. canEndSelectCondition: null,
  93. canNoSelect: () => false,
  94. selectCardCoroutine: null,
  95. afterSelectCardCoroutine: AfterSelectCardCoroutine1,
  96. 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).",
  97. maxCount: cardSources.Count,
  98. canEndNotMax: false,
  99. isShowOpponent: false,
  100. mode: SelectCardEffect.Mode.Custom,
  101. root: SelectCardEffect.Root.Custom,
  102. customRootCardList: cardSources,
  103. canLookReverseCard: true,
  104. selectPlayer: card.Owner,
  105. cardEffect: activateClass);
  106. selectCardEffect.SetNotShowCard();
  107. selectCardEffect.SetNotAddLog();
  108. selectCardEffect.SetUpSkillInfos(skillInfos);
  109. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  110. IEnumerator AfterSelectCardCoroutine1(List<CardSource> cardSources)
  111. {
  112. if (cardSources.Count >= 1)
  113. {
  114. selectedCards = cardSources.Clone();
  115. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Bottom Cards", true, true));
  116. }
  117. }
  118. if (selectedCards.Count >= 1)
  119. {
  120. List<Permanent> libraryPermanets = selectedCards.Map(cardSource => cardSource.PermanentOfThisCard());
  121. if (libraryPermanets.Count >= 1)
  122. {
  123. DeckBottomBounceClass putLibraryBottomPermanent = new DeckBottomBounceClass(libraryPermanets, CardEffectCommons.CardEffectHashtable(activateClass));
  124. putLibraryBottomPermanent.SetNotShowCards();
  125. yield return ContinuousController.instance.StartCoroutine(putLibraryBottomPermanent.DeckBounce());
  126. }
  127. }
  128. }
  129. }
  130. }
  131. bool PermanentCondition1(Permanent permanent)
  132. {
  133. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  134. }
  135. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
  136. permanentCondition: PermanentCondition1,
  137. changeValue: 3000,
  138. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  139. activateClass: activateClass));
  140. }
  141. }
  142. #endregion
  143. #region Security Effect
  144. if (timing == EffectTiming.SecuritySkill)
  145. {
  146. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Suspend 2 Digimon and activate effects.");
  147. }
  148. #endregion
  149. return cardEffects;
  150. }
  151. }
  152. }