BT11_061.cs 10 KB

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