Patamon_BT18_033.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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.OnDeclaration)
  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.HandCards.Contains(card);
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. if (card.Owner.GetBreedingAreaPermanents().Count == 0)
  40. {
  41. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  42. {
  43. if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 1)
  44. {
  45. return true;
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  52. {
  53. CardSource deckBottomCard = null;
  54. List<CardSource> cardSourcesPatamon = new List<CardSource>
  55. {
  56. card
  57. };
  58. if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 1)
  59. {
  60. int maxCount = 1;
  61. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  62. selectCardEffect.SetUp(
  63. canTargetCondition: (cardSource) => CanSelectCardCondition(cardSource),
  64. canTargetCondition_ByPreSelecetedList: null,
  65. canEndSelectCondition: null,
  66. canNoSelect: () => true,
  67. selectCardCoroutine: null,
  68. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  69. message: "Select a card to place at the bottom of the deck",
  70. maxCount: maxCount,
  71. canEndNotMax: false,
  72. isShowOpponent: false,
  73. mode: SelectCardEffect.Mode.Custom,
  74. root: SelectCardEffect.Root.Trash,
  75. customRootCardList: null,
  76. canLookReverseCard: true,
  77. selectPlayer: card.Owner,
  78. cardEffect: activateClass);
  79. selectCardEffect.SetNotShowCard();
  80. selectCardEffect.SetNotAddLog();
  81. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  82. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  83. {
  84. if (cardSources.Count == 1)
  85. {
  86. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources));
  87. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Bottom Card", true, true));
  88. deckBottomCard = cardSources[0];
  89. }
  90. }
  91. }
  92. if (deckBottomCard != null)
  93. {
  94. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  95. cardSources: cardSourcesPatamon,
  96. activateClass: activateClass,
  97. payCost: false,
  98. isTapped: false,
  99. root: SelectCardEffect.Root.Hand,
  100. activateETB: true,
  101. isBreedingArea: true));
  102. }
  103. }
  104. }
  105. #endregion
  106. return cardEffects;
  107. }
  108. }
  109. }