ST10_04.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. using Photon.Pun;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using UnityEngine;
  7. public class ST10_04 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] Reveal the top 3 cards of your deck. Add 1 yellow Digimon card and 1 purple Digimon card among them to your hand. Place the remaining cards at the bottom of your deck in any order.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. if (cardSource.IsDigimon)
  25. {
  26. if (cardSource.CardColors.Contains(CardColor.Yellow))
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanSelectCardCondition1(CardSource cardSource)
  34. {
  35. if (cardSource.IsDigimon)
  36. {
  37. if (cardSource.CardColors.Contains(CardColor.Purple))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.IsExistOnBattleArea(card))
  51. {
  52. if (card.Owner.LibraryCards.Count >= 1)
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  62. revealCount: 3,
  63. simplifiedSelectCardConditions:
  64. new SimplifiedSelectCardConditionClass[]
  65. {
  66. new SimplifiedSelectCardConditionClass(
  67. canTargetCondition:CanSelectCardCondition,
  68. message: "Select 1 yellow Digimon card.",
  69. mode: SelectCardEffect.Mode.AddHand,
  70. maxCount: 1,
  71. selectCardCoroutine: null),
  72. new SimplifiedSelectCardConditionClass(
  73. canTargetCondition:CanSelectCardCondition1,
  74. message: "Select 1 purple Digimon card.",
  75. mode: SelectCardEffect.Mode.AddHand,
  76. maxCount: 1,
  77. selectCardCoroutine: null),
  78. },
  79. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  80. activateClass: activateClass
  81. ));
  82. }
  83. }
  84. if (timing == EffectTiming.None)
  85. {
  86. bool Condition()
  87. {
  88. return CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.IsExistOnBattleArea(card);
  89. }
  90. bool PermanentCondition(Permanent targetPermanent)
  91. {
  92. return targetPermanent == card.PermanentOfThisCard();
  93. }
  94. bool CardSourceCondition(CardSource cardSource)
  95. {
  96. if (cardSource.CardTraits.Contains("Archangel"))
  97. {
  98. return true;
  99. }
  100. if (cardSource.CardTraits.Contains("Fallen Angel"))
  101. {
  102. return true;
  103. }
  104. if (cardSource.CardTraits.Contains("FallenAngel"))
  105. {
  106. return true;
  107. }
  108. return false;
  109. }
  110. bool RootCondition(SelectCardEffect.Root root)
  111. {
  112. return true;
  113. }
  114. cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect(
  115. changeValue: -2,
  116. permanentCondition: PermanentCondition,
  117. cardCondition: CardSourceCondition,
  118. rootCondition: RootCondition,
  119. isInheritedEffect: false,
  120. card: card,
  121. condition: Condition,
  122. setFixedCost: false));
  123. }
  124. if (timing == EffectTiming.OnEndTurn)
  125. {
  126. ActivateClass activateClass = new ActivateClass();
  127. activateClass.SetUpICardEffect("DNA digivolve this Digimon", CanUseCondition, card);
  128. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  129. activateClass.SetIsInheritedEffect(true);
  130. cardEffects.Add(activateClass);
  131. string EffectDiscription()
  132. {
  133. 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.";
  134. }
  135. bool CanSelectCardCondition(CardSource cardSource)
  136. {
  137. if (cardSource != null)
  138. {
  139. if (cardSource.IsDigimon)
  140. {
  141. if (cardSource.Owner == card.Owner)
  142. {
  143. if (cardSource.CanPlayJogress(true))
  144. {
  145. if (isExistOnField(card))
  146. {
  147. if (cardSource.CanJogressFromTargetPermanent(card.PermanentOfThisCard(), true))
  148. {
  149. return true;
  150. }
  151. }
  152. }
  153. }
  154. }
  155. }
  156. return false;
  157. }
  158. bool CanUseCondition(Hashtable hashtable)
  159. {
  160. if (isExistOnField(card))
  161. {
  162. return true;
  163. }
  164. return false;
  165. }
  166. bool CanActivateCondition(Hashtable hashtable)
  167. {
  168. if (CardEffectCommons.IsExistOnBattleArea(card))
  169. {
  170. if (CardEffectCommons.IsOwnerTurn(card))
  171. {
  172. if (card.Owner.HandCards.Count >= 1)
  173. {
  174. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard()))
  175. {
  176. return true;
  177. }
  178. }
  179. }
  180. }
  181. return false;
  182. }
  183. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  184. {
  185. if (isExistOnField(card))
  186. {
  187. yield return ContinuousController.instance.StartCoroutine(
  188. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  189. CanSelectCardCondition,
  190. payCost: true,
  191. isHand: true,
  192. activateClass,
  193. permanentConditions: new Func<Permanent, bool>[] { (permanent) => permanent == card.PermanentOfThisCard() }
  194. ));
  195. }
  196. }
  197. }
  198. return cardEffects;
  199. }
  200. }