BT18_060.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT18
  5. {
  6. public class BT18_060 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On Play
  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 card with [Vemmon] in its text among them to the hand, and place 1 [Vemmon] among them as the bottom digivolution card of 1 of your Digimon. Return the rest to the bottom of the deck.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. if (cardSource.HasText("Vemmon"))
  25. {
  26. return true;
  27. }
  28. return false;
  29. }
  30. bool CanSelectCardCondition1(CardSource cardSource)
  31. {
  32. if (cardSource.CardNames.Contains("Vemmon"))
  33. {
  34. if (CardEffectCommons.IsExistOnBattleArea(card))
  35. {
  36. return true;
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanSelectOwnerDigimon(Permanent permanent)
  42. {
  43. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  44. }
  45. bool CanUseCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  48. {
  49. return true;
  50. }
  51. return false;
  52. }
  53. bool CanActivateCondition(Hashtable hashtable)
  54. {
  55. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  56. }
  57. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  58. {
  59. CardSource tuckedCard = null;
  60. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  61. revealCount: 3,
  62. simplifiedSelectCardConditions:
  63. new SimplifiedSelectCardConditionClass[]
  64. {
  65. new SimplifiedSelectCardConditionClass(
  66. canTargetCondition:CanSelectCardCondition,
  67. message: "Select 1 card with [Vemmon] in its text.",
  68. mode: SelectCardEffect.Mode.AddHand,
  69. maxCount: 1,
  70. selectCardCoroutine: null),
  71. new SimplifiedSelectCardConditionClass(
  72. canTargetCondition:CanSelectCardCondition1,
  73. message: "Select 1 [Vemmon].",
  74. mode: SelectCardEffect.Mode.Custom,
  75. maxCount: 1,
  76. selectCardCoroutine: SelectCardCoroutine),
  77. },
  78. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  79. activateClass: activateClass
  80. ));
  81. IEnumerator SelectCardCoroutine(CardSource cardSource)
  82. {
  83. if(cardSource != null)
  84. {
  85. tuckedCard = cardSource;
  86. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  87. selectPermanentEffect.SetUp(
  88. selectPlayer: card.Owner,
  89. canTargetCondition: CanSelectOwnerDigimon,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. maxCount: 1,
  93. canNoSelect: false,
  94. canEndNotMax: false,
  95. selectPermanentCoroutine: SelectOwnerDigimon,
  96. afterSelectPermanentCoroutine: null,
  97. mode: SelectPermanentEffect.Mode.Custom,
  98. cardEffect: activateClass);
  99. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  100. }
  101. }
  102. IEnumerator SelectOwnerDigimon(Permanent permanent)
  103. {
  104. if(permanent != null)
  105. yield return ContinuousController.instance.StartCoroutine(permanent.AddDigivolutionCardsBottom(new List<CardSource>() { tuckedCard }, activateClass));
  106. }
  107. }
  108. }
  109. #endregion
  110. #region Your Turn - ESS
  111. ActivateClass activateClass2 = new ActivateClass();
  112. activateClass2.SetUpICardEffect("Digivolution Cost -1", CanUseCondition2, card);
  113. activateClass2.SetUpActivateClass(CanActivateCondition2, ActivateCoroutine2, 1, false, EffectDiscription2());
  114. activateClass2.SetIsInheritedEffect(true);
  115. activateClass2.SetNotShowUI(true);
  116. activateClass2.SetIsBackgroundProcess(true);
  117. activateClass2.SetHashString("DigivolutionCost-1_BT11_061");
  118. string EffectDiscription2()
  119. {
  120. return "";
  121. }
  122. bool CanUseCondition2(Hashtable hashtable)
  123. {
  124. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  125. {
  126. if (CardEffectCommons.IsOwnerTurn(card))
  127. {
  128. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  129. {
  130. List<CardSource> evoRootTops = CardEffectCommons.GetEvoRootTopsFromEnterFieldHashtable(
  131. hashtable,
  132. permanent => permanent.cardSources.Contains(card));
  133. if (evoRootTops != null)
  134. {
  135. if (!evoRootTops.Contains(card))
  136. {
  137. if (card.PermanentOfThisCard().TopCard.HasText("Vemmon"))
  138. {
  139. return true;
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
  146. return false;
  147. }
  148. bool CanActivateCondition2(Hashtable hashtable)
  149. {
  150. return CardEffectCommons.IsExistOnBattleArea(card);
  151. }
  152. IEnumerator ActivateCoroutine2(Hashtable _hashtable)
  153. {
  154. yield return null;
  155. }
  156. if (timing == EffectTiming.OnEnterFieldAnyone)
  157. {
  158. cardEffects.Add(activateClass2);
  159. }
  160. if (timing == EffectTiming.None)
  161. {
  162. ChangeCostClass changeCostClass = new ChangeCostClass();
  163. changeCostClass.SetUpICardEffect($"Digivolution Cost -1", CanUseCondition, card);
  164. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  165. changeCostClass.SetIsInheritedEffect(true);
  166. cardEffects.Add(changeCostClass);
  167. bool CanUseCondition(Hashtable hashtable)
  168. {
  169. if (CardEffectCommons.IsExistOnBattleArea(card))
  170. {
  171. if (CardEffectCommons.IsOwnerTurn(card))
  172. {
  173. if (!card.cEntity_EffectController.isOverMaxCountPerTurn(activateClass2, activateClass2.MaxCountPerTurn))
  174. {
  175. return true;
  176. }
  177. }
  178. }
  179. return false;
  180. }
  181. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  182. {
  183. if (CardSourceCondition(cardSource))
  184. {
  185. if (RootCondition(root))
  186. {
  187. if (PermanentsCondition(targetPermanents))
  188. {
  189. Cost -= 1;
  190. }
  191. }
  192. }
  193. return Cost;
  194. }
  195. bool PermanentsCondition(List<Permanent> targetPermanents)
  196. {
  197. if (targetPermanents != null)
  198. {
  199. if (targetPermanents.Count(PermanentCondition) >= 1)
  200. {
  201. return true;
  202. }
  203. }
  204. return false;
  205. }
  206. bool PermanentCondition(Permanent targetPermanent)
  207. {
  208. return targetPermanent == card.PermanentOfThisCard();
  209. }
  210. bool CardSourceCondition(CardSource cardSource)
  211. {
  212. if (cardSource.HasText("Vemmon"))
  213. {
  214. return true;
  215. }
  216. return false;
  217. }
  218. bool RootCondition(SelectCardEffect.Root root)
  219. {
  220. return true;
  221. }
  222. bool isUpDown()
  223. {
  224. return true;
  225. }
  226. }
  227. #endregion
  228. return cardEffects;
  229. }
  230. }
  231. }