BT20_082.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //DeathXmon
  4. namespace DCGO.CardEffects.BT20
  5. {
  6. public class BT20_082 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Sec Atk +1/Reboot/Blocker
  12. if (timing == EffectTiming.None)
  13. {
  14. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
  15. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  16. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  17. }
  18. #endregion
  19. #region All Turns
  20. if (timing == EffectTiming.WhenRemoveField)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Bottom deck 3 cards with [Dex] or [DeathX] in their names to prevent this Digimon from leaving Battle Area", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  25. activateClass.SetHashString("BottomDeckToStay_BT20_082");
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[All Turns] When this Digimon would leave the battle area by effects, by returning 3 cards with [Dex] or [DeathX] in their names from your trash to the bottom of the deck, it doesn't leave.";
  30. }
  31. bool DexOrDeathX(CardSource source)
  32. {
  33. return source.ContainsCardName("Dex") ||
  34. source.ContainsCardName("DeathX");
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  39. {
  40. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  41. {
  42. if (CardEffectCommons.IsByEffect(hashtable, cardEffect => cardEffect != null))
  43. {
  44. return true;
  45. }
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  53. {
  54. if (CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, DexOrDeathX) >= 3)
  55. {
  56. return true;
  57. }
  58. }
  59. return false;
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  62. {
  63. bool returned = false;
  64. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  65. selectCardEffect.SetUp(
  66. canTargetCondition: DexOrDeathX,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. canNoSelect: () => true,
  70. selectCardCoroutine: null,
  71. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  72. message: "Select 3 cards to bottom deck.\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).",
  73. maxCount: 3,
  74. canEndNotMax: false,
  75. isShowOpponent: true,
  76. mode: SelectCardEffect.Mode.Custom,
  77. root: SelectCardEffect.Root.Trash,
  78. customRootCardList: null,
  79. canLookReverseCard: true,
  80. selectPlayer: card.Owner,
  81. cardEffect: activateClass);
  82. yield return StartCoroutine(selectCardEffect.Activate());
  83. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  84. {
  85. if (cardSources.Count == 3)
  86. {
  87. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources));
  88. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Bottom Cards", true, true));
  89. returned = true;
  90. }
  91. }
  92. if (returned)
  93. {
  94. Permanent thisCardPermanent = card.PermanentOfThisCard();
  95. thisCardPermanent.willBeRemoveField = false;
  96. thisCardPermanent.HideDeleteEffect();
  97. thisCardPermanent.HideHandBounceEffect();
  98. thisCardPermanent.HideDeckBounceEffect();
  99. thisCardPermanent.HideWillRemoveFieldEffect();
  100. yield return null;
  101. }
  102. }
  103. }
  104. #endregion
  105. #region End of Turn
  106. if (timing == EffectTiming.OnEndTurn)
  107. {
  108. ActivateClass activateClass = new ActivateClass();
  109. activateClass.SetUpICardEffect("Delete all Digimon with the lowest level", CanUseCondition, card);
  110. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  111. activateClass.SetHashString("Delete_BT20_082");
  112. cardEffects.Add(activateClass);
  113. string EffectDiscription()
  114. {
  115. return "[End of All Turns] [Once Per Turn] Delete all Digimon with the lowest level.";
  116. }
  117. bool PermanentCondition(Permanent permanent)
  118. {
  119. return CardEffectCommons.IsMinLevelBoard(permanent);
  120. }
  121. bool CanUseCondition(Hashtable hashtable)
  122. {
  123. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  124. }
  125. bool CanActivateCondition(Hashtable hashtable)
  126. {
  127. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  130. {
  131. List<Permanent> destroyTargetPermanents = GManager.instance.turnStateMachine.gameContext.Players
  132. .Map(player => player.GetBattleAreaDigimons())
  133. .Flat()
  134. .Filter(PermanentCondition);
  135. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(destroyTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  136. }
  137. }
  138. #endregion
  139. return cardEffects;
  140. }
  141. }
  142. }