BT19_055.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT19
  5. {
  6. public class BT19_055 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On Deletion
  12. if (timing == EffectTiming.OnDestroyedAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Reveal the top 3 cards of your deck, add 1, place 1 under a tamer", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Deletion] Reveal the top 3 cards of your deck. Among them, add 1 card with [Knightmon] in its text or the [Twilight] trait to the hand and place 1 such card under any of your Tamers. Return the rest to the bottom of the deck.";
  21. }
  22. bool SelectKnightmonOrTwilight(CardSource source)
  23. {
  24. return source.HasText("Knightmon") || source.EqualsTraits("Twilight");
  25. }
  26. bool MyTamer(Permanent permanent)
  27. {
  28. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
  29. permanent.IsTamer;
  30. }
  31. bool CanUseCondition(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  34. }
  35. bool CanActivateCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.CanActivateOnDeletion(card);
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable hashtable)
  40. {
  41. int tamerCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, MyTamer));
  42. CardSource tuckedCard = null;
  43. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, MyTamer))
  44. {
  45. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  46. revealCount: 3,
  47. simplifiedSelectCardConditions:
  48. new SimplifiedSelectCardConditionClass[]
  49. {
  50. new SimplifiedSelectCardConditionClass(
  51. canTargetCondition:SelectKnightmonOrTwilight,
  52. message: "Select 1 card with [Knightmon] in its text or the [Twilight] trait to add to hand.",
  53. mode: SelectCardEffect.Mode.AddHand,
  54. maxCount: 1,
  55. selectCardCoroutine: null),
  56. new SimplifiedSelectCardConditionClass(
  57. canTargetCondition:SelectKnightmonOrTwilight,
  58. message: "Select 1 card with [Knightmon] in its text or the [Twilight] trait to place under a tamer.",
  59. mode: SelectCardEffect.Mode.Custom,
  60. maxCount: 1,
  61. selectCardCoroutine: PlaceUnderTamer),
  62. },
  63. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  64. activateClass: activateClass));
  65. }
  66. else
  67. {
  68. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  69. revealCount: 3,
  70. simplifiedSelectCardConditions:
  71. new SimplifiedSelectCardConditionClass[]
  72. {
  73. new SimplifiedSelectCardConditionClass(
  74. canTargetCondition:SelectKnightmonOrTwilight,
  75. message: "Select 1 card with [Knightmon] in its text or the [Twilight] trait to add to hand.",
  76. mode: SelectCardEffect.Mode.AddHand,
  77. maxCount: 1,
  78. selectCardCoroutine: null),
  79. },
  80. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  81. activateClass: activateClass));
  82. }
  83. IEnumerator PlaceUnderTamer(CardSource source)
  84. {
  85. tuckedCard = source;
  86. yield return null;
  87. }
  88. if(tuckedCard != null)
  89. {
  90. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, MyTamer))
  91. {
  92. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  93. selectPermanentEffect.SetUp(
  94. selectPlayer: card.Owner,
  95. canTargetCondition: MyTamer,
  96. canTargetCondition_ByPreSelecetedList: null,
  97. canEndSelectCondition: null,
  98. maxCount: 1,
  99. canNoSelect: false,
  100. canEndNotMax: false,
  101. selectPermanentCoroutine: SelectTamerCoroutine,
  102. afterSelectPermanentCoroutine: null,
  103. mode: SelectPermanentEffect.Mode.Custom,
  104. cardEffect: activateClass);
  105. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer that will add card to sources.", "The opponent is selecting 1 Tamer that will add card to sources.");
  106. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  107. IEnumerator SelectTamerCoroutine(Permanent permanent)
  108. {
  109. Permanent selectedPermanent = permanent;
  110. if (selectedPermanent != null)
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource> { tuckedCard }, activateClass));
  113. }
  114. }
  115. }
  116. }
  117. }
  118. }
  119. #endregion
  120. #region Reboot
  121. if (timing == EffectTiming.None)
  122. {
  123. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: true, card: card, condition: null));
  124. }
  125. #endregion
  126. return cardEffects;
  127. }
  128. }
  129. }