BT19_076.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT19
  5. {
  6. public class BT19_076 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolve Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsCardName("Shademon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: true, card: card, condition: null));
  19. }
  20. #endregion
  21. #region On Play
  22. if (timing == EffectTiming.OnEnterFieldAnyone)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  27. EffectDescription());
  28. cardEffects.Add(activateClass);
  29. string EffectDescription()
  30. {
  31. return
  32. "[On Play] Reveal the top 3 cards of your deck. Add 1 card with the [Xros Heart], [Blue Flare] or [Twilight] trait among them to the hand. Return the rest to the bottom of the deck. Then, you may play 1 Tamer with a play cost of 4 or less from your hand without paying the cost";
  33. }
  34. bool CanSelectCardCondition(CardSource cardSource)
  35. {
  36. return cardSource.EqualsTraits("Xros Heart") || cardSource.EqualsTraits("Blue Flare") || cardSource.EqualsTraits("Twilight");
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  41. }
  42. bool CanSelectTamerToPlay(CardSource cardSource)
  43. {
  44. if (cardSource.IsTamer)
  45. {
  46. if (cardSource.GetCostItself <= 4)
  47. {
  48. if (cardSource.HasPlayCost)
  49. {
  50. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  51. {
  52. return true;
  53. }
  54. }
  55. }
  56. }
  57. return false;
  58. }
  59. bool CanActivateCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  62. card.Owner.LibraryCards.Count >= 1;
  63. }
  64. IEnumerator ActivateCoroutine(Hashtable hashtable)
  65. {
  66. if (card.Owner.LibraryCards.Count >= 1)
  67. {
  68. yield return ContinuousController.instance.StartCoroutine(
  69. CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  70. revealCount: 3,
  71. simplifiedSelectCardConditions:
  72. new SimplifiedSelectCardConditionClass[]
  73. {
  74. new(
  75. canTargetCondition: CanSelectCardCondition,
  76. message: "Select 1 card with the [Xros Heart], [Blue Flare] or [Twilight] trait.",
  77. mode: SelectCardEffect.Mode.AddHand,
  78. maxCount: 1,
  79. selectCardCoroutine: null)
  80. },
  81. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  82. activateClass: activateClass
  83. ));
  84. }
  85. if (card.Owner.HandCards.Count(CanSelectTamerToPlay) >= 1)
  86. {
  87. List<CardSource> selectedCards = new List<CardSource>();
  88. int maxCount = 1;
  89. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  90. selectHandEffect.SetUp(
  91. selectPlayer: card.Owner,
  92. canTargetCondition: CanSelectTamerToPlay,
  93. canTargetCondition_ByPreSelecetedList: null,
  94. canEndSelectCondition: null,
  95. maxCount: maxCount,
  96. canNoSelect: true,
  97. canEndNotMax: false,
  98. isShowOpponent: true,
  99. selectCardCoroutine: SelectCardCoroutine,
  100. afterSelectCardCoroutine: null,
  101. mode: SelectHandEffect.Mode.Custom,
  102. cardEffect: activateClass);
  103. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  104. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  105. yield return StartCoroutine(selectHandEffect.Activate());
  106. IEnumerator SelectCardCoroutine(CardSource cardSource)
  107. {
  108. selectedCards.Add(cardSource);
  109. yield return null;
  110. }
  111. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  112. }
  113. }
  114. }
  115. #endregion
  116. #region On Deletion <Save>
  117. if (timing == EffectTiming.OnDestroyedAnyone)
  118. {
  119. cardEffects.Add(CardEffectFactory.SaveEffect(card: card));
  120. }
  121. #endregion
  122. return cardEffects;
  123. }
  124. }
  125. }