P_118.cs 6.9 KB

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