ST10_04.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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.HasCardColor(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.HasCardColor(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. mutualConditions: true
  82. ));
  83. }
  84. }
  85. if (timing == EffectTiming.None)
  86. {
  87. bool Condition()
  88. {
  89. return CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.IsExistOnBattleArea(card);
  90. }
  91. bool PermanentCondition(Permanent targetPermanent)
  92. {
  93. return targetPermanent == card.PermanentOfThisCard();
  94. }
  95. bool CardSourceCondition(CardSource cardSource)
  96. {
  97. if (cardSource.CardTraits.Contains("Archangel"))
  98. {
  99. return true;
  100. }
  101. if (cardSource.CardTraits.Contains("Fallen Angel"))
  102. {
  103. return true;
  104. }
  105. if (cardSource.CardTraits.Contains("FallenAngel"))
  106. {
  107. return true;
  108. }
  109. return false;
  110. }
  111. bool RootCondition(SelectCardEffect.Root root)
  112. {
  113. return true;
  114. }
  115. cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect(
  116. changeValue: -2,
  117. permanentCondition: PermanentCondition,
  118. cardCondition: CardSourceCondition,
  119. rootCondition: RootCondition,
  120. isInheritedEffect: false,
  121. card: card,
  122. condition: Condition,
  123. setFixedCost: false));
  124. }
  125. if (timing == EffectTiming.OnEndTurn)
  126. {
  127. ActivateClass activateClass = new ActivateClass();
  128. activateClass.SetUpICardEffect("DNA digivolve this Digimon", CanUseCondition, card);
  129. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  130. activateClass.SetIsInheritedEffect(true);
  131. cardEffects.Add(activateClass);
  132. string EffectDiscription()
  133. {
  134. 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.";
  135. }
  136. bool CanSelectCardCondition(CardSource cardSource)
  137. {
  138. if (cardSource != null)
  139. {
  140. if (cardSource.IsDigimon)
  141. {
  142. if (cardSource.Owner == card.Owner)
  143. {
  144. if (cardSource.CanPlayJogress(true))
  145. {
  146. if (isExistOnField(card))
  147. {
  148. if (cardSource.CanJogressFromTargetPermanent(card.PermanentOfThisCard(), true))
  149. {
  150. return true;
  151. }
  152. }
  153. }
  154. }
  155. }
  156. }
  157. return false;
  158. }
  159. bool CanUseCondition(Hashtable hashtable)
  160. {
  161. if (isExistOnField(card))
  162. {
  163. return true;
  164. }
  165. return false;
  166. }
  167. bool CanActivateCondition(Hashtable hashtable)
  168. {
  169. if (CardEffectCommons.IsExistOnBattleArea(card))
  170. {
  171. if (CardEffectCommons.IsOwnerTurn(card))
  172. {
  173. if (card.Owner.HandCards.Count >= 1)
  174. {
  175. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard()))
  176. {
  177. return true;
  178. }
  179. }
  180. }
  181. }
  182. return false;
  183. }
  184. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  185. {
  186. if (isExistOnField(card))
  187. {
  188. yield return ContinuousController.instance.StartCoroutine(
  189. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  190. CanSelectCardCondition,
  191. payCost: true,
  192. isHand: true,
  193. activateClass,
  194. permanentConditions: new Func<Permanent, bool>[] { (permanent) => permanent == card.PermanentOfThisCard() }
  195. ));
  196. }
  197. }
  198. }
  199. return cardEffects;
  200. }
  201. }