Patamon_BT18_033.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT18
  5. {
  6. public class Patamon_BT18_033 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Main
  12. if (timing == EffectTiming.OnEndTurn)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Delete your 1 Digimon to play 1 Digimon from hand", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[End of Your Turn] If your breeding area is empty, by returning 1 Digimon card with the [Three Great Angels] trait from your trash to the bottom of the deck, play this card in your breeding area without paying the cost.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. if (cardSource.HasAngelTraitRestrictive)
  25. {
  26. if (cardSource.IsDigimon)
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return card.Owner.GetBreedingAreaPermanents().Count == 0 &&
  36. CardEffectCommons.HasMatchConditionOwnersCardInTrash(card,CanSelectCardCondition) &&
  37. card.Owner.HandCards.Contains(card);
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. if (card.Owner.GetBreedingAreaPermanents().Count == 0)
  42. {
  43. if (CardEffectCommons.IsExistOnHand(card))
  44. {
  45. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  46. {
  47. return true;
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  54. {
  55. CardSource deckBottomCard = null;
  56. List<CardSource> cardSourcesPatamon = new List<CardSource>
  57. {
  58. card
  59. };
  60. if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 1)
  61. {
  62. int maxCount = 1;
  63. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  64. selectCardEffect.SetUp(
  65. canTargetCondition: (cardSource) => CanSelectCardCondition(cardSource),
  66. canTargetCondition_ByPreSelecetedList: null,
  67. canEndSelectCondition: null,
  68. canNoSelect: () => true,
  69. selectCardCoroutine: null,
  70. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  71. message: "Select a card to place at the bottom of the deck",
  72. maxCount: maxCount,
  73. canEndNotMax: false,
  74. isShowOpponent: false,
  75. mode: SelectCardEffect.Mode.Custom,
  76. root: SelectCardEffect.Root.Trash,
  77. customRootCardList: null,
  78. canLookReverseCard: true,
  79. selectPlayer: card.Owner,
  80. cardEffect: activateClass);
  81. selectCardEffect.SetNotShowCard();
  82. selectCardEffect.SetNotAddLog();
  83. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  84. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  85. {
  86. if (cardSources.Count == 1)
  87. {
  88. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources));
  89. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Bottom Card", true, true));
  90. deckBottomCard = cardSources[0];
  91. }
  92. }
  93. }
  94. if (deckBottomCard != null)
  95. {
  96. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  97. cardSources: cardSourcesPatamon,
  98. activateClass: activateClass,
  99. payCost: false,
  100. isTapped: false,
  101. root: SelectCardEffect.Root.Hand,
  102. activateETB: true,
  103. isBreedingArea: true));
  104. }
  105. }
  106. }
  107. #endregion
  108. return cardEffects;
  109. }
  110. }
  111. }