BT12_021.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. using Photon.Pun;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using UnityEngine;
  7. namespace DCGO.CardEffects.BT12
  8. {
  9. public class BT12_021 : CEntity_Effect
  10. {
  11. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  12. {
  13. List<ICardEffect> cardEffects = new List<ICardEffect>();
  14. if (timing == EffectTiming.OnEnterFieldAnyone)
  15. {
  16. ActivateClass activateClass = new ActivateClass();
  17. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  18. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[On Play] Reveal the top 3 cards of your deck. Add 1 Digimon card with [Imperialdramon] in its name or a [Free] trait and 1 Tamer card with [Davis Motomiya] in its name among them to your hand. Place the remaining cards at the bottom of your deck in any order.";
  23. }
  24. bool CanSelectCardCondition(CardSource cardSource)
  25. {
  26. if (cardSource.IsDigimon)
  27. {
  28. if (cardSource.ContainsCardName("Imperialdramon"))
  29. {
  30. return true;
  31. }
  32. if (cardSource.CardTraits.Contains("Free"))
  33. {
  34. return true;
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanSelectCardCondition1(CardSource cardSource)
  40. {
  41. if (cardSource.IsTamer)
  42. {
  43. if (cardSource.ContainsCardName("Davis Motomiya"))
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  53. }
  54. bool CanActivateCondition(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleArea(card))
  57. {
  58. if (card.Owner.LibraryCards.Count >= 1)
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  66. {
  67. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  68. revealCount: 3,
  69. simplifiedSelectCardConditions:
  70. new SimplifiedSelectCardConditionClass[]
  71. {
  72. new SimplifiedSelectCardConditionClass(
  73. canTargetCondition:CanSelectCardCondition,
  74. message: "Select 1 Digimon card with [Imperialdramon] in its name or a [Free] trait.",
  75. mode: SelectCardEffect.Mode.AddHand,
  76. maxCount: 1,
  77. selectCardCoroutine: null),
  78. new SimplifiedSelectCardConditionClass(
  79. canTargetCondition:CanSelectCardCondition1,
  80. message: "Select 1 Tamer card with [Davis Motomiya] in its name.",
  81. mode: SelectCardEffect.Mode.AddHand,
  82. maxCount: 1,
  83. selectCardCoroutine: null),
  84. },
  85. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  86. activateClass: activateClass,
  87. mutualConditions: true
  88. ));
  89. }
  90. }
  91. if (timing == EffectTiming.OnEndTurn)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("DNA digivolve this Digimon", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  96. activateClass.SetIsInheritedEffect(true);
  97. cardEffects.Add(activateClass);
  98. string EffectDiscription()
  99. {
  100. return "[End of Your Turn] You may DNA digivolve this Digimon and one of your other Digimon in play into a Digimon card in your hand by paying its DNA digivolve cost.";
  101. }
  102. bool CanSelectCardCondition(CardSource cardSource)
  103. {
  104. if (cardSource != null)
  105. {
  106. if (cardSource.IsDigimon)
  107. {
  108. if (cardSource.Owner == card.Owner)
  109. {
  110. if (cardSource.CanPlayJogress(true))
  111. {
  112. if (isExistOnField(card))
  113. {
  114. if (cardSource.CanJogressFromTargetPermanent(card.PermanentOfThisCard(), true))
  115. {
  116. return true;
  117. }
  118. }
  119. }
  120. }
  121. }
  122. }
  123. return false;
  124. }
  125. bool CanUseCondition(Hashtable hashtable)
  126. {
  127. if (isExistOnField(card))
  128. {
  129. return true;
  130. }
  131. return false;
  132. }
  133. bool CanActivateCondition(Hashtable hashtable)
  134. {
  135. if (CardEffectCommons.IsExistOnBattleArea(card))
  136. {
  137. if (CardEffectCommons.IsOwnerTurn(card))
  138. {
  139. if (card.Owner.HandCards.Count >= 1)
  140. {
  141. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard()))
  142. {
  143. return true;
  144. }
  145. }
  146. }
  147. }
  148. return false;
  149. }
  150. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  151. {
  152. if (isExistOnField(card))
  153. {
  154. yield return ContinuousController.instance.StartCoroutine(
  155. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  156. CanSelectCardCondition,
  157. payCost: true,
  158. isHand: true,
  159. activateClass,
  160. permanentConditions: new Func<Permanent, bool>[] { (permanent) => permanent == card.PermanentOfThisCard() }
  161. ));
  162. }
  163. }
  164. }
  165. return cardEffects;
  166. }
  167. }
  168. }