BT22_017.cs 7.5 KB

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