BT13_093.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT13
  5. {
  6. public class BT13_093 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] Trigger <Draw 1>. (Draw 1 card from your deck.)";
  20. }
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  24. }
  25. bool CanActivateCondition(Hashtable hashtable)
  26. {
  27. if (CardEffectCommons.IsExistOnBattleArea(card))
  28. {
  29. if (card.Owner.LibraryCards.Count >= 1)
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  37. {
  38. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  39. }
  40. }
  41. if (timing == EffectTiming.OnDestroyedAnyone)
  42. {
  43. ActivateClass activateClass = new ActivateClass();
  44. activateClass.SetUpICardEffect("Place 1 card to your [King Drasil_7D6]'s digivolution cards", CanUseCondition, card);
  45. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  46. cardEffects.Add(activateClass);
  47. string EffectDiscription()
  48. {
  49. return "[On Deletion] Place 1 Digimon card with the [Royal Knight] trait from your hand as the bottom digivolution card of one of your [King Drasil_7D6] in the breeding area.";
  50. }
  51. bool CanSelectCardCondition(CardSource cardSource)
  52. {
  53. if (cardSource.IsDigimon)
  54. {
  55. if (cardSource.HasRoyalKnightTraits)
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. bool CanSelectPermanentCondition(Permanent permanent)
  63. {
  64. if (CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card))
  65. {
  66. if (!permanent.IsToken)
  67. {
  68. if (permanent.TopCard.CardNames.Contains("King Drasil_7D6"))
  69. {
  70. return true;
  71. }
  72. if (permanent.TopCard.CardNames.Contains("KingDrasil_7D6"))
  73. {
  74. return true;
  75. }
  76. }
  77. }
  78. return false;
  79. }
  80. bool CanUseCondition(Hashtable hashtable)
  81. {
  82. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  83. }
  84. bool CanActivateCondition(Hashtable hashtable)
  85. {
  86. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  87. {
  88. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  89. {
  90. if (card.Owner.GetBreedingAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  91. {
  92. return true;
  93. }
  94. }
  95. }
  96. return false;
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  99. {
  100. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  101. {
  102. if (card.Owner.GetBreedingAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  103. {
  104. CardSource selectedCard = null;
  105. int maxCount = 1;
  106. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  107. selectHandEffect.SetUp(
  108. selectPlayer: card.Owner,
  109. canTargetCondition: CanSelectCardCondition,
  110. canTargetCondition_ByPreSelecetedList: null,
  111. canEndSelectCondition: null,
  112. maxCount: maxCount,
  113. canNoSelect: true,
  114. canEndNotMax: false,
  115. isShowOpponent: true,
  116. selectCardCoroutine: SelectCardCoroutine,
  117. afterSelectCardCoroutine: null,
  118. mode: SelectHandEffect.Mode.Custom,
  119. cardEffect: activateClass);
  120. selectHandEffect.SetUpCustomMessage("Select 1 card to place at the bottom of digivolution cards.", "The opponent is selecting 1 card to place at the bottom of digivolution cards.");
  121. yield return StartCoroutine(selectHandEffect.Activate());
  122. IEnumerator SelectCardCoroutine(CardSource cardSource)
  123. {
  124. selectedCard = cardSource;
  125. yield return null;
  126. }
  127. if (selectedCard != null)
  128. {
  129. if (card.Owner.GetBreedingAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  130. {
  131. Permanent selectedPermanent = card.Owner.GetBreedingAreaPermanents()[0];
  132. if (CanSelectPermanentCondition(selectedPermanent))
  133. {
  134. if (selectedPermanent != null)
  135. {
  136. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass));
  137. }
  138. }
  139. }
  140. }
  141. }
  142. }
  143. }
  144. }
  145. return cardEffects;
  146. }
  147. }
  148. }